1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-31 19:01:54 +02:00

Switch to using Rollup for bundling (#1568)

* Implement first working rollup config for main slate pkg

* Convert slate-base64-serializer to rollup

* Convert slate-dev-logger to rollup

* Convert slate-html-serializer to rollup

* Convert slate-hyperscript to rollup

* Convert slate-plain-serializer to rollup

* Convert slate-prop-types to rollup

* Convert (mostly) slate-react to rollup

* Convert slate-simulator to rollup

* Misc cleanup and configuration tweaks/fixes

* Convert slate-schema-violations to rollup

* Successful rollup build for top-level examples

* Add plugin to replace process.env.NODE_ENV

* Only rebuild modules and dev examples in watch mode

* Enable sourcemaps for development builds

* Force debug to use browser version, remove builtins plugin

* Remove is-image from example
It relies on node `path` and wouldn't work well in-browser anyway

* Use browser version of react-dom/server

* Move stray require to import

* Configure examples to watch child package output

* Fix tests

* Remove unneeded preferBuiltins from resolve config

* Use more precise files array to ensure sourcemaps aren't included

* Use lodash instead of lodash.throttle
It's pulled in anyway since slate-react needs slate, so using the
minipackage actually causes code duplication

* Improve naming/fix UMD builds, update UMD doc

* Add rollup configs to linting, add a missing dep to package.json

* Use longform rollup CLI flags

* Add rollup-plugin-auto-external to reduce external module configuration

* Combine rollup config into a unioned helper

* Centralize to a single rollup configuration

* Update dist structure and package field naming for PR feedback

* Add comments and address PR feedback on rollup config

* i.e. -> e.g.

* Add some spacing to the configuration to improve readability

* Add a bit more spacing

* Remove umd from example Slate unpkg link
This commit is contained in:
Zach Schneider
2018-02-02 18:46:36 -05:00
committed by Ian Storm Taylor
parent c044d048ad
commit 228b97ff29
25 changed files with 604 additions and 1483 deletions

View File

@@ -4,21 +4,19 @@
"workspaces": [
"packages/*"
],
"umd": "./examples/build.dev.js",
"umdMin": "./examples/build.prod.js",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-runtime": "^6.26.0",
"babelify": "^7.3.0",
"browserify": "^13.0.1",
"browserify-global-shim": "^1.0.3",
"chalk": "^1.1.3",
"disc": "^1.3.2",
"envify": "^3.4.1",
"eslint": "^4.16.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.6.0",
@@ -27,12 +25,13 @@
"fs-promise": "^1.0.0",
"gh-pages": "^0.11.0",
"http-server": "^0.9.0",
"image-extensions": "^1.1.0",
"immutable": "^3.8.1",
"is-hotkey": "^0.1.1",
"is-image": "^1.0.1",
"is-url": "^1.2.2",
"jsdom": "^11.5.1",
"lerna": "^2.7.1",
"lodash": "^4.17.4",
"matcha": "^0.7.0",
"mocha": "^2.5.3",
"npm-run-all": "^4.1.1",
@@ -46,15 +45,21 @@
"react-router-dom": "^4.1.1",
"read-metadata": "^1.0.0",
"read-yaml-promise": "^1.0.2",
"rollup": "^0.55.1",
"rollup-plugin-alias": "^1.4.0",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-json": "^2.3.0",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^3.0.0",
"slate-collapse-on-escape": "^0.5.0",
"slate-soft-break": "^0.5.0",
"slate-sugar": "^0.6.1",
"source-map-support": "^0.4.0",
"to-camel-case": "^1.0.0",
"to-title-case": "^1.0.0",
"uglify-js": "^2.7.0",
"uglifyify": "^3.0.2",
"watchify": "^3.7.0",
"yaml-js": "^0.2.0"
},
"peerDependencies": {
@@ -67,21 +72,16 @@
"scripts": {
"benchmark": "mkdir -p ./tmp && babel-node ./node_modules/.bin/_matcha --reporter ./support/benchmark-reporter ./packages/*/benchmark/index.js > ./tmp/benchmark-comparison.json && babel-node ./support/benchmark-compare",
"benchmark:save": "mkdir -p ./tmp && babel-node ./node_modules/.bin/_matcha --reporter ./support/benchmark-reporter ./packages/*/benchmark/index.js > ./tmp/benchmark-baseline.json",
"bootstrap": "lerna bootstrap && yarn run build",
"build": "yarn run build:packages",
"build:examples": "yarn run build:examples:dev && yarn run build:examples:prod",
"build:examples:dev": "browserify --debug --transform babelify ./examples/index.js > ./examples/build.dev.js",
"build:examples:prod": "NODE_ENV=production browserify --global-transform envify --global-transform uglifyify --transform babelify ./examples/index.js > ./examples/build.prod.js",
"build:packages": "lerna run build",
"bootstrap": "lerna bootstrap && yarn build",
"build": "NODE_ENV=production rollup --config",
"clean": "lerna run clean && rm -rf ./node_modules ./dist ./examples/build.*.js",
"gh-pages": "yarn run build && yarn run build:examples && gh-pages --dist ./examples",
"gh-pages": "yarn build && gh-pages --dist ./examples",
"lint": "eslint packages/*/src packages/*/test examples/*/*.js examples/dev/*/*.js",
"open": "open http://localhost:8080/dev.html",
"release": "yarn run test && yarn run lint && lerna publish && yarn run gh-pages",
"release": "yarn test && yarn lint && lerna publish && yarn gh-pages",
"start": "http-server ./examples",
"test": "BABEL_ENV=test mocha --require babel-core/register ./packages/*/test/index.js",
"watch": "npm-run-all --parallel --print-label watch:examples watch:packages start",
"watch:examples": "watchify --debug --transform babelify ./examples/index.js -o ./examples/build.dev.js -v",
"watch:packages": "lerna run --parallel watch"
"watch": "npm-run-all --parallel --print-label watch:rollup start",
"watch:rollup": "rollup --config --watch"
}
}