@zwa73/dev-utils 1.0.81 → 1.0.83

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.
Files changed (140) hide show
  1. package/bin/cli +1 -1
  2. package/data/template/base/gitignore +3 -0
  3. package/data/template/base/package.json +25 -0
  4. package/data/template/base/scripts/compile.ps1 +8 -0
  5. package/data/template/base/scripts/release.ps1 +4 -0
  6. package/data/template/base/src/macro.macro.ts +6 -0
  7. package/data/template/base/tsconfig.cjs.json +9 -0
  8. package/data/template/base/tsconfig.json +22 -0
  9. package/data/template/base/tsconfig.mjs.json +10 -0
  10. package/dist/cjs/Command/GenTemplate.d.ts +3 -0
  11. package/dist/cjs/Command/GenTemplate.js +59 -0
  12. package/dist/{Command → cjs/Command}/Route.js +2 -4
  13. package/dist/{Command → cjs/Command}/RouteInterface.d.ts +4 -0
  14. package/dist/{Command → cjs/Command}/RouteInterface.js +6 -2
  15. package/dist/cjs/test/testRegex.js +3 -0
  16. package/dist/{test → cjs/test}/testRegex.macro.js +0 -1
  17. package/dist/{test → cjs/test}/testRegexa.macro.js +0 -1
  18. package/dist/mjs/Command/ExpandMacro.d.ts +3 -0
  19. package/dist/mjs/Command/ExpandMacro.js +16 -0
  20. package/dist/mjs/Command/GenI18n.d.ts +3 -0
  21. package/dist/mjs/Command/GenI18n.js +75 -0
  22. package/dist/mjs/Command/GenSchema.d.ts +3 -0
  23. package/dist/mjs/Command/GenSchema.js +22 -0
  24. package/dist/mjs/Command/GenTemplate.d.ts +3 -0
  25. package/dist/mjs/Command/GenTemplate.js +52 -0
  26. package/dist/mjs/Command/MapPath.d.ts +3 -0
  27. package/dist/mjs/Command/MapPath.js +64 -0
  28. package/dist/mjs/Command/Node.d.ts +3 -0
  29. package/dist/mjs/Command/Node.js +14 -0
  30. package/dist/mjs/Command/Release.d.ts +3 -0
  31. package/dist/mjs/Command/Release.js +88 -0
  32. package/dist/mjs/Command/Route.d.ts +1 -0
  33. package/dist/mjs/Command/Route.js +20 -0
  34. package/dist/mjs/Command/RouteInterface.d.ts +24 -0
  35. package/dist/mjs/Command/RouteInterface.js +58 -0
  36. package/dist/mjs/Command/ScanDups.d.ts +3 -0
  37. package/dist/mjs/Command/ScanDups.js +43 -0
  38. package/dist/mjs/Command/index.d.ts +1 -0
  39. package/dist/mjs/Command/index.js +1 -0
  40. package/dist/mjs/Macro.macro.d.ts +1 -0
  41. package/dist/mjs/Macro.macro.js +2 -0
  42. package/dist/mjs/QuickFunc.d.ts +2 -0
  43. package/dist/mjs/QuickFunc.js +2 -0
  44. package/dist/mjs/UtilAst.d.ts +13 -0
  45. package/dist/mjs/UtilAst.js +15 -0
  46. package/dist/mjs/UtilDevTool.d.ts +99 -0
  47. package/dist/mjs/UtilDevTool.js +296 -0
  48. package/dist/mjs/UtilInterface.d.ts +4 -0
  49. package/dist/mjs/UtilInterface.js +1 -0
  50. package/dist/mjs/UtilMacro.d.ts +7 -0
  51. package/dist/mjs/UtilMacro.js +23 -0
  52. package/dist/mjs/index.d.ts +5 -0
  53. package/dist/mjs/index.js +5 -0
  54. package/dist/mjs/test/testFileMacro.d.ts +1 -0
  55. package/dist/mjs/test/testFileMacro.js +1 -0
  56. package/dist/mjs/test/testGlobMacro.d.ts +1 -0
  57. package/dist/mjs/test/testGlobMacro.js +2 -0
  58. package/dist/mjs/test/testRegex.d.ts +1 -0
  59. package/dist/mjs/test/testRegex.js +2 -0
  60. package/dist/mjs/test/testRegex.macro.d.ts +1 -0
  61. package/dist/mjs/test/testRegex.macro.js +9 -0
  62. package/dist/mjs/test/testRegexa.d.ts +1 -0
  63. package/dist/mjs/test/testRegexa.js +1 -0
  64. package/dist/mjs/test/testRegexa.macro.d.ts +1 -0
  65. package/dist/mjs/test/testRegexa.macro.js +2 -0
  66. package/package.json +8 -3
  67. package/data/init/index.d.ts +0 -1
  68. package/data/init/index.js +0 -1
  69. package/data/init/scripts/compile.ps1 +0 -5
  70. package/data/init/tsconfig.compile.json +0 -4
  71. package/data/init/tsconfig.json +0 -22
  72. package/dist/Command/Init.d.ts +0 -3
  73. package/dist/Command/Init.js +0 -82
  74. package/dist/Command/InitElectron.d.ts +0 -3
  75. package/dist/Command/InitElectron.js +0 -64
  76. package/dist/test/testRegex.js +0 -10
  77. package/index.d.ts +0 -1
  78. package/index.js +0 -1
  79. /package/data/{init → template/base}/scripts/watch.ps1 +0 -0
  80. /package/data/{init → template/base}/src/index.ts +0 -0
  81. /package/data/{InitElectron → template/electron}/.eslintrc.js +0 -0
  82. /package/data/{InitElectron → template/electron}/forge.config.ts +0 -0
  83. /package/data/{InitElectron → template/electron}/gitignore +0 -0
  84. /package/data/{InitElectron → template/electron}/package-lock.json +0 -0
  85. /package/data/{InitElectron → template/electron}/package.json +0 -0
  86. /package/data/{InitElectron → template/electron}/src/Backend/BridgeBackend.ts +0 -0
  87. /package/data/{InitElectron → template/electron}/src/Backend/index.ts +0 -0
  88. /package/data/{InitElectron → template/electron}/src/Frontend/Base.tsx +0 -0
  89. /package/data/{InitElectron → template/electron}/src/Frontend/ContextProxy.ts +0 -0
  90. /package/data/{InitElectron → template/electron}/src/Frontend/index.ts +0 -0
  91. /package/data/{InitElectron → template/electron}/src/app.tsx +0 -0
  92. /package/data/{InitElectron → template/electron}/src/index.html +0 -0
  93. /package/data/{InitElectron → template/electron}/src/index.ts +0 -0
  94. /package/data/{InitElectron → template/electron}/src/preload.ts +0 -0
  95. /package/data/{InitElectron → template/electron}/src/renderer.ts +0 -0
  96. /package/data/{InitElectron → template/electron}/tsconfig.json +0 -0
  97. /package/data/{InitElectron → template/electron}/webpack.main.config.ts +0 -0
  98. /package/data/{InitElectron → template/electron}/webpack.plugins.ts +0 -0
  99. /package/data/{InitElectron → template/electron}/webpack.renderer.config.ts +0 -0
  100. /package/data/{InitElectron → template/electron}/webpack.rules.ts +0 -0
  101. /package/dist/{Command → cjs/Command}/ExpandMacro.d.ts +0 -0
  102. /package/dist/{Command → cjs/Command}/ExpandMacro.js +0 -0
  103. /package/dist/{Command → cjs/Command}/GenI18n.d.ts +0 -0
  104. /package/dist/{Command → cjs/Command}/GenI18n.js +0 -0
  105. /package/dist/{Command → cjs/Command}/GenSchema.d.ts +0 -0
  106. /package/dist/{Command → cjs/Command}/GenSchema.js +0 -0
  107. /package/dist/{Command → cjs/Command}/MapPath.d.ts +0 -0
  108. /package/dist/{Command → cjs/Command}/MapPath.js +0 -0
  109. /package/dist/{Command → cjs/Command}/Node.d.ts +0 -0
  110. /package/dist/{Command → cjs/Command}/Node.js +0 -0
  111. /package/dist/{Command → cjs/Command}/Release.d.ts +0 -0
  112. /package/dist/{Command → cjs/Command}/Release.js +0 -0
  113. /package/dist/{Command → cjs/Command}/Route.d.ts +0 -0
  114. /package/dist/{Command → cjs/Command}/ScanDups.d.ts +0 -0
  115. /package/dist/{Command → cjs/Command}/ScanDups.js +0 -0
  116. /package/dist/{Command → cjs/Command}/index.d.ts +0 -0
  117. /package/dist/{Command → cjs/Command}/index.js +0 -0
  118. /package/dist/{Macro.macro.d.ts → cjs/Macro.macro.d.ts} +0 -0
  119. /package/dist/{Macro.macro.js → cjs/Macro.macro.js} +0 -0
  120. /package/dist/{QuickFunc.d.ts → cjs/QuickFunc.d.ts} +0 -0
  121. /package/dist/{QuickFunc.js → cjs/QuickFunc.js} +0 -0
  122. /package/dist/{UtilAst.d.ts → cjs/UtilAst.d.ts} +0 -0
  123. /package/dist/{UtilAst.js → cjs/UtilAst.js} +0 -0
  124. /package/dist/{UtilDevTool.d.ts → cjs/UtilDevTool.d.ts} +0 -0
  125. /package/dist/{UtilDevTool.js → cjs/UtilDevTool.js} +0 -0
  126. /package/dist/{UtilInterface.d.ts → cjs/UtilInterface.d.ts} +0 -0
  127. /package/dist/{UtilInterface.js → cjs/UtilInterface.js} +0 -0
  128. /package/dist/{UtilMacro.d.ts → cjs/UtilMacro.d.ts} +0 -0
  129. /package/dist/{UtilMacro.js → cjs/UtilMacro.js} +0 -0
  130. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  131. /package/dist/{index.js → cjs/index.js} +0 -0
  132. /package/dist/{test → cjs/test}/testFileMacro.d.ts +0 -0
  133. /package/dist/{test → cjs/test}/testFileMacro.js +0 -0
  134. /package/dist/{test → cjs/test}/testGlobMacro.d.ts +0 -0
  135. /package/dist/{test → cjs/test}/testGlobMacro.js +0 -0
  136. /package/dist/{test → cjs/test}/testRegex.d.ts +0 -0
  137. /package/dist/{test → cjs/test}/testRegex.macro.d.ts +0 -0
  138. /package/dist/{test → cjs/test}/testRegexa.d.ts +0 -0
  139. /package/dist/{test → cjs/test}/testRegexa.js +0 -0
  140. /package/dist/{test → cjs/test}/testRegexa.macro.d.ts +0 -0
