@commercetools-frontend/create-mc-app 22.23.3 → 22.25.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 +12 -0
- package/README.md +1 -1
- package/dist/commercetools-frontend-create-mc-app.cjs.dev.js +14 -6
- package/dist/commercetools-frontend-create-mc-app.cjs.prod.js +14 -6
- package/dist/commercetools-frontend-create-mc-app.esm.js +14 -6
- package/dist/declarations/src/utils.d.ts +2 -1
- package/package.json +2 -2
- package/src/tasks/download-template.ts +2 -2
- package/src/utils.ts +11 -1
- package/src/validations.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @commercetools-frontend/create-mc-app
|
|
2
2
|
|
|
3
|
+
## 22.25.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3502](https://github.com/commercetools/merchant-center-application-kit/pull/3502) [`b55d4e6`](https://github.com/commercetools/merchant-center-application-kit/commit/b55d4e606a07e5f5ac1522126b77213c67297a0c) Thanks [@Rombelirk](https://github.com/Rombelirk)! - Replace fs.exists with fs.access
|
|
8
|
+
|
|
9
|
+
## 22.24.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#3491](https://github.com/commercetools/merchant-center-application-kit/pull/3491) [`c2bba1d`](https://github.com/commercetools/merchant-center-application-kit/commit/c2bba1d065b6fd7882e6feb9162d91538962d85d) Thanks [@emmenko](https://github.com/emmenko)! - Adjust links to new docs
|
|
14
|
+
|
|
3
15
|
## 22.23.3
|
|
4
16
|
|
|
5
17
|
## 22.23.2
|
package/README.md
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
<a href="https://www.npmjs.com/package/@commercetools-frontend/create-mc-app"><img src="https://badgen.net/npm/v/@commercetools-frontend/create-mc-app" alt="Latest release (latest dist-tag)" /></a> <a href="https://www.npmjs.com/package/@commercetools-frontend/create-mc-app"><img src="https://badgen.net/npm/v/@commercetools-frontend/create-mc-app/next" alt="Latest release (next dist-tag)" /></a> <a href="https://bundlephobia.com/result?p=@commercetools-frontend/create-mc-app"><img src="https://badgen.net/bundlephobia/minzip/@commercetools-frontend/create-mc-app" alt="Minified + GZipped size" /></a> <a href="https://github.com/commercetools/merchant-center-application-kit/blob/main/LICENSE"><img src="https://badgen.net/github/license/commercetools/merchant-center-application-kit" alt="GitHub license" /></a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
Check out the [documentation](https://docs.commercetools.com/
|
|
7
|
+
Check out the [documentation](https://docs.commercetools.com/merchant-center-customizations/api-reference/create-mc-app) for more information.
|
|
@@ -71,7 +71,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
|
|
|
71
71
|
|
|
72
72
|
var pkgJson = {
|
|
73
73
|
name: "@commercetools-frontend/create-mc-app",
|
|
74
|
-
version: "22.
|
|
74
|
+
version: "22.25.0",
|
|
75
75
|
description: "Create Merchant Center applications to quickly get up and running",
|
|
76
76
|
bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
77
77
|
repository: {
|
|
@@ -79,7 +79,7 @@ var pkgJson = {
|
|
|
79
79
|
url: "https://github.com/commercetools/merchant-center-application-kit.git",
|
|
80
80
|
directory: "packages/create-mc-app"
|
|
81
81
|
},
|
|
82
|
-
homepage: "https://docs.commercetools.com/
|
|
82
|
+
homepage: "https://docs.commercetools.com/merchant-center-customizations",
|
|
83
83
|
keywords: [
|
|
84
84
|
"javascript",
|
|
85
85
|
"frontend",
|
|
@@ -143,6 +143,14 @@ function hintOutdatedVersion(currentVersion, releaseVersion) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
const isSemVer = version => /^(v?)([0-9].[0-9].[0-9])+/.test(version);
|
|
146
|
+
const doesFileExist = path => {
|
|
147
|
+
try {
|
|
148
|
+
fs__default["default"].accessSync(path);
|
|
149
|
+
return true;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
146
154
|
const shouldUseYarn = () => {
|
|
147
155
|
try {
|
|
148
156
|
const result = execa__default["default"].commandSync('yarn --version', {
|
|
@@ -184,7 +192,7 @@ const resolveFilePathByExtension = requestedModule => {
|
|
|
184
192
|
const fileExtension = _findInstanceProperty__default["default"](_context2 = ['.js', '.ts', '.mjs', '.cjs']).call(_context2, ext => {
|
|
185
193
|
var _context3;
|
|
186
194
|
const filePath = _concatInstanceProperty__default["default"](_context3 = "".concat(requestedModule)).call(_context3, ext);
|
|
187
|
-
return
|
|
195
|
+
return doesFileExist(filePath);
|
|
188
196
|
});
|
|
189
197
|
return _concatInstanceProperty__default["default"](_context4 = "".concat(requestedModule)).call(_context4, fileExtension);
|
|
190
198
|
};
|
|
@@ -211,13 +219,13 @@ const throwIfTemplateIsNotSupported = templateName => {
|
|
|
211
219
|
}
|
|
212
220
|
};
|
|
213
221
|
const throwIfProjectDirectoryExists = (dirName, dirPath) => {
|
|
214
|
-
if (
|
|
222
|
+
if (doesFileExist(dirPath)) {
|
|
215
223
|
var _context4;
|
|
216
224
|
throw new Error(_concatInstanceProperty__default["default"](_context4 = "A directory named \"".concat(dirName, "\" already exists at this location \"")).call(_context4, dirPath, "\". Please choose a different project name or remove the directory, then try running the command again."));
|
|
217
225
|
}
|
|
218
226
|
};
|
|
219
227
|
const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
|
|
220
|
-
if (!
|
|
228
|
+
if (!doesFileExist(templateFolderPath)) {
|
|
221
229
|
var _context5;
|
|
222
230
|
throw new Error(_concatInstanceProperty__default["default"](_context5 = "The downloaded template \"".concat(templateName, "\" does not exist for the given version \"")).call(_context5, versionToCheck, "\". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
|
|
223
231
|
}
|
|
@@ -344,7 +352,7 @@ function downloadTemplate(options) {
|
|
|
344
352
|
throw new Error(result.stderr);
|
|
345
353
|
}
|
|
346
354
|
const templatePackageJsonPath = path__default["default"].join(options.projectDirectoryPath, 'package.json');
|
|
347
|
-
if (!
|
|
355
|
+
if (!doesFileExist(templatePackageJsonPath)) {
|
|
348
356
|
throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
|
|
349
357
|
}
|
|
350
358
|
return result.stdout;
|
|
@@ -71,7 +71,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
|
|
|
71
71
|
|
|
72
72
|
var pkgJson = {
|
|
73
73
|
name: "@commercetools-frontend/create-mc-app",
|
|
74
|
-
version: "22.
|
|
74
|
+
version: "22.25.0",
|
|
75
75
|
description: "Create Merchant Center applications to quickly get up and running",
|
|
76
76
|
bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
77
77
|
repository: {
|
|
@@ -79,7 +79,7 @@ var pkgJson = {
|
|
|
79
79
|
url: "https://github.com/commercetools/merchant-center-application-kit.git",
|
|
80
80
|
directory: "packages/create-mc-app"
|
|
81
81
|
},
|
|
82
|
-
homepage: "https://docs.commercetools.com/
|
|
82
|
+
homepage: "https://docs.commercetools.com/merchant-center-customizations",
|
|
83
83
|
keywords: [
|
|
84
84
|
"javascript",
|
|
85
85
|
"frontend",
|
|
@@ -143,6 +143,14 @@ function hintOutdatedVersion(currentVersion, releaseVersion) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
const isSemVer = version => /^(v?)([0-9].[0-9].[0-9])+/.test(version);
|
|
146
|
+
const doesFileExist = path => {
|
|
147
|
+
try {
|
|
148
|
+
fs__default["default"].accessSync(path);
|
|
149
|
+
return true;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
146
154
|
const shouldUseYarn = () => {
|
|
147
155
|
try {
|
|
148
156
|
const result = execa__default["default"].commandSync('yarn --version', {
|
|
@@ -184,7 +192,7 @@ const resolveFilePathByExtension = requestedModule => {
|
|
|
184
192
|
const fileExtension = _findInstanceProperty__default["default"](_context2 = ['.js', '.ts', '.mjs', '.cjs']).call(_context2, ext => {
|
|
185
193
|
var _context3;
|
|
186
194
|
const filePath = _concatInstanceProperty__default["default"](_context3 = "".concat(requestedModule)).call(_context3, ext);
|
|
187
|
-
return
|
|
195
|
+
return doesFileExist(filePath);
|
|
188
196
|
});
|
|
189
197
|
return _concatInstanceProperty__default["default"](_context4 = "".concat(requestedModule)).call(_context4, fileExtension);
|
|
190
198
|
};
|
|
@@ -211,13 +219,13 @@ const throwIfTemplateIsNotSupported = templateName => {
|
|
|
211
219
|
}
|
|
212
220
|
};
|
|
213
221
|
const throwIfProjectDirectoryExists = (dirName, dirPath) => {
|
|
214
|
-
if (
|
|
222
|
+
if (doesFileExist(dirPath)) {
|
|
215
223
|
var _context4;
|
|
216
224
|
throw new Error(_concatInstanceProperty__default["default"](_context4 = "A directory named \"".concat(dirName, "\" already exists at this location \"")).call(_context4, dirPath, "\". Please choose a different project name or remove the directory, then try running the command again."));
|
|
217
225
|
}
|
|
218
226
|
};
|
|
219
227
|
const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
|
|
220
|
-
if (!
|
|
228
|
+
if (!doesFileExist(templateFolderPath)) {
|
|
221
229
|
var _context5;
|
|
222
230
|
throw new Error(_concatInstanceProperty__default["default"](_context5 = "The downloaded template \"".concat(templateName, "\" does not exist for the given version \"")).call(_context5, versionToCheck, "\". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
|
|
223
231
|
}
|
|
@@ -344,7 +352,7 @@ function downloadTemplate(options) {
|
|
|
344
352
|
throw new Error(result.stderr);
|
|
345
353
|
}
|
|
346
354
|
const templatePackageJsonPath = path__default["default"].join(options.projectDirectoryPath, 'package.json');
|
|
347
|
-
if (!
|
|
355
|
+
if (!doesFileExist(templatePackageJsonPath)) {
|
|
348
356
|
throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
|
|
349
357
|
}
|
|
350
358
|
return result.stdout;
|
|
@@ -35,7 +35,7 @@ import prettier from 'prettier';
|
|
|
35
35
|
|
|
36
36
|
var pkgJson = {
|
|
37
37
|
name: "@commercetools-frontend/create-mc-app",
|
|
38
|
-
version: "22.
|
|
38
|
+
version: "22.25.0",
|
|
39
39
|
description: "Create Merchant Center applications to quickly get up and running",
|
|
40
40
|
bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
41
41
|
repository: {
|
|
@@ -43,7 +43,7 @@ var pkgJson = {
|
|
|
43
43
|
url: "https://github.com/commercetools/merchant-center-application-kit.git",
|
|
44
44
|
directory: "packages/create-mc-app"
|
|
45
45
|
},
|
|
46
|
-
homepage: "https://docs.commercetools.com/
|
|
46
|
+
homepage: "https://docs.commercetools.com/merchant-center-customizations",
|
|
47
47
|
keywords: [
|
|
48
48
|
"javascript",
|
|
49
49
|
"frontend",
|
|
@@ -107,6 +107,14 @@ function hintOutdatedVersion(currentVersion, releaseVersion) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
const isSemVer = version => /^(v?)([0-9].[0-9].[0-9])+/.test(version);
|
|
110
|
+
const doesFileExist = path => {
|
|
111
|
+
try {
|
|
112
|
+
fs.accessSync(path);
|
|
113
|
+
return true;
|
|
114
|
+
} catch (error) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
110
118
|
const shouldUseYarn = () => {
|
|
111
119
|
try {
|
|
112
120
|
const result = execa.commandSync('yarn --version', {
|
|
@@ -148,7 +156,7 @@ const resolveFilePathByExtension = requestedModule => {
|
|
|
148
156
|
const fileExtension = _findInstanceProperty(_context2 = ['.js', '.ts', '.mjs', '.cjs']).call(_context2, ext => {
|
|
149
157
|
var _context3;
|
|
150
158
|
const filePath = _concatInstanceProperty(_context3 = "".concat(requestedModule)).call(_context3, ext);
|
|
151
|
-
return
|
|
159
|
+
return doesFileExist(filePath);
|
|
152
160
|
});
|
|
153
161
|
return _concatInstanceProperty(_context4 = "".concat(requestedModule)).call(_context4, fileExtension);
|
|
154
162
|
};
|
|
@@ -175,13 +183,13 @@ const throwIfTemplateIsNotSupported = templateName => {
|
|
|
175
183
|
}
|
|
176
184
|
};
|
|
177
185
|
const throwIfProjectDirectoryExists = (dirName, dirPath) => {
|
|
178
|
-
if (
|
|
186
|
+
if (doesFileExist(dirPath)) {
|
|
179
187
|
var _context4;
|
|
180
188
|
throw new Error(_concatInstanceProperty(_context4 = "A directory named \"".concat(dirName, "\" already exists at this location \"")).call(_context4, dirPath, "\". Please choose a different project name or remove the directory, then try running the command again."));
|
|
181
189
|
}
|
|
182
190
|
};
|
|
183
191
|
const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
|
|
184
|
-
if (!
|
|
192
|
+
if (!doesFileExist(templateFolderPath)) {
|
|
185
193
|
var _context5;
|
|
186
194
|
throw new Error(_concatInstanceProperty(_context5 = "The downloaded template \"".concat(templateName, "\" does not exist for the given version \"")).call(_context5, versionToCheck, "\". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
|
|
187
195
|
}
|
|
@@ -308,7 +316,7 @@ function downloadTemplate(options) {
|
|
|
308
316
|
throw new Error(result.stderr);
|
|
309
317
|
}
|
|
310
318
|
const templatePackageJsonPath = path.join(options.projectDirectoryPath, 'package.json');
|
|
311
|
-
if (!
|
|
319
|
+
if (!doesFileExist(templatePackageJsonPath)) {
|
|
312
320
|
throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
|
|
313
321
|
}
|
|
314
322
|
return result.stdout;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TApplicationType, TCliTaskOptions, TPackageManager } from './types';
|
|
2
2
|
declare const isSemVer: (version: string) => boolean;
|
|
3
|
+
declare const doesFileExist: (path: string) => boolean;
|
|
3
4
|
declare const shouldUseYarn: () => boolean;
|
|
4
5
|
declare const getPreferredPackageManager: (options: TCliTaskOptions) => TPackageManager;
|
|
5
6
|
declare const getInstallCommand: (options: TCliTaskOptions) => string;
|
|
@@ -8,4 +9,4 @@ declare const upperFirst: (value: string) => string;
|
|
|
8
9
|
declare const wordify: (slug: string) => string;
|
|
9
10
|
declare const resolveFilePathByExtension: (requestedModule: string) => string;
|
|
10
11
|
declare const isCustomView: (applicationType: TApplicationType) => boolean;
|
|
11
|
-
export { isSemVer, shouldUseYarn, slugify, wordify, upperFirst, resolveFilePathByExtension, getPreferredPackageManager, getInstallCommand, isCustomView, };
|
|
12
|
+
export { isSemVer, shouldUseYarn, slugify, wordify, upperFirst, resolveFilePathByExtension, getPreferredPackageManager, getInstallCommand, isCustomView, doesFileExist, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/create-mc-app",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.25.0",
|
|
4
4
|
"description": "Create Merchant Center applications to quickly get up and running",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://github.com/commercetools/merchant-center-application-kit.git",
|
|
9
9
|
"directory": "packages/create-mc-app"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://docs.commercetools.com/
|
|
11
|
+
"homepage": "https://docs.commercetools.com/merchant-center-customizations",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"javascript",
|
|
14
14
|
"frontend",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
1
|
import os from 'node:os';
|
|
3
2
|
import path from 'node:path';
|
|
4
3
|
import execa from 'execa';
|
|
5
4
|
import { Listr, type ListrTask } from 'listr2';
|
|
6
5
|
import { applicationTypes } from '../constants';
|
|
7
6
|
import type { TCliTaskOptions } from '../types';
|
|
7
|
+
import { doesFileExist } from '../utils';
|
|
8
8
|
import { throwIfTemplateVersionDoesNotExist } from '../validations';
|
|
9
9
|
|
|
10
10
|
const filesToBeRemoved = ['CHANGELOG.md'];
|
|
@@ -91,7 +91,7 @@ function downloadTemplate(options: TCliTaskOptions): ListrTask {
|
|
|
91
91
|
options.projectDirectoryPath,
|
|
92
92
|
'package.json'
|
|
93
93
|
);
|
|
94
|
-
if (!
|
|
94
|
+
if (!doesFileExist(templatePackageJsonPath)) {
|
|
95
95
|
throw new Error(
|
|
96
96
|
`Unable to verify that the template application has a package.json at "${templatePackageJsonPath}"`
|
|
97
97
|
);
|
package/src/utils.ts
CHANGED
|
@@ -8,6 +8,15 @@ import type {
|
|
|
8
8
|
|
|
9
9
|
const isSemVer = (version: string) => /^(v?)([0-9].[0-9].[0-9])+/.test(version);
|
|
10
10
|
|
|
11
|
+
const doesFileExist = (path: string): boolean => {
|
|
12
|
+
try {
|
|
13
|
+
fs.accessSync(path);
|
|
14
|
+
return true;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
const shouldUseYarn = () => {
|
|
12
21
|
try {
|
|
13
22
|
const result = execa.commandSync('yarn --version', { stdio: 'ignore' });
|
|
@@ -56,7 +65,7 @@ const wordify = (slug: string) =>
|
|
|
56
65
|
const resolveFilePathByExtension = (requestedModule: string) => {
|
|
57
66
|
const fileExtension = ['.js', '.ts', '.mjs', '.cjs'].find((ext) => {
|
|
58
67
|
const filePath = `${requestedModule}${ext}`;
|
|
59
|
-
return
|
|
68
|
+
return doesFileExist(filePath);
|
|
60
69
|
});
|
|
61
70
|
return `${requestedModule}${fileExtension}`;
|
|
62
71
|
};
|
|
@@ -74,4 +83,5 @@ export {
|
|
|
74
83
|
getPreferredPackageManager,
|
|
75
84
|
getInstallCommand,
|
|
76
85
|
isCustomView,
|
|
86
|
+
doesFileExist,
|
|
77
87
|
};
|
package/src/validations.ts
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import semver from 'semver';
|
|
4
4
|
import { applicationTypes, availableTemplates } from './constants';
|
|
5
5
|
import type { TApplicationType, TTemplate } from './types';
|
|
6
|
-
import { isSemVer } from './utils';
|
|
6
|
+
import { isSemVer, doesFileExist } from './utils';
|
|
7
7
|
|
|
8
8
|
const throwIfApplicationTypeIsNotSupported = (
|
|
9
9
|
applicationType: TApplicationType
|
|
@@ -31,7 +31,7 @@ const throwIfTemplateIsNotSupported = (templateName: TTemplate) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const throwIfProjectDirectoryExists = (dirName: string, dirPath: string) => {
|
|
34
|
-
if (
|
|
34
|
+
if (doesFileExist(dirPath)) {
|
|
35
35
|
throw new Error(
|
|
36
36
|
`A directory named "${dirName}" already exists at this location "${dirPath}". Please choose a different project name or remove the directory, then try running the command again.`
|
|
37
37
|
);
|
|
@@ -43,7 +43,7 @@ const throwIfTemplateVersionDoesNotExist = (
|
|
|
43
43
|
templateFolderPath: string,
|
|
44
44
|
versionToCheck: string
|
|
45
45
|
) => {
|
|
46
|
-
if (!
|
|
46
|
+
if (!doesFileExist(templateFolderPath)) {
|
|
47
47
|
throw new Error(
|
|
48
48
|
`The downloaded template "${templateName}" does not exist for the given version "${versionToCheck}". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases`
|
|
49
49
|
);
|