@elliemae/pui-cli 7.0.0-alpha.7 → 7.0.0-alpha.8

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.
@@ -35,69 +35,51 @@ var __copyProps = (to, from, except, desc) => {
35
35
  };
36
36
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
37
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var tsc_exports = {};
39
- __export(tsc_exports, {
40
- tscCmd: () => tscCmd,
41
- validateTypescript: () => validateTypescript
38
+ var tscheck_exports = {};
39
+ __export(tscheck_exports, {
40
+ tscheckCmd: () => tscheckCmd
42
41
  });
43
- module.exports = __toCommonJS(tsc_exports);
42
+ module.exports = __toCommonJS(tscheck_exports);
44
43
  var import_node_path = __toESM(require("node:path"), 1);
44
+ var import_node_fs = __toESM(require("node:fs"), 1);
45
45
  var import_yargs = __toESM(require("yargs"), 1);
46
- var import_child_process = require("child_process");
47
- var import_fs = __toESM(require("fs"), 1);
48
46
  var import_utils = require("./utils.js");
49
47
  const randomChars = () => Math.random().toString(36).slice(2);
50
- const resolveFromRoot = (...paths) => import_node_path.default.join(process.cwd(), ...paths);
51
- const validateTypescript = async () => {
52
- const args = process.argv.slice(2);
53
- const argsProjectIndex = args.findIndex((arg) => ["-p", "--project"].includes(arg));
54
- const argsProjectValue = argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : void 0;
55
- const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
56
- if (files.length === 0) {
57
- process.exit(0);
58
- }
59
- const remainingArgsToForward = args.slice().filter((arg) => !files.includes(arg));
60
- if (argsProjectIndex !== -1) {
61
- remainingArgsToForward.splice(argsProjectIndex, 2);
62
- }
63
- const tsconfigPath = argsProjectValue || resolveFromRoot("tsconfig.json");
64
- const tsconfigContent = import_fs.default.readFileSync(tsconfigPath).toString();
65
- let tsconfig = {};
66
- eval(`tsconfig = ${tsconfigContent}`);
67
- const tmpTsconfigPath = resolveFromRoot(`tsconfig.${randomChars()}.json`);
48
+ const validateTypescript = async (files = []) => {
49
+ const tsconfigPath = import_node_path.default.join(process.cwd(), "tsconfig.json");
50
+ const tsconfig = JSON.parse(import_node_fs.default.readFileSync(tsconfigPath));
51
+ const tmpTsconfigPath = import_node_path.default.join(process.cwd(), `tsconfig.${randomChars()}.json`);
68
52
  const tmpTsconfig = __spreadProps(__spreadValues({}, tsconfig), {
69
53
  compilerOptions: __spreadProps(__spreadValues({}, tsconfig.compilerOptions), {
70
54
  skipLibCheck: true
71
55
  }),
72
56
  files,
73
- include: ["shared/typings"]
57
+ include: ["app", "lib"]
74
58
  });
75
- import_fs.default.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
76
- const { status } = (0, import_child_process.spawnSync)("tsc", ["-p", tmpTsconfigPath, ...remainingArgsToForward], { stdio: "inherit" });
77
- import_fs.default.unlinkSync(tmpTsconfigPath);
78
- process.exit(status);
59
+ import_node_fs.default.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
60
+ const tscPath = import_node_path.default.resolve(process.cwd(), `./node_modules/.bin/tsc${process.platform === "win32" ? ".cmd" : ""}`);
61
+ try {
62
+ await (0, import_utils.exec)(`${tscPath} -p ${tmpTsconfigPath} --noEmit --emitDeclarationOnly false`);
63
+ } finally {
64
+ import_node_fs.default.unlinkSync(tmpTsconfigPath);
65
+ }
79
66
  };
80
- const tscCmd = {
81
- handler: async (argv) => {
67
+ const tscheckCmd = {
68
+ handler: async ({ files }) => {
82
69
  try {
83
- await validateTypescript(argv.p);
84
- (0, import_utils.logInfo)("Typescript validation started");
70
+ await validateTypescript(files);
71
+ (0, import_utils.logInfo)("Typescript validation completed");
85
72
  } catch (err) {
86
73
  (0, import_utils.logError)("Typescript validation failed", err);
87
74
  (0, import_yargs.default)().exit(-1, err);
88
75
  }
89
76
  },
90
- command: "tsc [options]",
91
- describe: "validate typescript code",
77
+ command: "tscheck [options]",
78
+ describe: "validate typescript file(s)",
92
79
  builder: {
93
- project: {
94
- alias: "p",
95
- type: "boolean",
96
- default: false
97
- },
98
- docs: {
99
- type: "boolean",
100
- default: false
80
+ files: {
81
+ type: "array",
82
+ default: []
101
83
  }
102
84
  }
103
85
  };
package/dist/cjs/cli.js CHANGED
@@ -30,6 +30,7 @@ var import_codemod = require("./cli-commands/codemod.js");
30
30
  var import_storybook = require("./cli-commands/storybook.js");
31
31
  var import_vitest = require("./cli-commands/vitest.js");
32
32
  var import_version = require("./cli-commands/version.js");
33
+ var import_tscheck = require("./cli-commands/tscheck.js");
33
34
  const import_meta = {};
34
35
  const __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
35
36
  (0, import_dotenv.config)();
@@ -44,4 +45,5 @@ process.env.PATH += import_node_path.default.delimiter + import_node_path.defaul
44
45
  (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_storybook.storybookCmd).help().argv;
45
46
  (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_vitest.vitestCmd).help().argv;
46
47
  (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_version.versionCmd).help().argv;
48
+ (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_tscheck.tscheckCmd).help().argv;
47
49
  (0, import_update_notifier.default)();
@@ -24,16 +24,11 @@ __export(lint_staged_config_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(lint_staged_config_exports);
26
26
  var import_node_path = __toESM(require("node:path"), 1);
27
- var import_node_url = require("node:url");
28
27
  var import_node_fs = __toESM(require("node:fs"), 1);
29
- const import_meta = {};
30
- const __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
31
28
  const npmClient = import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "pnpm-lock.yaml")) ? "pnpm" : "npm";
32
29
  const lintStagedConfig = {
33
30
  "*.{js,ts,jsx,tsx,md,mdx,html,css,json}": ["prettier --write"],
34
- "*.{ts,tsx}": [
35
- `node ${import_node_path.default.resolve(__dirname, "../typescript/tsc-files/index.js")} --noEmit --emitDeclarationOnly false`
36
- ],
31
+ "*.{ts,tsx}": [`${npmClient} run tscheck`],
37
32
  "*.{js,ts,jsx,tsx}": [
38
33
  `${npmClient} run lint:fix`,
39
34
  `${npmClient} run test:staged`,
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import path from "node:path";
21
+ import fs from "node:fs";
22
+ import yargs from "yargs";
23
+ import { exec, logInfo, logError } from "./utils.js";
24
+ const randomChars = () => Math.random().toString(36).slice(2);
25
+ const validateTypescript = async (files = []) => {
26
+ const tsconfigPath = path.join(process.cwd(), "tsconfig.json");
27
+ const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath));
28
+ const tmpTsconfigPath = path.join(process.cwd(), `tsconfig.${randomChars()}.json`);
29
+ const tmpTsconfig = __spreadProps(__spreadValues({}, tsconfig), {
30
+ compilerOptions: __spreadProps(__spreadValues({}, tsconfig.compilerOptions), {
31
+ skipLibCheck: true
32
+ }),
33
+ files,
34
+ include: ["app", "lib"]
35
+ });
36
+ fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
37
+ const tscPath = path.resolve(process.cwd(), `./node_modules/.bin/tsc${process.platform === "win32" ? ".cmd" : ""}`);
38
+ try {
39
+ await exec(`${tscPath} -p ${tmpTsconfigPath} --noEmit --emitDeclarationOnly false`);
40
+ } finally {
41
+ fs.unlinkSync(tmpTsconfigPath);
42
+ }
43
+ };
44
+ const tscheckCmd = {
45
+ handler: async ({ files }) => {
46
+ try {
47
+ await validateTypescript(files);
48
+ logInfo("Typescript validation completed");
49
+ } catch (err) {
50
+ logError("Typescript validation failed", err);
51
+ yargs().exit(-1, err);
52
+ }
53
+ },
54
+ command: "tscheck [options]",
55
+ describe: "validate typescript file(s)",
56
+ builder: {
57
+ files: {
58
+ type: "array",
59
+ default: []
60
+ }
61
+ }
62
+ };
63
+ export {
64
+ tscheckCmd
65
+ };
package/dist/esm/cli.js CHANGED
@@ -15,6 +15,7 @@ import { codemodCmd } from "./cli-commands/codemod.js";
15
15
  import { storybookCmd } from "./cli-commands/storybook.js";
16
16
  import { vitestCmd } from "./cli-commands/vitest.js";
17
17
  import { versionCmd } from "./cli-commands/version.js";
18
+ import { tscheckCmd } from "./cli-commands/tscheck.js";
18
19
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
19
20
  envConfig();
20
21
  process.env.PATH += path.delimiter + path.join(__dirname, "..", "node_modules", ".bin");
@@ -28,4 +29,5 @@ yargs(hideBin(process.argv)).command(codemodCmd).help().argv;
28
29
  yargs(hideBin(process.argv)).command(storybookCmd).help().argv;
29
30
  yargs(hideBin(process.argv)).command(vitestCmd).help().argv;
30
31
  yargs(hideBin(process.argv)).command(versionCmd).help().argv;
32
+ yargs(hideBin(process.argv)).command(tscheckCmd).help().argv;
31
33
  notifyUpdates();
@@ -1,13 +1,9 @@
1
1
  import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
2
  import fs from "node:fs";
4
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
3
  const npmClient = fs.existsSync(path.join(process.cwd(), "pnpm-lock.yaml")) ? "pnpm" : "npm";
6
4
  const lintStagedConfig = {
7
5
  "*.{js,ts,jsx,tsx,md,mdx,html,css,json}": ["prettier --write"],
8
- "*.{ts,tsx}": [
9
- `node ${path.resolve(__dirname, "../typescript/tsc-files/index.js")} --noEmit --emitDeclarationOnly false`
10
- ],
6
+ "*.{ts,tsx}": [`${npmClient} run tscheck`],
11
7
  "*.{js,ts,jsx,tsx}": [
12
8
  `${npmClient} run lint:fix`,
13
9
  `${npmClient} run test:staged`,
@@ -0,0 +1,14 @@
1
+ export namespace tscheckCmd {
2
+ function handler({ files }: {
3
+ files: any;
4
+ }): Promise<void>;
5
+ const command: string;
6
+ const describe: string;
7
+ namespace builder {
8
+ namespace files {
9
+ export const type: string;
10
+ const _default: never[];
11
+ export { _default as default };
12
+ }
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "7.0.0-alpha.7",
3
+ "version": "7.0.0-alpha.8",
4
4
  "description": "ICE MT UI Platform CLI",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -44,6 +44,7 @@
44
44
  "storybook:docs:build": "exit 0",
45
45
  "test": "ts-node -r tsconfig-paths/register ./lib/cli test -p",
46
46
  "test:staged": "jest --coverage --passWithNoTests --bail --findRelatedTests",
47
+ "tscheck": "ts-node -r tsconfig-paths/register ./lib/cli tscheck --files",
47
48
  "setup": "rimraf node_modules && rimraf pnpm-lock.yaml && pnpm i",
48
49
  "upgrade": "ncu -u && npm run setup",
49
50
  "prepare": "[ -n \"$CI\" ] || husky install"
@@ -1,68 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
33
- var import_execa = require("execa");
34
- var import_node_fs = __toESM(require("node:fs"), 1);
35
- var import_node_path = __toESM(require("node:path"), 1);
36
- var import_utils = require("./utils.js");
37
- const args = process.argv.slice(2);
38
- const argsProjectIndex = args.findIndex((arg) => ["-p", "--project"].includes(arg));
39
- const argsProjectValue = argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : void 0;
40
- const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
41
- if (files.length === 0) {
42
- process.exit(0);
43
- }
44
- const remainingArgsToForward = args.slice().filter((arg) => !files.includes(arg));
45
- if (argsProjectIndex !== -1) {
46
- remainingArgsToForward.splice(argsProjectIndex, 2);
47
- }
48
- const tsconfigPath = argsProjectValue || (0, import_utils.resolveFromRoot)("tsconfig.json");
49
- const tsconfigContent = import_node_fs.default.readFileSync(tsconfigPath).toString();
50
- let tsconfig = {};
51
- eval(`tsconfig = ${tsconfigContent}`);
52
- const tmpTsconfigPath = (0, import_utils.resolveFromRoot)(`tsconfig.${(0, import_utils.randomChars)()}.json`);
53
- const tmpTsconfig = __spreadProps(__spreadValues({}, tsconfig), {
54
- compilerOptions: __spreadProps(__spreadValues({}, tsconfig.compilerOptions), {
55
- skipLibCheck: true
56
- }),
57
- files,
58
- include: ["app", "lib"]
59
- });
60
- import_node_fs.default.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
61
- let status = 0;
62
- try {
63
- import_execa.execa.sync(import_node_path.default.resolve(process.cwd(), `./node_modules/.bin/tsc${process.platform === "win32" ? ".cmd" : ""}`), ["-p", tmpTsconfigPath, ...remainingArgsToForward], { stdio: "inherit" });
64
- } catch (ex) {
65
- status = ex.exitCode;
66
- }
67
- import_node_fs.default.unlinkSync(tmpTsconfigPath);
68
- process.exit(status);
@@ -1,31 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var utils_exports = {};
19
- __export(utils_exports, {
20
- randomChars: () => randomChars,
21
- resolveFromModule: () => resolveFromModule,
22
- resolveFromRoot: () => resolveFromRoot
23
- });
24
- module.exports = __toCommonJS(utils_exports);
25
- var import_node_path = require("node:path");
26
- const randomChars = () => Math.random().toString(36).slice(2);
27
- const resolveFromModule = (moduleName, ...paths) => {
28
- const modulePath = (0, import_node_path.dirname)(require.resolve(`${moduleName}/package.json`));
29
- return (0, import_node_path.join)(modulePath, ...paths);
30
- };
31
- const resolveFromRoot = (...paths) => (0, import_node_path.join)(process.cwd(), ...paths);
@@ -1,83 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import path from "node:path";
21
- import yargs from "yargs";
22
- import { spawnSync } from "child_process";
23
- import fs from "fs";
24
- import { logInfo, logError } from "./utils.js";
25
- const randomChars = () => Math.random().toString(36).slice(2);
26
- const resolveFromRoot = (...paths) => path.join(process.cwd(), ...paths);
27
- const validateTypescript = async () => {
28
- const args = process.argv.slice(2);
29
- const argsProjectIndex = args.findIndex((arg) => ["-p", "--project"].includes(arg));
30
- const argsProjectValue = argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : void 0;
31
- const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
32
- if (files.length === 0) {
33
- process.exit(0);
34
- }
35
- const remainingArgsToForward = args.slice().filter((arg) => !files.includes(arg));
36
- if (argsProjectIndex !== -1) {
37
- remainingArgsToForward.splice(argsProjectIndex, 2);
38
- }
39
- const tsconfigPath = argsProjectValue || resolveFromRoot("tsconfig.json");
40
- const tsconfigContent = fs.readFileSync(tsconfigPath).toString();
41
- let tsconfig = {};
42
- eval(`tsconfig = ${tsconfigContent}`);
43
- const tmpTsconfigPath = resolveFromRoot(`tsconfig.${randomChars()}.json`);
44
- const tmpTsconfig = __spreadProps(__spreadValues({}, tsconfig), {
45
- compilerOptions: __spreadProps(__spreadValues({}, tsconfig.compilerOptions), {
46
- skipLibCheck: true
47
- }),
48
- files,
49
- include: ["shared/typings"]
50
- });
51
- fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
52
- const { status } = spawnSync("tsc", ["-p", tmpTsconfigPath, ...remainingArgsToForward], { stdio: "inherit" });
53
- fs.unlinkSync(tmpTsconfigPath);
54
- process.exit(status);
55
- };
56
- const tscCmd = {
57
- handler: async (argv) => {
58
- try {
59
- await validateTypescript(argv.p);
60
- logInfo("Typescript validation started");
61
- } catch (err) {
62
- logError("Typescript validation failed", err);
63
- yargs().exit(-1, err);
64
- }
65
- },
66
- command: "tsc [options]",
67
- describe: "validate typescript code",
68
- builder: {
69
- project: {
70
- alias: "p",
71
- type: "boolean",
72
- default: false
73
- },
74
- docs: {
75
- type: "boolean",
76
- default: false
77
- }
78
- }
79
- };
80
- export {
81
- tscCmd,
82
- validateTypescript
83
- };
@@ -1,55 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { execa } from "execa";
21
- import fs from "node:fs";
22
- import path from "node:path";
23
- import { randomChars, resolveFromRoot } from "./utils.js";
24
- const args = process.argv.slice(2);
25
- const argsProjectIndex = args.findIndex((arg) => ["-p", "--project"].includes(arg));
26
- const argsProjectValue = argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : void 0;
27
- const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
28
- if (files.length === 0) {
29
- process.exit(0);
30
- }
31
- const remainingArgsToForward = args.slice().filter((arg) => !files.includes(arg));
32
- if (argsProjectIndex !== -1) {
33
- remainingArgsToForward.splice(argsProjectIndex, 2);
34
- }
35
- const tsconfigPath = argsProjectValue || resolveFromRoot("tsconfig.json");
36
- const tsconfigContent = fs.readFileSync(tsconfigPath).toString();
37
- let tsconfig = {};
38
- eval(`tsconfig = ${tsconfigContent}`);
39
- const tmpTsconfigPath = resolveFromRoot(`tsconfig.${randomChars()}.json`);
40
- const tmpTsconfig = __spreadProps(__spreadValues({}, tsconfig), {
41
- compilerOptions: __spreadProps(__spreadValues({}, tsconfig.compilerOptions), {
42
- skipLibCheck: true
43
- }),
44
- files,
45
- include: ["app", "lib"]
46
- });
47
- fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
48
- let status = 0;
49
- try {
50
- execa.sync(path.resolve(process.cwd(), `./node_modules/.bin/tsc${process.platform === "win32" ? ".cmd" : ""}`), ["-p", tmpTsconfigPath, ...remainingArgsToForward], { stdio: "inherit" });
51
- } catch (ex) {
52
- status = ex.exitCode;
53
- }
54
- fs.unlinkSync(tmpTsconfigPath);
55
- process.exit(status);
@@ -1,12 +0,0 @@
1
- import { dirname, join } from "node:path";
2
- const randomChars = () => Math.random().toString(36).slice(2);
3
- const resolveFromModule = (moduleName, ...paths) => {
4
- const modulePath = dirname(require.resolve(`${moduleName}/package.json`));
5
- return join(modulePath, ...paths);
6
- };
7
- const resolveFromRoot = (...paths) => join(process.cwd(), ...paths);
8
- export {
9
- randomChars,
10
- resolveFromModule,
11
- resolveFromRoot
12
- };
@@ -1,20 +0,0 @@
1
- export function validateTypescript(): Promise<never>;
2
- export namespace tscCmd {
3
- function handler(argv: any): Promise<void>;
4
- const command: string;
5
- const describe: string;
6
- namespace builder {
7
- namespace project {
8
- export const alias: string;
9
- export const type: string;
10
- const _default: boolean;
11
- export { _default as default };
12
- }
13
- namespace docs {
14
- const type_1: string;
15
- export { type_1 as type };
16
- const _default_1: boolean;
17
- export { _default_1 as default };
18
- }
19
- }
20
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export function randomChars(): string;
2
- export function resolveFromModule(moduleName: any, ...paths: any[]): string;
3
- export function resolveFromRoot(...paths: any[]): string;