@@ -0,0 +1 @@
1
+ type Test3 = 4;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //#endregion 1 ssa
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ 2;
2
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { commentMacro, fileMacro, regionMacro } from "../QuickFunc.js";
2
+ regionMacro('macroTest1', "type Test1 = 1");
3
+ regionMacro('macroTest2', "type Test2 = 2");
4
+ regionMacro('macroTest3', "type Test3 = 3");
5
+ commentMacro('comment1', "type CM1 = 3");
6
+ commentMacro('comment2', "type CM2 = 3");
7
+ regionMacro('macroTest4', "type Test3 = 4", { filePath: 'src/test/**/*.ts', glob: true });
8
+ fileMacro("type FileMacro = 5", { filePath: 'src/test/testFileMacro.ts' });
9
+ commentMacro(/regexTest[\S]*/, ({ matchId: id }) => `type ${id} = "${id}"`);
@@ -0,0 +1 @@
1
+ type CM1 = 3;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { commentMacro } from "../QuickFunc.js";
2
+ commentMacro('comment1', "type CM1 = 3");
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@zwa73/dev-utils",
3
- "version": "1.0.81",
3
+ "version": "1.0.83",
4
4
  "description": "编译与调试工具",
5
- "main": "index.js",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "require": "./dist/cjs/index.js",
9
+ "import": "./dist/mjs/index.js"
10
+ }
11
+ },
6
12
  "scripts": {
7
13
  "test": "jest",
8
14
  "release": "powershell scripts/release",
@@ -25,7 +31,6 @@
25
31
  "typescript-json-schema": "^0.64.0"
26
32
  },
