From 54480555a1b0df54b15c5134a0911c19b7ab3b1b Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Sat, 7 Aug 2021 23:30:07 +0200 Subject: [PATCH] Added the option to only bundle js in yarn deploy --- devEnv/deploy.mjs | 8 ++++++-- packages/plugin-r3f/devEnv/build.ts | 5 +++-- theatre/package.json | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/devEnv/deploy.mjs b/devEnv/deploy.mjs index d764bec..f9c73a8 100644 --- a/devEnv/deploy.mjs +++ b/devEnv/deploy.mjs @@ -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`, ), ) diff --git a/packages/plugin-r3f/devEnv/build.ts b/packages/plugin-r3f/devEnv/build.ts index ac8aa36..540ad9b 100644 --- a/packages/plugin-r3f/devEnv/build.ts +++ b/packages/plugin-r3f/devEnv/build.ts @@ -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'), diff --git a/theatre/package.json b/theatre/package.json index 001ed2d..4e9b726 100644 --- a/theatre/package.json +++ b/theatre/package.json @@ -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",