@akinon/projectzero 1.25.0-rc.3 → 1.25.0-rc.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/CHANGELOG.md +9 -0
- package/commands/plugins.ts +81 -81
- package/dist/commands/plugins.js +75 -75
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @akinon/projectzero
|
|
2
2
|
|
|
3
|
+
## 1.25.0-rc.5
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 350ffc0: ZERO-2522: Create command fixed for the cli
|
|
8
|
+
- 197d602: ZERO-2459: Warn if akinon-next version is not up to date
|
|
9
|
+
|
|
10
|
+
## 1.25.0-rc.4
|
|
11
|
+
|
|
3
12
|
## 1.25.0-rc.3
|
|
4
13
|
|
|
5
14
|
## 1.25.0-rc.2
|
package/commands/plugins.ts
CHANGED
|
@@ -7,71 +7,6 @@ const Prompt = require('prompt-checkbox');
|
|
|
7
7
|
|
|
8
8
|
const rootDir = path.resolve(process.cwd());
|
|
9
9
|
|
|
10
|
-
function findPluginsFilePath() {
|
|
11
|
-
const option1 = path.resolve(rootDir, './src/plugins.js');
|
|
12
|
-
const option2 = path.resolve(rootDir, './packages/akinon-next/plugins.js');
|
|
13
|
-
|
|
14
|
-
if (fs.existsSync(option1)) {
|
|
15
|
-
return option1;
|
|
16
|
-
} else if (fs.existsSync(option2)) {
|
|
17
|
-
return option2;
|
|
18
|
-
} else {
|
|
19
|
-
throw new Error(
|
|
20
|
-
'plugins.js was not found in either of the expected locations.'
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const pluginsFilePath = findPluginsFilePath();
|
|
26
|
-
|
|
27
|
-
let installedPlugins: Array<string> = [];
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
installedPlugins = require(pluginsFilePath);
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error('Error loading installed plugins:', error);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const definedPlugins = [
|
|
37
|
-
{
|
|
38
|
-
name: 'Basket Gift Pack',
|
|
39
|
-
value: 'pz-basket-gift-pack'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: 'Click & Collect',
|
|
43
|
-
value: 'pz-click-collect'
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: 'Checkout Gift Pack',
|
|
47
|
-
value: 'pz-checkout-gift-pack'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'One Click Checkout',
|
|
51
|
-
value: 'pz-one-click-checkout'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'Garanti Pay',
|
|
55
|
-
value: 'pz-gpay'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'Pay On Delivery',
|
|
59
|
-
value: 'pz-pay-on-delivery'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'Otp',
|
|
63
|
-
value: 'pz-otp'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'BKM Express',
|
|
67
|
-
value: 'pz-bkm'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'Credit Payment',
|
|
71
|
-
value: 'pz-credit-payment'
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
|
|
75
10
|
interface PackageInfo {
|
|
76
11
|
'dist-tags': {
|
|
77
12
|
latest: string;
|
|
@@ -84,30 +19,95 @@ interface PackageJson {
|
|
|
84
19
|
};
|
|
85
20
|
}
|
|
86
21
|
|
|
87
|
-
async
|
|
88
|
-
|
|
89
|
-
|
|
22
|
+
export default async () => {
|
|
23
|
+
async function checkVersion(pkg: PackageJson) {
|
|
24
|
+
const packageName = '@akinon/next';
|
|
25
|
+
const registryUrl = `https://registry.npmjs.org/${packageName}`;
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(registryUrl);
|
|
29
|
+
const pkgInfo = (await response.json()) as PackageInfo;
|
|
30
|
+
const latestVersion = pkgInfo['dist-tags'].latest;
|
|
31
|
+
|
|
32
|
+
if (!semver.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
33
|
+
console.warn(
|
|
34
|
+
`\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.`,
|
|
35
|
+
'\x1b[0m\n'
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
} catch (error: any) {
|
|
39
|
+
console.error(`\x1b[41mError: ${error?.message}`, '\x1b[0m\n');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function findPluginsFilePath() {
|
|
44
|
+
const option1 = path.resolve(rootDir, './src/plugins.js');
|
|
45
|
+
const option2 = path.resolve(rootDir, './packages/akinon-next/plugins.js');
|
|
90
46
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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'
|
|
47
|
+
if (fs.existsSync(option1)) {
|
|
48
|
+
return option1;
|
|
49
|
+
} else if (fs.existsSync(option2)) {
|
|
50
|
+
return option2;
|
|
51
|
+
} else {
|
|
52
|
+
throw new Error(
|
|
53
|
+
'plugins.js was not found in either of the expected locations.'
|
|
100
54
|
);
|
|
101
55
|
}
|
|
102
|
-
} catch (error: any) {
|
|
103
|
-
console.error(`\x1b[41mError: ${error?.message}`, '\x1b[0m\n');
|
|
104
56
|
}
|
|
105
|
-
}
|
|
106
57
|
|
|
107
|
-
export default async () => {
|
|
108
58
|
const pkg: PackageJson = require(path.resolve(rootDir, './package.json'));
|
|
109
59
|
await checkVersion(pkg);
|
|
110
60
|
|
|
61
|
+
const pluginsFilePath = findPluginsFilePath();
|
|
62
|
+
|
|
63
|
+
let installedPlugins: Array<string> = [];
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
installedPlugins = require(pluginsFilePath);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error('Error loading installed plugins:', error);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const definedPlugins = [
|
|
73
|
+
{
|
|
74
|
+
name: 'Basket Gift Pack',
|
|
75
|
+
value: 'pz-basket-gift-pack'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Click & Collect',
|
|
79
|
+
value: 'pz-click-collect'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Checkout Gift Pack',
|
|
83
|
+
value: 'pz-checkout-gift-pack'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'One Click Checkout',
|
|
87
|
+
value: 'pz-one-click-checkout'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'Garanti Pay',
|
|
91
|
+
value: 'pz-gpay'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'Pay On Delivery',
|
|
95
|
+
value: 'pz-pay-on-delivery'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'Otp',
|
|
99
|
+
value: 'pz-otp'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'BKM Express',
|
|
103
|
+
value: 'pz-bkm'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'Credit Payment',
|
|
107
|
+
value: 'pz-credit-payment'
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
|
|
111
111
|
const prompt = new Prompt({
|
|
112
112
|
name: 'plugins',
|
|
113
113
|
message: 'Please check/uncheck plugins to install/uninstall.',
|
package/dist/commands/plugins.js
CHANGED
|
@@ -41,86 +41,86 @@ const child_process_1 = require("child_process");
|
|
|
41
41
|
const semver_1 = __importDefault(require("semver"));
|
|
42
42
|
const Prompt = require('prompt-checkbox');
|
|
43
43
|
const rootDir = path_1.default.resolve(process.cwd());
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
installedPlugins = require(pluginsFilePath);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error('Error loading installed plugins:', error);
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
const definedPlugins = [
|
|
67
|
-
{
|
|
68
|
-
name: 'Basket Gift Pack',
|
|
69
|
-
value: 'pz-basket-gift-pack'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: 'Click & Collect',
|
|
73
|
-
value: 'pz-click-collect'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: 'Checkout Gift Pack',
|
|
77
|
-
value: 'pz-checkout-gift-pack'
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'One Click Checkout',
|
|
81
|
-
value: 'pz-one-click-checkout'
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'Garanti Pay',
|
|
85
|
-
value: 'pz-gpay'
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: 'Pay On Delivery',
|
|
89
|
-
value: 'pz-pay-on-delivery'
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: 'Otp',
|
|
93
|
-
value: 'pz-otp'
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: 'BKM Express',
|
|
97
|
-
value: 'pz-bkm'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'Credit Payment',
|
|
101
|
-
value: 'pz-credit-payment'
|
|
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');
|
|
44
|
+
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
function checkVersion(pkg) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const packageName = '@akinon/next';
|
|
48
|
+
const registryUrl = `https://registry.npmjs.org/${packageName}`;
|
|
49
|
+
try {
|
|
50
|
+
const response = yield fetch(registryUrl);
|
|
51
|
+
const pkgInfo = (yield response.json());
|
|
52
|
+
const latestVersion = pkgInfo['dist-tags'].latest;
|
|
53
|
+
if (!semver_1.default.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
54
|
+
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');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error(`\x1b[41mError: ${error === null || error === void 0 ? void 0 : error.message}`, '\x1b[0m\n');
|
|
114
59
|
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function findPluginsFilePath() {
|
|
63
|
+
const option1 = path_1.default.resolve(rootDir, './src/plugins.js');
|
|
64
|
+
const option2 = path_1.default.resolve(rootDir, './packages/akinon-next/plugins.js');
|
|
65
|
+
if (fs.existsSync(option1)) {
|
|
66
|
+
return option1;
|
|
115
67
|
}
|
|
116
|
-
|
|
117
|
-
|
|
68
|
+
else if (fs.existsSync(option2)) {
|
|
69
|
+
return option2;
|
|
118
70
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
71
|
+
else {
|
|
72
|
+
throw new Error('plugins.js was not found in either of the expected locations.');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
122
75
|
const pkg = require(path_1.default.resolve(rootDir, './package.json'));
|
|
123
76
|
yield checkVersion(pkg);
|
|
77
|
+
const pluginsFilePath = findPluginsFilePath();
|
|
78
|
+
let installedPlugins = [];
|
|
79
|
+
try {
|
|
80
|
+
installedPlugins = require(pluginsFilePath);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error('Error loading installed plugins:', error);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
const definedPlugins = [
|
|
87
|
+
{
|
|
88
|
+
name: 'Basket Gift Pack',
|
|
89
|
+
value: 'pz-basket-gift-pack'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'Click & Collect',
|
|
93
|
+
value: 'pz-click-collect'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Checkout Gift Pack',
|
|
97
|
+
value: 'pz-checkout-gift-pack'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'One Click Checkout',
|
|
101
|
+
value: 'pz-one-click-checkout'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Garanti Pay',
|
|
105
|
+
value: 'pz-gpay'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'Pay On Delivery',
|
|
109
|
+
value: 'pz-pay-on-delivery'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'Otp',
|
|
113
|
+
value: 'pz-otp'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'BKM Express',
|
|
117
|
+
value: 'pz-bkm'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'Credit Payment',
|
|
121
|
+
value: 'pz-credit-payment'
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
124
|
const prompt = new Prompt({
|
|
125
125
|
name: 'plugins',
|
|
126
126
|
message: 'Please check/uncheck plugins to install/uninstall.',
|