1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-15 11:44:05 +02:00

Improvements to developer experience with building packages (#1595)

* Improvements to developer experience with building packages

* Add note to Contributing.md about watch:packages
This commit is contained in:
Zach Schneider
2018-02-03 20:02:46 -05:00
committed by Ian Storm Taylor
parent b98e675bfb
commit b26bed1c88
4 changed files with 20 additions and 12 deletions

View File

@@ -72,6 +72,8 @@ To keep the source rebuilding on every file change, you need to run an additiona
yarn run watch
```
If you're not using the examples in-browser (and only running the tests against the watched source), you can instead run `yarn watch:packages` for faster rebuilds.
If you need to debug something, you can add a `debugger` line to the source, and then run `yarn run test debug`.
If you only want to run a specific test or tests, you can run `yarn run test --fgrep="slate-react rendering"` flag which will filter the tests being run by grepping for the string in each test.

View File

@@ -80,9 +80,10 @@
"lint": "eslint packages/*/src packages/*/test examples/*/*.js examples/dev/*/*.js",
"open": "open http://localhost:8080/dev.html",
"release": "yarn test && yarn lint && lerna publish && yarn gh-pages",
"start": "http-server ./examples",
"server": "http-server ./examples",
"start": "npm-run-all --parallel --print-label watch server",
"test": "cross-env BABEL_ENV=test mocha --require babel-core/register ./packages/*/test/index.js",
"watch": "npm-run-all --parallel --print-label watch:rollup start",
"watch:rollup": "rollup --config --watch"
"watch": "rollup --config --watch",
"watch:packages": "cross-env SKIP_EXAMPLES=true yarn watch"
}
}

View File

@@ -11,7 +11,7 @@ import slateReact from './packages/slate-react/package.json'
import slateSchemaViolations from './packages/slate-schema-violations/package.json'
import slateSimulator from './packages/slate-simulator/package.json'
export default [
const configurations = [
...factory(slate),
...factory(slateBase64Serializer),
...factory(slateDevLogger),
@@ -22,5 +22,10 @@ export default [
...factory(slateReact),
...factory(slateSchemaViolations),
...factory(slateSimulator),
...examplesConfig,
]
if (!process.env.SKIP_EXAMPLES) {
configurations.push(...examplesConfig)
}
export default configurations

View File

@@ -115,6 +115,11 @@ export default (pkg) => {
format: 'es',
sourcemap: environment === 'development',
},
{
file: `packages/${pkgName}/${output.cjs}`,
format: 'cjs',
exports: 'named',
},
],
external: isExternalDependency,
plugins: [
@@ -146,14 +151,9 @@ export default (pkg) => {
const configurations = [moduleConfig]
if (environment === 'production') {
// In development, we only build the ES version to
// In development, we only build the module version to
// reduce rebuild times. In production, we add the
// configs for the other variants here.
moduleConfig.output.push({
file: `packages/${pkgName}/${output.cjs}`,
format: 'cjs',
exports: 'named',
})
// configs for the UMD variants here.
configurations.push(umdConfig, umdConfigMin)
}