Refactor build system to support CSS modules#237
Conversation
…ules with inline SVG styles to work
| "build-all": "npm run build && npm run build-storybook", | ||
| "build-all": "npm run build && npm run build:storybook", | ||
| "build": "npm run clean; tsdx build --tsconfig tsconfig.dist.json; npm run build:reorganize-styles", | ||
| "build:reorganize-styles": "rimraf dist/assets; mv es/index.css es/reactist.css; mkdir styles; find es -iname '*.css' -type f -exec mv {} styles/ \\;", |
There was a problem hiding this comment.
Unsure if these commands could work in the across platform matter. Another option could consider is to do these work in a nodejs script.
stkao05
left a comment
There was a problem hiding this comment.
Test and work on my ends. Here is one comment regarding build setup
CommonJS build (/dist)
- We probably do not need to bundle every components together. Adopting the same structure
/esprobably makes more sense. The only difference between/dist/and/esis that the one uses the CommonJS module and the other uses ES module. Other than that everything should be the same. - Should not need to minify. It is commonly handled by the user's bundler to handle
| "build-all": "npm run build && npm run build-storybook", | ||
| "build-all": "npm run build && npm run build:storybook", | ||
| "build": "npm run clean; tsdx build --tsconfig tsconfig.dist.json; npm run build:reorganize-styles", | ||
| "build:reorganize-styles": "rimraf dist/assets; mv es/index.css es/reactist.css; mkdir styles; find es -iname '*.css' -type f -exec mv {} styles/ \\;", |
There was a problem hiding this comment.
Do you think it would make sense to put this into a bash script (separate file) and add a couple of comments?
antd & most other libraries have a convention that dist/ is actually bundled, and intended to be used directly in the browser. I've made a couple of changes now:
Done! 🙂 |
I am not sure if it is a common convention for If we want to create a "browser usage" bundle, maybe we can create another build folder |
stkao05
left a comment
There was a problem hiding this comment.
Would be great to address the CommonJS dist issue but isn't a blocking issue.
|
Agree, I'll:
This also echoes antd's approach. |
|
It seems v6 has broken TS support. When I install it in Twist I get TS failings all over. When I inspect the Here's what I see when I install v6: $ ls -l node_modules/@doist/reactist/dist/
-rw-r--r-- 1 ernesto staff 68K Oct 26 1985 reactist.cjs.development.js
-rw-r--r-- 1 ernesto staff 140K Oct 26 1985 reactist.cjs.development.js.map
-rw-r--r-- 1 ernesto staff 31K Oct 26 1985 reactist.cjs.production.min.js
-rw-r--r-- 1 ernesto staff 114K Oct 26 1985 reactist.cjs.production.min.js.mapvs. on v5.2.0: $ ls -l node_modules/@doist/reactist/dist/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Avatar/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Button/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Checkbox/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 ColorPicker/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Dropdown/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 ErrorMessage/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Icon/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Input/
drwxr-xr-x 4 ernesto staff 128B Jul 23 11:58 KeyCapturer/
drwxr-xr-x 4 ernesto staff 128B Jul 23 11:58 KeyboardShortcut/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Loading/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 MenuButton/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Modal/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Popover/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 ProgressBar/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 RangeInput/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Select/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Tabs/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Time/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Tip/
drwxr-xr-x 5 ernesto staff 160B Jul 23 11:58 Tooltip/
-rw-r--r-- 1 ernesto staff 2.1K Oct 26 1985 _rollupPluginBabelHelpers-0886f29f.js
-rw-r--r-- 1 ernesto staff 198B Oct 26 1985 _rollupPluginBabelHelpers-0886f29f.js.map
drwxr-xr-x 25 ernesto staff 800B Jul 23 11:58 components/
drwxr-xr-x 4 ernesto staff 128B Jul 23 11:58 index/
-rw-r--r-- 1 ernesto staff 1.3K Oct 26 1985 index.d.ts
-rw-r--r-- 1 ernesto staff 194B Oct 26 1985 index.js
-rw-r--r-- 1 ernesto staff 68K Oct 26 1985 reactist.cjs.development.js
-rw-r--r-- 1 ernesto staff 140K Oct 26 1985 reactist.cjs.development.js.map
-rw-r--r-- 1 ernesto staff 31K Oct 26 1985 reactist.cjs.production.min.js
-rw-r--r-- 1 ernesto staff 114K Oct 26 1985 reactist.cjs.production.min.js.map
-rw-r--r-- 1 ernesto staff 24K Oct 26 1985 reactist.css |
|
I had moved typings over to lib/index.d.ts but forgot to add |
Short description
This builds infrastructure for a single rollup build that supports:
This also removes the previous webpack builder as that is no longer necessary with this workflow.
Test Plan
This adds infrastructure to support CSS modules. Nothing has yet been made CSS module yet, as that needs additional changes in Twist & Todoist, but the builder has been completely changed. To test:
Note there are 2 PRs, one Twist, and one Todoist that have to be reviewed with this together.
PR Checklist
[ ] Added tests for bugs / new featuresCHANGELOG.mdnpm run lintand made sure no errors / warnings were shownnpm run testand made sure all tests are passingpackage.jsonnpm run build-all)