27
33
  "devDependencies": {
28
- "@types/fluent-ffmpeg": "^2.1.24",
29
34
  "@types/jest": "^29.5.12",
30
35
  "@types/node": "^20.14.11",
31
36
  "jest": "^29.7.0",
@@ -1 +0,0 @@
1
- export * from './dist';
@@ -1 +0,0 @@
1
- module.exports = require("./dist");
@@ -1,5 +0,0 @@
1
- Write-Output 开始删除原dist
2
- Remove-Item -Recurse -Force dist
3
- Write-Output 开始编译
4
- tsc -p tsconfig.compile.json
5
- tsc-alias -p tsconfig.compile.json
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["./src/**/*.ts", "./src/**/*.js"]
4
- }
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- "strict": true,
5
- "target": "ES2022",
6
- "module": "CommonJS",
7
- "moduleResolution": "node",
8
- "esModuleInterop": true,
9
- "outDir": "./dist",
10
- "declaration": true,
11
- "baseUrl": ".",
12
- "emitDecoratorMetadata": true,
13
- "experimentalDecorators": true,
14
- "paths": {
15
- "@src/*": ["./src/*"],
16
- "@/*": ["./*"],
17
- "@": ["./src/index"]
18
- }
19
- },
20
- "include": ["./src/**/*.ts", "./src/**/*.js", "./jest/**/*.ts"],
21
- "exclude": ["./node_modules/**/*"]
22
- }
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- /**对项目进行初始化 */
3
- export declare const CmdInit: (program: Command) => Command;
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.CmdInit = void 0;
30
- const fs = __importStar(require("fs"));
31
- const pathe_1 = __importDefault(require("pathe"));
32
- const utils_1 = require("@zwa73/utils");
33
- const RouteInterface_1 = require("./RouteInterface");
34
- const InitDataPath = pathe_1.default.join(RouteInterface_1.DATA_PATH, 'init');
35
- /**复制基础文件 */
36
- async function copyData() {
37
- const filelist = await fs.promises.readdir(InitDataPath);
38
- const plist = filelist.map(async (fileName) => {
39
- utils_1.SLogger.info(`正在复制 ${fileName}`);
40
- const filePath = pathe_1.default.join(InitDataPath, fileName);
41
- const targetPath = pathe_1.default.join(RouteInterface_1.PROJECT_PATH, fileName);
42
- if (!await utils_1.UtilFT.pathExists(targetPath))
43
- await fs.promises.cp(filePath, targetPath, { recursive: true });
44
- else
45
- utils_1.SLogger.info(`${fileName} 已存在 跳过`);
46
- return null;
47
- });
48
- await Promise.all(plist);
49
- }
50
- /**安装npm包 */
51
- async function installPackage() {
52
- const install = async (name) => await utils_1.UtilFunc.exec(`npm i --registry ${RouteInterface_1.MIRROR_SOURCE} ${name}`);
53
- const installdev = async (name) => await utils_1.UtilFunc.exec(`npm i --registry ${RouteInterface_1.MIRROR_SOURCE} --save-dev ${name}`);
54
- const packageList = ['@zwa73/utils'];
55
- const devPackList = [
56
- '@zwa73/dev-utils',
57
- '@types/fluent-ffmpeg',
58
- '@types/node',
59
- ];
60
- for (const name of packageList) {
61
- utils_1.SLogger.info(`正在安装 ${name}`);
62
- await install(name);
63
- }
64
- for (const name of devPackList) {
65
- utils_1.SLogger.info(`正在安装 ${name}`);
66
- await installdev(name);
67
- }
68
- }
69
- /**对项目进行初始化 */
70
- const CmdInit = (program) => program
71
- .command('Init')
72
- .alias('init')
73
- .description('对当前目录进行项目初始化')
74
- .action(async (opt) => {
75
- (0, RouteInterface_1.checkProject)();
76
- utils_1.SLogger.info(`开始初始化设置当前目录 ${RouteInterface_1.PROJECT_PATH}`);
77
- await Promise.all([
78
- copyData(),
79
- installPackage(),
80
- ]);
81
- });
82
- exports.CmdInit = CmdInit;
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- /**对项目进行初始化 */
3
- export declare const CmdInitElectron: (program: Command) => Command;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.CmdInitElectron = void 0;
30
- const fs = __importStar(require("fs"));
31
- const pathe_1 = __importDefault(require("pathe"));
32
- const utils_1 = require("@zwa73/utils");
33
- const RouteInterface_1 = require("./RouteInterface");
34
- const InitDataPath = pathe_1.default.join(RouteInterface_1.DATA_PATH, 'InitElectron');
35
- /**复制基础文件 */
36
- async function copyData() {
37
- const filelist = await fs.promises.readdir(InitDataPath);
38
- const plist = filelist.map(async (fileName) => {
39
- utils_1.SLogger.info(`正在复制 ${fileName}`);
40
- const filePath = pathe_1.default.join(InitDataPath, fileName);
41
- const targetPath = pathe_1.default.join(RouteInterface_1.PROJECT_PATH, fileName);
42
- if (!await utils_1.UtilFT.pathExists(targetPath))
43
- await fs.promises.cp(filePath, targetPath, { recursive: true });
44
- else
45
- utils_1.SLogger.info(`${fileName} 已存在 跳过`);
46
- return null;
47
- });
48
- await Promise.all(plist);
49
- await fs.promises.rename('./gitignore', './.gitignore');
50
- }
51
- /**对项目进行初始化 */
52
- const CmdInitElectron = (program) => program
53
- .command('Init-Electron')
54
- .alias('initelectron')
55
- .description('对当前目录进行项目初始化,创建Electron基础环境')
56
- .action(async (opt) => {
57
- //checkProject();
58
- utils_1.SLogger.info(`开始初始化设置当前目录 ${RouteInterface_1.PROJECT_PATH}`);
59
- await Promise.all([
60
- copyData(),
61
- utils_1.UtilFunc.exec(`npm ci`, { outlvl: 'info', errlvl: 'warn' })
62
- ]);
63
- });
64
- exports.CmdInitElectron = CmdInitElectron;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const utils_1 = require("@zwa73/utils");
7
- const pathe_1 = __importDefault(require("pathe"));
8
- utils_1.UtilFT.fileSearchRegexSync(__dirname, /.+/.source, { relative: false })
9
- .map((filepath) => pathe_1.default.relative(__dirname, filepath)); //?
10
- 2;
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist';
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("./dist");
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes