-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add css/scss modules support, back (#1174)
* add css/scss modules support, back * add postcss back to dev client * upgrade ci node * appease linter * new node openssl override * doc fix * mise var; yarnrc for integrity issues * support node externals allowlist * alpha publishes * alpha publishes * support webpackhot external on dev server * bundle all css * dev srcmap * update to faster source map * custom externals algorithm * custom externals algorithm * remove externals dep * externals handle no deps in package.json * externals handle bad package.json resolution in e2e tests * webpack 4 bs
- Loading branch information
Showing
31 changed files
with
1,463 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[tools] | ||
node = '20.10.0' | ||
# stuck on this version of yarn because of some weird problems | ||
# related to babel tooling when installing new dependencies | ||
yarn = '1.19.0' | ||
|
||
[env] | ||
MISE_FETCH_REMOTE_VERSIONS_TIMEOUT="300 s" | ||
NODE_OPTIONS = "--openssl-legacy-provider" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
unsafe-disable-integrity-migration false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,21 @@ Please make sure all PRs are: | |
|
||
If you want to propose a large feature idea or architecture change you should consider submitting an RFC. It's often helpful to get feedback on your concept in an issue before starting the RFC. RFCs are an evolving process in the `kyt` repository so expect a lot of changes and guidelines in the future. You can find the `kyt` RFC template [here](/rfc/template.md). | ||
|
||
## kyt local development | ||
## kyt local development workflow | ||
|
||
1. `nvm use` | ||
1. Fork and clone `kyt` | ||
1. [setup [mise](https://mise.jdx.dev/) and `mise install`] | ||
1. Run `yarn bootstrap` to install the packages in the monorepo | ||
1. Open a new shell and run `yarn watch` | ||
|
||
[lerna](https://github.com/lerna/lerna) is used to manage the monorepo but most of the development commands should be exercised through root directory `package.json` scripts. The following are some useful npm scripts for development: | ||
Most changes are best to develop against the universal starter kyt: | ||
|
||
1. `cd packages/kyt-starter-universal/starter-src` | ||
1. Run `yarn dev` or `yarn build` to test against kyt development and production builds | ||
|
||
Note: After you make changes, the watcher will update libraries but you will likely have to restart the universal app process to test changes. The watcher only works against kyt-core, server and runtime. Changes to babel presets and a few other packages may require you to re-`yarn bootstrap` or `yarn clean-bootstrap`. When in doubt run `yarn clean-bootstrap`. | ||
|
||
[lerna](https://github.com/lerna/lerna) is used to manage the monorepo but most of the development commands should be exercised through root directory `package.json` scripts. | ||
|
||
### bootstrap | ||
|
||
|
@@ -77,14 +85,12 @@ pushing directly to `main`. | |
For more information on using `lerna` to publish, see [the `lerna publish` | ||
documentation](https://github.com/lerna/lerna/tree/main/commands/publish#readme). | ||
|
||
### Development Versions | ||
### Publishing Alpha Versions | ||
|
||
If you would like your prerelease to have the `next` dist tag, rather than | ||
`latest`, such as when creating a release candidate or testing a development | ||
version, you can use the provided `publish:next` script. | ||
If you would like to publish alpha release versions, for example `[email protected]`: | ||
|
||
```sh | ||
$ GH_TOKEN=$GITHUB_TOKEN npm run publish:next | ||
$ GH_TOKEN=$GITHUB_TOKEN npm run publish:alpha | ||
``` | ||
|
||
If you need more functionality than this, it is recommended that you pass your | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Works similarly to webpack-node-externals but it's not as | ||
// aggressive. It only excludes top-level dependency-declared | ||
// modules. Respects an `allowList` of regexp's that will be | ||
// used to match modules to include in the bundle. | ||
const { userPackageJSONPath } = require('kyt-utils/paths')(); | ||
|
||
let pkg; | ||
|
||
try { | ||
// eslint-disable-next-line import/no-dynamic-require, global-require | ||
pkg = require(userPackageJSONPath); | ||
} catch (e) { | ||
pkg = {}; | ||
} | ||
|
||
module.exports = (allowList = []) => { | ||
// Get all of the dependencies from the package.json | ||
// and filter out the ones that are in the allowList | ||
const packageModules = []; | ||
Object.keys(pkg.dependencies || []).forEach(module => { | ||
allowList.forEach(allowedModule => { | ||
if (!allowedModule.test(module)) packageModules.push(module); | ||
}); | ||
}); | ||
|
||
return [ | ||
// eslint-disable-next-line consistent-return | ||
(context, request, callback) => { | ||
function getModuleName(requested) { | ||
const scopedModuleRegex = new RegExp( | ||
'@[a-zA-Z0-9][\\w-.]+/[a-zA-Z0-9][\\w-.]+([a-zA-Z0-9./]+)?', | ||
'g' | ||
); | ||
const req = requested; | ||
const delimiter = '/'; | ||
|
||
// Check if scoped module. For example: @company/boring-module | ||
if (scopedModuleRegex.test(req)) { | ||
// reset regexp | ||
scopedModuleRegex.lastIndex = 0; | ||
return req.split(delimiter, 2).join(delimiter); | ||
} | ||
return req.split(delimiter)[0]; | ||
} | ||
if (packageModules.includes(getModuleName(request))) { | ||
// Mark this module as EXTERNAL | ||
return callback(null, `commonjs ${request}`); | ||
} | ||
// Include module in bundle / NOT EXTERNAL | ||
callback(); | ||
}, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
postcssOptions: { | ||
plugins: [['autoprefixer', {}]], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.