@aidc-toolkit/dev 0.9.13-beta → 0.9.15-beta
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/config/release.json +9 -7
- package/dist/command-util.d.ts +17 -0
- package/dist/command-util.d.ts.map +1 -0
- package/dist/eslint-config-template.d.ts +2 -0
- package/dist/eslint-config-template.d.ts.map +1 -0
- package/dist/index.cjs +209 -2
- package/dist/index.d.ts +18 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +171 -2
- package/dist/publish-dev.d.ts +5 -0
- package/dist/publish-dev.d.ts.map +1 -0
- package/package.json +11 -10
- package/src/eslint-config-template.ts +2 -1
- package/src/publish-dev.ts +2 -2
- package/src/release.ts +22 -10
- package/tsconfig-declaration-local.json +14 -0
- package/tsconfig-declaration.json +14 -0
- package/tsconfig.json +2 -2
- package/tsup.config.ts +8 -0
package/config/release.json
CHANGED
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
"organization": "aidc-toolkit",
|
|
3
3
|
"repositories": {
|
|
4
4
|
"dev": {
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.15-beta"
|
|
6
6
|
},
|
|
7
7
|
"core": {
|
|
8
|
-
"version": "0.9.
|
|
8
|
+
"version": "0.9.15-beta"
|
|
9
9
|
},
|
|
10
10
|
"utility": {
|
|
11
|
-
"version": "0.9.
|
|
11
|
+
"version": "0.9.15-beta"
|
|
12
12
|
},
|
|
13
13
|
"gs1": {
|
|
14
|
-
"
|
|
15
|
-
"version": "0.9.13-beta"
|
|
14
|
+
"version": "0.9.15-beta"
|
|
16
15
|
},
|
|
17
16
|
"demo": {
|
|
18
|
-
"version": "0.9.
|
|
17
|
+
"version": "0.9.15-beta"
|
|
18
|
+
},
|
|
19
|
+
"app-extension": {
|
|
20
|
+
"version": "0.9.15-beta"
|
|
19
21
|
},
|
|
20
22
|
"aidc-toolkit.github.io": {
|
|
21
23
|
"directory": "doc",
|
|
22
|
-
"version": "0.9.
|
|
24
|
+
"version": "0.9.15-beta"
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a command and optionally capture its output.
|
|
3
|
+
*
|
|
4
|
+
* @param captureOutput
|
|
5
|
+
* If true, output is captured and returned.
|
|
6
|
+
*
|
|
7
|
+
* @param command
|
|
8
|
+
* Command to run.
|
|
9
|
+
*
|
|
10
|
+
* @param args
|
|
11
|
+
* Arguments to command.
|
|
12
|
+
*
|
|
13
|
+
* @returns
|
|
14
|
+
* Output if captured or empty array if not.
|
|
15
|
+
*/
|
|
16
|
+
export declare function run(captureOutput: boolean, command: string, ...args: string[]): string[];
|
|
17
|
+
//# sourceMappingURL=command-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-util.d.ts","sourceRoot":"","sources":["../src/command-util.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,GAAG,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAkBxF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-config-template.d.ts","sourceRoot":"","sources":["../src/eslint-config-template.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,qEA0GnC,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,212 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
esLintConfigAIDCToolkit: () => esLintConfigAIDCToolkit,
|
|
34
|
+
publishDev: () => publishDev
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
|
+
|
|
38
|
+
// src/eslint-config-template.ts
|
|
39
|
+
var import_js = __toESM(require("@eslint/js"), 1);
|
|
40
|
+
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
41
|
+
var import_eslint_config_love = __toESM(require("eslint-config-love"), 1);
|
|
42
|
+
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
43
|
+
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
44
|
+
var esLintConfigAIDCToolkit = import_typescript_eslint.default.config(
|
|
45
|
+
{
|
|
46
|
+
ignores: ["dist"]
|
|
47
|
+
},
|
|
48
|
+
import_js.default.configs.recommended,
|
|
49
|
+
...import_typescript_eslint.default.configs.strictTypeChecked,
|
|
50
|
+
import_eslint_plugin.default.configs.recommended,
|
|
51
|
+
import_eslint_plugin_jsdoc.default.configs["flat/recommended-typescript"],
|
|
52
|
+
import_eslint_config_love.default,
|
|
53
|
+
{
|
|
54
|
+
languageOptions: {
|
|
55
|
+
parserOptions: {
|
|
56
|
+
projectService: true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
linterOptions: {
|
|
60
|
+
reportUnusedDisableDirectives: "error"
|
|
61
|
+
},
|
|
62
|
+
rules: {
|
|
63
|
+
"complexity": "off",
|
|
64
|
+
"max-depth": ["error", 10],
|
|
65
|
+
"max-lines": "off",
|
|
66
|
+
"no-dupe-class-members": "off",
|
|
67
|
+
"no-redeclare": "off",
|
|
68
|
+
"no-unused-vars": "off",
|
|
69
|
+
"@typescript-eslint/class-literal-property-style": "off",
|
|
70
|
+
"@typescript-eslint/class-methods-use-this": "off",
|
|
71
|
+
"@typescript-eslint/init-declarations": "off",
|
|
72
|
+
"@typescript-eslint/max-params": "off",
|
|
73
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
74
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
75
|
+
"@typescript-eslint/no-magic-numbers": "off",
|
|
76
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "off",
|
|
77
|
+
"@typescript-eslint/no-unused-vars": [
|
|
78
|
+
"error",
|
|
79
|
+
{
|
|
80
|
+
argsIgnorePattern: "^_",
|
|
81
|
+
varsIgnorePattern: "^_",
|
|
82
|
+
caughtErrorsIgnorePattern: "^_"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"@typescript-eslint/prefer-destructuring": "off",
|
|
86
|
+
"@typescript-eslint/unbound-method": ["error", {
|
|
87
|
+
ignoreStatic: true
|
|
88
|
+
}],
|
|
89
|
+
"@stylistic/array-bracket-newline": ["error", "consistent"],
|
|
90
|
+
"@stylistic/brace-style": ["error", "1tbs", {
|
|
91
|
+
allowSingleLine: false
|
|
92
|
+
}],
|
|
93
|
+
"@stylistic/comma-dangle": ["error", "never"],
|
|
94
|
+
"@stylistic/indent": ["error", 4],
|
|
95
|
+
"@stylistic/member-delimiter-style": ["error", {
|
|
96
|
+
multiline: {
|
|
97
|
+
delimiter: "semi",
|
|
98
|
+
requireLast: true
|
|
99
|
+
},
|
|
100
|
+
singleline: {
|
|
101
|
+
delimiter: "semi"
|
|
102
|
+
}
|
|
103
|
+
}],
|
|
104
|
+
"@stylistic/no-trailing-spaces": ["off"],
|
|
105
|
+
"@stylistic/operator-linebreak": ["error", "after"],
|
|
106
|
+
"@stylistic/quotes": ["error", "double"],
|
|
107
|
+
"@stylistic/semi": ["error", "always"],
|
|
108
|
+
"@stylistic/object-curly-newline": ["error", {
|
|
109
|
+
ObjectExpression: {
|
|
110
|
+
multiline: true,
|
|
111
|
+
minProperties: 1
|
|
112
|
+
},
|
|
113
|
+
ObjectPattern: {
|
|
114
|
+
multiline: true,
|
|
115
|
+
minProperties: 1
|
|
116
|
+
}
|
|
117
|
+
}],
|
|
118
|
+
"@stylistic/object-property-newline": "error",
|
|
119
|
+
"jsdoc/require-description": ["warn", {
|
|
120
|
+
contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
|
|
121
|
+
}],
|
|
122
|
+
"jsdoc/require-jsdoc": ["warn", {
|
|
123
|
+
contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
|
|
124
|
+
}],
|
|
125
|
+
"jsdoc/require-returns": ["warn", {
|
|
126
|
+
checkGetters: false
|
|
127
|
+
}],
|
|
128
|
+
"jsdoc/tag-lines": ["warn", "any", {
|
|
129
|
+
count: 1,
|
|
130
|
+
startLines: 1
|
|
131
|
+
}]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
files: [
|
|
136
|
+
"test/**/*"
|
|
137
|
+
],
|
|
138
|
+
rules: {
|
|
139
|
+
"max-nested-callbacks": "off",
|
|
140
|
+
"jsdoc/require-jsdoc": "off",
|
|
141
|
+
"@typescript-eslint/dot-notation": "off",
|
|
142
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// src/publish-dev.ts
|
|
148
|
+
var fs = __toESM(require("fs"), 1);
|
|
149
|
+
|
|
150
|
+
// src/command-util.ts
|
|
151
|
+
var import_child_process = require("child_process");
|
|
152
|
+
function run(captureOutput, command, ...args) {
|
|
153
|
+
const spawnResult = (0, import_child_process.spawnSync)(command, args, {
|
|
154
|
+
stdio: ["inherit", captureOutput ? "pipe" : "inherit", "inherit"]
|
|
155
|
+
});
|
|
156
|
+
if (spawnResult.error !== void 0) {
|
|
157
|
+
throw spawnResult.error;
|
|
158
|
+
}
|
|
159
|
+
if (spawnResult.status === null) {
|
|
160
|
+
throw new Error(`Terminated by signal ${spawnResult.signal}`);
|
|
161
|
+
}
|
|
162
|
+
if (spawnResult.status !== 0) {
|
|
163
|
+
throw new Error(`Failed with status ${spawnResult.status}`);
|
|
164
|
+
}
|
|
165
|
+
return captureOutput ? spawnResult.stdout.toString().split("\n").slice(0, -1) : [];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// src/publish-dev.ts
|
|
169
|
+
function zeroPadded(n, length) {
|
|
170
|
+
return `${"0".repeat(length - 1)}${n}`.slice(-length);
|
|
171
|
+
}
|
|
172
|
+
function fixAlphaDependencies(atOrganization, dependencies) {
|
|
173
|
+
if (dependencies !== void 0) {
|
|
174
|
+
for (const dependency in dependencies) {
|
|
175
|
+
if (dependency.split("/")[0] === atOrganization) {
|
|
176
|
+
dependencies[dependency] = "alpha";
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function publishDev() {
|
|
182
|
+
run(false, "npm", "update", "--save");
|
|
183
|
+
const now = /* @__PURE__ */ new Date();
|
|
184
|
+
const packageConfigurationPath = "package.json";
|
|
185
|
+
const backupPackageConfigurationPath = "_package.json";
|
|
186
|
+
const packageConfiguration = JSON.parse(fs.readFileSync(packageConfigurationPath).toString());
|
|
187
|
+
const atOrganization = packageConfiguration.name.split("/")[0];
|
|
188
|
+
fixAlphaDependencies(atOrganization, packageConfiguration.devDependencies);
|
|
189
|
+
fixAlphaDependencies(atOrganization, packageConfiguration.dependencies);
|
|
190
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}
|
|
191
|
+
`);
|
|
192
|
+
fs.renameSync(packageConfigurationPath, backupPackageConfigurationPath);
|
|
193
|
+
try {
|
|
194
|
+
const [majorVersion, minorVersion, patchVersion] = packageConfiguration.version.split("-")[0].split(".").map((versionString) => Number(versionString));
|
|
195
|
+
packageConfiguration.version = `${majorVersion}.${minorVersion}.${patchVersion + 1}-alpha.${now.getFullYear()}${zeroPadded(now.getMonth() + 1, 2)}${zeroPadded(now.getDate(), 2)}${zeroPadded(now.getHours(), 2)}${zeroPadded(now.getMinutes(), 2)}`;
|
|
196
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}
|
|
197
|
+
`);
|
|
198
|
+
run(false, "npm", "run", "build:dev");
|
|
199
|
+
run(false, "npm", "publish", "--tag", "alpha");
|
|
200
|
+
} finally {
|
|
201
|
+
fs.rmSync(packageConfigurationPath);
|
|
202
|
+
fs.renameSync(backupPackageConfigurationPath, packageConfigurationPath);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
206
|
+
0 && (module.exports = {
|
|
207
|
+
esLintConfigAIDCToolkit,
|
|
208
|
+
publishDev
|
|
209
|
+
});
|
|
3
210
|
/*!
|
|
4
211
|
* Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
5
212
|
* contributors
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
3
|
+
* contributors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
7
16
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
export * from "./eslint-config-template.js";
|
|
18
|
+
export * from "./publish-dev.js";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/eslint-config-template.ts
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
4
|
+
import esLintConfigLove from "eslint-config-love";
|
|
5
|
+
import jsdoc from "eslint-plugin-jsdoc";
|
|
6
|
+
import tseslint from "typescript-eslint";
|
|
7
|
+
var esLintConfigAIDCToolkit = tseslint.config(
|
|
8
|
+
{
|
|
9
|
+
ignores: ["dist"]
|
|
10
|
+
},
|
|
11
|
+
js.configs.recommended,
|
|
12
|
+
...tseslint.configs.strictTypeChecked,
|
|
13
|
+
stylistic.configs.recommended,
|
|
14
|
+
jsdoc.configs["flat/recommended-typescript"],
|
|
15
|
+
esLintConfigLove,
|
|
16
|
+
{
|
|
17
|
+
languageOptions: {
|
|
18
|
+
parserOptions: {
|
|
19
|
+
projectService: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
linterOptions: {
|
|
23
|
+
reportUnusedDisableDirectives: "error"
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
"complexity": "off",
|
|
27
|
+
"max-depth": ["error", 10],
|
|
28
|
+
"max-lines": "off",
|
|
29
|
+
"no-dupe-class-members": "off",
|
|
30
|
+
"no-redeclare": "off",
|
|
31
|
+
"no-unused-vars": "off",
|
|
32
|
+
"@typescript-eslint/class-literal-property-style": "off",
|
|
33
|
+
"@typescript-eslint/class-methods-use-this": "off",
|
|
34
|
+
"@typescript-eslint/init-declarations": "off",
|
|
35
|
+
"@typescript-eslint/max-params": "off",
|
|
36
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
37
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
38
|
+
"@typescript-eslint/no-magic-numbers": "off",
|
|
39
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "off",
|
|
40
|
+
"@typescript-eslint/no-unused-vars": [
|
|
41
|
+
"error",
|
|
42
|
+
{
|
|
43
|
+
argsIgnorePattern: "^_",
|
|
44
|
+
varsIgnorePattern: "^_",
|
|
45
|
+
caughtErrorsIgnorePattern: "^_"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"@typescript-eslint/prefer-destructuring": "off",
|
|
49
|
+
"@typescript-eslint/unbound-method": ["error", {
|
|
50
|
+
ignoreStatic: true
|
|
51
|
+
}],
|
|
52
|
+
"@stylistic/array-bracket-newline": ["error", "consistent"],
|
|
53
|
+
"@stylistic/brace-style": ["error", "1tbs", {
|
|
54
|
+
allowSingleLine: false
|
|
55
|
+
}],
|
|
56
|
+
"@stylistic/comma-dangle": ["error", "never"],
|
|
57
|
+
"@stylistic/indent": ["error", 4],
|
|
58
|
+
"@stylistic/member-delimiter-style": ["error", {
|
|
59
|
+
multiline: {
|
|
60
|
+
delimiter: "semi",
|
|
61
|
+
requireLast: true
|
|
62
|
+
},
|
|
63
|
+
singleline: {
|
|
64
|
+
delimiter: "semi"
|
|
65
|
+
}
|
|
66
|
+
}],
|
|
67
|
+
"@stylistic/no-trailing-spaces": ["off"],
|
|
68
|
+
"@stylistic/operator-linebreak": ["error", "after"],
|
|
69
|
+
"@stylistic/quotes": ["error", "double"],
|
|
70
|
+
"@stylistic/semi": ["error", "always"],
|
|
71
|
+
"@stylistic/object-curly-newline": ["error", {
|
|
72
|
+
ObjectExpression: {
|
|
73
|
+
multiline: true,
|
|
74
|
+
minProperties: 1
|
|
75
|
+
},
|
|
76
|
+
ObjectPattern: {
|
|
77
|
+
multiline: true,
|
|
78
|
+
minProperties: 1
|
|
79
|
+
}
|
|
80
|
+
}],
|
|
81
|
+
"@stylistic/object-property-newline": "error",
|
|
82
|
+
"jsdoc/require-description": ["warn", {
|
|
83
|
+
contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
|
|
84
|
+
}],
|
|
85
|
+
"jsdoc/require-jsdoc": ["warn", {
|
|
86
|
+
contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
|
|
87
|
+
}],
|
|
88
|
+
"jsdoc/require-returns": ["warn", {
|
|
89
|
+
checkGetters: false
|
|
90
|
+
}],
|
|
91
|
+
"jsdoc/tag-lines": ["warn", "any", {
|
|
92
|
+
count: 1,
|
|
93
|
+
startLines: 1
|
|
94
|
+
}]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
files: [
|
|
99
|
+
"test/**/*"
|
|
100
|
+
],
|
|
101
|
+
rules: {
|
|
102
|
+
"max-nested-callbacks": "off",
|
|
103
|
+
"jsdoc/require-jsdoc": "off",
|
|
104
|
+
"@typescript-eslint/dot-notation": "off",
|
|
105
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// src/publish-dev.ts
|
|
111
|
+
import * as fs from "fs";
|
|
112
|
+
|
|
113
|
+
// src/command-util.ts
|
|
114
|
+
import { spawnSync } from "child_process";
|
|
115
|
+
function run(captureOutput, command, ...args) {
|
|
116
|
+
const spawnResult = spawnSync(command, args, {
|
|
117
|
+
stdio: ["inherit", captureOutput ? "pipe" : "inherit", "inherit"]
|
|
118
|
+
});
|
|
119
|
+
if (spawnResult.error !== void 0) {
|
|
120
|
+
throw spawnResult.error;
|
|
121
|
+
}
|
|
122
|
+
if (spawnResult.status === null) {
|
|
123
|
+
throw new Error(`Terminated by signal ${spawnResult.signal}`);
|
|
124
|
+
}
|
|
125
|
+
if (spawnResult.status !== 0) {
|
|
126
|
+
throw new Error(`Failed with status ${spawnResult.status}`);
|
|
127
|
+
}
|
|
128
|
+
return captureOutput ? spawnResult.stdout.toString().split("\n").slice(0, -1) : [];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/publish-dev.ts
|
|
132
|
+
function zeroPadded(n, length) {
|
|
133
|
+
return `${"0".repeat(length - 1)}${n}`.slice(-length);
|
|
134
|
+
}
|
|
135
|
+
function fixAlphaDependencies(atOrganization, dependencies) {
|
|
136
|
+
if (dependencies !== void 0) {
|
|
137
|
+
for (const dependency in dependencies) {
|
|
138
|
+
if (dependency.split("/")[0] === atOrganization) {
|
|
139
|
+
dependencies[dependency] = "alpha";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function publishDev() {
|
|
145
|
+
run(false, "npm", "update", "--save");
|
|
146
|
+
const now = /* @__PURE__ */ new Date();
|
|
147
|
+
const packageConfigurationPath = "package.json";
|
|
148
|
+
const backupPackageConfigurationPath = "_package.json";
|
|
149
|
+
const packageConfiguration = JSON.parse(fs.readFileSync(packageConfigurationPath).toString());
|
|
150
|
+
const atOrganization = packageConfiguration.name.split("/")[0];
|
|
151
|
+
fixAlphaDependencies(atOrganization, packageConfiguration.devDependencies);
|
|
152
|
+
fixAlphaDependencies(atOrganization, packageConfiguration.dependencies);
|
|
153
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}
|
|
154
|
+
`);
|
|
155
|
+
fs.renameSync(packageConfigurationPath, backupPackageConfigurationPath);
|
|
156
|
+
try {
|
|
157
|
+
const [majorVersion, minorVersion, patchVersion] = packageConfiguration.version.split("-")[0].split(".").map((versionString) => Number(versionString));
|
|
158
|
+
packageConfiguration.version = `${majorVersion}.${minorVersion}.${patchVersion + 1}-alpha.${now.getFullYear()}${zeroPadded(now.getMonth() + 1, 2)}${zeroPadded(now.getDate(), 2)}${zeroPadded(now.getHours(), 2)}${zeroPadded(now.getMinutes(), 2)}`;
|
|
159
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}
|
|
160
|
+
`);
|
|
161
|
+
run(false, "npm", "run", "build:dev");
|
|
162
|
+
run(false, "npm", "publish", "--tag", "alpha");
|
|
163
|
+
} finally {
|
|
164
|
+
fs.rmSync(packageConfigurationPath);
|
|
165
|
+
fs.renameSync(backupPackageConfigurationPath, packageConfigurationPath);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
esLintConfigAIDCToolkit,
|
|
170
|
+
publishDev
|
|
171
|
+
};
|
|
3
172
|
/*!
|
|
4
173
|
* Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
5
174
|
* contributors
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-dev.d.ts","sourceRoot":"","sources":["../src/publish-dev.ts"],"names":[],"mappings":"AA+DA;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CA2CjC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/dev",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.15-beta",
|
|
4
4
|
"description": "Shared development artefacts for AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://aidc-toolkit.com/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/aidc-toolkit/dev.git"
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"copy-workflows": "copy-files-from-to --config copy-workflows.json",
|
|
23
|
-
"lint": "eslint
|
|
24
|
-
"build:core": "tsup
|
|
25
|
-
"build:dev": "npm run build:core && tsc
|
|
23
|
+
"lint": "eslint",
|
|
24
|
+
"build:core": "tsup",
|
|
25
|
+
"build:dev": "npm run build:core && tsc --project tsconfig-declaration-local.json",
|
|
26
26
|
"build:release": "npm run build:core -- --minify",
|
|
27
|
+
"build:doc": "npm run build:dev",
|
|
27
28
|
"publish-dev": "bin/publish-dev-local",
|
|
28
29
|
"release": "tsx src/release.ts"
|
|
29
30
|
},
|
|
@@ -31,22 +32,22 @@
|
|
|
31
32
|
"publish-dev": "bin/publish-dev"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"copy-files-from-to": "^3.12.
|
|
35
|
+
"copy-files-from-to": "^3.12.1"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@eslint/js": "^9.20.0",
|
|
38
39
|
"@octokit/types": "^13.8.0",
|
|
39
|
-
"@stylistic/eslint-plugin": "^
|
|
40
|
-
"eslint": "^9.
|
|
40
|
+
"@stylistic/eslint-plugin": "^4.0.1",
|
|
41
|
+
"eslint": "^9.21.0",
|
|
41
42
|
"eslint-config-love": "^118.0.0",
|
|
42
43
|
"eslint-plugin-jsdoc": "^50.6.3",
|
|
43
44
|
"jiti": "^2.4.2",
|
|
44
45
|
"octokit": "^4.1.2",
|
|
45
46
|
"ts-node": "^10.9.2",
|
|
46
47
|
"tsup": "^8.3.6",
|
|
47
|
-
"tsx": "^4.19.
|
|
48
|
+
"tsx": "^4.19.3",
|
|
48
49
|
"typescript": "^5.7.3",
|
|
49
|
-
"typescript-eslint": "^8.
|
|
50
|
+
"typescript-eslint": "^8.25.0",
|
|
50
51
|
"yaml": "^2.7.0"
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -10,7 +10,7 @@ export const esLintConfigAIDCToolkit = tseslint.config(
|
|
|
10
10
|
},
|
|
11
11
|
js.configs.recommended,
|
|
12
12
|
...tseslint.configs.strictTypeChecked,
|
|
13
|
-
stylistic.configs
|
|
13
|
+
stylistic.configs.recommended,
|
|
14
14
|
jsdoc.configs["flat/recommended-typescript"],
|
|
15
15
|
esLintConfigLove,
|
|
16
16
|
{
|
|
@@ -26,6 +26,7 @@ export const esLintConfigAIDCToolkit = tseslint.config(
|
|
|
26
26
|
|
|
27
27
|
rules: {
|
|
28
28
|
"complexity": "off",
|
|
29
|
+
"max-depth": ["error", 10],
|
|
29
30
|
"max-lines": "off",
|
|
30
31
|
"no-dupe-class-members": "off",
|
|
31
32
|
"no-redeclare": "off",
|
package/src/publish-dev.ts
CHANGED
|
@@ -82,7 +82,7 @@ export function publishDev(): void {
|
|
|
82
82
|
fixAlphaDependencies(atOrganization, packageConfiguration.dependencies);
|
|
83
83
|
|
|
84
84
|
// Save the package configuration.
|
|
85
|
-
fs.writeFileSync(packageConfigurationPath, JSON.stringify(packageConfiguration, null, 2));
|
|
85
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}\n`);
|
|
86
86
|
|
|
87
87
|
// Backup the package configuration file.
|
|
88
88
|
fs.renameSync(packageConfigurationPath, backupPackageConfigurationPath);
|
|
@@ -95,7 +95,7 @@ export function publishDev(): void {
|
|
|
95
95
|
packageConfiguration.version = `${majorVersion}.${minorVersion}.${patchVersion + 1}-alpha.${now.getFullYear()}${zeroPadded(now.getMonth() + 1, 2)}${zeroPadded(now.getDate(), 2)}${zeroPadded(now.getHours(), 2)}${zeroPadded(now.getMinutes(), 2)}`;
|
|
96
96
|
|
|
97
97
|
// Save the package configuration.
|
|
98
|
-
fs.writeFileSync(packageConfigurationPath, JSON.stringify(packageConfiguration, null, 2));
|
|
98
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}\n`);
|
|
99
99
|
|
|
100
100
|
// Run the development build.
|
|
101
101
|
run(false, "npm", "run", "build:dev");
|
package/src/release.ts
CHANGED
|
@@ -174,10 +174,16 @@ async function release(): Promise<void> {
|
|
|
174
174
|
*
|
|
175
175
|
* @param dependencies
|
|
176
176
|
* Dependencies.
|
|
177
|
+
*
|
|
177
178
|
* @param restoreAlpha
|
|
178
179
|
* If true, "alpha" is restored as the version for development.
|
|
180
|
+
*
|
|
181
|
+
* @returns
|
|
182
|
+
* True if any dependencies were updated.
|
|
179
183
|
*/
|
|
180
|
-
function updateDependencies(dependencies: Record<string, string> | undefined, restoreAlpha: boolean):
|
|
184
|
+
function updateDependencies(dependencies: Record<string, string> | undefined, restoreAlpha: boolean): boolean {
|
|
185
|
+
let anyUpdated = false;
|
|
186
|
+
|
|
181
187
|
if (dependencies !== undefined) {
|
|
182
188
|
// eslint-disable-next-line guard-for-in -- Dependency record type is shallow.
|
|
183
189
|
for (const dependency in dependencies) {
|
|
@@ -185,9 +191,12 @@ async function release(): Promise<void> {
|
|
|
185
191
|
|
|
186
192
|
if (dependencyAtOrganization === atOrganization) {
|
|
187
193
|
dependencies[dependency] = !restoreAlpha ? `^${configuration.repositories[dependencyRepositoryName].version}` : "alpha";
|
|
194
|
+
anyUpdated = true;
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
197
|
}
|
|
198
|
+
|
|
199
|
+
return anyUpdated;
|
|
191
200
|
}
|
|
192
201
|
|
|
193
202
|
const octokit = new Octokit({
|
|
@@ -253,6 +262,8 @@ async function release(): Promise<void> {
|
|
|
253
262
|
if (!firstRepository && run(true, "git", "tag", "--points-at", "HEAD", tag).length === 0) {
|
|
254
263
|
throw new Error(`Repository ${name} has at least one commit since version ${repository.version}`);
|
|
255
264
|
}
|
|
265
|
+
|
|
266
|
+
state[name] = "skipped";
|
|
256
267
|
}
|
|
257
268
|
break;
|
|
258
269
|
|
|
@@ -353,13 +364,7 @@ async function release(): Promise<void> {
|
|
|
353
364
|
});
|
|
354
365
|
|
|
355
366
|
await step(name, "commit", () => {
|
|
356
|
-
run(false, "git", "commit", "--all", `--message=Updated to version ${repository.version}
|
|
357
|
-
|
|
358
|
-
// Restore dependencies to "alpha" version for development.
|
|
359
|
-
updateDependencies(packageConfiguration.devDependencies, true);
|
|
360
|
-
updateDependencies(packageConfiguration.dependencies, true);
|
|
361
|
-
|
|
362
|
-
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}\n`);
|
|
367
|
+
run(false, "git", "commit", "--all", `--message=Updated to version ${repository.version}.`);
|
|
363
368
|
});
|
|
364
369
|
|
|
365
370
|
await step(name, "tag", () => {
|
|
@@ -395,9 +400,16 @@ async function release(): Promise<void> {
|
|
|
395
400
|
});
|
|
396
401
|
}
|
|
397
402
|
|
|
403
|
+
// Restore dependencies to "alpha" version for development.
|
|
404
|
+
const devDependenciesUpdated = updateDependencies(packageConfiguration.devDependencies, true);
|
|
405
|
+
const dependenciesUpdated = updateDependencies(packageConfiguration.dependencies, true);
|
|
406
|
+
|
|
407
|
+
if (devDependenciesUpdated || dependenciesUpdated) {
|
|
408
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}\n`);
|
|
409
|
+
run(false, "git", "commit", "--all", "--message=Restored alpha version.");
|
|
410
|
+
}
|
|
411
|
+
|
|
398
412
|
state[name] = "complete";
|
|
399
|
-
} else {
|
|
400
|
-
state[name] = "skipped";
|
|
401
413
|
}
|
|
402
414
|
|
|
403
415
|
saveState();
|
package/tsconfig.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"noPropertyAccessFromIndexSignature": true,
|
|
10
10
|
|
|
11
11
|
// Modules.
|
|
12
|
-
"module": "
|
|
12
|
+
"module": "NodeNext",
|
|
13
13
|
"resolveJsonModule": true,
|
|
14
14
|
|
|
15
15
|
// Interop constraints.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"forceConsistentCasingInFileNames": true,
|
|
18
18
|
|
|
19
19
|
// Language and environment.
|
|
20
|
-
"target": "
|
|
20
|
+
"target": "ESNext",
|
|
21
21
|
"useDefineForClassFields": true,
|
|
22
22
|
|
|
23
23
|
// Completeness.
|