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')
}
const skipTypescriptEmit = argv['skip-ts'] === true
console.log('Assigning versions')
await assignVersions(version)
console.log('Building all packages')
await Promise.all(
packagesToBuild.map(
(workspace) => $`yarn workspace ${workspace} run build`,
packagesToBuild.map((workspace) =>
skipTypescriptEmit
? $`yarn workspace ${workspace} run build:js`
: $`yarn workspace ${workspace} run build`,
),
)

View file

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

View file

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