Skip to content

Commit

Permalink
rename package json rollup script to watch
Browse files Browse the repository at this point in the history
fix global watch cli
  • Loading branch information
shahriar-shojib committed Sep 29, 2023
1 parent fbca0f6 commit d60d400
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
38 changes: 26 additions & 12 deletions config/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
});
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/plop/templates/package/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"typecheck": "yarn p:typecheck"
},
"scripts": {
"build": "tsc && yarn p:rollup"
"build": "yarn p:tsup"
},
"dependencies": {
"@udecode/plate-common": "{{coreVersion}}"
Expand Down

0 comments on commit d60d400

Please sign in to comment.