Skip to content

Commit

Permalink
feat: add --check flag to build to auto run check after build
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Apr 10, 2024
1 parent 161e3b5 commit 35a6d42
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion playground/babel-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion playground/browser-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"main": "./dist/index.cjs",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/custom-dist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"module": "./lib/index.esm.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf lib"
}
}
2 changes: 1 addition & 1 deletion playground/default-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"main": "./dist/index.cjs",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/dummy-commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"src"
],
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/dummy-lodash-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"src"
],
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist",
"test": "node test.cjs && node test.mjs"
},
Expand Down
2 changes: 1 addition & 1 deletion playground/dummy-lodash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"src"
],
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist",
"test": "node test.cjs && node test.mjs"
},
Expand Down
2 changes: 1 addition & 1 deletion playground/dummy-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"src"
],
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/extra-bundles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"main": "./dist/index.js",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"main": "./dist/index.js",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/multi-exports-commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
},
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist plugin.js"
}
}
2 changes: 1 addition & 1 deletion playground/reference-esm-only/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"src"
],
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion playground/styled-components-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"src"
],
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist",
"test": "node test.mjs"
},
Expand Down
2 changes: 1 addition & 1 deletion playground/ts-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/ts-node16/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
}
}
2 changes: 1 addition & 1 deletion playground/ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"check:types": "tsc",
"clean": "rimraf dist"
}
Expand Down
2 changes: 1 addition & 1 deletion playground/use-client-directive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "run-s clean && pkg build --strict && pkg check --strict",
"build": "run-s clean && pkg build --strict --check",
"clean": "rimraf dist"
},
"devDependencies": {
Expand Down
13 changes: 12 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ cli
.option('--emitDeclarationOnly', 'Emit d.ts only')
.option('--strict', 'Strict mode')
.option('--tsconfig [tsconfig]', '[string] tsconfig.json')
.option('--check', 'Run the check command after build (same as running `pkg build && pkg check`)')
.action(async (options) => {
const {check = false, ...buildOptions} = options
const {buildAction} = await import('./buildAction')

return buildAction(options)
await buildAction(buildOptions)

if (check) {
const {checkAction} = await import('./checkAction')

await checkAction({
strict: options.strict,
tsconfig: options.tsconfig,
})
}
})

cli.command('init [path]', 'Initialize package').action(async (p) => {
Expand Down

0 comments on commit 35a6d42

Please sign in to comment.