diff --git a/config/tsup.config.ts b/config/tsup.config.ts index 33d494ee05..78dea7369f 100644 --- a/config/tsup.config.ts +++ b/config/tsup.config.ts @@ -8,16 +8,30 @@ const INPUT_FILE = fs.existsSync(INPUT_FILE_PATH) ? INPUT_FILE_PATH : path.join(PACKAGE_ROOT_PATH, 'src/index.tsx'); -export default defineConfig({ - entry: [INPUT_FILE], - sourcemap: true, - format: ['cjs', 'esm'], - minify: false, - dts: true, - skipNodeModulesBundle: true, - outExtension: ({ format }) => { - return { - js: format === 'cjs' ? '.js' : '.es.js', - }; - }, +export default defineConfig((opts) => { + return { + ...opts, + entry: [INPUT_FILE], + sourcemap: true, + format: ['cjs', 'esm'], + minify: false, + dts: true, + skipNodeModulesBundle: true, + outExtension: ({ format }) => { + return { + js: format === 'cjs' ? '.js' : '.es.js', + }; + }, + onSuccess: async () => { + if (opts.watch) { + console.log('Watching for changes...'); + + return; + } + + console.log('Build succeeded!'); + }, + + silent: true, + }; }); diff --git a/package.json b/package.json index 47c4f7d17a..3eb1f979c4 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "g:brl": "turbo --filter \"./packages/**\" brl", "g:build": "turbo --filter \"./packages/**\" build", "g:build:registry": "yarn workspace www build:registry", - "g:build:watch": "turbo --filter \"./packages/**\" build:watch --concurrency 100", + "g:build:watch": "turbo --filter \"./packages/**\" build:watch --parallel", "g:changeset": "changeset", "g:clean": "turbo --filter \"./packages/**\" clean", "gen:package": "yarn plop --plopfile scripts/plop/plopfile.cjs package", @@ -52,12 +52,12 @@ "nuke:node_modules": "rimraf '**/node_modules'", "p:brl": "cd $INIT_CWD && barrelsby -d $INIT_CWD/src -D -l all -q -e '.*(fixture|template|spec|__tests__).*'", "p:brl:below": "cd $INIT_CWD && barrelsby -d $INIT_CWD/src -D -l below -q -e '.*(fixture|template|spec|__tests__).*'", - "p:build": "cd $INIT_CWD && yarn p:rollup && tsc", - "p:build:watch": "cd $INIT_CWD && concurrently \"yarn p:rollup --watch\" \"yarn p:typecheck -w\"", + "p:build": "cd $INIT_CWD && yarn p:tsup", + "p:build:watch": "cd $INIT_CWD && yarn p:tsup --watch", "p:clean": "cd $INIT_CWD && rimraf dist && jest --clear-cache", "p:lint": "eslint $INIT_CWD/src --color", "p:lint:fix": "eslint $INIT_CWD/src --color --fix", - "p:rollup": "cd $INIT_CWD && tsup --config=${PROJECT_CWD}/config/tsup.config.ts", + "p:tsup": "cd $INIT_CWD && tsup --config=${PROJECT_CWD}/config/tsup.config.ts", "p:test": "cd $INIT_CWD && jest --config=${PROJECT_CWD}/jest.config.cjs --maxWorkers=1 --passWithNoTests $INIT_CWD ", "p:typecheck": "cd $INIT_CWD && tsc --noEmit --emitDeclarationOnly false", "postinstall": "patch-package", diff --git a/scripts/plop/templates/package/package.json.hbs b/scripts/plop/templates/package/package.json.hbs index be6c8f4ea5..7ce0fcc2dd 100644 --- a/scripts/plop/templates/package/package.json.hbs +++ b/scripts/plop/templates/package/package.json.hbs @@ -30,7 +30,7 @@ "typecheck": "yarn p:typecheck" }, "scripts": { - "build": "tsc && yarn p:rollup" + "build": "yarn p:tsup" }, "dependencies": { "@udecode/plate-common": "{{coreVersion}}"