Ver código fonte

Merge pull request #1586 from transloadit/fix/uploadcdn

New `uploadcdn` script
Renée Kooi 5 anos atrás
pai
commit
d408531c1f

+ 7 - 1
.travis.yml

@@ -10,7 +10,13 @@ script:
 - npm run build
 - npm run test
 - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then npm run test:endtoend; fi
-#- npm run uploadcdn
+- |
+  if [ "${TRAVIS_PULL_REQUEST}" = "false" ] &&\
+     [[ "${TRAVIS_COMMIT_MESSAGE}" =~ ^Release* ]]; then
+    npm run uploadcdn uppy
+    npm run uploadcdn @uppy/robodog
+    npm run uploadcdn @uppy/locales
+  fi
 cache:
   apt: true
   directories:

+ 163 - 0
bin/upload-to-cdn.js

@@ -0,0 +1,163 @@
+#!/usr/bin/env node
+// Upload Uppy releases to Edgly.net CDN. Copyright (c) 2018, Transloadit Ltd.
+//
+// This file:
+//
+//  - Assumes EDGLY_KEY and EDGLY_SECRET are available (e.g. set via Travis secrets)
+//  - Assumes a fully built uppy is in root dir (unless a specific tag was specified, then it's fetched from npm)
+//  - Collects dist/ files that would be in an npm package release, and uploads to eg. https://transloadit.edgly.net/releases/uppy/v1.0.1/uppy.css
+//  - Uses local package by default, if [version] argument was specified, takes package from npm
+//
+// Run as:
+//
+//  npm run uploadcdn <package-name> [version]
+//
+// Authors:
+//
+//  - Kevin van Zonneveld <kevin@transloadit.com>
+
+const path = require('path')
+const AWS = require('aws-sdk')
+const packlist = require('npm-packlist')
+const tar = require('tar')
+const pacote = require('pacote')
+const concat = require('concat-stream')
+const { promisify } = require('util')
+const readFile = promisify(require('fs').readFile)
+const finished = promisify(require('stream').finished)
+
+function delay (ms) {
+  return new Promise(resolve => setTimeout(resolve, ms))
+}
+
+const AWS_REGION = 'us-east-1'
+const AWS_BUCKET = 'crates.edgly.net'
+const AWS_DIRECTORY = '756b8efaed084669b02cb99d4540d81f/default'
+
+/**
+ * Get remote dist/ files by fetching the tarball for the given version
+ * from npm and filtering it down to package/dist/ files.
+ *
+ * @param {string} Package name, eg. @uppy/robodog
+ * @param {string} Package version, eg. "1.2.0"
+ * @returns a Map<string, Buffer>, filename → content
+ */
+async function getRemoteDistFiles (packageName, version) {
+  const files = new Map()
+  const tarball = pacote.tarball.stream(`${packageName}@${version}`)
+    .pipe(new tar.Parse())
+
+  tarball.on('entry', (readEntry) => {
+    if (readEntry.path.startsWith('package/dist/')) {
+      readEntry
+        .pipe(concat((buf) => {
+          files.set(readEntry.path.replace(/^package\/dist\//, ''), buf)
+        }))
+        .on('error', (err) => {
+          tarball.emit('error', err)
+        })
+    } else {
+      readEntry.resume()
+    }
+  })
+
+  await finished(tarball)
+  return files
+}
+
+/**
+ * Get local dist/ files by asking npm-packlist what files would be added
+ * to an npm package during publish, and filtering those down to just dist/ files.
+ *
+ * @param {string} Base file path of the package, eg. ./packages/@uppy/locales
+ * @returns a Map<string, Buffer>, filename → content
+ */
+async function getLocalDistFiles (packagePath) {
+  const files = (await packlist({ path: packagePath }))
+    .filter(f => f.startsWith('dist/'))
+    .map(f => f.replace(/^dist\//, ''))
+
+  const entries = await Promise.all(
+    files.map(async (f) => [
+      f,
+      await readFile(path.join(packagePath, 'dist', f))
+    ])
+  )
+
+  return new Map(entries)
+}
+
+async function main (packageName, version) {
+  if (!packageName) {
+    console.error('usage: upload-to-cdn <packagename> [version]')
+    console.error('Must provide a package name')
+    process.exit(1)
+  }
+
+  if (!process.env.EDGLY_KEY || !process.env.EDGLY_SECRET) {
+    console.error('Missing EDGLY_KEY or EDGLY_SECRET env variables, bailing')
+    process.exit(1)
+  }
+
+  const s3 = new AWS.S3({
+    credentials: new AWS.Credentials({
+      accessKeyId: process.env.EDGLY_KEY,
+      secretAccessKey: process.env.EDGLY_SECRET
+    }),
+    region: AWS_REGION
+  })
+
+  const remote = !!version
+  if (!remote) {
+    version = require(`../packages/${packageName}/package.json`).version
+  }
+
+  // Warn if uploading a local build not from CI:
+  // - If we're on CI, this should be a release commit.
+  // - If we're local, normally we should upload a released version, not a local build.
+  if (!remote && !process.env.CI) {
+    console.log('Warning, writing a local build to the CDN, this is usually not what you want. Sleeping 3s. Press CTRL+C!')
+    await delay(3000)
+  }
+
+  const packagePath = remote
+    ? `${packageName}@${version}`
+    : path.join(__dirname, '..', 'packages', packageName)
+
+  // uppy → releases/uppy/
+  // @uppy/robodog → releases/uppy/robodog/
+  // @uppy/locales → releases/uppy/locales/
+  const dirName = packageName.startsWith('@uppy/')
+    ? packageName.replace(/^@/, '')
+    : 'uppy'
+
+  const outputPath = path.posix.join('releases', dirName, `v${version}`)
+
+  const { Contents: existing } = await s3.listObjects({
+    Bucket: AWS_BUCKET,
+    Prefix: `${AWS_DIRECTORY}/${outputPath}/`
+  }).promise()
+  if (existing.length > 0) {
+    console.error(`Release files for ${dirName} v${version} already exist, exiting...`)
+    process.exit(1)
+  }
+
+  const files = remote
+    ? await getRemoteDistFiles(packageName, version)
+    : await getLocalDistFiles(packagePath)
+
+  for (const [filename, buffer] of files.entries()) {
+    const key = path.posix.join(AWS_DIRECTORY, outputPath, filename)
+    console.log(`pushing s3://${AWS_BUCKET}/${key}`)
+    await s3.putObject({
+      Bucket: AWS_BUCKET,
+      Key: key,
+      Body: buffer
+    }).promise()
+  }
+}
+
+main(...process.argv.slice(2)).catch((err) => {
+  console.error(err.stack)
+  process.exit(1)
+})

+ 0 - 190
bin/upload-to-cdn.sh

@@ -1,190 +0,0 @@
-#!/usr/bin/env bash
-# Upload Uppy releases to Edgly.net CDN. Copyright (c) 2018, Transloadit Ltd.
-#
-# This file:
-#
-#  - Assumes EDGLY_KEY and EDGLY_SECRET are available (e.g. set via Travis secrets)
-#  - Tries to load env.sh instead, if not
-#  - Checks if a tag is being built (on Travis - otherwise opts to continue execution regardless)
-#  - Installs AWS CLI if needed
-#  - Assumed a fully built uppy is in root dir (unless a specific tag was specified, then it's fetched from npm)
-#  - Runs npm pack, and stores files to e.g. https://transloadit.edgly.net/releases/uppy/v1.0.1/uppy.css
-#  - Uses local package by default, if [version] argument was specified, takes package from npm
-#
-# Run as:
-#
-#  ./upload-to-cdn.sh [version]
-#
-# To upload all versions in one go (DANGER):
-#
-#  git tag |awk -Fv '{print "./bin/upload-to-cdn.sh "$2}' |bash
-#
-# Authors:
-#
-#  - Kevin van Zonneveld <kevin@transloadit.com>
-set -o pipefail
-set -o errexit
-set -o nounset
-# set -o xtrace
-
-# Set magic variables for current FILE & DIR
-__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
-__base="$(basename ${__file} .sh)"
-__root="$(cd "$(dirname "${__dir}")" && pwd)"
-
-versionSuffix=""
-# versionSuffix="-test3"
-
-function fatal () {
-  echo "❌ ${*}";
-  exit 1
-}
-
-pushd "${__root}" > /dev/null 2>&1
-  if [ -n "${TRAVIS:-}" ]; then
-    if [ "${TRAVIS_PULL_REQUEST:-}" != "false" ]; then
-      echo "On Travis (TRAVIS is '${TRAVIS}'), I'm not pushing releases to the CDN for pull requests (TRAVIS_PULL_REQUEST is '${TRAVIS_PULL_REQUEST}')"
-      exit 0
-    fi
-    if [[ ! "$TRAVIS_COMMIT_MESSAGE" =~ ^Release* ]]; then
-      echo "On Travis (TRAVIS is '${TRAVIS}'), I'm not pushing releases to the CDN unless commit message starts with 'Release' (TRAVIS_COMMIT_MESSAGE is '${TRAVIS_COMMIT_MESSAGE}')"
-      exit 0
-    fi
-  fi
-
-
-  if [ -z "${EDGLY_KEY:-}" ] && [ -f ./env.sh ]; then
-    source ./env.sh
-  fi
-  [ -z "${EDGLY_KEY:-}" ] && fatal "Unable to find or source EDGLY_KEY env var"
-
-  type aws || pip install --user awscli
-
-  remoteVersion="${1:-}"
-  version="${remoteVersion}"
-  if [ -z "${remoteVersion}" ]; then
-    localVersion=$(node -pe "require('./packages/uppy/package.json').version")
-    echo "${localVersion}"
-    version="${localVersion}"
-  fi
-
-  majorVersion=$(echo "${version}${versionSuffix}" |awk -F. '{print $1}')
-
-  echo -n "--> Check if not overwriting an existing tag ... "
-  env \
-    AWS_ACCESS_KEY_ID="${EDGLY_KEY}" \
-    AWS_SECRET_ACCESS_KEY="${EDGLY_SECRET}" \
-  aws s3 ls \
-    --region="us-east-1" \
-  "s3://crates.edgly.net/756b8efaed084669b02cb99d4540d81f/default/releases/uppy/v${version}${versionSuffix}/uppy.min.css" > /dev/null 2>&1 && fatal "Tag ${version}${versionSuffix} already exists"
-  echo "✅"
-
-
-  echo "--> Obtain relevant npm files for robodog ${version}${versionSuffix} ... "
-  pushd packages/@uppy/robodog
-    if [ -z "${remoteVersion}" ]; then
-      echo "Warning, writing a local build to the CDN, this is usually not what you want. Sleeping 3s. Press CTRL+C! "
-      sleep 3
-      npm pack
-    else
-      npm pack "@uppy/robodog@${remoteVersion}"
-    fi
-  popd > /dev/null 2>&1
-  echo "✅"
-  rm -rf /tmp/robodog-to-edgly
-  mkdir -p /tmp/robodog-to-edgly
-  cp -af "packages/@uppy/robodog/uppy-robodog-${version}.tgz" /tmp/robodog-to-edgly/
-  tar zxvf "packages/@uppy/robodog/uppy-robodog-${version}.tgz" -C /tmp/robodog-to-edgly/
-
-  echo "--> Upload robodog to edgly.net CDN"
-  pushd /tmp/robodog-to-edgly/package/dist
-    # --delete \
-    env \
-      AWS_ACCESS_KEY_ID="${EDGLY_KEY}" \
-      AWS_SECRET_ACCESS_KEY="${EDGLY_SECRET}" \
-    aws s3 sync \
-      --region="us-east-1" \
-      --exclude 'node_modules/*' \
-    ./ "s3://crates.edgly.net/756b8efaed084669b02cb99d4540d81f/default/releases/uppy/v${version}${versionSuffix}"
-    echo "Saved https://transloadit.edgly.net/releases/uppy/v${version}${versionSuffix}/"
-  popd > /dev/null 2>&1
-  rm -rf /tmp/robodog-to-edgly
-
-  echo "--> Obtain relevant npm files for locales ${version}${versionSuffix} ... "
-  pushd packages/@uppy/locales
-    if [ -z "${remoteVersion}" ]; then
-      npm pack || fatal "Unable to fetch "
-    else
-      npm pack "@uppy/locales@${remoteVersion}"
-    fi
-  popd > /dev/null 2>&1
-  echo "✅"
-  rm -rf /tmp/locales-to-edgly
-  mkdir -p /tmp/locales-to-edgly
-  cp -af "packages/@uppy/locales/uppy-locales-${version}.tgz" /tmp/locales-to-edgly/
-  tar zxvf "packages/@uppy/locales/uppy-locales-${version}.tgz" -C /tmp/locales-to-edgly/
-
-  echo "--> Upload locales to edgly.net CDN"
-  pushd /tmp/locales-to-edgly/package/dist
-    # --delete \
-    env \
-      AWS_ACCESS_KEY_ID="${EDGLY_KEY}" \
-      AWS_SECRET_ACCESS_KEY="${EDGLY_SECRET}" \
-    aws s3 sync \
-      --region="us-east-1" \
-      --exclude 'node_modules/*' \
-    ./ "s3://crates.edgly.net/756b8efaed084669b02cb99d4540d81f/default/releases/uppy/v${version}${versionSuffix}/locales"
-    echo "Saved https://transloadit.edgly.net/releases/uppy/v${version}${versionSuffix}/locales/"
-  popd > /dev/null 2>&1
-  rm -rf /tmp/locales-to-edgly
-
-  echo "--> Obtain relevant npm files for uppy ${version}${versionSuffix} ... "
-  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 "packages/uppy/uppy-${version}.tgz" /tmp/uppy-to-edgly/
-  tar zxvf "packages/uppy/uppy-${version}.tgz" -C /tmp/uppy-to-edgly/
-
-  echo "--> Upload uppy to edgly.net CDN"
-  pushd /tmp/uppy-to-edgly/package/dist
-    # --delete \
-    env \
-      AWS_ACCESS_KEY_ID="${EDGLY_KEY}" \
-      AWS_SECRET_ACCESS_KEY="${EDGLY_SECRET}" \
-    aws s3 sync \
-      --region="us-east-1" \
-      --exclude 'node_modules/*' \
-    ./ "s3://crates.edgly.net/756b8efaed084669b02cb99d4540d81f/default/releases/uppy/v${version}${versionSuffix}"
-    echo "Saved https://transloadit.edgly.net/releases/uppy/v${version}${versionSuffix}/"
-  popd > /dev/null 2>&1
-  rm -rf /tmp/uppy-to-edgly
-
-  if [ "${versionSuffix}" != "" ]; then
-    echo "Not setting latest version because versionSuffix was set, which is used for testing only"
-  else 
-    echo "${version}" | env \
-      AWS_ACCESS_KEY_ID="${EDGLY_KEY}" \
-      AWS_SECRET_ACCESS_KEY="${EDGLY_SECRET}" \
-    aws s3 cp \
-      --region="us-east-1" \
-      --content-type="text/plain" \
-    - "s3://crates.edgly.net/756b8efaed084669b02cb99d4540d81f/default/releases/uppy/latest.txt"
-    echo "Saved https://transloadit.edgly.net/releases/uppy/latest.txt"
-    echo "${version}" | env \
-      AWS_ACCESS_KEY_ID="${EDGLY_KEY}" \
-      AWS_SECRET_ACCESS_KEY="${EDGLY_SECRET}" \
-    aws s3 cp \
-      --region="us-east-1" \
-      --content-type="text/plain" \
-    - "s3://crates.edgly.net/756b8efaed084669b02cb99d4540d81f/default/releases/uppy/v${majorVersion}-latest.txt"
-    echo "Saved https://transloadit.edgly.net/releases/uppy/v${majorVersion}-latest.txt"
-  fi
-popd > /dev/null 2>&1

+ 16 - 29
package-lock.json

@@ -3206,9 +3206,9 @@
       "dev": true
     },
     "@types/express": {
-      "version": "4.16.1",
-      "resolved": "https://registry.npmjs.org/@types/express/-/express-4.16.1.tgz",
-      "integrity": "sha512-V0clmJow23WeyblmACoxbHBu2JKlE5TiIme6Lem14FnPW9gsttyHtk6wq7njcdIWH1njAaFgR8gW09lgY98gQg==",
+      "version": "4.17.0",
+      "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.0.tgz",
+      "integrity": "sha512-CjaMu57cjgjuZbh9DpkloeGxV45CnMGlVd+XpG7Gm9QgVrd7KFq+X4HY0vM+2v0bczS48Wg7bvnMY5TN+Xmcfw==",
       "requires": {
         "@types/body-parser": "*",
         "@types/express-serve-static-core": "*",
@@ -3294,9 +3294,9 @@
       }
     },
     "@types/lodash": {
-      "version": "4.14.132",
-      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.132.tgz",
-      "integrity": "sha512-RNUU1rrh85NgUJcjOOr96YXr+RHwInGbaQCZmlitqOaCKXffj8bh+Zxwuq5rjDy5OgzFldDVoqk4pyLEDiwxIw=="
+      "version": "4.14.133",
+      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.133.tgz",
+      "integrity": "sha512-/3JqnvPnY58GLzG3Y7fpphOhATV1DDZ/Ak3DQufjlRK5E4u+s0CfClfNFtAGBabw+jDGtRFbOZe+Z02ZMWCBNQ=="
     },
     "@types/lodash.merge": {
       "version": "4.6.6",
@@ -12087,19 +12087,6 @@
           "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
           "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
         },
-        "mime-db": {
-          "version": "1.40.0",
-          "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
-          "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
-        },
-        "mime-types": {
-          "version": "2.1.24",
-          "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
-          "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
-          "requires": {
-            "mime-db": "1.40.0"
-          }
-        },
         "proxy-addr": {
           "version": "2.0.5",
           "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
@@ -19401,9 +19388,9 @@
       "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
     },
     "mime-db": {
-      "version": "1.27.0",
-      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz",
-      "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE="
+      "version": "1.40.0",
+      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
+      "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
     },
     "mime-match": {
       "version": "1.0.2",
@@ -19414,11 +19401,11 @@
       }
     },
     "mime-types": {
-      "version": "2.1.15",
-      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz",
-      "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=",
+      "version": "2.1.24",
+      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
+      "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
       "requires": {
-        "mime-db": "~1.27.0"
+        "mime-db": "1.40.0"
       }
     },
     "mimic-fn": {
@@ -23186,9 +23173,9 @@
       "dev": true
     },
     "pstree.remy": {
-      "version": "1.1.6",
-      "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.6.tgz",
-      "integrity": "sha512-NdF35+QsqD7EgNEI5mkI/X+UwaxVEbQaz9f4IooEmMUv6ZPmlTQYGjBPJGgrlzNdjSvIy4MWMg6Q6vCgBO2K+w=="
+      "version": "1.1.7",
+      "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.7.tgz",
+      "integrity": "sha512-xsMgrUwRpuGskEzBFkH8NmTimbZ5PcPup0LA8JJkHIm2IMUbQcpo3yeLNWVrufEYjh8YwtSVh0xz6UeWc5Oh5A=="
     },
     "public-encrypt": {
       "version": "4.0.3",

+ 3 - 1
package.json

@@ -64,6 +64,7 @@
     "nock": "^9.6.1",
     "node-sass": "^4.11.0",
     "npm-auth-to-token": "^1.0.0",
+    "npm-packlist": "^1.4.1",
     "npm-run-all": "^4.1.5",
     "onchange": "^4.1.0",
     "postcss": "^7.0.16",
@@ -75,6 +76,7 @@
     "redux": "^4.0.1",
     "replace-x": "^1.5.0",
     "stringify-object": "^3.3.0",
+    "tar": "^4.4.8",
     "temp-write": "^3.4.0",
     "tinyify": "^2.5.0",
     "touch": "^3.1.0",
@@ -122,7 +124,7 @@
     "test:unit": "npm run build:lib && jest",
     "test:watch": "jest --watch",
     "test": "npm-run-all lint test:locale-packs test:unit test:type test:companion",
-    "uploadcdn": "bin/upload-to-cdn.sh",
+    "uploadcdn": "node ./bin/upload-to-cdn.js",
     "version": "node ./bin/after-version-bump.js",
     "watch:css": "onchange 'packages/**/*.scss' --initial --verbose -- npm run build:css",
     "watch:js:bundle": "onchange 'packages/{@uppy/,}*/src/**/*.js' --initial --verbose -- npm run build:bundle",

+ 1 - 3
website/inject.js

@@ -186,8 +186,6 @@ function injectLocaleList () {
 
   const localePackagePath = path.join(localesRoot, 'src', '*.js')
   let localePackageVersion = require(path.join(localesRoot, 'package.json')).version
-  // @TODO: remove next line when upload-to-cdn is updated
-  localePackageVersion = '1.0.0'
 
   glob.sync(localePackagePath).forEach((localePath) => {
     const localeName = path.basename(localePath, '.js')
@@ -205,7 +203,7 @@ function injectLocaleList () {
     const languageName = LocaleCode.getLanguageName(localeNameWithDash)
     const countryName = LocaleCode.getCountryName(localeNameWithDash)
     const npmPath = `<code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/${localeName}</code>`
-    const cdnPath = `[\`${localeName}.min.js\`](https://transloadit.edgly.net/releases/uppy/v${localePackageVersion}/locales/${localeName}.min.js)`
+    const cdnPath = `[\`${localeName}.min.js\`](https://transloadit.edgly.net/releases/uppy/locales/v${localePackageVersion}/${localeName}.min.js)`
     const githubSource = `[\`${localeName}.js\`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/${localeName}.js)`
     const mdTableRow = `| ${languageName}<br/> <small>${countryName}</small>${variant ? `<br /><small>(${variant})</small>` : ''} | ${npmPath} | ${cdnPath} | ✏️ ${githubSource} |`
     mdRows.push(mdTableRow)

+ 15 - 14
website/src/_template/list_of_locale_packs.md

@@ -1,18 +1,19 @@
 <!-- WARNING! This file was automatically injected. Please run "inject.js" to re-generate -->
 
 
-| 13 Locales | NPM                | CDN                 | Source on GitHub |
+| 14 Locales | NPM                | CDN                 | Source on GitHub |
 | --------------- | ------------------ | ------------------- | ---------------- |
-| Chinese<br/> <small>China</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/zh_CN</code> | [`zh_CN.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/zh_CN.min.js) | ✏️ [`zh_CN.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/zh_CN.js) |
-| Chinese<br/> <small>Taiwan, Province of China</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/zh_TW</code> | [`zh_TW.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/zh_TW.min.js) | ✏️ [`zh_TW.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/zh_TW.js) |
-| Dutch<br/> <small>Netherlands</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/nl_NL</code> | [`nl_NL.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/nl_NL.min.js) | ✏️ [`nl_NL.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/nl_NL.js) |
-| English<br/> <small>United States</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/en_US</code> | [`en_US.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/en_US.min.js) | ✏️ [`en_US.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/en_US.js) |
-| French<br/> <small>France</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/fr_FR</code> | [`fr_FR.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/fr_FR.min.js) | ✏️ [`fr_FR.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/fr_FR.js) |
-| German<br/> <small>Germany</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/de_DE</code> | [`de_DE.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/de_DE.min.js) | ✏️ [`de_DE.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/de_DE.js) |
-| Hungarian<br/> <small>Hungary</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/hu_HU</code> | [`hu_HU.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/hu_HU.min.js) | ✏️ [`hu_HU.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/hu_HU.js) |
-| Italian<br/> <small>Italy</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/it_IT</code> | [`it_IT.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/it_IT.min.js) | ✏️ [`it_IT.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/it_IT.js) |
-| Persian<br/> <small>Iran, Islamic Republic of</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/fa_IR</code> | [`fa_IR.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/fa_IR.min.js) | ✏️ [`fa_IR.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/fa_IR.js) |
-| Russian<br/> <small>Russian Federation</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/ru_RU</code> | [`ru_RU.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/ru_RU.min.js) | ✏️ [`ru_RU.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/ru_RU.js) |
-| Serbian<br/> <small>Serbia</small><br /><small>(Latin)</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/sr_RS_Latin</code> | [`sr_RS_Latin.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/sr_RS_Latin.min.js) | ✏️ [`sr_RS_Latin.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/sr_RS_Latin.js) |
-| Spanish<br/> <small>Greenland</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/es_GL</code> | [`es_GL.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/es_GL.min.js) | ✏️ [`es_GL.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/es_GL.js) |
-| Spanish<br/> <small>Spain</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/es_ES</code> | [`es_ES.min.js`](https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/es_ES.min.js) | ✏️ [`es_ES.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/es_ES.js) |
+| Chinese<br/> <small>China</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/zh_CN</code> | [`zh_CN.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/zh_CN.min.js) | ✏️ [`zh_CN.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/zh_CN.js) |
+| Chinese<br/> <small>Taiwan, Province of China</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/zh_TW</code> | [`zh_TW.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/zh_TW.min.js) | ✏️ [`zh_TW.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/zh_TW.js) |
+| Dutch<br/> <small>Netherlands</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/nl_NL</code> | [`nl_NL.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/nl_NL.min.js) | ✏️ [`nl_NL.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/nl_NL.js) |
+| English<br/> <small>United States</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/en_US</code> | [`en_US.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/en_US.min.js) | ✏️ [`en_US.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/en_US.js) |
+| French<br/> <small>France</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/fr_FR</code> | [`fr_FR.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/fr_FR.min.js) | ✏️ [`fr_FR.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/fr_FR.js) |
+| German<br/> <small>Germany</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/de_DE</code> | [`de_DE.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/de_DE.min.js) | ✏️ [`de_DE.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/de_DE.js) |
+| Hungarian<br/> <small>Hungary</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/hu_HU</code> | [`hu_HU.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/hu_HU.min.js) | ✏️ [`hu_HU.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/hu_HU.js) |
+| Italian<br/> <small>Italy</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/it_IT</code> | [`it_IT.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/it_IT.min.js) | ✏️ [`it_IT.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/it_IT.js) |
+| Persian<br/> <small>Iran, Islamic Republic of</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/fa_IR</code> | [`fa_IR.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/fa_IR.min.js) | ✏️ [`fa_IR.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/fa_IR.js) |
+| Portuguese<br/> <small>Brazil</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/pt_BR</code> | [`pt_BR.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/pt_BR.min.js) | ✏️ [`pt_BR.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/pt_BR.js) |
+| Russian<br/> <small>Russian Federation</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/ru_RU</code> | [`ru_RU.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/ru_RU.min.js) | ✏️ [`ru_RU.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/ru_RU.js) |
+| Serbian<br/> <small>Serbia</small><br /><small>(Latin)</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/sr_RS_Latin</code> | [`sr_RS_Latin.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/sr_RS_Latin.min.js) | ✏️ [`sr_RS_Latin.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/sr_RS_Latin.js) |
+| Spanish<br/> <small>Greenland</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/es_GL</code> | [`es_GL.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/es_GL.min.js) | ✏️ [`es_GL.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/es_GL.js) |
+| Spanish<br/> <small>Spain</small> | <code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/es_ES</code> | [`es_ES.min.js`](https://transloadit.edgly.net/releases/uppy/locales/v1.2.0/es_ES.min.js) | ✏️ [`es_ES.js`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/es_ES.js) |

+ 1 - 1
website/src/docs/locales.md

@@ -34,7 +34,7 @@ Add a `<script>` tag with Uppy bundle and the locale pack you’d like to use. Y
 
 ```html
 <script src="https://transloadit.edgly.net/releases/uppy/v1.0.0/uppy.min.js"></script>
-<script src="https://transloadit.edgly.net/releases/uppy/v1.0.0/locales/de_DE.min.js"></script>
+<script src="https://transloadit.edgly.net/releases/uppy/locales/v1.0.0/de_DE.min.js"></script>
 
 <script>
 var uppy = Uppy.Core({

+ 4 - 4
website/src/docs/robodog-form.md

@@ -104,7 +104,7 @@ $(selector).transloadit({
 ```
 ```html
 <!-- The new Robodog way! -->
-<script src="//transloadit.edgly.net/releases/uppy/v1.0.0/robodog.min.js"></script>
+<script src="//transloadit.edgly.net/releases/uppy/robodog/v1.0.0/robodog.min.js"></script>
 
 <script>
 window.Robodog.form(selector, {
@@ -116,7 +116,7 @@ window.Robodog.form(selector, {
 Make sure to also include the Uppy css file in your `<head>` tag in case you want to use the `modal: true` option:
 ```html
 <head>
-  <link rel="stylesheet" href="https://transloadit.edgly.net/releases/uppy/v1.0.0/robodog.min.css">
+  <link rel="stylesheet" href="https://transloadit.edgly.net/releases/uppy/robodog/v1.0.0/robodog.min.css">
 </head>
 ```
 
@@ -128,7 +128,7 @@ Notice how the form is submitted to the inexistant `/uploads` route once all tra
 <html>
   <head>
     <title>Testing Robodog</title>
-    <link rel="stylesheet" href="https://transloadit.edgly.net/releases/uppy/v1.0.0/robodog.min.css">
+    <link rel="stylesheet" href="https://transloadit.edgly.net/releases/uppy/robodog/v1.0.0/robodog.min.css">
   </head>
   <body>
     <form id="upload-form" action="/uploads" enctype="multipart/form-data" method="POST">
@@ -138,7 +138,7 @@ Notice how the form is submitted to the inexistant `/uploads` route once all tra
       <button type="submit">Upload</button>
     </form>
 
-    <script src="https://transloadit.edgly.net/releases/uppy/v1.0.0/robodog.min.js"></script>
+    <script src="https://transloadit.edgly.net/releases/uppy/robodog/v1.0.0/robodog.min.js"></script>
     <script type="text/javascript">
     window.Robodog.form('#upload-form', {
       waitForEncoding: true,

+ 2 - 2
website/src/docs/robodog.md

@@ -29,8 +29,8 @@ const robodog = require('@uppy/robodog')
 If you are not using a bundler, you can also import Robodog using an HTML script tag.
 
 ```html
-<link rel="stylesheet" href="https://transloadit.edgly.net/releases/uppy/v1.0.0/robodog.min.css">
-<script src="https://transloadit.edgly.net/releases/uppy/v1.0.0/robodog.min.js"></script>
+<link rel="stylesheet" href="https://transloadit.edgly.net/releases/uppy/robodog/v1.0.0/robodog.min.css">
+<script src="https://transloadit.edgly.net/releases/uppy/robodog/v1.0.0/robodog.min.js"></script>
 <!-- you can now use: window.Robodog.pick() -->
 ```