chore(): add production build check (#19031)

This commit is contained in:
Manu MA 2019-08-07 20:00:15 +02:00 committed by Mike Hartington
parent 6d7b221b86
commit c473b3ed92
1 changed files with 12 additions and 0 deletions

View File

@ -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}`;