@akinon/projectzero 1.24.1 → 1.25.0-rc.1
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/CHANGELOG.md +11 -1
- package/commands/plugins.ts +36 -0
- package/dist/commands/plugins.js +20 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
# @akinon/projectzero
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.25.0-rc.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 197d602: ZERO-2459: Warn if akinon-next version is not up to date
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
11
|
- 95510c7: ZERO-2508: Enable rc branch pipeline and add check-publish-version step
|
|
8
12
|
|
|
13
|
+
## 1.25.0-rc.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 197d602: ZERO-2459: Warn if akinon-next version is not up to date
|
|
18
|
+
|
|
9
19
|
## 1.24.0
|
|
10
20
|
|
|
11
21
|
## 1.23.0
|
package/commands/plugins.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
|
+
import semver from 'semver';
|
|
4
5
|
|
|
5
6
|
const Prompt = require('prompt-checkbox');
|
|
6
7
|
|
|
@@ -71,7 +72,42 @@ const definedPlugins = [
|
|
|
71
72
|
}
|
|
72
73
|
];
|
|
73
74
|
|
|
75
|
+
interface PackageInfo {
|
|
76
|
+
'dist-tags': {
|
|
77
|
+
latest: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface PackageJson {
|
|
82
|
+
dependencies: {
|
|
83
|
+
[key: string]: string;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function checkVersion(pkg: PackageJson) {
|
|
88
|
+
const packageName = '@akinon/next';
|
|
89
|
+
const registryUrl = `https://registry.npmjs.org/${packageName}`;
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
const response = await fetch(registryUrl);
|
|
93
|
+
const pkgInfo = (await response.json()) as PackageInfo;
|
|
94
|
+
const latestVersion = pkgInfo['dist-tags'].latest;
|
|
95
|
+
|
|
96
|
+
if (!semver.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
97
|
+
console.warn(
|
|
98
|
+
`\x1b[43mWarning: The "${packageName}" package is currently at version ${pkg.dependencies['@akinon/next']}. Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`,
|
|
99
|
+
'\x1b[0m\n'
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
} catch (error: any) {
|
|
103
|
+
console.error(`\x1b[41mError: ${error?.message}`, '\x1b[0m\n');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
74
107
|
export default async () => {
|
|
108
|
+
const pkg: PackageJson = require(path.resolve(rootDir, './package.json'));
|
|
109
|
+
await checkVersion(pkg);
|
|
110
|
+
|
|
75
111
|
const prompt = new Prompt({
|
|
76
112
|
name: 'plugins',
|
|
77
113
|
message: 'Please check/uncheck plugins to install/uninstall.',
|
package/dist/commands/plugins.js
CHANGED
|
@@ -38,6 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
38
|
const fs = __importStar(require("fs"));
|
|
39
39
|
const path_1 = __importDefault(require("path"));
|
|
40
40
|
const child_process_1 = require("child_process");
|
|
41
|
+
const semver_1 = __importDefault(require("semver"));
|
|
41
42
|
const Prompt = require('prompt-checkbox');
|
|
42
43
|
const rootDir = path_1.default.resolve(process.cwd());
|
|
43
44
|
function findPluginsFilePath() {
|
|
@@ -100,7 +101,26 @@ const definedPlugins = [
|
|
|
100
101
|
value: 'pz-credit-payment'
|
|
101
102
|
}
|
|
102
103
|
];
|
|
104
|
+
function checkVersion(pkg) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const packageName = '@akinon/next';
|
|
107
|
+
const registryUrl = `https://registry.npmjs.org/${packageName}`;
|
|
108
|
+
try {
|
|
109
|
+
const response = yield fetch(registryUrl);
|
|
110
|
+
const pkgInfo = (yield response.json());
|
|
111
|
+
const latestVersion = pkgInfo['dist-tags'].latest;
|
|
112
|
+
if (!semver_1.default.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
113
|
+
console.warn(`\x1b[43mWarning: The "${packageName}" package is currently at version ${pkg.dependencies['@akinon/next']}. Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`, '\x1b[0m\n');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.error(`\x1b[41mError: ${error === null || error === void 0 ? void 0 : error.message}`, '\x1b[0m\n');
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
103
121
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
|
+
const pkg = require(path_1.default.resolve(rootDir, './package.json'));
|
|
123
|
+
yield checkVersion(pkg);
|
|
104
124
|
const prompt = new Prompt({
|
|
105
125
|
name: 'plugins',
|
|
106
126
|
message: 'Please check/uncheck plugins to install/uninstall.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/projectzero",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0-rc.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI tool to manage your Project Zero Next project",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"license": "ISC",
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^18.8.0",
|
|
18
|
+
"@types/semver": "7.5.8",
|
|
18
19
|
"@types/temp": "0.9.4"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|