Skip to content

Commit

Permalink
Move UMD bundling to top-level, deploy UMD builds in core packages (#…
Browse files Browse the repository at this point in the history
…1520)

* build: move UMD builds into core packages, deprecating react-dnd-umd-builds

* build: remove useless escape chars

* build: disable lint rule in go_no_go script

* build: remove umd build from workspace packages

* build: add a script to copy umd builds into the umd builds package

This will allow for users to have UMD builds available either from the packages directly or from the react-dnd-umd-builds packag.

* docs: add umd readme

* build: use pretty-quick for formatting staged files

* build: update the pretty-quick spec

* build: update precommit scripts

* build: fix npm script name

* build: reorder build scripts

* build: remove precommit script from npm scripts

* build: update copy script

* build: add changelog generation script
  • Loading branch information
darthtrevino committed Sep 20, 2019
1 parent ae7a05b commit 1d1c158
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 74 deletions.
30 changes: 17 additions & 13 deletions package.json
Expand Up @@ -34,29 +34,35 @@
"homepage": "https://github.com/react-dnd/react-dnd",
"scripts": {
"clean": "lerna run clean",
"build:packages": "lerna run build --stream",
"build:cjs": "node scripts/execute_cjs_replacements.js",
"build": "run-s build:packages build:cjs",
"build_packages": "lerna run build --stream",
"build_cjs": "node scripts/execute_cjs_replacements.js",
"build": "run-s build_packages build_cjs bundle_umd_libs copy_umd_libs",
"bundle_umd_libs:development": "webpack --mode development",
"bundle_umd_libs:production": "webpack --mode production",
"bundle_umd_libs": "run-p bundle_umd_libs:*",
"copy_umd_libs": "./scripts/copy_umd_packages.sh",
"unit_test": "jest",
"jest:watch": "jest --watch",
"jest:cov": "jest --coverage",
"lint": "eslint . --ext .js,.ts,.jsx,.tsx",
"test_modules": "CI=true lerna run test --stream",
"release": "run-s clean build go_no_go release:packages ",
"changelog": "conventional-changelog -p eslint -i CHANGELOG.md -s -r 0",
"release": "run-s clean build go_no_go release:packages changelog",
"release:packages": "lerna publish",
"test_modules": "CI=true lerna run test --stream",
"go_no_go": "node scripts/go_no_go.js",
"release_docs": "lerna run release --stream --scope react-dnd-documentation",
"test": "run-s clean lint build test_modules jest:cov",
"prettify": "prettier 'packages/*/**/*.js' 'examples/**/*.js' 'site/**/*.js'",
"precommit": "lint-staged",
"precommit:lint": "lint-staged",
"precommit:format": "pretty-quick --staged",
"preinstall": "node scripts/create_cjs_modules.js",
"start": "lerna run --parallel --stream start",
"start_docs": "lerna run --stream start --scope react-dnd-documentation",
"watch": "lerna run --parallel --stream watch"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-commit": "run-s precommit:lint precommit:format",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
Expand All @@ -71,6 +77,7 @@
"@types/jest": "^24.0.15",
"@typescript-eslint/eslint-plugin": "^1.11.0",
"@typescript-eslint/parser": "^1.11.0",
"conventional-changelog-cli": "^2.0.23",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"eslint": "^6.0.1",
Expand All @@ -89,11 +96,13 @@
"npm": "^6.9.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"replace-in-file": "^4.1.0",
"ts-jest": "^24.0.2",
"typescript": "^3.5.2"
"typescript": "^3.5.2",
"webpack-cli": "^3.3.5"
},
"jest": {
"clearMocks": true,
Expand Down Expand Up @@ -144,13 +153,8 @@
}
},
"lint-staged": {
"*.{js,jsx}": [
"prettier --write",
"git add"
],
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write",
"git add"
]
},
Expand Down
21 changes: 0 additions & 21 deletions packages/alternative_builds/umd/LICENSE

This file was deleted.

13 changes: 2 additions & 11 deletions packages/alternative_builds/umd/package.json
Expand Up @@ -2,15 +2,6 @@
"name": "react-dnd-umd-builds",
"version": "9.3.4",
"license": "MIT",
"scripts": {
"bundle:development": "webpack --mode development",
"bundle:production": "webpack --mode production",
"build": "run-p bundle:*"
},
"devDependencies": {
"npm-run-all": "^4.1.5",
"react-dnd": "^9.3.4",
"react-dnd-html5-backend": "^9.3.4",
"webpack-cli": "^3.3.5"
}
"scripts": {},
"devDependencies": {}
}
16 changes: 0 additions & 16 deletions packages/alternative_builds/umd/test.html

This file was deleted.

5 changes: 5 additions & 0 deletions scripts/copy_umd_packages.sh
@@ -0,0 +1,5 @@
#!/bin/sh
mkdir -p packages/alternative_builds/umd/dist &&
cp packages/core/react-dnd/dist/umd/*.js packages/alternative_builds/umd/dist &&
cp packages/core/html5-backend/dist/umd/*.js packages/alternative_builds/umd/dist &&
cp packages/core/touch-backend/dist/umd/*.js packages/alternative_builds/umd/dist
19 changes: 11 additions & 8 deletions .../alternative_builds/umd/webpack.config.js → webpack.config.js
Expand Up @@ -6,13 +6,13 @@ function createWebpackConfiguration() {
entry: './lib/index.js',
resolve: {
alias: {
'dnd-core': path.join(__dirname, '../../core/dnd-core'),
'dnd-core': path.join(__dirname, 'packages/core/dnd-core'),
},
modules: [
path.join(__dirname, '../../core/react-dnd'),
path.join(__dirname, '../../core/dnd-core/node_modules'),
path.join(__dirname, '../../core/react-dnd/node_modules'),
path.join(__dirname, '../../../node_modules'),
path.join(__dirname, 'packages/core/react-dnd'),
path.join(__dirname, 'packages/core/dnd-core/node_modules'),
path.join(__dirname, 'packages/core/react-dnd/node_modules'),
path.join(__dirname, 'node_modules'),
],
},
output: {
Expand Down Expand Up @@ -43,18 +43,20 @@ module.exports = (env, { mode }) => {
return [
{
...commonConfig,
context: path.resolve(__dirname, '../../core/react-dnd'),
context: path.resolve(__dirname, 'packages/core/react-dnd'),
output: {
...commonConfig.output,
path: path.resolve(__dirname, 'packages/core/react-dnd/dist/umd'),
library: 'ReactDnD',
filename: `ReactDnD.${mode === 'production' ? 'min.' : ''}js`,
},
},
{
...commonConfig,
context: path.resolve(__dirname, '../../core/html5-backend'),
context: path.resolve(__dirname, 'packages/core/html5-backend'),
output: {
...commonConfig.output,
path: path.resolve(__dirname, 'packages/core/html5-backend/dist/umd'),
library: 'ReactDnDHTML5Backend',
filename: `ReactDnDHTML5Backend.${
mode === 'production' ? 'min.' : ''
Expand All @@ -63,9 +65,10 @@ module.exports = (env, { mode }) => {
},
{
...commonConfig,
context: path.resolve(__dirname, '../../core/touch-backend'),
context: path.resolve(__dirname, 'packages/core/touch-backend'),
output: {
...commonConfig.output,
path: path.resolve(__dirname, 'packages/core/touch-backend/dist/umd'),
library: 'ReactDnDTouchBackend',
filename: `ReactDnDTouchBackend.${
mode === 'production' ? 'min.' : ''
Expand Down

0 comments on commit 1d1c158

Please sign in to comment.