Added the option to only bundle js in yarn deploy

This commit is contained in:
Aria Minaei 2021-08-07 23:30:07 +02:00
parent f4f33dcd8d
commit 54480555a1
3 changed files with 12 additions and 7 deletions

View file

@ -95,13 +95,17 @@ const packagesWhoseVersionsShouldBump = [
console.log('Skipping typecheck and lint') console.log('Skipping typecheck and lint')
} }
const skipTypescriptEmit = argv['skip-ts'] === true
console.log('Assigning versions') console.log('Assigning versions')
await assignVersions(version) await assignVersions(version)
console.log('Building all packages') console.log('Building all packages')
await Promise.all( await Promise.all(
packagesToBuild.map( packagesToBuild.map((workspace) =>
(workspace) => $`yarn workspace ${workspace} run build`, skipTypescriptEmit
? $`yarn workspace ${workspace} run build:js`
: $`yarn workspace ${workspace} run build`,
), ),
) )

View file

@ -1,7 +1,7 @@
import * as path from 'path' import * as path from 'path'
import {build} from 'esbuild' import {build} from 'esbuild'
import type {Plugin} from 'esbuild' import type {Plugin} from 'esbuild'
import {mkdirSync, writeFileSync} from 'fs' import {existsSync, mkdirSync, writeFileSync} from 'fs'
const externalPlugin = (patterns: RegExp[]): Plugin => { const externalPlugin = (patterns: RegExp[]): Plugin => {
return { return {
@ -55,6 +55,7 @@ function createBundles(watch: boolean) {
format: 'cjs', format: 'cjs',
}) })
if (!existsSync(path.join(pathToPackage, 'dist')))
mkdirSync(path.join(pathToPackage, 'dist')) mkdirSync(path.join(pathToPackage, 'dist'))
writeFileSync( writeFileSync(

View file

@ -11,9 +11,9 @@
"typecheck": "tsc --build", "typecheck": "tsc --build",
"build:js": "node -r esbuild-register devEnv/bundle.ts", "build:js": "node -r esbuild-register devEnv/bundle.ts",
"build:js:watch": "node -r esbuild-register devEnv/watch.ts", "build:js:watch": "node -r esbuild-register devEnv/watch.ts",
"build:dts": "run-s typecheck build:dts:bundle", "build:ts": "run-s typecheck build:ts:bundle",
"build:dts:bundle": "rollup -c devEnv/declarations-bundler/rollup.config.js", "build:ts:bundle": "rollup -c devEnv/declarations-bundler/rollup.config.js",
"build": "run-p build:dts build:js" "build": "run-p build:ts build:js"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.14.3", "@babel/cli": "^7.14.3",