@akinon/projectzero 1.29.0 → 1.30.0

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 197d602: ZERO-2459: Warn if akinon-next version is not up to date
8
+
9
+ ### Patch Changes
10
+
11
+ - 073fbd2: ZERO-2503: Add check changeset control script
12
+
3
13
  ## 1.29.0
4
14
 
5
15
  ## 1.27.0
@@ -1,11 +1,44 @@
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
 
7
8
  const rootDir = path.resolve(process.cwd());
8
9
 
10
+ interface PackageInfo {
11
+ 'dist-tags': {
12
+ latest: string;
13
+ };
14
+ }
15
+
16
+ interface PackageJson {
17
+ dependencies: {
18
+ [key: string]: string;
19
+ };
20
+ }
21
+
22
+ async function checkVersion(pkg: PackageJson) {
23
+ const packageName = '@akinon/next';
24
+ const registryUrl = `https://registry.npmjs.org/${packageName}`;
25
+
26
+ try {
27
+ const response = await fetch(registryUrl);
28
+ const pkgInfo = (await response.json()) as PackageInfo;
29
+ const latestVersion = pkgInfo['dist-tags'].latest;
30
+
31
+ if (!semver.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
32
+ console.warn(
33
+ `\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.`,
34
+ '\x1b[0m\n'
35
+ );
36
+ }
37
+ } catch (error: any) {
38
+ console.error(`\x1b[41mError: ${error?.message}`, '\x1b[0m\n');
39
+ }
40
+ }
41
+
9
42
  export default async () => {
10
43
  function findPluginsFilePath() {
11
44
  const option1 = path.resolve(rootDir, './src/plugins.js');
@@ -22,6 +55,9 @@ export default async () => {
22
55
  }
23
56
  }
24
57
 
58
+ const pkg: PackageJson = require(path.resolve(rootDir, './package.json'));
59
+ await checkVersion(pkg);
60
+
25
61
  const pluginsFilePath = findPluginsFilePath();
26
62
 
27
63
  let installedPlugins: Array<string> = [];
@@ -38,8 +38,26 @@ 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());
44
+ function checkVersion(pkg) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const packageName = '@akinon/next';
47
+ const registryUrl = `https://registry.npmjs.org/${packageName}`;
48
+ try {
49
+ const response = yield fetch(registryUrl);
50
+ const pkgInfo = (yield response.json());
51
+ const latestVersion = pkgInfo['dist-tags'].latest;
52
+ if (!semver_1.default.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
53
+ 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');
54
+ }
55
+ }
56
+ catch (error) {
57
+ console.error(`\x1b[41mError: ${error === null || error === void 0 ? void 0 : error.message}`, '\x1b[0m\n');
58
+ }
59
+ });
60
+ }
43
61
  exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
44
62
  function findPluginsFilePath() {
45
63
  const option1 = path_1.default.resolve(rootDir, './src/plugins.js');
@@ -54,6 +72,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
54
72
  throw new Error('plugins.js was not found in either of the expected locations.');
55
73
  }
56
74
  }
75
+ const pkg = require(path_1.default.resolve(rootDir, './package.json'));
76
+ yield checkVersion(pkg);
57
77
  const pluginsFilePath = findPluginsFilePath();
58
78
  let installedPlugins = [];
59
79
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
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": {