Skip to content

Commit 9e6d2ca

Browse files
authored
feat: rename package.json scripts (#97)
Remove the ':' character from script names. They were denoting both a namespace (e.g. `build:src, build:dts`) and a switch (e.g. `build:watch`). This causes scripts to become difficult to find. Now we use `-` for namespacing, and `--` for switches, eg: `build-src`, `build-dts`, `build--watch` BREAKING CHANGE: Scripts renamed to new namespace / switching rules.
1 parent c7ed380 commit 9e6d2ca

File tree

14 files changed

+117
-121
lines changed

14 files changed

+117
-121
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ If you're unsure about anything, don't hesitate to ask. We're here to help!
3737
- [ ] Fixing a bug? An open [bug report](https://github.com/iamturns/create-exposed-app/labels/bug) exists.
3838
- [ ] Breaking API changes? Migration notes attached.
3939
- [ ] Changed relevant files in `templates` directory.
40-
- [ ] Updated examples: `npm run build:examples`.
40+
- [ ] Updated examples: `npm run build-examples`.
4141
- [ ] Ready for review

DEVELOPING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- [Why are there so many config files?](#why-are-there-so-many-config-files)
1212
- [Why isn't the build bundled or minified?](#why-isnt-the-build-bundled-or-minified)
1313
- [Why does the Babel build script contain the `--source-maps` option?](#why-does-the-babel-build-script-contain-the---source-maps-option)
14-
- [Why does the `format:eslint` script ignore errors?](#why-does-the-formateslint-script-ignore-errors)
14+
- [Why does the `format-eslint` script ignore errors?](#why-does-the-format-eslint-command-ignore-errors)
1515

1616
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1717

@@ -27,7 +27,7 @@
2727

2828
1. Create a system-wide link for use in other directories: `npm link`
2929
1. Start develop mode: `npm run dev`
30-
1. For TDD fans: `npm run test:watch`
30+
1. For TDD fans: `npm run test--watch`
3131
1. Write code
3232
1. Create new temporary directory to test app population named `create-exposed-app-test-my-new-feature`
3333
1. Run `npx create-exposed-app` in new directory
@@ -66,7 +66,7 @@ See [ADR-004: Minimally Transform Source Code During Build](docs/adr/004-minimal
6666

6767
This option is available in the Babel config file (`sourceMaps: true`), but has diffrent behaviour. Only the command line supports the creation of `.map` files. See [https://github.com/babel/babel/issues/5261](https://github.com/babel/babel/issues/5261).
6868

69-
## Why does the `format:eslint` script ignore errors?
69+
## Why does the `format-eslint` script ignore errors?
7070

7171
Linting errors should not be reported when formatting, that it was the `lint` command is for.
7272

bin/build-examples.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mkdir examples
77

88
mkdir examples/default-server-side
99

10-
npm run start:src \
10+
npm run start-src \
1111
-- \
1212
--project-package-name="create-exposed-app" \
1313
--project-overview="Default server-side example of create-exposed-app" \
@@ -34,7 +34,7 @@ rm -Rf \
3434

3535
mkdir examples/default-client-side
3636

37-
npm run start:src \
37+
npm run start-src \
3838
-- \
3939
--project-package-name="create-exposed-app" \
4040
--project-overview="Default client-side example of create-exposed-app" \

examples/default-client-side/DEVELOPING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- [Why are there so many config files?](#why-are-there-so-many-config-files)
1212
- [Why isn't the build bundled or minified?](#why-isnt-the-build-bundled-or-minified)
1313
- [Why does the Babel build script contain the `--source-maps` option?](#why-does-the-babel-build-script-contain-the---source-maps-option)
14-
- [Why does the `format:eslint` script ignore errors?](#why-does-the-formateslint-script-ignore-errors)
14+
- [Why does the `format-eslint` script ignore errors?](#why-does-the-format-eslint-script-ignore-errors)
1515

1616
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1717

@@ -26,7 +26,7 @@
2626
## What's the development workflow?
2727

2828
1. Start develop mode: `npm run dev`
29-
1. For TDD fans: `npm run test:watch`
29+
1. For TDD fans: `npm run test--watch`
3030
1. Write code
3131
1. Create a [pull request on GitHub](https://github.com/iamturns/create-exposed-app/pulls)
3232

@@ -58,7 +58,7 @@ See [ADR-004: Minimally Transform Source Code During Build](docs/adr/004-minimal
5858

5959
This option is available in the Babel config file (`sourceMaps: true`), but has diffrent behaviour. Only the command line supports the creation of `.map` files. See [https://github.com/babel/babel/issues/5261](https://github.com/babel/babel/issues/5261).
6060

61-
## Why does the `format:eslint` script ignore errors?
61+
## Why does the `format-eslint` script ignore errors?
6262

6363
Linting errors should not be reported when formatting, that it was the `lint` command is for.
6464

examples/default-client-side/lint-staged.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
linters: {
3-
"(README|DEVELOPING).md": ["npm run format:doctoc", "git add"],
4-
"package.json": ["npm run format:package", "git add"],
3+
"(README|DEVELOPING).md": ["npm run format-doctoc", "git add"],
4+
"package.json": ["npm run format-package-json", "git add"],
55
".editorconfig": ["prettier --write", "git add"],
66
LICENSE: ["prettier --write", "git add"],
77
"**/*.md": ["markdownlint"],

examples/default-client-side/package.json

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,34 @@
1515
"main": "dist/create-exposed-app.js",
1616
"scripts": {
1717
"pre-commit": "lint-staged",
18-
"build": "run-p --print-label build:src build:dts",
19-
"build:dts": "tsc --emitDeclarationOnly",
20-
"build:dts:watch": "npm run build:dts -- --watch --preserveWatchOutput",
21-
"build:src": "babel src --out-dir dist --extensions .js,.jsx,.ts,.tsx --source-maps",
22-
"build:src:watch": "npm run build:src -- --watch 'src/**/*' --verbose",
23-
"build:watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run build",
24-
"dev": "NODE_ENV=development npm run build-serve:watch",
25-
"dev:debug": "DEBUG=* npm run dev",
26-
"dev:debug:app": "DEBUG=create-exposed-app npm run dev",
18+
"build": "run-p --print-label build-src build-dts",
19+
"build--watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run build",
20+
"build-dts": "tsc --emitDeclarationOnly",
21+
"build-dts--watch": "npm run build-dts -- --watch --preserveWatchOutput",
22+
"build-src": "babel src --out-dir dist --extensions .js,.jsx,.ts,.tsx --source-maps",
23+
"build-src--watch": "npm run build-src -- --watch 'src/**/*' --verbose",
24+
"dev": "NODE_ENV=development npm run start-src--watch",
25+
"dev--debug": "DEBUG=create-exposed-app npm run dev",
2726
"display-browser-support": "browserslist --stats && echo '' && browserslist --coverage && echo '' && echo 'See more at https://browserl.ist/'",
28-
"format": "run-s format:doctoc format:package format:imports format:prettier format:eslint",
29-
"format:doctoc": "doctoc --maxlevel 3 --notitle ./README.md ./DEVELOPING.md",
30-
"format:eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ >/dev/null 2>&1 || true",
31-
"format:imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'",
32-
"format:package": "prettier-package-json --write",
33-
"format:prettier": "prettier --write '**/*.{css,gql,graphql,html,js,jsx,json,less,md,mdx,scss,ts,tsx,vue,yaml,yml}' '.editorconfig' 'LICENSE'",
34-
"lint": "run-p lint:eslint lint:markdown",
35-
"lint:eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./",
36-
"lint:markdown": "markdownlint --ignore coverage --ignore dist --ignore node_modules '**/*.md' '.**/**/*.md'",
37-
"lint:watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run lint",
27+
"format": "run-s format-doctoc format-package-json format-imports format-prettier format-eslint",
28+
"format-doctoc": "doctoc --maxlevel 3 --notitle ./README.md ./DEVELOPING.md",
29+
"format-eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ >/dev/null 2>&1 || true",
30+
"format-imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'",
31+
"format-package-json": "prettier-package-json --write",
32+
"format-prettier": "prettier --write '**/*.{css,gql,graphql,html,js,jsx,json,less,md,mdx,scss,ts,tsx,vue,yaml,yml}' '.editorconfig' 'LICENSE'",
33+
"lint": "run-p lint-eslint lint-markdown",
34+
"lint--watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run lint",
35+
"lint-eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./",
36+
"lint-markdown": "markdownlint --ignore coverage --ignore dist --ignore node_modules '**/*.md' '.**/**/*.md'",
3837
"prepublish": "rimraf dist && npm run build",
3938
"start": "node dist/create-exposed-app.js",
40-
"start:dev": "NODE_ENV=development npm run start",
41-
"start:src": "babel-node --extensions .js,.jsx,.ts,.tsx src/create-exposed-app-cli.ts",
42-
"start:src:watch": "nodemon --ext js,jsx,ts,tsx --delay 1 --exec npm run start:src",
39+
"start--dev": "NODE_ENV=development npm run start",
40+
"start-src": "babel-node --extensions .js,.jsx,.ts,.tsx src/create-exposed-app.ts",
41+
"start-src--watch": "nodemon --ext js,jsx,ts,tsx --delay 1 --exec npm run start-src",
4342
"test": "jest --passWithNoTests --coverage",
44-
"test:watch": "jest --watch",
43+
"test--watch": "jest --watch",
4544
"typecheck": "tsc --noEmit",
46-
"typecheck:watch": "npm run typecheck -- --watch",
45+
"typecheck--watch": "npm run typecheck -- --watch",
4746
"validate": "run-p --print-label lint typecheck test build"
4847
},
4948
"dependencies": {},

examples/default-server-side/DEVELOPING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- [Why are there so many config files?](#why-are-there-so-many-config-files)
1212
- [Why isn't the build bundled or minified?](#why-isnt-the-build-bundled-or-minified)
1313
- [Why does the Babel build script contain the `--source-maps` option?](#why-does-the-babel-build-script-contain-the---source-maps-option)
14-
- [Why does the `format:eslint` script ignore errors?](#why-does-the-formateslint-script-ignore-errors)
14+
- [Why does the `format-eslint` script ignore errors?](#why-does-the-format-eslint-script-ignore-errors)
1515

1616
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1717

@@ -26,7 +26,7 @@
2626
## What's the development workflow?
2727

2828
1. Start develop mode: `npm run dev`
29-
1. For TDD fans: `npm run test:watch`
29+
1. For TDD fans: `npm run test--watch`
3030
1. Write code
3131
1. Create a [pull request on GitHub](https://github.com/iamturns/create-exposed-app/pulls)
3232

@@ -58,7 +58,7 @@ See [ADR-004: Minimally Transform Source Code During Build](docs/adr/004-minimal
5858

5959
This option is available in the Babel config file (`sourceMaps: true`), but has diffrent behaviour. Only the command line supports the creation of `.map` files. See [https://github.com/babel/babel/issues/5261](https://github.com/babel/babel/issues/5261).
6060

61-
## Why does the `format:eslint` script ignore errors?
61+
## Why does the `format-eslint` script ignore errors?
6262

6363
Linting errors should not be reported when formatting, that it was the `lint` command is for.
6464

examples/default-server-side/lint-staged.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
linters: {
3-
"(README|DEVELOPING).md": ["npm run format:doctoc", "git add"],
4-
"package.json": ["npm run format:package", "git add"],
3+
"(README|DEVELOPING).md": ["npm run format-doctoc", "git add"],
4+
"package.json": ["npm run format-package-json", "git add"],
55
".editorconfig": ["prettier --write", "git add"],
66
LICENSE: ["prettier --write", "git add"],
77
"**/*.md": ["markdownlint"],

examples/default-server-side/package.json

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,34 @@
1515
"main": "dist/create-exposed-app.js",
1616
"scripts": {
1717
"pre-commit": "lint-staged",
18-
"build": "run-p --print-label build:src build:dts",
19-
"build:dts": "tsc --emitDeclarationOnly",
20-
"build:dts:watch": "npm run build:dts -- --watch --preserveWatchOutput",
21-
"build:src": "babel src --out-dir dist --extensions .js,.jsx,.ts,.tsx --source-maps",
22-
"build:src:watch": "npm run build:src -- --watch 'src/**/*' --verbose",
23-
"build:watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run build",
24-
"dev": "NODE_ENV=development npm run build-serve:watch",
25-
"dev:debug": "DEBUG=* npm run dev",
26-
"dev:debug:app": "DEBUG=create-exposed-app npm run dev",
18+
"build": "run-p --print-label build-src build-dts",
19+
"build--watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run build",
20+
"build-dts": "tsc --emitDeclarationOnly",
21+
"build-dts--watch": "npm run build-dts -- --watch --preserveWatchOutput",
22+
"build-src": "babel src --out-dir dist --extensions .js,.jsx,.ts,.tsx --source-maps",
23+
"build-src--watch": "npm run build-src -- --watch 'src/**/*' --verbose",
24+
"dev": "NODE_ENV=development npm run start-src--watch",
25+
"dev--debug": "DEBUG=create-exposed-app npm run dev",
2726
"display-browser-support": "browserslist --stats && echo '' && browserslist --coverage && echo '' && echo 'See more at https://browserl.ist/'",
28-
"format": "run-s format:doctoc format:package format:imports format:prettier format:eslint",
29-
"format:doctoc": "doctoc --maxlevel 3 --notitle ./README.md ./DEVELOPING.md",
30-
"format:eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ >/dev/null 2>&1 || true",
31-
"format:imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'",
32-
"format:package": "prettier-package-json --write",
33-
"format:prettier": "prettier --write '**/*.{css,gql,graphql,html,js,jsx,json,less,md,mdx,scss,ts,tsx,vue,yaml,yml}' '.editorconfig' 'LICENSE'",
34-
"lint": "run-p lint:eslint lint:markdown",
35-
"lint:eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./",
36-
"lint:markdown": "markdownlint --ignore coverage --ignore dist --ignore node_modules '**/*.md' '.**/**/*.md'",
37-
"lint:watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run lint",
27+
"format": "run-s format-doctoc format-package-json format-imports format-prettier format-eslint",
28+
"format-doctoc": "doctoc --maxlevel 3 --notitle ./README.md ./DEVELOPING.md",
29+
"format-eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ >/dev/null 2>&1 || true",
30+
"format-imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'",
31+
"format-package-json": "prettier-package-json --write",
32+
"format-prettier": "prettier --write '**/*.{css,gql,graphql,html,js,jsx,json,less,md,mdx,scss,ts,tsx,vue,yaml,yml}' '.editorconfig' 'LICENSE'",
33+
"lint": "run-p lint-eslint lint-markdown",
34+
"lint--watch": "onchange 'src/**/*' --initial --kill --delay 1000 -- npm run lint",
35+
"lint-eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./",
36+
"lint-markdown": "markdownlint --ignore coverage --ignore dist --ignore node_modules '**/*.md' '.**/**/*.md'",
3837
"prepublish": "rimraf dist && npm run build",
3938
"start": "node dist/create-exposed-app.js",
40-
"start:dev": "NODE_ENV=development npm run start",
41-
"start:src": "babel-node --extensions .js,.jsx,.ts,.tsx src/create-exposed-app-cli.ts",
42-
"start:src:watch": "nodemon --ext js,jsx,ts,tsx --delay 1 --exec npm run start:src",
39+
"start--dev": "NODE_ENV=development npm run start",
40+
"start-src": "babel-node --extensions .js,.jsx,.ts,.tsx src/create-exposed-app.ts",
41+
"start-src--watch": "nodemon --ext js,jsx,ts,tsx --delay 1 --exec npm run start-src",
4342
"test": "jest --passWithNoTests --coverage",
44-
"test:watch": "jest --watch",
43+
"test--watch": "jest --watch",
4544
"typecheck": "tsc --noEmit",
46-
"typecheck:watch": "npm run typecheck -- --watch",
45+
"typecheck--watch": "npm run typecheck -- --watch",
4746
"validate": "run-p --print-label lint typecheck test build"
4847
},
4948
"dependencies": {},

lint-staged.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
linters: {
3-
"(README|DEVELOPING).md": ["npm run format:doctoc", "git add"],
4-
"package.json": ["npm run format:package", "git add"],
3+
"(README|DEVELOPING).md": ["npm run format-doctoc", "git add"],
4+
"package.json": ["npm run format-package-json", "git add"],
55
".editorconfig": ["prettier --write", "git add"],
66
LICENSE: ["prettier --write", "git add"],
77
"**/*.md": ["markdownlint"],

0 commit comments

Comments
 (0)