@aidc-toolkit/dev 0.9.15-beta → 0.9.17-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/publish.json +53 -0
- package/dev.iml +9 -0
- package/dist/eslint-config-template.js +99 -0
- package/dist/eslint-config-template.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -171
- package/dist/index.js.map +1 -0
- package/dist/{command-util.d.ts → utility.d.ts} +6 -1
- package/dist/utility.d.ts.map +1 -0
- package/dist/utility.js +57 -0
- package/dist/utility.js.map +1 -0
- package/eslint.config.ts +1 -1
- package/package.json +9 -11
- package/src/index.ts +1 -1
- package/src/publish-external.ts +332 -0
- package/src/publish-internal.ts +111 -0
- package/src/publish.ts +273 -0
- package/src/{command-util.ts → utility.ts} +24 -1
- package/tsconfig-build-dev-local.json +9 -0
- package/tsconfig-build-dev.json +9 -0
- package/tsconfig-build-local.json +11 -0
- package/{tsconfig-declaration.json → tsconfig-build.json} +1 -4
- package/tsconfig.json +6 -3
- package/bin/publish-dev +0 -8
- package/bin/publish-dev-local +0 -8
- package/config/release.json +0 -27
- package/dist/command-util.d.ts.map +0 -1
- package/dist/index.cjs +0 -225
- package/dist/index.d.cts +0 -10
- package/dist/publish-dev.d.ts +0 -5
- package/dist/publish-dev.d.ts.map +0 -1
- package/src/publish-dev.ts +0 -110
- package/src/release.ts +0 -426
- package/tsconfig-declaration-local.json +0 -14
- package/tsup.config.ts +0 -8
package/src/publish.ts
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import configurationJSON from "../config/publish.json";
|
|
4
|
+
import secureConfigurationJSON from "../config/publish.secure.json";
|
|
5
|
+
import { logger, run } from "./utility";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Repository.
|
|
9
|
+
*/
|
|
10
|
+
export interface Repository {
|
|
11
|
+
/**
|
|
12
|
+
* Directory in which repository resides, if different from repository name.
|
|
13
|
+
*/
|
|
14
|
+
directory?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Dependency type, dictating how it is published.
|
|
18
|
+
*/
|
|
19
|
+
dependencyType: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Files excluded from consideration when checking for changes.
|
|
23
|
+
*/
|
|
24
|
+
excludeFiles?: string[];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Date/time the package was last published internally in ISO format.
|
|
28
|
+
*/
|
|
29
|
+
lastInternalPublished?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Date/time the package was last published externally in ISO format.
|
|
33
|
+
*/
|
|
34
|
+
lastExternalPublished?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Last external published version.
|
|
38
|
+
*/
|
|
39
|
+
lastExternalVersion?: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Current step in external publication; used to resume after failure recovery.
|
|
43
|
+
*/
|
|
44
|
+
publishExternalStep?: string | undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Configuration layout of publish.json.
|
|
49
|
+
*/
|
|
50
|
+
export interface Configuration {
|
|
51
|
+
/**
|
|
52
|
+
* Organization that owns the repositories.
|
|
53
|
+
*/
|
|
54
|
+
organization: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Repositories.
|
|
58
|
+
*/
|
|
59
|
+
repositories: Record<string, Repository>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Configuration layout of publish.secure.json.
|
|
64
|
+
*/
|
|
65
|
+
interface SecureConfiguration {
|
|
66
|
+
token: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Configuration layout of package.json (relevant attributes only).
|
|
71
|
+
*/
|
|
72
|
+
export interface PackageConfiguration {
|
|
73
|
+
/**
|
|
74
|
+
* Name.
|
|
75
|
+
*/
|
|
76
|
+
name: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Version.
|
|
80
|
+
*/
|
|
81
|
+
version: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Development dependencies.
|
|
85
|
+
*/
|
|
86
|
+
devDependencies?: Record<string, string>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Dependencies.
|
|
90
|
+
*/
|
|
91
|
+
dependencies?: Record<string, string>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const configuration: Configuration = configurationJSON;
|
|
95
|
+
export const secureConfiguration: SecureConfiguration = secureConfigurationJSON;
|
|
96
|
+
|
|
97
|
+
const atOrganization = `@${configuration.organization}`;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get the organization repository name or a dependency if it belongs to the organization or null if not.
|
|
101
|
+
*
|
|
102
|
+
* @param dependency
|
|
103
|
+
* Dependency.
|
|
104
|
+
*
|
|
105
|
+
* @returns
|
|
106
|
+
* Organization repository name or null.
|
|
107
|
+
*/
|
|
108
|
+
export function organizationRepository(dependency: string): string | null {
|
|
109
|
+
const [dependencyAtOrganization, dependencyRepositoryName] = dependency.split("/");
|
|
110
|
+
|
|
111
|
+
return dependencyAtOrganization === atOrganization ? dependencyRepositoryName : null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Determine if there have been any changes to a repository.
|
|
116
|
+
*
|
|
117
|
+
* @param repository
|
|
118
|
+
* Repository configuration.
|
|
119
|
+
*
|
|
120
|
+
* @param external
|
|
121
|
+
* False if comparing to the last internal published date/time, true if comparing to the last external published
|
|
122
|
+
* date/time.
|
|
123
|
+
*
|
|
124
|
+
* @returns
|
|
125
|
+
* True if there is no last published date/time or if there have been any changes since then.
|
|
126
|
+
*/
|
|
127
|
+
export function anyChanges(repository: Repository, external: boolean): boolean {
|
|
128
|
+
let anyChanges: boolean;
|
|
129
|
+
|
|
130
|
+
const lastPublishedString = !external ? repository.lastInternalPublished : repository.lastExternalPublished;
|
|
131
|
+
|
|
132
|
+
const changedFilesSet = new Set<string>();
|
|
133
|
+
|
|
134
|
+
if (lastPublishedString !== undefined) {
|
|
135
|
+
for (const line of run(true, "git", "log", `--since="${lastPublishedString}"`, "--name-status", "--pretty=oneline")) {
|
|
136
|
+
// Header starts with 40-character SHA.
|
|
137
|
+
if (!/^[0-9a-f]{40} /.test(line)) {
|
|
138
|
+
const [status, file] = line.split("\t");
|
|
139
|
+
|
|
140
|
+
// Ignore deleted files; anything that depends on a deleted file will have been modified.
|
|
141
|
+
if (status !== "D") {
|
|
142
|
+
logger.debug(`+File: ${file}`);
|
|
143
|
+
|
|
144
|
+
changedFilesSet.add(file);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
logger.debug(`Commit SHA ${line.substring(0, 40)}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (lastPublishedString !== undefined || external) {
|
|
153
|
+
const output = run(true, "git", "status", "--porcelain");
|
|
154
|
+
|
|
155
|
+
if (output.length !== 0) {
|
|
156
|
+
if (external) {
|
|
157
|
+
throw new Error("Repository has uncommitted changes");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
logger.debug("Uncommitted");
|
|
161
|
+
|
|
162
|
+
for (const line of output) {
|
|
163
|
+
// Line is two-character status, space, and detail.
|
|
164
|
+
const status = line.substring(0, 2);
|
|
165
|
+
const detail = line.substring(3);
|
|
166
|
+
|
|
167
|
+
// Ignore deleted files; anything that depends on a deleted file will have been modified.
|
|
168
|
+
if (status !== "D ") {
|
|
169
|
+
let file: string;
|
|
170
|
+
|
|
171
|
+
if (status.startsWith("R")) {
|
|
172
|
+
// File has been renamed; get old and new file names.
|
|
173
|
+
const [oldFile, newFile] = detail.split(" -> ");
|
|
174
|
+
|
|
175
|
+
logger.debug(`-File: ${oldFile}`);
|
|
176
|
+
|
|
177
|
+
changedFilesSet.delete(oldFile);
|
|
178
|
+
|
|
179
|
+
file = newFile;
|
|
180
|
+
} else {
|
|
181
|
+
file = detail;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
logger.debug(`+File: ${file}`);
|
|
185
|
+
|
|
186
|
+
changedFilesSet.add(file);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (lastPublishedString !== undefined) {
|
|
193
|
+
logger.debug("Excluded");
|
|
194
|
+
|
|
195
|
+
const hiddenFiles = [];
|
|
196
|
+
|
|
197
|
+
// Get list of hidden files and directories.
|
|
198
|
+
for (const changedFile of changedFilesSet) {
|
|
199
|
+
if (changedFile.startsWith(".") || changedFile.includes("/.")) {
|
|
200
|
+
hiddenFiles.push(changedFile);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Exclude hidden files and directories.
|
|
205
|
+
for (const hiddenFile of hiddenFiles) {
|
|
206
|
+
logger.debug(`-File: ${hiddenFile}`);
|
|
207
|
+
|
|
208
|
+
changedFilesSet.delete(hiddenFile);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (repository.excludeFiles !== undefined) {
|
|
212
|
+
for (const excludeFile of repository.excludeFiles) {
|
|
213
|
+
if (changedFilesSet.delete(excludeFile)) {
|
|
214
|
+
logger.debug(`-File: ${excludeFile}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
logger.info("Changed");
|
|
220
|
+
|
|
221
|
+
const lastPublished = new Date(lastPublishedString);
|
|
222
|
+
|
|
223
|
+
anyChanges = false;
|
|
224
|
+
|
|
225
|
+
for (const changedFile of changedFilesSet) {
|
|
226
|
+
if (fs.lstatSync(changedFile).mtime > lastPublished) {
|
|
227
|
+
logger.info(`File: ${changedFile}`);
|
|
228
|
+
|
|
229
|
+
anyChanges = true;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
// No last published, so there must have been changes.
|
|
234
|
+
anyChanges = true;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (!anyChanges) {
|
|
238
|
+
logger.debug("No changes");
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return anyChanges;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Configuration may be written from any directory so full path is required.
|
|
245
|
+
const configurationPath = path.resolve("config/publish.json");
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Save the current configuration.
|
|
249
|
+
*/
|
|
250
|
+
export function saveConfiguration(): void {
|
|
251
|
+
fs.writeFileSync(configurationPath, `${JSON.stringify(configuration, null, 2)}\n`);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Publish all repositories.
|
|
256
|
+
*
|
|
257
|
+
* @param callback
|
|
258
|
+
* Callback taking the name and properties of the repository to publish.
|
|
259
|
+
*/
|
|
260
|
+
export async function publishRepositories(callback: (name: string, repository: Repository) => void | Promise<void>): Promise<void> {
|
|
261
|
+
logger.settings.minLevel = 2;
|
|
262
|
+
|
|
263
|
+
for (const [name, repository] of Object.entries(configuration.repositories)) {
|
|
264
|
+
logger.info(`Repository ${name}...`);
|
|
265
|
+
|
|
266
|
+
// All repositories are expected to be children of the parent of this repository.
|
|
267
|
+
process.chdir(`../${repository.directory ?? name}`);
|
|
268
|
+
|
|
269
|
+
await callback(name, repository);
|
|
270
|
+
|
|
271
|
+
saveConfiguration();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { spawnSync } from "child_process";
|
|
2
|
+
import { Logger } from "tslog";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Log level.
|
|
6
|
+
*/
|
|
7
|
+
enum LogLevel {
|
|
8
|
+
Silly, Trace, Debug, Info, Warn, Error, Fatal
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Logger with a default minimum level of Info.
|
|
13
|
+
*/
|
|
14
|
+
export const logger = new Logger({
|
|
15
|
+
minLevel: LogLevel.Info
|
|
16
|
+
});
|
|
2
17
|
|
|
3
18
|
/**
|
|
4
19
|
* Run a command and optionally capture its output.
|
|
@@ -16,6 +31,8 @@ import { spawnSync } from "child_process";
|
|
|
16
31
|
* Output if captured or empty array if not.
|
|
17
32
|
*/
|
|
18
33
|
export function run(captureOutput: boolean, command: string, ...args: string[]): string[] {
|
|
34
|
+
logger.debug(`Running command "${command}" with arguments ${JSON.stringify(args)}.`);
|
|
35
|
+
|
|
19
36
|
const spawnResult = spawnSync(command, args, {
|
|
20
37
|
stdio: ["inherit", captureOutput ? "pipe" : "inherit", "inherit"]
|
|
21
38
|
});
|
|
@@ -32,5 +49,11 @@ export function run(captureOutput: boolean, command: string, ...args: string[]):
|
|
|
32
49
|
throw new Error(`Failed with status ${spawnResult.status}`);
|
|
33
50
|
}
|
|
34
51
|
|
|
35
|
-
|
|
52
|
+
const output = captureOutput ? spawnResult.stdout.toString().split("\n").slice(0, -1) : [];
|
|
53
|
+
|
|
54
|
+
if (captureOutput) {
|
|
55
|
+
logger.debug(`Output is ${JSON.stringify(output)}.`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return output;
|
|
36
59
|
}
|
package/tsconfig.json
CHANGED
|
@@ -9,16 +9,19 @@
|
|
|
9
9
|
"noPropertyAccessFromIndexSignature": true,
|
|
10
10
|
|
|
11
11
|
// Modules.
|
|
12
|
-
"module": "
|
|
12
|
+
"module": "ES2022",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
13
14
|
"resolveJsonModule": true,
|
|
14
15
|
|
|
16
|
+
// Emit.
|
|
17
|
+
"declaration": true,
|
|
18
|
+
|
|
15
19
|
// Interop constraints.
|
|
16
20
|
"esModuleInterop": true,
|
|
17
21
|
"forceConsistentCasingInFileNames": true,
|
|
18
22
|
|
|
19
23
|
// Language and environment.
|
|
20
|
-
"target": "
|
|
21
|
-
"useDefineForClassFields": true,
|
|
24
|
+
"target": "ES2022",
|
|
22
25
|
|
|
23
26
|
// Completeness.
|
|
24
27
|
"skipLibCheck": true
|
package/bin/publish-dev
DELETED
package/bin/publish-dev-local
DELETED
package/config/release.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"organization": "aidc-toolkit",
|
|
3
|
-
"repositories": {
|
|
4
|
-
"dev": {
|
|
5
|
-
"version": "0.9.15-beta"
|
|
6
|
-
},
|
|
7
|
-
"core": {
|
|
8
|
-
"version": "0.9.15-beta"
|
|
9
|
-
},
|
|
10
|
-
"utility": {
|
|
11
|
-
"version": "0.9.15-beta"
|
|
12
|
-
},
|
|
13
|
-
"gs1": {
|
|
14
|
-
"version": "0.9.15-beta"
|
|
15
|
-
},
|
|
16
|
-
"demo": {
|
|
17
|
-
"version": "0.9.15-beta"
|
|
18
|
-
},
|
|
19
|
-
"app-extension": {
|
|
20
|
-
"version": "0.9.15-beta"
|
|
21
|
-
},
|
|
22
|
-
"aidc-toolkit.github.io": {
|
|
23
|
-
"directory": "doc",
|
|
24
|
-
"version": "0.9.15-beta"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/index.cjs
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
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
|
-
});
|
|
210
|
-
/*!
|
|
211
|
-
* Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
212
|
-
* contributors
|
|
213
|
-
*
|
|
214
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
215
|
-
* you may not use this file except in compliance with the License.
|
|
216
|
-
* You may obtain a copy of the License at
|
|
217
|
-
*
|
|
218
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
219
|
-
*
|
|
220
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
221
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
222
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
223
|
-
* See the License for the specific language governing permissions and
|
|
224
|
-
* limitations under the License.
|
|
225
|
-
*/
|
package/dist/index.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
-
|
|
3
|
-
declare const esLintConfigAIDCToolkit: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Publish to development npm registry.
|
|
7
|
-
*/
|
|
8
|
-
declare function publishDev(): void;
|
|
9
|
-
|
|
10
|
-
export { esLintConfigAIDCToolkit, publishDev };
|
package/dist/publish-dev.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|