瀏覽代碼

Refactor npm scripts (a little bit)

- sort them
- fix db touch in travis hexo clean
- rename update.js to inject.js which i think is less generic
- use colons (vs dashes) for delimiting as is idiomatic
Kevin van Zonneveld 6 年之前
父節點
當前提交
f0ca917a1e

+ 30 - 28
package.json

@@ -6,7 +6,7 @@
   "lint-staged": {
     "*.js": "eslint"
   },
-  "pre-commit": "lint-staged",
+  "pre-commit": "lint:staged",
   "license": "MIT",
   "devDependencies": {
     "@types/react": "^16.4.18",
@@ -80,57 +80,59 @@
     "webdriverio": "^4.14.0"
   },
   "scripts": {
+    "bootstrap": "lerna bootstrap",
     "build:bundle": "node ./bin/build-js.js",
-    "build:css": "node ./bin/build-css.js",
     "build:companion": "cd ./packages/@uppy/companion && npm run build",
+    "build:css": "node ./bin/build-css.js",
     "build:gzip": "node ./bin/gzip.js",
-    "size": "echo 'JS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.css | gzip | wc -c",
     "build:js": "npm-run-all build:lib build:bundle",
     "build:lib": "node ./bin/build-lib.js",
     "build": "npm-run-all --parallel build:js build:css build:companion --serial build:gzip size",
     "clean": "rm -rf packages/*/lib packages/@uppy/*/lib packages/*/dist packages/@uppy/*/dist",
+    "contributors:save": "replace-x -m '<!--contributors-->[\\s\\S]+<!--/contributors-->' \"<!--contributors-->\n## Contributors\n\n$(npm run --silent contributors)\n<!--/contributors-->\" README.md",
+    "contributors": "githubcontrib --owner transloadit --repo uppy --cols 6 $([ \"${GITHUB_TOKEN:-}\" == \"\" ] && echo \"\" || echo \"--authToken ${GITHUB_TOKEN}\") --showlogin true --sortOrder desc",
+    "dev:browsersync": "browser-sync start --no-open --no-ghost-mode false --server examples/dev --port 3452 --serveStatic packages/uppy/dist --files \"examples/dev/bundle.js, packages/uppy/dist/uppy.min.css, packages/uppy/lib/**/*\"",
+    "dev:js": "cd examples/dev && npm run watch",
+    "dev:no-companion": "npm-run-all --parallel dev:js watch:css watch:js:lib dev:browsersync",
+    "dev": "npm-run-all --parallel start:companion dev:js watch:css watch:js:lib dev:browsersync",
     "lint:fix": "npm run lint -- --fix",
+    "lint:staged": "lint-staged",
     "lint": "eslint . --cache",
-    "lint-staged": "lint-staged",
     "release": "./bin/release",
-    "version": "./bin/sync-version-numbers",
+    "size": "echo 'JS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.css | gzip | wc -c",
     "start:companion": "sh ./bin/companion",
     "start": "npm-run-all --parallel watch start:companion web:preview",
-    "test:registry": "verdaccio --listen 4002 --config test/endtoend/verdaccio.yaml",
-    "test:build": "./bin/endtoend-build",
-    "test:build-ci": "./bin/endtoend-build-ci",
-    "test:prepare-ci": "npm-run-all --parallel --race test:registry test:build-ci",
-    "test:acceptance": "npm run test:prepare-ci && wdio test/endtoend/wdio.remote.conf.js",
     "test:acceptance:local": "npm run test:build && wdio test/endtoend/wdio.local.conf.js",
-    "test:unit": "npm run build:lib && jest",
+    "test:acceptance": "npm run test:prepare-ci && wdio test/endtoend/wdio.remote.conf.js",
+    "test:build-ci": "./bin/endtoend-build-ci",
+    "test:build": "./bin/endtoend-build",
     "test:companion": "cd ./packages/@uppy/companion && npm run test",
+    "test:prepare-ci": "npm-run-all --parallel --race test:registry test:build-ci",
+    "test:registry": "verdaccio --listen 4002 --config test/endtoend/verdaccio.yaml",
     "test:type": "tsc -p .",
-    "test": "npm run lint && npm run test:unit && npm run test:type && npm run test:companion",
+    "test:unit": "npm run build:lib && jest",
     "test:watch": "jest --watch",
+    "test": "npm-run-all lint test:unit test:type test:companion",
     "travis:deletecache": "travis cache --delete",
+    "uploadcdn": "bin/upload-to-cdn.sh",
+    "version": "./bin/sync-version-numbers",
     "watch:css": "onchange 'packages/**/*.scss' --initial --verbose -- npm run build:css",
-    "watch:js": "onchange 'packages/{@uppy/,}*/src/**/*.js' --initial --verbose -- npm run build:bundle",
     "watch:js:lib": "onchange 'packages/{@uppy/,}*/src/**/*.js' --initial --verbose -- npm run build:lib",
+    "watch:js": "onchange 'packages/{@uppy/,}*/src/**/*.js' --initial --verbose -- npm run build:bundle",
     "watch": "npm-run-all --parallel watch:js watch:css",
-    "dev:browsersync": "browser-sync start --no-open --no-ghost-mode false --server examples/dev --port 3452 --serveStatic packages/uppy/dist --files \"examples/dev/bundle.js, packages/uppy/dist/uppy.min.css, packages/uppy/lib/**/*\"",
-    "dev:js": "cd examples/dev && npm run watch",
-    "dev": "npm-run-all --parallel start:companion dev:js watch:css watch:js:lib dev:browsersync",
-    "dev:no-companion": "npm-run-all --parallel dev:js watch:css watch:js:lib dev:browsersync",
-    "web:build": "cd website && node update.js && touch db.json && ./node_modules/.bin/hexo generate && node build-examples.js",
-    "web:clean": "cd website && ./node_modules/.bin/hexo clean",
+    "web:build": "npm-run-all web:inject web:generate web:examples",
+    "web:bundle:update:watch": "onchange 'packages/uppy/dist/**/*.css' 'packages/uppy/dist/**/*.js' --initial --verbose -- npm run web:inject",
+    "web:clean": "cd website && touch db.json && ./node_modules/.bin/hexo clean",
     "web:deploy": "npm-run-all web:clean web:disc web:build && ./bin/web-deploy",
     "web:disc": "node ./bin/disc.js",
-    "web:install": "cd website && npm install",
-    "web:bundle:update:watch": "onchange 'packages/uppy/dist/**/*.css' 'packages/uppy/dist/**/*.js' --initial --verbose -- node website/update.js",
     "web:examples:watch": "cd website && node build-examples.js watch",
-    "web:serve": "cd website && ./node_modules/.bin/hexo server",
+    "web:examples": "cd website && node build-examples.js",
+    "web:generate": "cd website && touch db.json && ./node_modules/.bin/hexo generate",
+    "web:inject:frontpagecodesample": "npm run web:generate && cp -f public/frontpage-code-sample.html ./themes/uppy/layout/partials/frontpage-code-sample.html",
+    "web:inject": "cd website && node inject.js",
+    "web:install": "cd website && npm install",
     "web:preview": "npm-run-all build:lib --parallel web:examples:watch web:bundle:update:watch web:serve",
-    "web:update:frontpage:code:sample": "cd website && ./node_modules/.bin/hexo generate && cp -f public/frontpage-code-sample.html ./themes/uppy/layout/partials/frontpage-code-sample.html",
-    "web": "npm-run-all web:clean web:build",
-    "uploadcdn": "bin/upload-to-cdn.sh",
-    "bootstrap": "lerna bootstrap",
-    "contributors": "githubcontrib --owner transloadit --repo uppy --cols 6 $([ \"${GITHUB_TOKEN:-}\" == \"\" ] && echo \"\" || echo \"--authToken ${GITHUB_TOKEN}\") --showlogin true --sortOrder desc",
-    "contributors:save": "replace-x -m '<!--contributors-->[\\s\\S]+<!--/contributors-->' \"<!--contributors-->\n## Contributors\n\n$(npm run --silent contributors)\n<!--/contributors-->\" README.md"
+    "web:serve": "cd website && touch db.json &&./node_modules/.bin/hexo server"
   },
   "jest": {
     "automock": false,

+ 0 - 0
website/update.js → website/inject.js


+ 1 - 1
website/src/_template/contributing.md

@@ -1,4 +1,4 @@
-<!-- WARNING! This file was injected. Please edit in ".github/CONTRIBUTING.md" instead and run "update.js" -->
+<!-- WARNING! This file was injected. Please edit in ".github/CONTRIBUTING.md" instead and run "inject.js" -->
 
 ## Uppy development
 

+ 1 - 1
website/src/_template/integration_help.md

@@ -1,4 +1,4 @@
-<!-- WARNING! This file was injected. Please edit in ".github/ISSUE_TEMPLATE/integration_help.md" instead and run "update.js" -->
+<!-- WARNING! This file was injected. Please edit in ".github/ISSUE_TEMPLATE/integration_help.md" instead and run "inject.js" -->
 
 Transloadit is providing Uppy free of charge. If you want you can self-host all components and never pay us a dime. There's docs and tests and your Bugs and Feature Requests are always welcome on GitHub. 
 

+ 1 - 1
website/src/frontpage-code-sample.ejs

@@ -2,7 +2,7 @@
 layout: false
 ---
 <!--
-You can `npm run web:update:frontpage:code:sample` to render this code snippet and
+You can `npm run web:inject:frontpagecodesample` to render this code snippet and
 save it as a layout partial
 -->
 {% codeblock lang:bash %}

+ 1 - 1
website/themes/uppy/layout/partials/frontpage-code-sample.html

@@ -1,5 +1,5 @@
 <!--
-You can `npm run web:update:frontpage:code:sample` to render this code snippet and
+You can `npm run web:inject:frontpagecodesample` to render this code snippet and
 save it as a layout partial
 -->
 <figure class="highlight bash"><table><tr><td class="code"><pre>$ <span class="token function">npm</span> <span class="token function">install</span> @uppy/core @uppy/dashboard @uppy/instagram @uppy/tus </pre></td></tr></table></figure>