@aidc-toolkit/dev 0.9.12-beta → 0.9.13-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.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { publishDev } from "@aidc-toolkit/dev";
3
+
4
+ try {
5
+ publishDev();
6
+ } catch (e) {
7
+ console.error(e);
8
+ }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env tsx
2
+ import { publishDev } from "../src/publish-dev.js";
3
+
4
+ try {
5
+ publishDev();
6
+ } catch (e) {
7
+ console.error(e);
8
+ }
@@ -2,24 +2,24 @@
2
2
  "organization": "aidc-toolkit",
3
3
  "repositories": {
4
4
  "dev": {
5
- "version": "0.9.12-beta"
5
+ "version": "0.9.13-beta"
6
6
  },
7
7
  "core": {
8
- "version": "0.9.12-beta"
8
+ "version": "0.9.13-beta"
9
9
  },
10
10
  "utility": {
11
- "version": "0.9.12-beta"
11
+ "version": "0.9.13-beta"
12
12
  },
13
13
  "gs1": {
14
14
  "name": "gs1",
15
- "version": "0.9.12-beta"
15
+ "version": "0.9.13-beta"
16
16
  },
17
17
  "demo": {
18
- "version": "0.9.12-beta"
18
+ "version": "0.9.13-beta"
19
19
  },
20
20
  "aidc-toolkit.github.io": {
21
21
  "directory": "doc",
22
- "version": "0.9.12-beta"
22
+ "version": "0.9.13-beta"
23
23
  }
24
24
  }
25
25
  }
