Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calypso Build Package: Add calypso-build bin shorthand #32295

Merged
merged 25 commits into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
55d8e5f
Calypso Build Package: Alias bin/build-packages as transpile bin
ockham Apr 16, 2019
7a18202
Rename bin/build-package.js to bin/transpile.js
ockham Apr 16, 2019
08e7522
Static paths to transpile 😬
sirreal Apr 17, 2019
5d19f36
Make cb script magically work with webpack
sirreal Apr 17, 2019
3eeebf8
Use cb to build apps/
ockham Apr 18, 2019
e0142ac
Simplify env.WP setting
ockham Apr 18, 2019
e1f1a4d
Revert "Static paths to transpile 😬"
ockham Apr 18, 2019
dea04ca
Use correct webpack config in wpcom-block-editor
ockham Apr 18, 2019
7521b4d
Revert "Revert "Static paths to transpile 😬""
ockham Apr 18, 2019
65781e3
Tighten config check in cb.js
ockham Apr 18, 2019
408dc7f
Fix build
ockham Apr 18, 2019
100a49b
Revert "Revert "Revert "Static paths to transpile 😬"""
ockham Apr 19, 2019
6c9f988
Remove ^ range
ockham Apr 19, 2019
0379658
Shrinkwrap
ockham Apr 19, 2019
5920f90
Use cb to build notifications
ockham Apr 19, 2019
c790b3f
Just transpile :sunglasses:
ockham Apr 22, 2019
c15e370
Use cb to build full-side-editing
ockham Apr 22, 2019
f220fac
Make webpack.config.js path relative
ockham Apr 22, 2019
8755b59
Use current working dir's webpack.config.js
ockham Apr 23, 2019
e4fee9b
Ugh wrong dir
ockham Apr 23, 2019
d009155
Remove redundant `--env.WP` arg
sirreal Apr 23, 2019
b23ba67
Remove redundant `--env.WP` arg
sirreal Apr 23, 2019
bd0cb18
Calypso Build: Change default outputPath
ockham Apr 22, 2019
56f9398
Remove redundant --output-path='./dist'' arg
ockham Apr 23, 2019
334f224
s/cb/calypso-bin/g
ockham Apr 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/full-site-editing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
},
"homepage": "https://github.com/Automattic/wp-calypso",
"scripts": {
"plugin": "webpack --source='plugin'",
"plugin": "calypso-build --source='plugin'",
"dev:plugin": "npm run plugin",
"build:plugin": "NODE_ENV=production npm run plugin",
"theme": "webpack --source='theme'",
"theme": "calypso-build --source='theme'",
"dev:theme": "npm run theme",
"build:theme": "NODE_ENV=production npm run theme",
"dev": "npm-run-all --parallel dev:*",
Expand Down
2 changes: 1 addition & 1 deletion apps/o2-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"clean": "npx rimraf dist",
"prebuild": "npm run clean",
"build": "webpack --config='../../packages/calypso-build/webpack.config.js' --output-path='./dist' --env.WP='true' editor='./src/editor.js' "
"build": "calypso-build editor='./src/editor.js' --env.WP"
},
"dependencies": {
"@wordpress/blocks": "6.0.7",
Expand Down
2 changes: 1 addition & 1 deletion apps/wpcom-block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"homepage": "https://github.com/Automattic/wp-calypso",
"scripts": {
"bundle": "webpack --env.WP='true'",
"bundle": "calypso-build --env.WP",
"build:dev": "npm run bundle --",
"build:prod": "NODE_ENV=production npm run bundle --",
"build": "npm-run-all --parallel \"build:* -- {@}\" --"
Expand Down
15 changes: 6 additions & 9 deletions docs/monorepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Two different directories for modules are:
`/apps` — projects that can produce independent, binary-like outputs deployed elsewhere. Typically not published to NPM or build on `npm start`.

Modules should follow our convention for layout:

```
# your package.json
package.json
Expand Down Expand Up @@ -49,9 +50,7 @@ The only exception are `devDependencies` which _must be declared in the wp-calyp
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
"keywords": [
"wordpress"
],
"keywords": [ "wordpress" ],
"author": "Your Name <you@example.com> (https://yoursite.wordpress.com/)",
"contributors": [],
"homepage": "https://github.com/Automattic/wp-calypso",
Expand All @@ -67,19 +66,16 @@ The only exception are `devDependencies` which _must be declared in the wp-calyp
"bugs": {
"url": "https://github.com/Automattic/wp-calypso/issues"
},
"files": [
"dist",
"src"
],
"files": [ "dist", "src" ],
"scripts": {
"clean": "npx rimraf dist",
"prepublish": "npm run clean",
"prepare": "npx @automattic/calypso-build"
"prepare": "transpile"
}
}
```

If your package requires compilation, the `package.json` `prepare` script should compile the package. If it contains ES6+ code that needs to be transpiled, use `npx @automattic/calypso-build` which will automatically compile code in `src/` to `dist/cjs` (CommonJS) and `dist/esm` (ECMAScript Modules) by running `babel` over any source files it finds.
If your package requires compilation, the `package.json` `prepare` script should compile the package. If it contains ES6+ code that needs to be transpiled, use `transpile` (from `@automattic/calypso-build`) which will automatically compile code in `src/` to `dist/cjs` (CommonJS) and `dist/esm` (ECMAScript Modules) by running `babel` over any source files it finds.

## Running Tests

Expand Down Expand Up @@ -116,6 +112,7 @@ npx lerna run build --scope="@automattic/calypso-build"
All `prepare` scripts found in all `package.json`s of apps and packages are always run on Calypso's `npm install`. Therefore independent apps in `/apps` directory can use `build` instead of `prepare` so avoid unnecessary builds.

You can also run other custom `package.json` scripts only for your app or package:

```bash
npx lerna run your-script --scope="@automattic/your-package"
```
Expand Down
Loading