Giter VIP home page Giter VIP logo

experiments-201908-rush-typescript-just-bili-monorepo's Introduction

Experimenting with a monorepo using Rush.js

Expected outcome

Each package should have the minimum boilerplate for:

  • least number of packaging manifest (i.e. only a bili.config.js, or just.config.js)
  • smallest package.json contents as possible
  • package publish step common for all packages
  • tests at the same place (e.g. in src/__tests__/), regardless if it's written in JavaScript, ECMAScript 6+, TypeScript.

Objective

  • Streamline how we publish things so we can import them consistently in many runtime environments (no copy pasta, just import in package.json, require/import in code, use)
  • Harmonize way of packaging, maintenance, with less boilerplate
  • So other team members will quickly see what's really needed to create new modules

Desired features

  • Easy to spot or get feedback when missing dependency between packages
  • Can depend between packages

Trying it out

All examples below expects you first have @microsoft/rush installed globally, refer to the docs.

For Continuous integration mode, refer to .gitlab-ci.yml.

Run with debugging

export CI_SERVER="yes-capn" # Assuming GitLab or other CI would have such variable set in CI mode.
export DEBUG="*,-babel,-agentkeepalive,-fetch-retry"
rush update
rush build

experiments-201908-rush-typescript-just-bili-monorepo's People

Contributors

renoirb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

experiments-201908-rush-typescript-just-bili-monorepo's Issues

use-bili can't add own Rollup plugins

When we're using use-bili, we can't use our own Rollup plugins.

See also:

// package's bili.config.ts
import useBili from '@renoirb/conventions-use-bili'
import builtins from 'rollup-plugin-node-builtins'
import nodePolyfills from 'rollup-plugin-node-polyfills';

export default useBili(
  {
    input: 'main.ts',
    bundleNodeModules: true /* So it's possible to inline dependencies */,
    externals: [],
    output: {
      minify: false,
    },
     plugins: {
       nodePolyfills: {}
    },
    resolvePlugins: {
      nodePolyfills: () => import('rollup-plugin-node-polyfills')
    }
  },
  {
    firstYear: 2003,
  },
  {
    withCore: true,
  },
)

In resolveRunTimeOptions, add a plugins line like this:

const resolveRunTimeOptions = (/* ... */) => {
  // ... rest
  const out = {
    hasBiliBundleNodeModulesOption,
    isDevModeVerbose,
    plugins: Object.assign({}, ('plugins' in cfg ? cfg.plugins : {})),  // <===
  };
  return Object.freeze(out)
}

const useBili = () => {
  const config = Object.assign({
    banner: bannerFooter.banner,
    bundleNodeModules: false
  }, cfg || {}, {
    input,
    output,
    plugins: { ...plugins, ...(cfg.plugins||{})}, // <===
  });

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.