package/dist/index.cjs CHANGED
@@ -1,150 +1,5 @@
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
- });
35
- module.exports = __toCommonJS(index_exports);
36
-
37
- // src/eslint-config-template.ts
38
- var import_js = __toESM(require("@eslint/js"), 1);
39
- var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
40
- var import_eslint_config_love = __toESM(require("eslint-config-love"), 1);
41
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
42
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
43
- var esLintConfigAIDCToolkit = import_typescript_eslint.default.config(
44
- {
45
- ignores: ["dist"]
46
- },
47
- import_js.default.configs.recommended,
48
- ...import_typescript_eslint.default.configs.strictTypeChecked,
49
- import_eslint_plugin.default.configs["recommended-flat"],
50
- import_eslint_plugin_jsdoc.default.configs["flat/recommended-typescript"],
51
- import_eslint_config_love.default,
52
- {
53
- languageOptions: {
54
- parserOptions: {
55
- projectService: true
56
- }
57
- },
58
- linterOptions: {
59
- reportUnusedDisableDirectives: "error"
60
- },
61
- rules: {
62
- "complexity": "off",
63
- "max-lines": "off",
64
- "no-dupe-class-members": "off",
65
- "no-redeclare": "off",
66
- "no-unused-vars": "off",
67
- "@typescript-eslint/class-literal-property-style": "off",
68
- "@typescript-eslint/class-methods-use-this": "off",
69
- "@typescript-eslint/init-declarations": "off",
70
- "@typescript-eslint/max-params": "off",
71
- "@typescript-eslint/no-empty-function": "off",
72
- "@typescript-eslint/no-empty-object-type": "off",
73
- "@typescript-eslint/no-magic-numbers": "off",
74
- "@typescript-eslint/no-unnecessary-type-parameters": "off",
75
- "@typescript-eslint/no-unused-vars": [
76
- "error",
77
- {
78
- argsIgnorePattern: "^_",
79
- varsIgnorePattern: "^_",
80
- caughtErrorsIgnorePattern: "^_"
81
- }
82
- ],
83
- "@typescript-eslint/prefer-destructuring": "off",
84
- "@typescript-eslint/unbound-method": ["error", {
85
- ignoreStatic: true
86
- }],
87
- "@stylistic/array-bracket-newline": ["error", "consistent"],
88
- "@stylistic/brace-style": ["error", "1tbs", {
89
- allowSingleLine: false
90
- }],
91
- "@stylistic/comma-dangle": ["error", "never"],
92
- "@stylistic/indent": ["error", 4],
93
- "@stylistic/member-delimiter-style": ["error", {
94
- multiline: {
95
- delimiter: "semi",
96
- requireLast: true
97
- },
98
- singleline: {
99
- delimiter: "semi"
100
- }
101
- }],
102
- "@stylistic/no-trailing-spaces": ["off"],
103
- "@stylistic/operator-linebreak": ["error", "after"],
104
- "@stylistic/quotes": ["error", "double"],
105
- "@stylistic/semi": ["error", "always"],
106
- "@stylistic/object-curly-newline": ["error", {
107
- ObjectExpression: {
108
- multiline: true,
109
- minProperties: 1
110
- },
111
- ObjectPattern: {
112
- multiline: true,
113
- minProperties: 1
114
- }
115
- }],
116
- "@stylistic/object-property-newline": "error",
117
- "jsdoc/require-description": ["warn", {
118
- contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
119
- }],
120
- "jsdoc/require-jsdoc": ["warn", {
121
- contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
122
- }],
123
- "jsdoc/require-returns": ["warn", {
124
- checkGetters: false
125
- }],
126
- "jsdoc/tag-lines": ["warn", "any", {
127
- count: 1,
128
- startLines: 1
129
- }]
130
- }
131
- },
132
- {
133
- files: [
134
- "test/**/*"
135
- ],
136
- rules: {
137
- "max-nested-callbacks": "off",
138
- "jsdoc/require-jsdoc": "off",
139
- "@typescript-eslint/dot-notation": "off",
140
- "@typescript-eslint/no-unsafe-type-assertion": "off"
141
- }
142
- }
143
- );
144
- // Annotate the CommonJS export names for ESM import in node:
145
- 0 && (module.exports = {
146
- esLintConfigAIDCToolkit
147
- });
1
+ "use strict";var j=Object.create;var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var i in t)a(e,i,{get:t[i],enumerable:!0})},f=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of k(t))!x.call(e,s)&&s!==i&&a(e,s,{get:()=>t[s],enumerable:!(r=v(t,s))||r.enumerable});return e};var o=(e,t,i)=>(i=e!=null?j(P(e)):{},f(t||!e||!e.__esModule?a(i,"default",{value:e,enumerable:!0}):i,e)),T=e=>f(a({},"__esModule",{value:!0}),e);var F={};C(F,{esLintConfigAIDCToolkit:()=>$,publishDev:()=>O});module.exports=T(F);var u=o(require("@eslint/js"),1),m=o(require("@stylistic/eslint-plugin"),1),d=o(require("eslint-config-love"),1),g=o(require("eslint-plugin-jsdoc"),1),p=o(require("typescript-eslint"),1),$=p.default.config({ignores:["dist"]},u.default.configs.recommended,...p.default.configs.strictTypeChecked,m.default.configs["recommended-flat"],g.default.configs["flat/recommended-typescript"],d.default,{languageOptions:{parserOptions:{projectService:!0}},linterOptions:{reportUnusedDisableDirectives:"error"},rules:{complexity:"off","max-lines":"off","no-dupe-class-members":"off","no-redeclare":"off","no-unused-vars":"off","@typescript-eslint/class-literal-property-style":"off","@typescript-eslint/class-methods-use-this":"off","@typescript-eslint/init-declarations":"off","@typescript-eslint/max-params":"off","@typescript-eslint/no-empty-function":"off","@typescript-eslint/no-empty-object-type":"off","@typescript-eslint/no-magic-numbers":"off","@typescript-eslint/no-unnecessary-type-parameters":"off","@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",varsIgnorePattern:"^_",caughtErrorsIgnorePattern:"^_"}],"@typescript-eslint/prefer-destructuring":"off","@typescript-eslint/unbound-method":["error",{ignoreStatic:!0}],"@stylistic/array-bracket-newline":["error","consistent"],"@stylistic/brace-style":["error","1tbs",{allowSingleLine:!1}],"@stylistic/comma-dangle":["error","never"],"@stylistic/indent":["error",4],"@stylistic/member-delimiter-style":["error",{multiline:{delimiter:"semi",requireLast:!0},singleline:{delimiter:"semi"}}],"@stylistic/no-trailing-spaces":["off"],"@stylistic/operator-linebreak":["error","after"],"@stylistic/quotes":["error","double"],"@stylistic/semi":["error","always"],"@stylistic/object-curly-newline":["error",{ObjectExpression:{multiline:!0,minProperties:1},ObjectPattern:{multiline:!0,minProperties:1}}],"@stylistic/object-property-newline":"error","jsdoc/require-description":["warn",{contexts:["ClassDeclaration","ClassProperty","FunctionDeclaration","MethodDefinition","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]}],"jsdoc/require-jsdoc":["warn",{contexts:["ClassDeclaration","ClassProperty","FunctionDeclaration","MethodDefinition","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]}],"jsdoc/require-returns":["warn",{checkGetters:!1}],"jsdoc/tag-lines":["warn","any",{count:1,startLines:1}]}},{files:["test/**/*"],rules:{"max-nested-callbacks":"off","jsdoc/require-jsdoc":"off","@typescript-eslint/dot-notation":"off","@typescript-eslint/no-unsafe-type-assertion":"off"}});var n=o(require("fs"),1);var y=require("child_process");function c(e,t,...i){let r=(0,y.spawnSync)(t,i,{stdio:["inherit",e?"pipe":"inherit","inherit"]});if(r.error!==void 0)throw r.error;if(r.status===null)throw new Error(`Terminated by signal ${r.signal}`);if(r.status!==0)throw new Error(`Failed with status ${r.status}`);return e?r.stdout.toString().split(`
2
+ `).slice(0,-1):[]}function l(e,t){return`${"0".repeat(t-1)}${e}`.slice(-t)}function b(e,t){if(t!==void 0)for(let i in t)i.split("/")[0]===e&&(t[i]="alpha")}function O(){c(!1,"npm","update","--save");let e=new Date,t="package.json",i="_package.json",r=JSON.parse(n.readFileSync(t).toString()),s=r.name.split("/")[0];b(s,r.devDependencies),b(s,r.dependencies),n.writeFileSync(t,JSON.stringify(r,null,2)),n.renameSync(t,i);try{let[h,D,S]=r.version.split("-")[0].split(".").map(w=>Number(w));r.version=`${h}.${D}.${S+1}-alpha.${e.getFullYear()}${l(e.getMonth()+1,2)}${l(e.getDate(),2)}${l(e.getHours(),2)}${l(e.getMinutes(),2)}`,n.writeFileSync(t,JSON.stringify(r,null,2)),c(!1,"npm","run","build:dev"),c(!1,"npm","publish","--tag","alpha")}finally{n.rmSync(t),n.renameSync(i,t)}}0&&(module.exports={esLintConfigAIDCToolkit,publishDev});
148
3
  /*!
149
4
  * Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
150
5
  * contributors
package/dist/index.d.cts CHANGED
@@ -2,4 +2,9 @@ import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts
2
2
 
3
3
  declare const esLintConfigAIDCToolkit: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
4
4
 
5
- export { esLintConfigAIDCToolkit };
5
+ /**
6
+ * Publish to development npm registry.
7
+ */
8
+ declare function publishDev(): void;
9
+
10
+ export { esLintConfigAIDCToolkit, publishDev };
package/dist/index.d.ts CHANGED
@@ -2,4 +2,9 @@ import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts
2
2
 
