@aidc-toolkit/dev 0.9.5 → 0.9.6-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 +25 -0
- package/copy-workflows.json +40 -0
- package/dist/index.cjs +3 -1
- package/dist/index.js +3 -1
- package/package.json +16 -9
- package/src/eslint.config.template.ts +3 -1
- package/src/release.ts +384 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/actions/build-publish/action.yml +0 -73
- package/.github/workflows/build-publish.yml +0 -21
- package/.idea/dev.iml +0 -9
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/runConfigurations/build.xml +0 -12
- package/.idea/runConfigurations/eslint.xml +0 -12
- package/.idea/vcs.xml +0 -6
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"organization": "aidc-toolkit",
|
|
3
|
+
"repositories": {
|
|
4
|
+
"dev": {
|
|
5
|
+
"version": "0.9.6-beta"
|
|
6
|
+
},
|
|
7
|
+
"core": {
|
|
8
|
+
"version": "0.9.6-beta"
|
|
9
|
+
},
|
|
10
|
+
"utility": {
|
|
11
|
+
"version": "0.9.6-beta"
|
|
12
|
+
},
|
|
13
|
+
"gs1": {
|
|
14
|
+
"name": "gs1",
|
|
15
|
+
"version": "0.9.6-beta"
|
|
16
|
+
},
|
|
17
|
+
"demo": {
|
|
18
|
+
"version": "0.9.6-beta"
|
|
19
|
+
},
|
|
20
|
+
"aidc-toolkit.github.io": {
|
|
21
|
+
"directory": "doc",
|
|
22
|
+
"version": "0.9.6-beta"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"copyFiles": [
|
|
3
|
+
{
|
|
4
|
+
"from": ".github/workflows/tag.yml",
|
|
5
|
+
"to": "../core/.github/workflows/"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"from": ".github/workflows/tag.yml",
|
|
9
|
+
"to": "../utility/.github/workflows/"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"from": ".github/workflows/tag.yml",
|
|
13
|
+
"to": "../gs1/.github/workflows/"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"from": ".github/workflows/tag.yml",
|
|
17
|
+
"to": "../demo/.github/workflows/"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"from": ".github/workflows/tag.yml",
|
|
21
|
+
"to": "../doc/.github/workflows/"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"from": ".github/workflows/release.yml",
|
|
25
|
+
"to": "../core/.github/workflows/"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"from": ".github/workflows/release.yml",
|
|
29
|
+
"to": "../utility/.github/workflows/"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"from": ".github/workflows/release.yml",
|
|
33
|
+
"to": "../gs1/.github/workflows/"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
|
|
37
|
+
"copyFilesSettings": {
|
|
38
|
+
"whenFileExists": "overwrite"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -59,6 +59,7 @@ var esLintConfigAIDCToolkit = import_typescript_eslint.default.config(
|
|
|
59
59
|
reportUnusedDisableDirectives: "error"
|
|
60
60
|
},
|
|
61
61
|
rules: {
|
|
62
|
+
"complexity": "off",
|
|
62
63
|
"no-dupe-class-members": "off",
|
|
63
64
|
"no-redeclare": "off",
|
|
64
65
|
"no-unused-vars": "off",
|
|
@@ -133,7 +134,8 @@ var esLintConfigAIDCToolkit = import_typescript_eslint.default.config(
|
|
|
133
134
|
],
|
|
134
135
|
rules: {
|
|
135
136
|
"jsdoc/require-jsdoc": "off",
|
|
136
|
-
"@typescript-eslint/dot-notation": "off"
|
|
137
|
+
"@typescript-eslint/dot-notation": "off",
|
|
138
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off"
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
);
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var esLintConfigAIDCToolkit = tseslint.config(
|
|
|
23
23
|
reportUnusedDisableDirectives: "error"
|
|
24
24
|
},
|
|
25
25
|
rules: {
|
|
26
|
+
"complexity": "off",
|
|
26
27
|
"no-dupe-class-members": "off",
|
|
27
28
|
"no-redeclare": "off",
|
|
28
29
|
"no-unused-vars": "off",
|
|
@@ -97,7 +98,8 @@ var esLintConfigAIDCToolkit = tseslint.config(
|
|
|
97
98
|
],
|
|
98
99
|
rules: {
|
|
99
100
|
"jsdoc/require-jsdoc": "off",
|
|
100
|
-
"@typescript-eslint/dot-notation": "off"
|
|
101
|
+
"@typescript-eslint/dot-notation": "off",
|
|
102
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off"
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/dev",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6-beta",
|
|
4
4
|
"description": "Shared development artefacts for AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,25 +19,32 @@
|
|
|
19
19
|
"url": "https://www.linkedin.com/in/kdean"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"
|
|
22
|
+
"copy-workflows": "copy-files-from-to --config copy-workflows.json",
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"release": "tsx src/release.ts",
|
|
23
25
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
24
26
|
"build-doc": "npm run build"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"
|
|
29
|
+
"copy-files-from-to": "^3.12.0",
|
|
30
|
+
"eslint": "^9.16.0",
|
|
28
31
|
"ts-node": "^10.9.2",
|
|
29
32
|
"tsup": "^8.3.5",
|
|
30
|
-
"
|
|
33
|
+
"tsx": "^4.19.2",
|
|
34
|
+
"typescript": "^5.7.2"
|
|
31
35
|
},
|
|
32
36
|
"peerDependencies": {
|
|
33
37
|
"eslint": ">=9"
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
|
-
"@eslint/js": "^9.
|
|
37
|
-
"@
|
|
40
|
+
"@eslint/js": "^9.16.0",
|
|
41
|
+
"@octokit/types": "^13.6.2",
|
|
42
|
+
"@rollup/rollup-linux-x64-gnu": "^4.28.0",
|
|
38
43
|
"@stylistic/eslint-plugin": "^2.11.0",
|
|
39
|
-
"eslint-config-love": "^
|
|
40
|
-
"eslint-plugin-jsdoc": "^50.
|
|
41
|
-
"
|
|
44
|
+
"eslint-config-love": "^109.0.0",
|
|
45
|
+
"eslint-plugin-jsdoc": "^50.6.0",
|
|
46
|
+
"octokit": "^4.0.2",
|
|
47
|
+
"typescript-eslint": "^8.16.0",
|
|
48
|
+
"yaml": "^2.6.1"
|
|
42
49
|
}
|
|
43
50
|
}
|
|
@@ -25,6 +25,7 @@ export const esLintConfigAIDCToolkit = tseslint.config(
|
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
rules: {
|
|
28
|
+
"complexity": "off",
|
|
28
29
|
"no-dupe-class-members": "off",
|
|
29
30
|
"no-redeclare": "off",
|
|
30
31
|
"no-unused-vars": "off",
|
|
@@ -102,7 +103,8 @@ export const esLintConfigAIDCToolkit = tseslint.config(
|
|
|
102
103
|
],
|
|
103
104
|
rules: {
|
|
104
105
|
"jsdoc/require-jsdoc": "off",
|
|
105
|
-
"@typescript-eslint/dot-notation": "off"
|
|
106
|
+
"@typescript-eslint/dot-notation": "off",
|
|
107
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off"
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
);
|
package/src/release.ts
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { spawnSync } from "child_process";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { Octokit } from "octokit";
|
|
5
|
+
import { parse as yamlParse } from "yaml";
|
|
6
|
+
|
|
7
|
+
import configurationJSON from "../config/release.json" assert { type: "json" };
|
|
8
|
+
import secureConfigurationJSON from "../config/release.secure.json" assert { type: "json" };
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Configuration layout of release.json.
|
|
12
|
+
*/
|
|
13
|
+
interface Configuration {
|
|
14
|
+
/**
|
|
15
|
+
* Organization that owns the repositories.
|
|
16
|
+
*/
|
|
17
|
+
organization: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Repositories.
|
|
21
|
+
*/
|
|
22
|
+
repositories: Record<string, {
|
|
23
|
+
/**
|
|
24
|
+
* Directory in which repository resides, if different from repository name.
|
|
25
|
+
*/
|
|
26
|
+
directory?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Version for repository. Not all repositories will be in sync with the version.
|
|
30
|
+
*/
|
|
31
|
+
version: string;
|
|
32
|
+
}>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* If true, the fact that the repository is uncommitted is ignored. For development and testing purposes only.
|
|
36
|
+
*/
|
|
37
|
+
ignoreUncommitted?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Configuration layout of release.secure.json.
|
|
42
|
+
*/
|
|
43
|
+
interface SecureConfiguration {
|
|
44
|
+
token: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const configuration: Configuration = configurationJSON;
|
|
48
|
+
const secureConfiguration: SecureConfiguration = secureConfigurationJSON;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Configuration layout of package.json (relevant attributes only).
|
|
52
|
+
*/
|
|
53
|
+
interface PackageConfiguration {
|
|
54
|
+
/**
|
|
55
|
+
* Version.
|
|
56
|
+
*/
|
|
57
|
+
version: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Development dependencies.
|
|
61
|
+
*/
|
|
62
|
+
devDependencies?: Record<string, string>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Dependencies.
|
|
66
|
+
*/
|
|
67
|
+
dependencies?: Record<string, string>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Configuration layout of release.yml workflow (relevant attributes only).
|
|
72
|
+
*/
|
|
73
|
+
interface WorkflowConfiguration {
|
|
74
|
+
/**
|
|
75
|
+
* Workflow name.
|
|
76
|
+
*/
|
|
77
|
+
name: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Workflow trigger.
|
|
81
|
+
*/
|
|
82
|
+
on: {
|
|
83
|
+
/**
|
|
84
|
+
* Push trigger.
|
|
85
|
+
*/
|
|
86
|
+
push?: {
|
|
87
|
+
/**
|
|
88
|
+
* Push branches.
|
|
89
|
+
*/
|
|
90
|
+
branches?: string[];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Release trigger.
|
|
95
|
+
*/
|
|
96
|
+
release?: {
|
|
97
|
+
/**
|
|
98
|
+
* Release types.
|
|
99
|
+
*/
|
|
100
|
+
types?: string[];
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Run a command and optionally capture its output.
|
|
107
|
+
*
|
|
108
|
+
* @param captureOutput
|
|
109
|
+
* If true, output is captured and returned.
|
|
110
|
+
*
|
|
111
|
+
* @param command
|
|
112
|
+
* Command to run.
|
|
113
|
+
*
|
|
114
|
+
* @param args
|
|
115
|
+
* Arguments to command.
|
|
116
|
+
*
|
|
117
|
+
* @returns
|
|
118
|
+
* Output if captured or empty array if not.
|
|
119
|
+
*/
|
|
120
|
+
function run(captureOutput: boolean, command: string, ...args: string[]): string[] {
|
|
121
|
+
const spawnResult = spawnSync(command, args, {
|
|
122
|
+
stdio: ["inherit", captureOutput ? "pipe" : "inherit", "inherit"]
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (spawnResult.error !== undefined) {
|
|
126
|
+
throw spawnResult.error;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (spawnResult.status === null) {
|
|
130
|
+
throw new Error(`Terminated by signal ${spawnResult.signal}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (spawnResult.status !== 0) {
|
|
134
|
+
throw new Error(`Failed with status ${spawnResult.status}`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return captureOutput ? spawnResult.stdout.toString().split("\n").slice(0, -1) : [];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Release.
|
|
142
|
+
*/
|
|
143
|
+
async function release(): Promise<void> {
|
|
144
|
+
const statePath = path.resolve("config/release.state.json");
|
|
145
|
+
|
|
146
|
+
let state: Record<string, string | undefined> = {};
|
|
147
|
+
|
|
148
|
+
if (fs.existsSync(statePath)) {
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Format is controlled by this process.
|
|
150
|
+
state = JSON.parse(fs.readFileSync(statePath).toString());
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Save the current state.
|
|
155
|
+
*/
|
|
156
|
+
function saveState(): void {
|
|
157
|
+
fs.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}\n`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Execute a step.
|
|
162
|
+
*
|
|
163
|
+
* @param name
|
|
164
|
+
* Repository name.
|
|
165
|
+
*
|
|
166
|
+
* @param stepState
|
|
167
|
+
* State at which step takes place.
|
|
168
|
+
*
|
|
169
|
+
* @param callback
|
|
170
|
+
* Callback to execute step.
|
|
171
|
+
*
|
|
172
|
+
* @returns
|
|
173
|
+
* Promise.
|
|
174
|
+
*/
|
|
175
|
+
async function step(name: string, stepState: string, callback: () => (void | Promise<void>)): Promise<void> {
|
|
176
|
+
const repositoryState = state[name];
|
|
177
|
+
|
|
178
|
+
if (repositoryState === undefined || repositoryState === stepState) {
|
|
179
|
+
state[name] = stepState;
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
const result = callback();
|
|
183
|
+
|
|
184
|
+
if (result instanceof Promise) {
|
|
185
|
+
await result;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
state[name] = undefined;
|
|
189
|
+
} finally {
|
|
190
|
+
fs.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}\n`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const octokit = new Octokit({
|
|
196
|
+
auth: secureConfiguration.token,
|
|
197
|
+
userAgent: `${configuration.organization} release`
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
for (const name of Object.keys(configuration.repositories)) {
|
|
201
|
+
const repository = configuration.repositories[name];
|
|
202
|
+
|
|
203
|
+
console.log(`Repository ${name}...`);
|
|
204
|
+
|
|
205
|
+
// All repositories are expected to be children of the parent of this repository.
|
|
206
|
+
process.chdir(`../${repository.directory ?? name}`);
|
|
207
|
+
|
|
208
|
+
// Repository must be on main branch.
|
|
209
|
+
if (run(true, "git", "branch", "--show-current")[0] !== "main") {
|
|
210
|
+
throw new Error("Repository is not on main branch");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Repository must be fully committed except for untracked files.
|
|
214
|
+
if (!(configuration.ignoreUncommitted ?? false) && state[name] === undefined && run(true, "git", "status", "--short", "--untracked-files=no").length !== 0) {
|
|
215
|
+
throw new Error("Repository has uncommitted changes");
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const workflowsPath = ".github/workflows/";
|
|
219
|
+
|
|
220
|
+
let hasPushWorkflow = false;
|
|
221
|
+
let hasReleaseWorkflow = false;
|
|
222
|
+
|
|
223
|
+
for (const workflowFile of fs.readdirSync(workflowsPath)) {
|
|
224
|
+
if (workflowFile.endsWith(".yml")) {
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Workflow configuration format is known.
|
|
226
|
+
const workflowOn = (yamlParse(fs.readFileSync(path.resolve(workflowsPath, workflowFile)).toString()) as WorkflowConfiguration).on;
|
|
227
|
+
|
|
228
|
+
if (workflowOn.push !== undefined && (workflowOn.push.branches === undefined || workflowOn.push.branches.includes("main"))) {
|
|
229
|
+
hasPushWorkflow = true;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (workflowOn.release !== undefined && (workflowOn.release.types === undefined || workflowOn.release.types.includes("published"))) {
|
|
233
|
+
hasReleaseWorkflow = true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const tag = `v${repository.version}`;
|
|
239
|
+
|
|
240
|
+
const octokitParameterBase = {
|
|
241
|
+
owner: configuration.organization,
|
|
242
|
+
repo: name
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const commitSHA = run(true, "git", "rev-parse", "HEAD")[0];
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Validate the workflow by waiting for it to complete.
|
|
249
|
+
*/
|
|
250
|
+
async function validateWorkflow(): Promise<void> {
|
|
251
|
+
while (!await new Promise<void>((resolve) => {
|
|
252
|
+
setTimeout(resolve, 2000);
|
|
253
|
+
}).then(async () => await octokit.rest.actions.listWorkflowRunsForRepo({
|
|
254
|
+
...octokitParameterBase,
|
|
255
|
+
head_sha: commitSHA
|
|
256
|
+
})).then((response) => {
|
|
257
|
+
let workflowRunID = -1;
|
|
258
|
+
|
|
259
|
+
let queryCount = 0;
|
|
260
|
+
let completed = false;
|
|
261
|
+
|
|
262
|
+
for (const workflowRun of response.data.workflow_runs) {
|
|
263
|
+
if (workflowRun.status !== "completed") {
|
|
264
|
+
if (workflowRun.id === workflowRunID) {
|
|
265
|
+
process.stdout.write(".");
|
|
266
|
+
} else if (workflowRunID === -1) {
|
|
267
|
+
workflowRunID = workflowRun.id;
|
|
268
|
+
|
|
269
|
+
console.log(`Workflow run ID ${workflowRunID}`);
|
|
270
|
+
} else {
|
|
271
|
+
throw new Error(`Parallel workflow runs for SHA ${commitSHA}`);
|
|
272
|
+
}
|
|
273
|
+
} else if (workflowRun.id === workflowRunID) {
|
|
274
|
+
process.stdout.write("\n");
|
|
275
|
+
|
|
276
|
+
if (workflowRun.conclusion !== "success") {
|
|
277
|
+
throw new Error(`Workflow ${workflowRun.conclusion}`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
completed = true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Abort if workflow run not started after 10 queries.
|
|
285
|
+
if (++queryCount === 10 && workflowRunID === -1) {
|
|
286
|
+
throw new Error(`Workflow run not started for SHA ${commitSHA}`);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return completed;
|
|
290
|
+
})) {
|
|
291
|
+
// Execution within conditional.
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const packageConfigurationPath = "package.json";
|
|
296
|
+
|
|
297
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Package configuration format is known.
|
|
298
|
+
const packageConfiguration: PackageConfiguration = JSON.parse(fs.readFileSync(packageConfigurationPath).toString());
|
|
299
|
+
|
|
300
|
+
const skipRepository = state[name] === undefined && packageConfiguration.version === repository.version;
|
|
301
|
+
|
|
302
|
+
if (packageConfiguration.version !== repository.version) {
|
|
303
|
+
packageConfiguration.version = repository.version;
|
|
304
|
+
|
|
305
|
+
const atOrganization = `@${configuration.organization}/`;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Update dependencies from the organization.
|
|
309
|
+
*
|
|
310
|
+
* @param dependencies
|
|
311
|
+
* Dependencies.
|
|
312
|
+
*/
|
|
313
|
+
function updateDependencies(dependencies: Record<string, string> | undefined): void {
|
|
314
|
+
if (dependencies !== undefined) {
|
|
315
|
+
for (const dependency in dependencies) {
|
|
316
|
+
const [dependencyAtOrganization, dependencyRepositoryName] = dependency.split("/");
|
|
317
|
+
|
|
318
|
+
if (dependencyAtOrganization === atOrganization) {
|
|
319
|
+
dependencies[dependency] = `^${configuration.repositories[dependencyRepositoryName].version}`;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
updateDependencies(packageConfiguration.devDependencies);
|
|
326
|
+
updateDependencies(packageConfiguration.dependencies);
|
|
327
|
+
|
|
328
|
+
fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}\n`);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (!skipRepository) {
|
|
332
|
+
await step(name, "npm install", () => {
|
|
333
|
+
run(false, "npm", "install");
|
|
334
|
+
}).then(async () => {
|
|
335
|
+
await step(name, "git commit", () => {
|
|
336
|
+
run(false, "git", "commit", "--all", `--message=Updated to version ${repository.version}`);
|
|
337
|
+
});
|
|
338
|
+
}).then(async () => {
|
|
339
|
+
await step(name, "git tag", () => {
|
|
340
|
+
run(false, "git", "tag", tag);
|
|
341
|
+
});
|
|
342
|
+
}).then(async () => {
|
|
343
|
+
await step(name, "git push", () => {
|
|
344
|
+
run(false, "git", "push", "--atomic", "origin", "main", tag);
|
|
345
|
+
});
|
|
346
|
+
}).then(async () => {
|
|
347
|
+
await step(name, "push workflow", async () => {
|
|
348
|
+
if (hasPushWorkflow) {
|
|
349
|
+
await validateWorkflow();
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}).then(async () => {
|
|
353
|
+
await step(name, "release", async () => {
|
|
354
|
+
const versionSplit = repository.version.split("-");
|
|
355
|
+
const prerelease = versionSplit.length !== 1;
|
|
356
|
+
|
|
357
|
+
await octokit.rest.repos.createRelease({
|
|
358
|
+
...octokitParameterBase,
|
|
359
|
+
tag_name: tag,
|
|
360
|
+
name: `${prerelease ? `${versionSplit[1].substring(0, 1).toUpperCase()}${versionSplit[1].substring(1)} r` : "R"}elease ${versionSplit[0]}`,
|
|
361
|
+
// TODO Remove "false" override.
|
|
362
|
+
prerelease: false
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
}).then(async () => {
|
|
366
|
+
await step(name, "release workflow", async () => {
|
|
367
|
+
if (hasReleaseWorkflow) {
|
|
368
|
+
await validateWorkflow();
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
state[name] = "complete";
|
|
374
|
+
saveState();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
state = {};
|
|
379
|
+
saveState();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
await release().catch((e: unknown) => {
|
|
383
|
+
console.error(e);
|
|
384
|
+
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Create a report to help us improve
|
|
4
|
-
title: ''
|
|
5
|
-
labels: ''
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Describe the bug**
|
|
11
|
-
A clear and concise description of what the bug is.
|
|
12
|
-
|
|
13
|
-
**To Reproduce**
|
|
14
|
-
Steps to reproduce the behavior:
|
|
15
|
-
1. Go to '...'
|
|
16
|
-
2. Click on '....'
|
|
17
|
-
3. Scroll down to '....'
|
|
18
|
-
4. See error
|
|
19
|
-
|
|
20
|
-
**Expected behavior**
|
|
21
|
-
A clear and concise description of what you expected to happen.
|
|
22
|
-
|
|
23
|
-
**Screenshots**
|
|
24
|
-
If applicable, add screenshots to help explain your problem.
|
|
25
|
-
|
|
26
|
-
**Platform**
|
|
27
|
-
- OS: [e.g. Windows, iOS]
|
|
28
|
-
- Browser [e.g. chrome, safari]
|
|
29
|
-
- Browser Version [e.g. 22]
|
|
30
|
-
|
|
31
|
-
**Additional context**
|
|
32
|
-
Add any other context about the problem here.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Feature request
|
|
3
|
-
about: Suggest an idea for this project
|
|
4
|
-
title: ''
|
|
5
|
-
labels: ''
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Is your feature request related to a problem? Please describe.**
|
|
11
|
-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
-
|
|
13
|
-
**Describe the solution you'd like**
|
|
14
|
-
A clear and concise description of what you want to happen.
|
|
15
|
-
|
|
16
|
-
**Describe alternatives you've considered**
|
|
17
|
-
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
-
|
|
19
|
-
**Additional context**
|
|
20
|
-
Add any other context or screenshots about the feature request here.
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
name: Build project and publish to NPM
|
|
2
|
-
|
|
3
|
-
inputs:
|
|
4
|
-
project:
|
|
5
|
-
description: Project to be built and published
|
|
6
|
-
required: true
|
|
7
|
-
node_version:
|
|
8
|
-
description: Node version
|
|
9
|
-
required: true
|
|
10
|
-
node_auth_token:
|
|
11
|
-
description: Node authentication token for publishing to NPM
|
|
12
|
-
required: true
|
|
13
|
-
no_test:
|
|
14
|
-
description: If true, test is not run
|
|
15
|
-
required: false
|
|
16
|
-
terminal_pre_build:
|
|
17
|
-
description: If true, terminal session is started before build step is run
|
|
18
|
-
required: false
|
|
19
|
-
terminal_post_build:
|
|
20
|
-
description: If true, terminal session is started after build step is run
|
|
21
|
-
required: false
|
|
22
|
-
|
|
23
|
-
runs:
|
|
24
|
-
using: composite
|
|
25
|
-
|
|
26
|
-
steps:
|
|
27
|
-
- name: Setup node
|
|
28
|
-
uses: actions/setup-node@v4
|
|
29
|
-
with:
|
|
30
|
-
node-version: ${{ inputs.node_version }}
|
|
31
|
-
registry-url: https://registry.npmjs.org/
|
|
32
|
-
|
|
33
|
-
- name: Checkout
|
|
34
|
-
uses: actions/checkout@v4
|
|
35
|
-
|
|
36
|
-
- name: Start terminal session (pre build)
|
|
37
|
-
if: inputs.terminal_pre_build == 'true'
|
|
38
|
-
uses: mxschmitt/action-tmate@v3
|
|
39
|
-
|
|
40
|
-
- name: Build ${{ inputs.project }}
|
|
41
|
-
shell: bash
|
|
42
|
-
run: |
|
|
43
|
-
# Removing package-lock.json is necessary to force download of all dependencies including linked dependencies.
|
|
44
|
-
rm package-lock.json
|
|
45
|
-
|
|
46
|
-
npm install
|
|
47
|
-
|
|
48
|
-
# This is necessary to work around platform-specific optional dependencies bug
|
|
49
|
-
# (https://github.com/npm/cli/issues/4828).
|
|
50
|
-
npm install @rollup/rollup-linux-x64-gnu
|
|
51
|
-
|
|
52
|
-
# All projects have build script.
|
|
53
|
-
npm run build
|
|
54
|
-
|
|
55
|
-
- name: Start terminal session (post build)
|
|
56
|
-
if: inputs.terminal_post_build == 'true'
|
|
57
|
-
uses: mxschmitt/action-tmate@v3
|
|
58
|
-
|
|
59
|
-
- name: Test ${{ inputs.project }}
|
|
60
|
-
if: inputs.no_test != 'true'
|
|
61
|
-
shell: bash
|
|
62
|
-
run: |
|
|
63
|
-
# Project must have test script.
|
|
64
|
-
npm run test
|
|
65
|
-
|
|
66
|
-
- name: Publish ${{ inputs.project }}
|
|
67
|
-
# Publish is valid only as part of release.
|
|
68
|
-
if: github.event_name == 'release'
|
|
69
|
-
shell: bash
|
|
70
|
-
env:
|
|
71
|
-
NODE_AUTH_TOKEN: ${{ inputs.node_auth_token }}
|
|
72
|
-
run: |
|
|
73
|
-
npm publish --access public
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Build and publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types:
|
|
6
|
-
- published
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build-and-publish:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: Build and publish dev
|
|
14
|
-
uses: aidc-toolkit/dev/.github/actions/build-publish@main
|
|
15
|
-
with:
|
|
16
|
-
project: dev
|
|
17
|
-
node_version: ${{ vars.NODE_VERSION }}
|
|
18
|
-
node_auth_token: ${{ secrets.NODE_AUTH_TOKEN }}
|
|
19
|
-
no_test: true
|
|
20
|
-
terminal_pre_build: ${{ vars.TERMINAL_PRE_BUILD }}
|
|
21
|
-
terminal_post_build: ${{ vars.TERMINAL_POST_BUILD }}
|
package/.idea/dev.iml
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
</component>
|
|
9
|
-
</module>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<component name="InspectionProjectProfileManager">
|
|
2
|
-
<profile version="1.0">
|
|
3
|
-
<option name="myName" value="Project Default" />
|
|
4
|
-
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
5
|
-
<inspection_tool class="UpdateDependencyToLatestVersion" enabled="true" level="WARNING" enabled_by_default="true" editorAttributes="WARNING_ATTRIBUTES" />
|
|
6
|
-
</profile>
|
|
7
|
-
</component>
|
package/.idea/misc.xml
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
|
|
4
|
-
<output url="file://$PROJECT_DIR$/out" />
|
|
5
|
-
</component>
|
|
6
|
-
</project>
|
package/.idea/modules.xml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<component name="ProjectRunConfigurationManager">
|
|
2
|
-
<configuration default="false" name="build" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
-
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
-
<command value="run" />
|
|
5
|
-
<scripts>
|
|
6
|
-
<script value="build" />
|
|
7
|
-
</scripts>
|
|
8
|
-
<node-interpreter value="project" />
|
|
9
|
-
<envs />
|
|
10
|
-
<method v="2" />
|
|
11
|
-
</configuration>
|
|
12
|
-
</component>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<component name="ProjectRunConfigurationManager">
|
|
2
|
-
<configuration default="false" name="eslint" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
-
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
-
<command value="run" />
|
|
5
|
-
<scripts>
|
|
6
|
-
<script value="eslint" />
|
|
7
|
-
</scripts>
|
|
8
|
-
<node-interpreter value="project" />
|
|
9
|
-
<envs />
|
|
10
|
-
<method v="2" />
|
|
11
|
-
</configuration>
|
|
12
|
-
</component>
|