create-swdg-frontend 0.1.1 → 0.1.5
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/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"prettier": "prettier --check .",
|
|
15
15
|
"prettier:fix": "prettier --write .",
|
|
16
16
|
"gen:api": "node ./scripts/gen-api.cjs",
|
|
17
|
+
"release": "node scripts/release.mjs",
|
|
17
18
|
"test": "vitest",
|
|
18
19
|
"test:run": "vitest run"
|
|
19
20
|
},
|
|
@@ -43,13 +44,13 @@
|
|
|
43
44
|
"vue-router": "^4.6.4"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@openapitools/openapi-generator-cli": "^2.21.0",
|
|
47
47
|
"@commitlint/cli": "^20.3.1",
|
|
48
48
|
"@commitlint/config-conventional": "^20.3.1",
|
|
49
49
|
"@commitlint/lint": "^20.3.1",
|
|
50
50
|
"@commitlint/load": "^20.3.1",
|
|
51
51
|
"@eslint/eslintrc": "^3.3.3",
|
|
52
52
|
"@eslint/js": "^9.39.2",
|
|
53
|
+
"@openapitools/openapi-generator-cli": "^2.21.0",
|
|
53
54
|
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
54
55
|
"@typescript-eslint/parser": "^8.53.0",
|
|
55
56
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"eslint-config-prettier": "^10.1.8",
|
|
60
61
|
"eslint-plugin-prettier": "^5.5.5",
|
|
61
62
|
"eslint-plugin-vue": "^10.7.0",
|
|
63
|
+
"fs-extra": "^11.3.3",
|
|
62
64
|
"husky": "^9.1.7",
|
|
63
65
|
"jsdom": "^27.4.0",
|
|
64
66
|
"less": "^4.5.1",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import process from 'node:process';
|
|
4
|
+
import { execSync } from 'node:child_process';
|
|
5
|
+
|
|
6
|
+
const rootDir = process.cwd();
|
|
7
|
+
const createDir = path.join(rootDir, 'create-swdg');
|
|
8
|
+
const swdgDir = path.join(rootDir, 'swdg');
|
|
9
|
+
|
|
10
|
+
const createPkgPath = path.join(createDir, 'package.json');
|
|
11
|
+
const swdgPkgPath = path.join(swdgDir, 'package.json');
|
|
12
|
+
|
|
13
|
+
const input = process.argv[2];
|
|
14
|
+
if (!input) {
|
|
15
|
+
console.error('Usage: node scripts/release.mjs <x.y.z>');
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
20
|
+
const writeJson = (filePath, data) =>
|
|
21
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n', 'utf8');
|
|
22
|
+
|
|
23
|
+
const isValidVersion = (value) => /^\d+\.\d+\.\d+$/.test(value);
|
|
24
|
+
const createPkg = readJson(createPkgPath);
|
|
25
|
+
const swdgPkg = readJson(swdgPkgPath);
|
|
26
|
+
|
|
27
|
+
if (!isValidVersion(input)) {
|
|
28
|
+
console.error('Version must be in x.y.z format, e.g. 0.1.2');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const nextVersion = input;
|
|
33
|
+
|
|
34
|
+
createPkg.version = nextVersion;
|
|
35
|
+
swdgPkg.version = nextVersion;
|
|
36
|
+
swdgPkg.dependencies = swdgPkg.dependencies || {};
|
|
37
|
+
swdgPkg.dependencies['create-swdg-frontend'] = `^${nextVersion}`;
|
|
38
|
+
|
|
39
|
+
writeJson(createPkgPath, createPkg);
|
|
40
|
+
writeJson(swdgPkgPath, swdgPkg);
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
execSync('npm config set registry https://registry.npmjs.org/', {
|
|
44
|
+
stdio: 'inherit',
|
|
45
|
+
});
|
|
46
|
+
execSync('pnpm -C create-swdg run prepublishOnly', { stdio: 'inherit' });
|
|
47
|
+
execSync('npm publish --access public --registry https://registry.npmjs.org/', {
|
|
48
|
+
stdio: 'inherit',
|
|
49
|
+
cwd: createDir,
|
|
50
|
+
});
|
|
51
|
+
execSync('npm publish --access public --registry https://registry.npmjs.org/', {
|
|
52
|
+
stdio: 'inherit',
|
|
53
|
+
cwd: swdgDir,
|
|
54
|
+
});
|
|
55
|
+
} finally {
|
|
56
|
+
execSync('npm config set registry https://registry.npmmirror.com/', {
|
|
57
|
+
stdio: 'inherit',
|
|
58
|
+
});
|
|
59
|
+
}
|