@commercetools-frontend/create-mc-app 21.9.0 → 21.12.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 +10 -0
- package/README.md +1 -12
- package/bin/cli.js +1 -90
- package/dist/commercetools-frontend-create-mc-app.cjs.d.ts +1 -0
- package/dist/commercetools-frontend-create-mc-app.cjs.dev.js +792 -0
- package/dist/commercetools-frontend-create-mc-app.cjs.js +7 -0
- package/dist/commercetools-frontend-create-mc-app.cjs.prod.js +787 -0
- package/dist/commercetools-frontend-create-mc-app.esm.js +764 -0
- package/dist/declarations/src/cli.d.ts +2 -0
- package/dist/declarations/src/hint-outdated-version.d.ts +2 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/process-options.d.ts +3 -0
- package/dist/declarations/src/tasks/download-template.d.ts +4 -0
- package/dist/declarations/src/tasks/index.d.ts +5 -0
- package/dist/declarations/src/tasks/install-dependencies.d.ts +4 -0
- package/dist/declarations/src/tasks/update-application-constants.d.ts +4 -0
- package/dist/declarations/src/tasks/update-custom-application-config.d.ts +4 -0
- package/dist/declarations/src/tasks/update-package-json.d.ts +4 -0
- package/dist/declarations/src/types.d.ts +19 -0
- package/dist/declarations/src/utils.d.ts +7 -0
- package/dist/declarations/src/validations.d.ts +7 -0
- package/package.json +7 -3
- package/src/cli.ts +109 -0
- package/src/hint-outdated-version.ts +39 -0
- package/src/index.ts +3 -0
- package/src/process-options.ts +97 -0
- package/src/tasks/{download-template.js → download-template.ts} +11 -8
- package/src/tasks/index.ts +5 -0
- package/src/tasks/{install-dependencies.js → install-dependencies.ts} +8 -4
- package/src/tasks/update-application-constants.ts +61 -0
- package/src/tasks/update-custom-application-config.ts +85 -0
- package/src/tasks/{update-package-json.js → update-package-json.ts} +10 -6
- package/src/types.ts +21 -0
- package/src/utils.ts +41 -0
- package/src/{validations.js → validations.ts} +44 -15
- package/tsconfig.json +6 -0
- package/src/hint-outdated-version.js +0 -34
- package/src/index.js +0 -12
- package/src/parse-arguments.js +0 -87
- package/src/tasks/index.js +0 -13
- package/src/tasks/update-application-constants.js +0 -48
- package/src/tasks/update-custom-application-config.js +0 -64
- package/src/utils.js +0 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @commercetools-frontend/create-mc-app
|
|
2
2
|
|
|
3
|
+
## 21.12.0
|
|
4
|
+
|
|
5
|
+
## 21.11.0
|
|
6
|
+
|
|
7
|
+
## 21.10.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [#2666](https://github.com/commercetools/merchant-center-application-kit/pull/2666) [`f1ac3f0b`](https://github.com/commercetools/merchant-center-application-kit/commit/f1ac3f0b35eed8e3bb7e0003242cc5fa5d7d6944) Thanks [@emmenko](https://github.com/emmenko)! - Migrate CLI to TypeScript
|
|
12
|
+
|
|
3
13
|
## 21.9.0
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -4,15 +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
|
-
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
$ npm install --global @commercetools-frontend/create-mc-app
|
|
13
|
-
$ create-mc-app my-new-custom-application-project --template starter
|
|
14
|
-
|
|
15
|
-
# or
|
|
16
|
-
|
|
17
|
-
$ npx @commercetools-frontend/create-mc-app@latest my-new-custom-application-project --template starter
|
|
18
|
-
```
|
|
7
|
+
Check out the [documentation](https://docs.commercetools.com/custom-applications/api-reference/create-mc-app) for more information.
|
package/bin/cli.js
CHANGED
|
@@ -1,92 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const Listr = require('listr');
|
|
5
|
-
const {
|
|
6
|
-
isValidNodeVersion,
|
|
7
|
-
shouldUseYarn,
|
|
8
|
-
tasks,
|
|
9
|
-
hintOutdatedVersion,
|
|
10
|
-
parseArguments,
|
|
11
|
-
} = require('../src');
|
|
12
|
-
const pkg = require('../package.json');
|
|
13
|
-
|
|
14
|
-
isValidNodeVersion(process.versions.node, pkg.engines.node);
|
|
15
|
-
|
|
16
|
-
const currentVersion = pkg.version;
|
|
17
|
-
|
|
18
|
-
async function execute() {
|
|
19
|
-
const flags = mri(process.argv.slice(2), {
|
|
20
|
-
alias: { help: ['h'] },
|
|
21
|
-
default: { 'skip-install': false, yes: false },
|
|
22
|
-
});
|
|
23
|
-
const commands = flags._;
|
|
24
|
-
|
|
25
|
-
if (commands.length === 0 || (flags.help && commands.length === 0)) {
|
|
26
|
-
console.log(`
|
|
27
|
-
Usage: create-mc-app [project-directory] [flags]
|
|
28
|
-
|
|
29
|
-
Displays help information.
|
|
30
|
-
|
|
31
|
-
Options:
|
|
32
|
-
|
|
33
|
-
--template <name> (optional) The name of the template to install [default "starter"]
|
|
34
|
-
Available options: ["starter"]
|
|
35
|
-
--template-version <version> (optional) The version of the template to install [default "main"]
|
|
36
|
-
--skip-install (optional) Skip installing the dependencies after cloning the template [default "false"]
|
|
37
|
-
--yes (optional) If set, the prompt options with default values will be skipped. [default "false"]
|
|
38
|
-
--entry-point-uri-path <value> (optional) The version of the template to install [default "starter-<hash>"]
|
|
39
|
-
--initial-project-key <value> (optional) A commercetools project key used for the initial login in development. By default, the value is prompted in the terminal.
|
|
40
|
-
`);
|
|
41
|
-
process.exit(0);
|
|
42
|
-
}
|
|
43
|
-
console.log('');
|
|
44
|
-
console.log(`create-mc-app: v${currentVersion}`);
|
|
45
|
-
hintOutdatedVersion(currentVersion);
|
|
46
|
-
console.log('');
|
|
47
|
-
|
|
48
|
-
console.log(
|
|
49
|
-
`Documentation available at https://docs.commercetools.com/custom-applications`
|
|
50
|
-
);
|
|
51
|
-
console.log('');
|
|
52
|
-
|
|
53
|
-
const options = await parseArguments(flags);
|
|
54
|
-
|
|
55
|
-
const taskList = new Listr(
|
|
56
|
-
[
|
|
57
|
-
tasks.downloadTemplate(options),
|
|
58
|
-
tasks.updatePackageJson(options),
|
|
59
|
-
tasks.updateCustomApplicationConfig(options),
|
|
60
|
-
tasks.updateApplicationConstants(options),
|
|
61
|
-
!flags['skip-install'] && tasks.installDependencies(options),
|
|
62
|
-
].filter(Boolean)
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
await taskList.run();
|
|
66
|
-
const useYarn = shouldUseYarn();
|
|
67
|
-
|
|
68
|
-
console.log('');
|
|
69
|
-
console.log(
|
|
70
|
-
`🎉 🎉 🎉 The Custom Application has been created in the "${options.projectDirectoryName}" folder.`
|
|
71
|
-
);
|
|
72
|
-
console.log('');
|
|
73
|
-
console.log(`To get started:`);
|
|
74
|
-
console.log(`$ cd ${options.projectDirectoryName}`);
|
|
75
|
-
if (flags['skip-install']) {
|
|
76
|
-
console.log(`$ ${useYarn ? 'yarn' : 'npm'} install`);
|
|
77
|
-
}
|
|
78
|
-
console.log(`$ ${useYarn ? 'yarn' : 'npm'} start`);
|
|
79
|
-
console.log('');
|
|
80
|
-
console.log(
|
|
81
|
-
`Visit https://docs.commercetools.com/custom-applications for more info about developing Custom Applications. Enjoy 🚀`
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
execute()
|
|
86
|
-
.then(() => {
|
|
87
|
-
process.exit(0);
|
|
88
|
-
})
|
|
89
|
-
.catch((error) => {
|
|
90
|
-
console.error(error);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
});
|
|
3
|
+
require('../').cli();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./declarations/src/index";
|