Browse Source

Update build scripts.

Renée Kooi 6 years ago
parent
commit
6e24d0e4c9
6 changed files with 27 additions and 28 deletions
  1. 1 1
      bin/disc.js
  2. 3 3
      bin/endtoend-build
  3. 1 1
      bin/gzip.js
  4. 10 11
      bin/upload-to-cdn.sh
  5. 6 6
      package.json
  6. 6 6
      test/endtoend/src/main.js

+ 1 - 1
bin/disc.js

@@ -16,7 +16,7 @@ function minifyify () {
   })
 }
 
-const bundler = browserify(path.join(__dirname, '../src/index.js'), {
+const bundler = browserify(path.join(__dirname, '../packages/uppy/index.js'), {
   fullPaths: true,
   standalone: 'Uppy'
 })

+ 3 - 3
bin/endtoend-build

@@ -7,12 +7,12 @@ rm -rf ./test/endtoend/node_modules
 npm run prepublishOnly
 # archive the uppy package
 echo "Creating archive for Uppy package"
-npm pack
+cd packages/uppy && npm pack && cd ../..
 
-UPPY_VERSION=$(node -e 'console.log(require("./package.json").version)')
+UPPY_VERSION=$(node -e 'console.log(require("./packages/uppy/package.json").version)')
 # install from the archived uppy package
 echo "Installing Uppy from archived file uppy-${UPPY_VERSION}.tgz"
-npm install --prefix ./test/endtoend uppy-${UPPY_VERSION}.tgz
+npm install --prefix ./test/endtoend packages/uppy/uppy-${UPPY_VERSION}.tgz
 
 # removing package-lock.json because we do not need it.
 rm ./test/endtoend/package-lock.json

+ 1 - 1
bin/gzip.js

@@ -25,7 +25,7 @@ function gzip (file) {
 
 function gzipDist () {
   return new Promise(function (resolve) {
-    glob('./dist/**/*.*(css|js)', function (err, files) {
+    glob('./{,packages/uppy/}dist/**/*.*(css|js)', function (err, files) {
       if (err) console.log(err)
       var gzipPromises = []
       files.forEach(function (file) {

+ 10 - 11
bin/upload-to-cdn.sh

@@ -60,7 +60,7 @@ pushd "${__root}" > /dev/null 2>&1
   remoteVersion="${1:-}"
   version="${remoteVersion}"
   if [ -z "${remoteVersion}" ]; then
-    localVersion=$(node -pe "require('./package.json').version")
+    localVersion=$(node -pe "require('./packages/uppy/package.json').version")
     echo "${localVersion}"
     version="${localVersion}"
   fi
@@ -77,16 +77,18 @@ pushd "${__root}" > /dev/null 2>&1
   echo "✅"
 
   echo "--> Obtain relevant npm files for uppy ${version} ... "
-  if [ -z "${remoteVersion}" ]; then
-    npm pack || fatal "Unable to fetch "
-  else
-    npm pack "uppy@${remoteVersion}"
-  fi
+  pushd packages/uppy
+    if [ -z "${remoteVersion}" ]; then
+      npm pack || fatal "Unable to fetch "
+    else
+      npm pack "uppy@${remoteVersion}"
+    fi
+  popd > /dev/null 2>&1
   echo "✅"
   rm -rf /tmp/uppy-to-edgly
   mkdir -p /tmp/uppy-to-edgly
-  cp -af "uppy-${version}.tgz" /tmp/uppy-to-edgly/
-  tar zxvf "uppy-${version}.tgz" -C /tmp/uppy-to-edgly/
+  cp -af "packages/uppy/uppy-${version}.tgz" /tmp/uppy-to-edgly/
+  tar zxvf "packages/uppy/uppy-${version}.tgz" -C /tmp/uppy-to-edgly/
 
   echo "--> Upload to edgly.net CDN"
   pushd /tmp/uppy-to-edgly/package
@@ -96,10 +98,7 @@ pushd "${__root}" > /dev/null 2>&1
       AWS_SECRET_ACCESS_KEY="${EDGLY_SECRET}" \
     aws s3 sync \
       --region="us-east-1" \
-      --exclude 'website/*' \
       --exclude 'node_modules/*' \
-      --exclude 'test/*/node_modules/*' \
-      --exclude 'examples/*/node_modules/*' \
     ./ "s3://crates.edgly.net/756b8efaed084669b02cb99d4540d81f/default/releases/uppy/v${version}"
     echo "Saved https://transloadit.edgly.net/releases/uppy/v${version}/"
   popd > /dev/null 2>&1

+ 6 - 6
package.json

@@ -132,11 +132,11 @@
     "build:bundle": "node ./bin/build-js.js",
     "build:css": "node ./bin/build-css.js",
     "build:gzip": "node ./bin/gzip.js",
-    "size": "echo 'JS Bundle mingz:' && cat ./dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./dist/uppy.min.css | gzip | wc -c",
-    "build:js": "npm-run-all build:bundle build:lib",
+    "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": "babel --version && node ./bin/build-lib.js",
     "build": "npm-run-all --parallel build:js build:css --serial build:gzip size",
-    "clean": "rm -rf lib && rm -rf dist",
+    "clean": "rm -rf packages/*/lib packages/@uppy/*/lib && rm -rf packages/uppy/dist",
     "lint:fix": "npm run lint -- --fix",
     "lint": "eslint packages/*/src packages/@uppy/*/src test website/scripts website/build-examples.js website/update.js website/themes/uppy/source/js/common.js",
     "lint-staged": "lint-staged",
@@ -156,10 +156,10 @@
     "test:watch": "jest --watch --testPathPattern=src",
     "travis:deletecache": "travis cache --delete",
     "watch:css": "onchange 'src/scss/**/*.scss' --initial --verbose -- npm run build:css",
-    "watch:js": "onchange 'src/**/*.js' --initial --verbose -- npm run build:bundle",
+    "watch:js": "onchange 'packages/{@uppy/,}*/src/**/*.js' --initial --verbose -- npm run build:bundle",
     "watch": "npm-run-all --parallel watch:js watch:css",
     "watch:fast": "npm-run-all --parallel watch:css web:preview",
-    "watch:example:browsersync": "browser-sync start --server examples/bundled-example --port 3452 --serveStatic dist --files \"examples/bundled-example/bundle.js, dist/uppy.min.css\"",
+    "watch:example:browsersync": "browser-sync start --server examples/bundled-example --port 3452 --serveStatic \"packages/uppy/dist, dist\" --files \"examples/bundled-example/bundle.js, dist/uppy.min.css\"",
     "watch:example:js": "cd examples/bundled-example && npm run watch",
     "watch:example": "npm-run-all --parallel watch:example:js watch:css watch:example:browsersync",
     "dev": "npm-run-all --parallel watch:example:js watch:css watch:example:browsersync",
@@ -169,7 +169,7 @@
     "web:generated-docs": "cd website && node node_modules/documentation/bin/documentation.js readme ../src/index.js --readme-file=src/docs/api.md --section 'Uppy Core & Plugins' -q --github -c doc-order.json",
     "web:disc": "node ./bin/disc.js",
     "web:install": "cd website && npm install",
-    "web:bundle:update:watch": "onchange 'dist/**/*.css' 'dist/**/*.js' --initial --verbose -- node website/update.js",
+    "web:bundle:update:watch": "onchange 'dist/**/*.css' 'packages/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:preview": "npm-run-all --parallel web:examples:watch web:bundle:update:watch web:serve",

+ 6 - 6
test/endtoend/src/main.js

@@ -1,9 +1,9 @@
-const Uppy = require('uppy/lib/core')
-const DragDrop = require('uppy/lib/plugins/DragDrop')
-const Dashboard = require('uppy/lib/plugins/Dashboard')
-const Tus = require('uppy/lib/plugins/Tus')
-const XHRUpload = require('uppy/lib/plugins/XHRUpload')
-const ProgressBar = require('uppy/lib/plugins/ProgressBar')
+const Uppy = require('@uppy/core')
+const DragDrop = require('@uppy/drag-drop')
+const Dashboard = require('@uppy/dashboard')
+const Tus = require('@uppy/tus')
+const XHRUpload = require('@uppy/xhrupload')
+const ProgressBar = require('@uppy/progress-bar')
 
 // Initialise Uppy with Drag & Drop
 const uppyDragDrop = Uppy({