Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify build process #3

Open
vilbergs opened this issue Oct 9, 2021 · 0 comments
Open

Simplify build process #3

vilbergs opened this issue Oct 9, 2021 · 0 comments

Comments

@vilbergs
Copy link
Contributor

vilbergs commented Oct 9, 2021

Today we build each util as a separate module in order to guarantee that it's possible to import only the utils that we need without relying on opaque tree-shaking processes in build tools.

In order to get nice imports like  import x from @Teachiq/utils/x as well as avoid clutter in the root directory of the project, we're forced to do the following since npm (package.json) doesn't have a great interface for structure the package contents:

  1. build each separate module into the libdirectory
  2. move the modules to the root directory of the project
  3. run npm publish, where package.json is set to point at each module at the root (see the files option)
  4. move the modules back to lib to avoid clutter in the root directory

This requires a whole lot of setting up if a new type of utility module is to be added, which may be a large time sink.

My suggestions to solve this:

  1. Let the root directory be cluttered and just build package directly there
  2. Make a build script that magically handles building and publishing modules in the source directory
  3. Simplify the project structure and rely on build-tool treeshaking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant