mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 20:24:01 +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:
committed by
Ian Storm Taylor
parent
b98e675bfb
commit
b26bed1c88
@@ -72,6 +72,8 @@ To keep the source rebuilding on every file change, you need to run an additiona
|
|||||||
yarn run watch
|
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 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.
|
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.
|
||||||
|
@@ -80,9 +80,10 @@
|
|||||||
"lint": "eslint packages/*/src packages/*/test examples/*/*.js examples/dev/*/*.js",
|
"lint": "eslint packages/*/src packages/*/test examples/*/*.js examples/dev/*/*.js",
|
||||||
"open": "open http://localhost:8080/dev.html",
|
"open": "open http://localhost:8080/dev.html",
|
||||||
"release": "yarn test && yarn lint && lerna publish && yarn gh-pages",
|
"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",
|
"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 --config --watch",
|
||||||
"watch:rollup": "rollup --config --watch"
|
"watch:packages": "cross-env SKIP_EXAMPLES=true yarn watch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@ import slateReact from './packages/slate-react/package.json'
|
|||||||
import slateSchemaViolations from './packages/slate-schema-violations/package.json'
|
import slateSchemaViolations from './packages/slate-schema-violations/package.json'
|
||||||
import slateSimulator from './packages/slate-simulator/package.json'
|
import slateSimulator from './packages/slate-simulator/package.json'
|
||||||
|
|
||||||
export default [
|
const configurations = [
|
||||||
...factory(slate),
|
...factory(slate),
|
||||||
...factory(slateBase64Serializer),
|
...factory(slateBase64Serializer),
|
||||||
...factory(slateDevLogger),
|
...factory(slateDevLogger),
|
||||||
@@ -22,5 +22,10 @@ export default [
|
|||||||
...factory(slateReact),
|
...factory(slateReact),
|
||||||
...factory(slateSchemaViolations),
|
...factory(slateSchemaViolations),
|
||||||
...factory(slateSimulator),
|
...factory(slateSimulator),
|
||||||
...examplesConfig,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (!process.env.SKIP_EXAMPLES) {
|
||||||
|
configurations.push(...examplesConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default configurations
|
||||||
|
@@ -115,6 +115,11 @@ export default (pkg) => {
|
|||||||
format: 'es',
|
format: 'es',
|
||||||
sourcemap: environment === 'development',
|
sourcemap: environment === 'development',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
file: `packages/${pkgName}/${output.cjs}`,
|
||||||
|
format: 'cjs',
|
||||||
|
exports: 'named',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
external: isExternalDependency,
|
external: isExternalDependency,
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -146,14 +151,9 @@ export default (pkg) => {
|
|||||||
const configurations = [moduleConfig]
|
const configurations = [moduleConfig]
|
||||||
|
|
||||||
if (environment === 'production') {
|
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
|
// reduce rebuild times. In production, we add the
|
||||||
// configs for the other variants here.
|
// configs for the UMD variants here.
|
||||||
moduleConfig.output.push({
|
|
||||||
file: `packages/${pkgName}/${output.cjs}`,
|
|
||||||
format: 'cjs',
|
|
||||||
exports: 'named',
|
|
||||||
})
|
|
||||||
configurations.push(umdConfig, umdConfigMin)
|
configurations.push(umdConfig, umdConfigMin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user