3
3
  declare const esLintConfigAIDCToolkit: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
4
4
 
5
- export { esLintConfigAIDCToolkit };
5
+ /**
6
+ * Publish to development npm registry.
7
+ */
8
+ declare function publishDev(): void;
9
+
10
+ export { esLintConfigAIDCToolkit, publishDev };
package/dist/index.js CHANGED
@@ -1,113 +1,5 @@
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-flat"],
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-lines": "off",
28
- "no-dupe-class-members": "off",
29
- "no-redeclare": "off",
30
- "no-unused-vars": "off",
31
- "@typescript-eslint/class-literal-property-style": "off",
32
- "@typescript-eslint/class-methods-use-this": "off",
33
- "@typescript-eslint/init-declarations": "off",
34
- "@typescript-eslint/max-params": "off",
35
- "@typescript-eslint/no-empty-function": "off",
36
- "@typescript-eslint/no-empty-object-type": "off",
37
- "@typescript-eslint/no-magic-numbers": "off",
38
- "@typescript-eslint/no-unnecessary-type-parameters": "off",
39
- "@typescript-eslint/no-unused-vars": [
40
- "error",
41
- {
42
- argsIgnorePattern: "^_",
43
- varsIgnorePattern: "^_",
44
- caughtErrorsIgnorePattern: "^_"
45
- }
46
- ],
47
- "@typescript-eslint/prefer-destructuring": "off",
48
- "@typescript-eslint/unbound-method": ["error", {
49
- ignoreStatic: true
50
- }],
51
- "@stylistic/array-bracket-newline": ["error", "consistent"],
52
- "@stylistic/brace-style": ["error", "1tbs", {
53
- allowSingleLine: false
54
- }],
55
- "@stylistic/comma-dangle": ["error", "never"],
56
- "@stylistic/indent": ["error", 4],
57
- "@stylistic/member-delimiter-style": ["error", {
58
- multiline: {
59
- delimiter: "semi",
60
- requireLast: true
61
- },
62
- singleline: {
63
- delimiter: "semi"
64
- }
65
- }],
66
- "@stylistic/no-trailing-spaces": ["off"],
67
- "@stylistic/operator-linebreak": ["error", "after"],
68
- "@stylistic/quotes": ["error", "double"],
69
- "@stylistic/semi": ["error", "always"],
70
- "@stylistic/object-curly-newline": ["error", {
71
- ObjectExpression: {
72
- multiline: true,
73
- minProperties: 1
74
- },
75
- ObjectPattern: {
76
- multiline: true,
77
- minProperties: 1
78
- }
79
- }],
80
- "@stylistic/object-property-newline": "error",
81
- "jsdoc/require-description": ["warn", {
82
- contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
83
- }],
84
- "jsdoc/require-jsdoc": ["warn", {
85
- contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
86
- }],
87
- "jsdoc/require-returns": ["warn", {
88
- checkGetters: false
89
- }],
90
- "jsdoc/tag-lines": ["warn", "any", {
91
- count: 1,
92
- startLines: 1
93
- }]
94
- }
95
- },
96
- {
97
- files: [
98
- "test/**/*"
99
- ],
100
- rules: {
101
- "max-nested-callbacks": "off",
102
- "jsdoc/require-jsdoc": "off",
103
- "@typescript-eslint/dot-notation": "off",
104
- "@typescript-eslint/no-unsafe-type-assertion": "off"
105
- }
106
- }
107
- );
108
- export {
109
- esLintConfigAIDCToolkit
110
- };
1
+ import d from"@eslint/js";import g from"@stylistic/eslint-plugin";import y from"eslint-config-love";import b from"eslint-plugin-jsdoc";import c from"typescript-eslint";var k=c.config({ignores:["dist"]},d.configs.recommended,...c.configs.strictTypeChecked,g.configs["recommended-flat"],b.configs["flat/recommended-typescript"],y,{languageOptions:{parserOptions:{projectService:!0}},linterOptions:{reportUnusedDisableDirectives:"error"},rules:{complexity:"off","max-lines":"off","no-dupe-class-members":"off","no-redeclare":"off","no-unused-vars":"off","@typescript-eslint/class-literal-property-style":"off","@typescript-eslint/class-methods-use-this":"off","@typescript-eslint/init-declarations":"off","@typescript-eslint/max-params":"off","@typescript-eslint/no-empty-function":"off","@typescript-eslint/no-empty-object-type":"off","@typescript-eslint/no-magic-numbers":"off","@typescript-eslint/no-unnecessary-type-parameters":"off","@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",varsIgnorePattern:"^_",caughtErrorsIgnorePattern:"^_"}],"@typescript-eslint/prefer-destructuring":"off","@typescript-eslint/unbound-method":["error",{ignoreStatic:!0}],"@stylistic/array-bracket-newline":["error","consistent"],"@stylistic/brace-style":["error","1tbs",{allowSingleLine:!1}],"@stylistic/comma-dangle":["error","never"],"@stylistic/indent":["error",4],"@stylistic/member-delimiter-style":["error",{multiline:{delimiter:"semi",requireLast:!0},singleline:{delimiter:"semi"}}],"@stylistic/no-trailing-spaces":["off"],"@stylistic/operator-linebreak":["error","after"],"@stylistic/quotes":["error","double"],"@stylistic/semi":["error","always"],"@stylistic/object-curly-newline":["error",{ObjectExpression:{multiline:!0,minProperties:1},ObjectPattern:{multiline:!0,minProperties:1}}],"@stylistic/object-property-newline":"error","jsdoc/require-description":["warn",{contexts:["ClassDeclaration","ClassProperty","FunctionDeclaration","MethodDefinition","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]}],"jsdoc/require-jsdoc":["warn",{contexts:["ClassDeclaration","ClassProperty","FunctionDeclaration","MethodDefinition","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]}],"jsdoc/require-returns":["warn",{checkGetters:!1}],"jsdoc/tag-lines":["warn","any",{count:1,startLines:1}]}},{files:["test/**/*"],rules:{"max-nested-callbacks":"off","jsdoc/require-jsdoc":"off","@typescript-eslint/dot-notation":"off","@typescript-eslint/no-unsafe-type-assertion":"off"}});import*as i from"fs";import{spawnSync as h}from"child_process";function s(r,e,...n){let t=h(e,n,{stdio:["inherit",r?"pipe":"inherit","inherit"]});if(t.error!==void 0)throw t.error;if(t.status===null)throw new Error(`Terminated by signal ${t.signal}`);if(t.status!==0)throw new Error(`Failed with status ${t.status}`);return r?t.stdout.toString().split(`
2
+ `).slice(0,-1):[]}function o(r,e){return`${"0".repeat(e-1)}${r}`.slice(-e)}function l(r,e){if(e!==void 0)for(let n in e)n.split("/")[0]===r&&(e[n]="alpha")}function $(){s(!1,"npm","update","--save");let r=new Date,e="package.json",n="_package.json",t=JSON.parse(i.readFileSync(e).toString()),a=t.name.split("/")[0];l(a,t.devDependencies),l(a,t.dependencies),i.writeFileSync(e,JSON.stringify(t,null,2)),i.renameSync(e,n);try{let[p,f,u]=t.version.split("-")[0].split(".").map(m=>Number(m));t.version=`${p}.${f}.${u+1}-alpha.${r.getFullYear()}${o(r.getMonth()+1,2)}${o(r.getDate(),2)}${o(r.getHours(),2)}${o(r.getMinutes(),2)}`,i.writeFileSync(e,JSON.stringify(t,null,2)),s(!1,"npm","run","build:dev"),s(!1,"npm","publish","--tag","alpha")}finally{i.rmSync(e),i.renameSync(n,e)}}export{k as esLintConfigAIDCToolkit,$ as publishDev};
111
3
  /*!
112
4
  * Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
113
5
  * contributors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aidc-toolkit/dev",
3
- "version": "0.9.12-beta",
3
+ "version": "0.9.13-beta",
4
4
  "description": "Shared development artefacts for AIDC Toolkit",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,26 +21,31 @@
21
21
  "scripts": {
22
22
  "copy-workflows": "copy-files-from-to --config copy-workflows.json",
23
23
  "lint": "eslint .",
24
- "release": "tsx src/release.ts",
25
- "build-dist": "tsup src/index.ts --format cjs,esm --dts",
26
- "build-doc": "npm run build-dist"
24
+ "build:core": "tsup src/index.ts --format cjs,esm --dts --clean",
25
+ "build:dev": "npm run build:core && tsc src/index.ts --outDir dist --target esnext --moduleResolution nodenext --module nodenext --emitDeclarationOnly --declaration --declarationMap",
26
+ "build:release": "npm run build:core -- --minify",
27
+ "publish-dev": "bin/publish-dev-local",
28
+ "release": "tsx src/release.ts"
29
+ },
30
+ "bin": {
31
+ "publish-dev": "bin/publish-dev"
27
32
  },
28
33
  "devDependencies": {
29
- "copy-files-from-to": "^3.12.0",
30
- "eslint": "^9.20.1",
31
- "jiti": "^2.4.2",
32
- "ts-node": "^10.9.2",
33
- "tsup": "^8.3.6",
34
- "tsx": "^4.19.2",
35
- "typescript": "^5.7.3"
34
+ "copy-files-from-to": "^3.12.0"
36
35
  },
37
36
  "dependencies": {
38
37
  "@eslint/js": "^9.20.0",
39
38
  "@octokit/types": "^13.8.0",
40
39
  "@stylistic/eslint-plugin": "^3.1.0",
40
+ "eslint": "^9.20.1",
41
41
  "eslint-config-love": "^118.0.0",
42
42
  "eslint-plugin-jsdoc": "^50.6.3",
43
+ "jiti": "^2.4.2",
43
44
  "octokit": "^4.1.2",
45
+ "ts-node": "^10.9.2",
46
+ "tsup": "^8.3.6",
47
+ "tsx": "^4.19.2",
48
+ "typescript": "^5.7.3",
44
49
  "typescript-eslint": "^8.24.0",
45
50
  "yaml": "^2.7.0"
46
51
  }
@@ -0,0 +1,36 @@
1
+ import { spawnSync } from "child_process";
2
+
3
+ /**
4
+ * Run a command and optionally capture its output.
5
+ *
6
+ * @param captureOutput
7
+ * If true, output is captured and returned.
8
+ *
9
+ * @param command
10
+ * Command to run.
11
+ *
12
+ * @param args
13
+ * Arguments to command.
14
+ *
15
+ * @returns
16
+ * Output if captured or empty array if not.
17
+ */
18
+ export function run(captureOutput: boolean, command: string, ...args: string[]): string[] {
19
+ const spawnResult = spawnSync(command, args, {
20
+ stdio: ["inherit", captureOutput ? "pipe" : "inherit", "inherit"]
21
+ });
22
+
23
+ if (spawnResult.error !== undefined) {
24
+ throw spawnResult.error;
25
+ }
26
+
27
+ if (spawnResult.status === null) {
28
+ throw new Error(`Terminated by signal ${spawnResult.signal}`);
29
+ }
30
+
31
+ if (spawnResult.status !== 0) {
32
+ throw new Error(`Failed with status ${spawnResult.status}`);
33
+ }
34
+
35
+ return captureOutput ? spawnResult.stdout.toString().split("\n").slice(0, -1) : [];
36
+ }
package/src/index.ts CHANGED
@@ -15,3 +15,4 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  export * from "./eslint-config-template.js";
18
+ export * from "./publish-dev.js";
@@ -0,0 +1,110 @@
1
+ import * as fs from "fs";
2
+ import { run } from "./command-util.js";
3
+
4
+ /**
5
+ * Configuration layout of package.json (relevant attributes only).
6
+ */
7
+ interface PackageConfiguration {
8
+ /**
9
+ * Name.
10
+ */
11
+ name: string;
12
+
13
+ /**
14
+ * Version.
15
+ */
16
+ version: string;
17
+
18
+ /**
19
+ * Development dependencies.
20
+ */
21
+ devDependencies?: Record<string, string>;
22
+
23
+ /**
24
+ * Dependencies.
25
+ */
26
+ dependencies?: Record<string, string>;
27
+ }
28
+
29
+ /**
30
+ * Convert a number to a zero-padded string.
31
+ *
32
+ * @param n
33
+ * Number.
34
+ *
35
+ * @param length
36
+ * Length of required string.
37
+ *
38
+ * @returns
39
+ * Zero-padded string.
40
+ */
41
+ function zeroPadded(n: number, length: number): string {
42
+ return `${"0".repeat(length - 1)}${n}`.slice(-length);
43
+ }
44
+
45
+ /**
46
+ * Fix alpha dependencies from the organization.
47
+ *
48
+ * @param atOrganization
49
+ * '@' symbol and organization.
50
+ * @param dependencies
51
+ * Dependencies.
52
+ */
53
+ function fixAlphaDependencies(atOrganization: string, dependencies: Record<string, string> | undefined): void {
54
+ if (dependencies !== undefined) {
55
+ for (const dependency in dependencies) {
56
+ if (dependency.split("/")[0] === atOrganization) {
57
+ // npm update --save updates this with the latest.
58
+ dependencies[dependency] = "alpha";
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Publish to development npm registry.
66
+ */
67
+ export function publishDev(): void {
68
+ // Ensure that packages are up to date.
69
+ run(false, "npm", "update", "--save");
70
+
71
+ const now = new Date();
72
+
73
+ const packageConfigurationPath = "package.json";
74
+ const backupPackageConfigurationPath = "_package.json";
75
+
76
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Package configuration format is known.
77
+ const packageConfiguration: PackageConfiguration = JSON.parse(fs.readFileSync(packageConfigurationPath).toString());
78
+
79
+ const atOrganization = packageConfiguration.name.split("/")[0];
80
+
81
+ fixAlphaDependencies(atOrganization, packageConfiguration.devDependencies);
82
+ fixAlphaDependencies(atOrganization, packageConfiguration.dependencies);
83
+
84
+ // Save the package configuration.
85
+ fs.writeFileSync(packageConfigurationPath, JSON.stringify(packageConfiguration, null, 2));
86
+
87
+ // Backup the package configuration file.
88
+ fs.renameSync(packageConfigurationPath, backupPackageConfigurationPath);
89
+
90
+ try {
91
+ // Strip pre-release identifier if any and parse semantic version into its components.
92
+ const [majorVersion, minorVersion, patchVersion] = packageConfiguration.version.split("-")[0].split(".").map(versionString => Number(versionString));
93
+
94
+ // Set version to alpha version with incremental patch version number.
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
+
97
+ // Save the package configuration.
98
+ fs.writeFileSync(packageConfigurationPath, JSON.stringify(packageConfiguration, null, 2));
99
+
100
+ // Run the development build.
101
+ run(false, "npm", "run", "build:dev");
102
+
103
+ // Publish to the registry.
104
+ run(false, "npm", "publish", "--tag", "alpha");
105
+ } finally {
106
+ // Restore the package configuration file.
107
+ fs.rmSync(packageConfigurationPath);
108
+ fs.renameSync(backupPackageConfigurationPath, packageConfigurationPath);
109
+ }
110
+ }
package/src/release.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable no-console -- Console application. */
2
2
 
3
- import { spawnSync } from "child_process";
4
3
  import * as fs from "fs";
5
4
  import * as path from "node:path";
6
5
  import * as util from "node:util";
@@ -9,6 +8,7 @@ import { parse as yamlParse } from "yaml";
9
8
 
10
9
  import configurationJSON from "../config/release.json" assert { type: "json" };
11
10
  import secureConfigurationJSON from "../config/release.secure.json" assert { type: "json" };
11
+ import { run } from "./command-util.js";
12
12
 
13
13
  /**
14
14
  * Configuration layout of release.json.
@@ -60,7 +60,7 @@ interface PackageConfiguration {
60
60
  version: string;
61
61
 
62
62
  /**
63
- * If true, package is private and not linked by others.
63
+ * If true, package is private and not referenced by others.
64
64
  */
65
65
  private?: boolean;
66
66
 
@@ -110,58 +110,20 @@ interface WorkflowConfiguration {
110
110
  };
111
111
  }
112
112
 
113
- /**
114
- * Run a command and optionally capture its output.
115
- *
116
- * @param captureOutput
117
- * If true, output is captured and returned.
118
- *
119
- * @param command
120
- * Command to run.
121
- *
122
- * @param args
123
- * Arguments to command.
124
- *
125
- * @returns
126
- * Output if captured or empty array if not.
127
- */
128
- function run(captureOutput: boolean, command: string, ...args: string[]): string[] {
129
- const spawnResult = spawnSync(command, args, {
130
- stdio: ["inherit", captureOutput ? "pipe" : "inherit", "inherit"]
131
- });
132
-
133
- if (spawnResult.error !== undefined) {
134
- throw spawnResult.error;
135
- }
136
-
137
- if (spawnResult.status === null) {
138
- throw new Error(`Terminated by signal ${spawnResult.signal}`);
139
- }
140
-
141
- if (spawnResult.status !== 0) {
142
- throw new Error(`Failed with status ${spawnResult.status}`);
143
- }
144
-
145
- return captureOutput ? spawnResult.stdout.toString().split("\n").slice(0, -1) : [];
146
- }
147
-
148
113
  /**
149
114
  * Supported states.
150
115
  */
151
- type State = "skipped" | "install" | "build" | "link" | "commit" | "tag" | "push" | "workflow (push)" | "release" | "workflow (release)" | "complete";
116
+ type State = "skipped" | "install" | "build" | "commit" | "tag" | "push" | "workflow (push)" | "release" | "workflow (release)" | "complete";
152
117
 
153
118
  /**
154
119
  * Release.
155
120
  */
156
121
  async function release(): Promise<void> {
122
+ // State may be written from any directory so full path is required.
157
123
  const statePath = path.resolve("config/release.state.json");
158
124
 
159
- let state: Record<string, State | undefined> = {};
160
-
161
- if (fs.existsSync(statePath)) {
162
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Format is controlled by this process.
163
- state = JSON.parse(fs.readFileSync(statePath).toString());
164
- }
125
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Format is controlled by this process.
126
+ const state: Record<string, State | undefined> = fs.existsSync(statePath) ? JSON.parse(fs.readFileSync(statePath).toString()) : {};
165
127
 
166
128
  /**
167
129
  * Save the current state.
@@ -205,6 +167,29 @@ async function release(): Promise<void> {
205
167
  }
206
168
  }
207
169
 
170
+ const atOrganization = `@${configuration.organization}`;
171
+
172
+ /**
173
+ * Update dependencies from the organization.
174
+ *
175
+ * @param dependencies
176
+ * Dependencies.
177
+ * @param restoreAlpha
178
+ * If true, "alpha" is restored as the version for development.
179
+ */
180
+ function updateDependencies(dependencies: Record<string, string> | undefined, restoreAlpha: boolean): void {
181
+ if (dependencies !== undefined) {
182
+ // eslint-disable-next-line guard-for-in -- Dependency record type is shallow.
183
+ for (const dependency in dependencies) {
184
+ const [dependencyAtOrganization, dependencyRepositoryName] = dependency.split("/");
185
+
186
+ if (dependencyAtOrganization === atOrganization) {
187
+ dependencies[dependency] = !restoreAlpha ? `^${configuration.repositories[dependencyRepositoryName].version}` : "alpha";
188
+ }
189
+ }
190
+ }
191
+ }
192
+
208
193
  const octokit = new Octokit({
209
194
  auth: secureConfiguration.token,
210
195
  userAgent: `${configuration.organization} release`
@@ -255,41 +240,10 @@ async function release(): Promise<void> {
255
240
 
256
241
  packageConfiguration.version = repository.version;
257
242
 
258
- const atOrganization = `@${configuration.organization}`;
259
-
260
- /**
261
- * Update dependencies from the organization.
262
- *
263
- * @param dependencies
264
- * Dependencies.
265
- *
266
- * @returns
267
- * List of dependencies that require linking.
268
- */
269
- function updateDependencies(dependencies: Record<string, string> | undefined): string[] {
270
- const linkDependencies = new Array<string>();
271
-
272
- if (dependencies !== undefined) {
273
- // eslint-disable-next-line guard-for-in -- Dependency record type is shallow.
274
- for (const dependency in dependencies) {
275
- const [dependencyAtOrganization, dependencyRepositoryName] = dependency.split("/");
276
-
277
- if (dependencyAtOrganization === atOrganization) {
278
- dependencies[dependency] = `^${configuration.repositories[dependencyRepositoryName].version}`;
279
-
280
- linkDependencies.push(dependency);
281
- }
282
- }
283
- }
284
-
285
- return linkDependencies;
286
- }
287
-
288
- const linkDependencies = [...updateDependencies(packageConfiguration.devDependencies), ...updateDependencies(packageConfiguration.dependencies)];
243
+ updateDependencies(packageConfiguration.devDependencies, false);
244
+ updateDependencies(packageConfiguration.dependencies, false);
289
245
 
290
246
  fs.writeFileSync(packageConfigurationPath, `${JSON.stringify(packageConfiguration, null, 2)}\n`);
291
-
292
- run(false, "npm", "link", ...linkDependencies);
293
247
  } else {
294
248
  if (!allSkipped) {
295
249
  throw new Error(`Repository ${name} is supposed to be skipped but at least one prior repository has been updated`);
@@ -398,14 +352,14 @@ async function release(): Promise<void> {
398
352
  run(false, "npm", "run", "build", "--if-present");
399
353
  });
400
354
 
401
- if (!(packageConfiguration.private ?? false)) {
402
- await step(name, "link", () => {
403
- run(false, "npm", "link");
404
- });
405
- }
406
-
407
355
  await step(name, "commit", () => {
408
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`);
409
363
  });
410
364
 
411
365
  await step(name, "tag", () => {