From 92c0e70b1935113fd92f1193e3c816f64236fbd1 Mon Sep 17 00:00:00 2001 From: ealush Date: Sat, 25 Jun 2022 15:31:44 +0300 Subject: [PATCH] vx: build single --- .github/workflows/integration.yml | 2 ++ vx/cli.js | 19 ++++++------------- vx/commands/release.js | 6 ------ vx/scripts/build/buildPackage.js | 4 ++-- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 0818e1b97..07c4733a2 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -32,6 +32,8 @@ jobs: run: yarn test - name: Lint run: yarn lint + - name: Build Types + run: yarn build --buildSingle - name: Set npmrc run: echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > ~/.npmrc env: diff --git a/vx/cli.js b/vx/cli.js index 267645efe..c3bdab5ba 100755 --- a/vx/cli.js +++ b/vx/cli.js @@ -34,11 +34,6 @@ genTsConfig(); const argv = hideBin(process.argv); -const namedOptions = Object.entries({ - '--package': 2, - '-p': 2, -}); - const defaultPackage = usePackage() ?? insidePackageDir(); const cli = yargs(argv) @@ -56,20 +51,18 @@ const cli = yargs(argv) describe: 'Package to run against', ...(!!defaultPackage && { default: defaultPackage }), }) + .option('buildSingle', { + demandOption: false, + describe: 'build format', + }) .help().argv; -const { package, command } = cli; +const { package, command, buildSingle } = cli; if (!commands[command]) { throw new Error(`Command ${command} not found.`); } -const options = argv.slice( - namedOptions.reduce((count, [option, increment]) => { - return argv.includes(option) ? count + increment : count; - }, 1) -); - logger.info( joinTruthy([ `Running command ${command}`, @@ -79,7 +72,7 @@ logger.info( ctx.withPackage(package, () => commands[command]({ - options, + buildSingle, }) ); diff --git a/vx/commands/release.js b/vx/commands/release.js index 50ea1cf61..4b8c2cdef 100644 --- a/vx/commands/release.js +++ b/vx/commands/release.js @@ -1,6 +1,5 @@ const commitChangesToGit = require('../scripts/release/steps/commitChangesToGit'); -const build = require('vx/commands/build'); const logger = require('vx/logger'); const packagesToRelease = require('vx/scripts/release/packagesToRelease'); const releasePackage = require('vx/scripts/release/releasePackage'); @@ -20,11 +19,6 @@ function release() { return; } - // Start by running a build, we don't really want to build here - // but the types are required for the release script. - // FIXME: We should come back and fix this. - build({ SINGLE: true }); - const pkg = usePackage() || targetPackage; if (pkg) { return ctx.withPackage(pkg, releasePackage); diff --git a/vx/scripts/build/buildPackage.js b/vx/scripts/build/buildPackage.js index a9fad780b..8a426e9a7 100644 --- a/vx/scripts/build/buildPackage.js +++ b/vx/scripts/build/buildPackage.js @@ -12,11 +12,11 @@ function buildPackage(options = {}) { cleanupDistFiles(name); process.env.VX_PACKAGE_NAME = name; - process.env.VX_BUILD_SINGLE = !!options.SINGLE; + process.env.VX_BUILD_SINGLE = !!options.buildSingle; let builds; - if (options.SINGLE) { + if (options.buildSingle) { builds = [opts.format.CJS]; } else { builds = [opts.format.ES, opts.format.UMD, opts.format.CJS];