Browse Source

Run build after version bump

Renée Kooi 6 years ago
parent
commit
bc6da2a637
4 changed files with 442 additions and 535 deletions
  1. 3 2
      babel.config.js
  2. 26 6
      bin/after-version-bump.js
  3. 412 527
      package-lock.json
  4. 1 0
      package.json

+ 3 - 2
babel.config.js

@@ -15,7 +15,8 @@ module.exports = (api) => {
     plugins: [
       '@babel/plugin-proposal-object-rest-spread',
       '@babel/plugin-transform-object-assign',
-      ['@babel/plugin-transform-react-jsx', { pragma: 'h' }]
-    ]
+      ['@babel/plugin-transform-react-jsx', { pragma: 'h' }],
+      process.env.IS_RELEASE_BUILD && 'babel-plugin-inline-package-json'
+    ].filter(Boolean)
   }
 }

+ 26 - 6
bin/after-version-bump.js

@@ -44,6 +44,28 @@ async function updateVersions (files, packageName) {
   }
 }
 
+async function gitAdd (files) {
+  const git = spawn('git', ['add', ...files], { stdio: 'inherit' })
+  const exitCode = await once(git, 'exit')
+  if (exitCode !== 0) {
+    throw new Error(`git add failed with ${exitCode}`)
+  }
+}
+
+async function npmRunBuild () {
+  const npmRun = spawn('npm', ['run', 'build'], {
+    stdio: 'inherit',
+    env: {
+      ...process.env,
+      IS_RELEASE_BUILD: true
+    }
+  })
+  const exitCode = await once(npmRun, 'exit')
+  if (exitCode !== 0) {
+    throw new Error(`npm run build failed with ${exitCode}`)
+  }
+}
+
 async function main () {
   if (process.env.ENDTOEND === '1') {
     console.log('Publishing for e2e tests, skipping version number sync.')
@@ -64,18 +86,16 @@ async function main () {
     'website/src/docs/**',
     'website/src/examples/**',
     'website/themes/uppy/layout/**',
-    '!node_modules'
+    '!**/node_modules/**'
   ])
 
   await updateVersions(files, 'uppy')
   await updateVersions(files, '@uppy/robodog')
   await updateVersions(files, '@uppy/locales')
 
-  const gitAdd = spawn('git', ['add', ...files], { stdio: 'inherit' })
-  const exitCode = await once(gitAdd, 'exit')
-  if (exitCode !== 0) {
-    throw new Error(`git add failed with ${exitCode}`)
-  }
+  await gitAdd(files)
+
+  await npmRunBuild()
 }
 
 main().catch(function (err) {

File diff suppressed because it is too large
+ 412 - 527
package-lock.json


+ 1 - 0
package.json

@@ -23,6 +23,7 @@
     "aliasify": "^2.1.0",
     "autoprefixer": "^9.5.1",
     "babel-jest": "^24.8.0",
+    "babel-plugin-inline-package-json": "^2.0.0",
     "babelify": "^10.0.0",
     "browser-resolve": "^1.11.3",
     "browser-sync": "^2.26.5",

Some files were not shown because too many files changed in this diff