@sanity/pkg-utils 6.2.1 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +12 -4
- package/dist/cli.cjs.map +1 -1
- package/package.json +2 -2
- package/src/cli/index.ts +12 -1
package/dist/cli.cjs
CHANGED
|
@@ -3,7 +3,7 @@ var cac = require("cac");
|
|
|
3
3
|
function _interopDefaultCompat(e) {
|
|
4
4
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
5
5
|
}
|
|
6
|
-
var cac__default = /* @__PURE__ */ _interopDefaultCompat(cac), version = "6.
|
|
6
|
+
var cac__default = /* @__PURE__ */ _interopDefaultCompat(cac), version = "6.3.0";
|
|
7
7
|
const cli = cac__default.default();
|
|
8
8
|
cli.command("", "Check").alias("check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async (options) => {
|
|
9
9
|
const { checkAction } = await Promise.resolve().then(function() {
|
|
@@ -11,11 +11,19 @@ cli.command("", "Check").alias("check").option("--strict", "Strict mode").option
|
|
|
11
11
|
});
|
|
12
12
|
return checkAction(options);
|
|
13
13
|
});
|
|
14
|
-
cli.command("build", "Build package").option("--emitDeclarationOnly", "Emit d.ts only").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async (options) => {
|
|
15
|
-
const { buildAction } = await Promise.resolve().then(function() {
|
|
14
|
+
cli.command("build", "Build package").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) => {
|
|
15
|
+
const { check = !1, ...buildOptions } = options, { buildAction } = await Promise.resolve().then(function() {
|
|
16
16
|
return require("./_chunks-cjs/buildAction.cjs");
|
|
17
17
|
});
|
|
18
|
-
|
|
18
|
+
if (await buildAction(buildOptions), check) {
|
|
19
|
+
const { checkAction } = await Promise.resolve().then(function() {
|
|
20
|
+
return require("./_chunks-cjs/checkAction.cjs");
|
|
21
|
+
});
|
|
22
|
+
await checkAction({
|
|
23
|
+
strict: options.strict,
|
|
24
|
+
tsconfig: options.tsconfig
|
|
25
|
+
});
|
|
26
|
+
}
|
|
19
27
|
});
|
|
20
28
|
cli.command("init [path]", "Initialize package").action(async (p) => {
|
|
21
29
|
const { initAction } = await Promise.resolve().then(function() {
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","sources":["../src/cli/index.ts"],"sourcesContent":["import cac from 'cac'\n\nimport {version} from '../../package.json'\n\nconst cli = cac()\n\ncli\n .command('', 'Check')\n .alias('check') // alias to align with the action name\n .option('--strict', 'Strict mode')\n .option('--tsconfig [tsconfig]', '[string] tsconfig.json')\n .action(async (options) => {\n const {checkAction} = await import('./checkAction')\n\n return checkAction(options)\n })\n\ncli\n .command('build', 'Build package')\n .option('--emitDeclarationOnly', 'Emit d.ts only')\n .option('--strict', 'Strict mode')\n .option('--tsconfig [tsconfig]', '[string] tsconfig.json')\n .action(async (options) => {\n const {buildAction} = await import('./buildAction')\n\n
|
|
1
|
+
{"version":3,"file":"cli.cjs","sources":["../src/cli/index.ts"],"sourcesContent":["import cac from 'cac'\n\nimport {version} from '../../package.json'\n\nconst cli = cac()\n\ncli\n .command('', 'Check')\n .alias('check') // alias to align with the action name\n .option('--strict', 'Strict mode')\n .option('--tsconfig [tsconfig]', '[string] tsconfig.json')\n .action(async (options) => {\n const {checkAction} = await import('./checkAction')\n\n return checkAction(options)\n })\n\ncli\n .command('build', 'Build package')\n .option('--emitDeclarationOnly', 'Emit d.ts only')\n .option('--strict', 'Strict mode')\n .option('--tsconfig [tsconfig]', '[string] tsconfig.json')\n .option('--check', 'Run the check command after build (same as running `pkg build && pkg check`)')\n .action(async (options) => {\n const {check = false, ...buildOptions} = options\n const {buildAction} = await import('./buildAction')\n\n await buildAction(buildOptions)\n\n if (check) {\n const {checkAction} = await import('./checkAction')\n\n await checkAction({\n strict: options.strict,\n tsconfig: options.tsconfig,\n })\n }\n })\n\ncli.command('init [path]', 'Initialize package').action(async (p) => {\n const {initAction} = await import('./initAction')\n\n return initAction({\n path: p,\n })\n})\n\ncli\n .command('watch', 'Watch package')\n .option('--strict', 'Strict mode')\n .option('--tsconfig [tsconfig]', '[string] tsconfig.json')\n .action(async (options) => {\n const {watchAction} = await import('./watchAction')\n\n return watchAction(options)\n })\n\n// Display help message when `-h` or `--help` appears\ncli.help()\n\n// Display version number when `-v` or `--version` appears\n// It's also used in help message\ncli.version(version)\n\ncli.parse()\n"],"names":["cac"],"mappings":";;;;;;AAIA,MAAM,MAAMA,aAAI,QAAA;AAEhB,IACG,QAAQ,IAAI,OAAO,EACnB,MAAM,OAAO,EACb,OAAO,YAAY,aAAa,EAChC,OAAO,yBAAyB,wBAAwB,EACxD,OAAO,OAAO,YAAY;AACzB,QAAM,EAAC,YAAA,IAAe,MAAM,QAAA,QAAA,EAAA,KAAA,WAAA;AAAA,WAAA,QAAO,+BAAe;AAAA,EAAA,CAAA;AAElD,SAAO,YAAY,OAAO;AAC5B,CAAC;AAEH,IACG,QAAQ,SAAS,eAAe,EAChC,OAAO,yBAAyB,gBAAgB,EAChD,OAAO,YAAY,aAAa,EAChC,OAAO,yBAAyB,wBAAwB,EACxD,OAAO,WAAW,8EAA8E,EAChG,OAAO,OAAO,YAAY;AACzB,QAAM,EAAC,QAAQ,IAAO,GAAG,aAAY,IAAI,SACnC,EAAC,YAAW,IAAI,MAAM,QAAA,QAAA,EAAA,KAAA,WAAA;AAAA,WAAA,QAAO,+BAAe;AAAA,EAAA,CAAA;AAIlD,MAFA,MAAM,YAAY,YAAY,GAE1B,OAAO;AACT,UAAM,EAAC,YAAA,IAAe,MAAM,QAAA,QAAA,EAAA,KAAA,WAAA;AAAA,aAAA,QAAO,+BAAe;AAAA,IAAA,CAAA;AAElD,UAAM,YAAY;AAAA,MAChB,QAAQ,QAAQ;AAAA,MAChB,UAAU,QAAQ;AAAA,IAAA,CACnB;AAAA,EACH;AACF,CAAC;AAEH,IAAI,QAAQ,eAAe,oBAAoB,EAAE,OAAO,OAAO,MAAM;AACnE,QAAM,EAAC,WAAA,IAAc,MAAM,QAAA,QAAA,EAAA,KAAA,WAAA;AAAA,WAAA,QAAO,8BAAc;AAAA,EAAA,CAAA;AAEhD,SAAO,WAAW;AAAA,IAChB,MAAM;AAAA,EAAA,CACP;AACH,CAAC;AAED,IACG,QAAQ,SAAS,eAAe,EAChC,OAAO,YAAY,aAAa,EAChC,OAAO,yBAAyB,wBAAwB,EACxD,OAAO,OAAO,YAAY;AACzB,QAAM,EAAC,YAAA,IAAe,MAAM,QAAA,QAAA,EAAA,KAAA,WAAA;AAAA,WAAA,QAAO,+BAAe;AAAA,EAAA,CAAA;AAElD,SAAO,YAAY,OAAO;AAC5B,CAAC;AAGH,IAAI,KAAK;AAIT,IAAI,QAAQ,OAAO;AAEnB,IAAI,MAAM;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"typescript": "5.4.5",
|
|
136
136
|
"vitest": "^1.4.0",
|
|
137
137
|
"vitest-github-actions-reporter": "^0.11.1",
|
|
138
|
-
"@sanity/pkg-utils": "6.
|
|
138
|
+
"@sanity/pkg-utils": "6.3.0"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|
|
141
141
|
"typescript": "5.4.x"
|
package/src/cli/index.ts
CHANGED
|
@@ -20,10 +20,21 @@ cli
|
|
|
20
20
|
.option('--emitDeclarationOnly', 'Emit d.ts only')
|
|
21
21
|
.option('--strict', 'Strict mode')
|
|
22
22
|
.option('--tsconfig [tsconfig]', '[string] tsconfig.json')
|
|
23
|
+
.option('--check', 'Run the check command after build (same as running `pkg build && pkg check`)')
|
|
23
24
|
.action(async (options) => {
|
|
25
|
+
const {check = false, ...buildOptions} = options
|
|
24
26
|
const {buildAction} = await import('./buildAction')
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
await buildAction(buildOptions)
|
|
29
|
+
|
|
30
|
+
if (check) {
|
|
31
|
+
const {checkAction} = await import('./checkAction')
|
|
32
|
+
|
|
33
|
+
await checkAction({
|
|
34
|
+
strict: options.strict,
|
|
35
|
+
tsconfig: options.tsconfig,
|
|
36
|
+
})
|
|
37
|
+
}
|
|
27
38
|
})
|
|
28
39
|
|
|
29
40
|
cli.command('init [path]', 'Initialize package').action(async (p) => {
|