From c473b3ed923bfbd41b800114a89e106c4edc7f7c Mon Sep 17 00:00:00 2001 From: Manu MA Date: Wed, 7 Aug 2019 20:00:15 +0200 Subject: [PATCH] chore(): add production build check (#19031) --- .scripts/release.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.scripts/release.js b/.scripts/release.js index 966aa7ad59..97c69b66fa 100644 --- a/.scripts/release.js +++ b/.scripts/release.js @@ -5,6 +5,7 @@ const tc = require('turbocolor'); const execa = require('execa'); const Listr = require('listr'); +const path = require('path'); const octokit = require('@octokit/rest')() const common = require('./common'); const fs = require('fs-extra'); @@ -16,6 +17,8 @@ async function main() { throw new Error('env.GH_TOKEN is undefined'); } + checkProductionRelease(); + const tasks = []; const { version } = common.readPkg('core'); const changelog = findChangelog(); @@ -39,6 +42,15 @@ async function main() { } } +function checkProductionRelease() { + const corePath = common.projectPath('core'); + const hasEsm = fs.existsSync(path.join(corePath, 'dist', 'esm')); + const hasEsmEs5 = fs.existsSync(path.join(corePath, 'dist', 'esm-es5')); + const hasCjs = fs.existsSync(path.join(corePath, 'dist', 'cjs')); + if (!hasEsm || !hasEsmEs5 || !hasCjs) { + throw new Error('core build is not a production build'); + } +} function publishGit(tasks, version, changelog) { const tag = `v${version}`;