@spree/cli 0.1.0 → 1.0.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/README.md +33 -72
- package/dist/commands/new/app.d.ts +9 -0
- package/dist/commands/new/app.d.ts.map +1 -0
- package/dist/commands/{generate/store.js → new/app.js} +69 -52
- package/dist/commands/new/app.js.map +1 -0
- package/dist/commands/start/app.d.ts +9 -0
- package/dist/commands/start/app.d.ts.map +1 -0
- package/dist/commands/start/app.js +42 -0
- package/dist/commands/start/app.js.map +1 -0
- package/dist/domains/dependencies/checkDependencies.d.ts.map +1 -1
- package/dist/domains/dependencies/checkDependencies.js +11 -7
- package/dist/domains/dependencies/checkDependencies.js.map +1 -1
- package/dist/domains/dependencies/checkVersionByShellCommand.d.ts +1 -1
- package/dist/domains/dependencies/checkVersionByShellCommand.d.ts.map +1 -1
- package/dist/domains/dependencies/checkVersionByShellCommand.js +3 -2
- package/dist/domains/dependencies/checkVersionByShellCommand.js.map +1 -1
- package/dist/domains/dependencies/extractVersion.d.ts +3 -0
- package/dist/domains/dependencies/extractVersion.d.ts.map +1 -0
- package/dist/domains/dependencies/extractVersion.js +12 -0
- package/dist/domains/dependencies/extractVersion.js.map +1 -0
- package/dist/domains/dependencies/validate/validateDependencies.d.ts +4 -0
- package/dist/domains/dependencies/validate/validateDependencies.d.ts.map +1 -0
- package/dist/domains/dependencies/validate/validateDependencies.js +35 -0
- package/dist/domains/dependencies/validate/validateDependencies.js.map +1 -0
- package/dist/domains/directory/createDirectory.js +1 -1
- package/dist/domains/directory/createDirectory.js.map +1 -1
- package/dist/domains/git-repository/cloneGitRepository.d.ts +1 -0
- package/dist/domains/git-repository/cloneGitRepository.d.ts.map +1 -1
- package/dist/domains/git-repository/cloneGitRepository.js +3 -1
- package/dist/domains/git-repository/cloneGitRepository.js.map +1 -1
- package/dist/domains/integration/fetchIntegrations.d.ts.map +1 -1
- package/dist/domains/integration/fetchIntegrations.js +3 -2
- package/dist/domains/integration/fetchIntegrations.js.map +1 -1
- package/dist/domains/integration/getIntegration.d.ts.map +1 -1
- package/dist/domains/integration/getIntegration.js +14 -8
- package/dist/domains/integration/getIntegration.js.map +1 -1
- package/dist/domains/module/Module.d.ts +1 -0
- package/dist/domains/module/Module.d.ts.map +1 -1
- package/dist/domains/module/Runner.d.ts +2 -0
- package/dist/domains/module/Runner.d.ts.map +1 -1
- package/dist/domains/module/Template.d.ts +7 -0
- package/dist/domains/module/Template.d.ts.map +1 -1
- package/dist/domains/run/RunScript.d.ts +3 -0
- package/dist/domains/run/RunScript.d.ts.map +1 -0
- package/dist/domains/{dependencies/CheckDependency.js → run/RunScript.js} +1 -1
- package/dist/domains/run/RunScript.js.map +1 -0
- package/dist/domains/run/getRunScript.d.ts +4 -0
- package/dist/domains/run/getRunScript.d.ts.map +1 -0
- package/dist/domains/run/getRunScript.js +14 -0
- package/dist/domains/run/getRunScript.js.map +1 -0
- package/dist/domains/run/index.d.ts +3 -0
- package/dist/domains/run/index.d.ts.map +1 -0
- package/dist/domains/run/index.js +10 -0
- package/dist/domains/run/index.js.map +1 -0
- package/dist/domains/spree/fetchSpreeTemplates.d.ts.map +1 -1
- package/dist/domains/spree/fetchSpreeTemplates.js +6 -2
- package/dist/domains/spree/fetchSpreeTemplates.js.map +1 -1
- package/dist/domains/variables/Variables.d.ts +1 -0
- package/dist/domains/variables/Variables.d.ts.map +1 -1
- package/dist/domains/variables/useVariables.d.ts.map +1 -1
- package/dist/domains/variables/useVariables.js +3 -1
- package/dist/domains/variables/useVariables.js.map +1 -1
- package/locales/en-US/translation.json +10 -15
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/test_app/backend/app/assets/builds/.keep +0 -0
- package/dist/commands/generate/store.d.ts +0 -12
- package/dist/commands/generate/store.d.ts.map +0 -1
- package/dist/commands/generate/store.js.map +0 -1
- package/dist/domains/dependencies/CheckDependency.d.ts +0 -4
- package/dist/domains/dependencies/CheckDependency.d.ts.map +0 -1
- package/dist/domains/dependencies/CheckDependency.js.map +0 -1
- package/dist/domains/dependencies/checkDockerVersion.d.ts +0 -4
- package/dist/domains/dependencies/checkDockerVersion.d.ts.map +0 -1
- package/dist/domains/dependencies/checkDockerVersion.js +0 -10
- package/dist/domains/dependencies/checkDockerVersion.js.map +0 -1
- package/dist/domains/dependencies/checkNodeVersion.d.ts +0 -4
- package/dist/domains/dependencies/checkNodeVersion.d.ts.map +0 -1
- package/dist/domains/dependencies/checkNodeVersion.js +0 -10
- package/dist/domains/dependencies/checkNodeVersion.js.map +0 -1
- package/dist/domains/dependencies/checkRubyVersion.d.ts +0 -4
- package/dist/domains/dependencies/checkRubyVersion.d.ts.map +0 -1
- package/dist/domains/dependencies/checkRubyVersion.js +0 -10
- package/dist/domains/dependencies/checkRubyVersion.js.map +0 -1
- package/dist/domains/dependencies/extractDockerVersion.d.ts +0 -3
- package/dist/domains/dependencies/extractDockerVersion.d.ts.map +0 -1
- package/dist/domains/dependencies/extractDockerVersion.js +0 -10
- package/dist/domains/dependencies/extractDockerVersion.js.map +0 -1
- package/dist/domains/dependencies/extractNodeVersion.d.ts +0 -3
- package/dist/domains/dependencies/extractNodeVersion.d.ts.map +0 -1
- package/dist/domains/dependencies/extractNodeVersion.js +0 -10
- package/dist/domains/dependencies/extractNodeVersion.js.map +0 -1
- package/dist/domains/dependencies/extractRubyVersion.d.ts +0 -3
- package/dist/domains/dependencies/extractRubyVersion.d.ts.map +0 -1
- package/dist/domains/dependencies/extractRubyVersion.js +0 -10
- package/dist/domains/dependencies/extractRubyVersion.js.map +0 -1
- package/dist/domains/dependencies/extractVersionByRegExp.d.ts +0 -3
- package/dist/domains/dependencies/extractVersionByRegExp.d.ts.map +0 -1
- package/dist/domains/dependencies/extractVersionByRegExp.js +0 -11
- package/dist/domains/dependencies/extractVersionByRegExp.js.map +0 -1
- package/dist/domains/dependencies/index.d.ts +0 -3
- package/dist/domains/dependencies/index.d.ts.map +0 -1
- package/dist/domains/dependencies/index.js +0 -10
- package/dist/domains/dependencies/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,93 +1,54 @@
|
|
|
1
1
|
# Spree CLI
|
|
2
2
|
|
|
3
|
-
Spree
|
|
4
|
-
|
|
5
|
-
## Getting started
|
|
6
|
-
To use the CLI you need:
|
|
7
|
-
* Node 14+
|
|
8
|
-
* Requirements listed below, based on selected template
|
|
9
|
-
|
|
10
|
-
### Using NextJS Storefront
|
|
11
|
-
Using NextJS Storefront may be problematic - sometimes NextJS server is not launched properly or it stops during launch.
|
|
12
|
-
If you encounter any problems during usage of this integration check Troubleshooting section below.
|
|
13
|
-
## Local Installation
|
|
14
|
-
|
|
15
|
-
### Using Docker (Recommended)
|
|
16
|
-
#### 1. Install required tools and dependencies:
|
|
17
|
-
|
|
18
|
-
Backend:
|
|
19
|
-
* [Docker](https://www.docker.com/community-edition#/download)
|
|
20
|
-
|
|
21
|
-
Frontend:
|
|
22
|
-
|
|
23
|
-
1. VueStorefront:
|
|
24
|
-
* Node 14.15.x - 14.19.x
|
|
25
|
-
|
|
26
|
-
2. NextJs Storefront:
|
|
27
|
-
* Node
|
|
28
|
-
* Npm
|
|
29
|
-
3. Legacy:
|
|
30
|
-
#### 2. Before running script
|
|
31
|
-
Build your CLI using:
|
|
32
|
-
```bash
|
|
33
|
-
yarn install
|
|
34
|
-
yarn build
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
#### 3. Run setup script
|
|
3
|
+
Spree CLI is a tool that makes it easy to bootstrap a new Spree project.
|
|
4
|
+
It provides an interactive process for configuring Spree backend (running in Dockerized, Hybrid or Native mode) and a selection of available frontends.
|
|
38
5
|
|
|
39
|
-
|
|
40
|
-
./bin/run generate store
|
|
41
|
-
```
|
|
6
|
+
## Dependencies
|
|
42
7
|
|
|
43
|
-
|
|
8
|
+
Node 14+ is required to run the CLI. Depending on the chosen Spree setup, you will have to install different dependencies first:
|
|
44
9
|
|
|
45
|
-
|
|
10
|
+
### Spree (dockerized)
|
|
11
|
+
- docker >= 20.0
|
|
12
|
+
- docker-compose
|
|
46
13
|
|
|
47
|
-
###
|
|
14
|
+
### Spree (no docker)
|
|
15
|
+
- ruby = 3.0.3
|
|
16
|
+
- vips >= 8.6
|
|
17
|
+
- gpg
|
|
18
|
+
- psql
|
|
19
|
+
- redis
|
|
48
20
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
### Spree (hybrid)
|
|
22
|
+
- docker >= 20.0
|
|
23
|
+
- docker-compose
|
|
24
|
+
- ruby = 3.0.3
|
|
25
|
+
- vips >= 8.6
|
|
26
|
+
- redis (only needed for running rspec tests)
|
|
53
27
|
|
|
28
|
+
### Vue Storefront
|
|
29
|
+
- node >= 14.15 <= 14.19
|
|
30
|
+
- yarn
|
|
54
31
|
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
### Next.js Commerce
|
|
33
|
+
- node >= 13.0
|
|
34
|
+
- yarn
|
|
57
35
|
|
|
36
|
+
## Usage
|
|
58
37
|
|
|
59
|
-
|
|
60
|
-
* NVM - https://github.com/nvm-sh/nvm
|
|
61
|
-
* Ruby - `rvm install 3.0.2`
|
|
62
|
-
* Node - `nvm install`
|
|
63
|
-
* Yarn - `npm -g install yarn`
|
|
64
|
-
|
|
65
|
-
Frontend:
|
|
66
|
-
|
|
67
|
-
1. VueStorefront:
|
|
68
|
-
* Node 14.15.x - 14.19.x
|
|
69
|
-
|
|
70
|
-
2. NextJs Storefront:
|
|
71
|
-
* Node
|
|
72
|
-
* Npm
|
|
73
|
-
3. Legacy:
|
|
74
|
-
#### 2. Before running script
|
|
75
|
-
Build your CLI using:
|
|
38
|
+
To get started, simply run the following command in your terminal:
|
|
76
39
|
|
|
77
40
|
```bash
|
|
78
|
-
|
|
79
|
-
yarn build
|
|
41
|
+
npx @spree/cli new app
|
|
80
42
|
```
|
|
81
43
|
|
|
82
|
-
|
|
44
|
+
This will launch the interactive process that will guide you through the process of setting up a new Spree-based store.
|
|
83
45
|
|
|
46
|
+
In order to start the already generated app, navigate to your project's folder and run the following command:
|
|
84
47
|
```bash
|
|
85
|
-
|
|
48
|
+
npx @spree/cli start app
|
|
86
49
|
```
|
|
50
|
+
Happy hacking!
|
|
87
51
|
|
|
88
|
-
This will automatically launch the application at `http://localhost:4000/admin`
|
|
89
|
-
|
|
90
|
-
Selected storefront integration will be accessible under `http://localhost:3000`
|
|
91
52
|
## Troubleshooting
|
|
92
53
|
|
|
93
54
|
### 1. NextJS storefront doesn't start properly
|
|
@@ -104,7 +65,7 @@ If you have encountered any other problem with NextJS you can also refer to Next
|
|
|
104
65
|
|
|
105
66
|
## Overview
|
|
106
67
|
|
|
107
|
-
This repository contains CLI to integrate
|
|
68
|
+
This repository contains CLI to integrate Spree and storefront of your choice
|
|
108
69
|
|
|
109
70
|
This repository is being developed and maintained by [Upside](https://upsidelab.io)
|
|
110
71
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/commands/new/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AA4B7C,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,OAAgB,WAAW,SAAoC;IAE/D,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK,KAAM;IAE3B,OAAgB,IAAI,UAAM;IAEpB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8I3B"}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
5
6
|
const color_1 = tslib_1.__importDefault(require("@oclif/color"));
|
|
6
7
|
const i18next_1 = require("i18next");
|
|
7
8
|
const path = tslib_1.__importStar(require("path"));
|
|
9
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
10
|
const child_process_1 = require("child_process");
|
|
9
11
|
const project_name_1 = require("../../domains/project-name");
|
|
10
12
|
const git_repository_1 = require("../../domains/git-repository");
|
|
@@ -12,26 +14,35 @@ const directory_1 = require("../../domains/directory");
|
|
|
12
14
|
const spree_1 = require("../../domains/spree");
|
|
13
15
|
const integration_1 = require("../../domains/integration");
|
|
14
16
|
const build_1 = require("../../domains/build");
|
|
17
|
+
const run_1 = require("../../domains/run");
|
|
15
18
|
const variables_1 = require("../../domains/variables");
|
|
16
19
|
const typescript_1 = require("../../domains/typescript");
|
|
17
20
|
const existsDirectory_1 = tslib_1.__importDefault(require("../../domains/directory/existsDirectory"));
|
|
18
21
|
const directory_2 = require("../../domains/directory");
|
|
19
|
-
const
|
|
20
|
-
class
|
|
22
|
+
const validateDependencies_1 = tslib_1.__importDefault(require("../../domains/dependencies/validate/validateDependencies"));
|
|
23
|
+
class NewApp extends core_1.Command {
|
|
21
24
|
async run() {
|
|
22
25
|
const variables = await (async () => {
|
|
23
|
-
const projectName = await (0, project_name_1.getProjectName)((0, i18next_1.t)('command.
|
|
26
|
+
const projectName = await (0, project_name_1.getProjectName)((0, i18next_1.t)('command.new_app.input.project_name'));
|
|
24
27
|
return (0, variables_1.useVariables)({ projectName });
|
|
25
28
|
})();
|
|
26
29
|
const projectDir = path.resolve(variables.projectName);
|
|
27
|
-
const spree = await (0, spree_1.getSpree)({ message: (0, i18next_1.t)('command.
|
|
30
|
+
const { samples, ...spree } = await (0, spree_1.getSpree)({ message: (0, i18next_1.t)('command.new_app.input.spree') });
|
|
31
|
+
const { samples: withSamples } = await inquirer_1.default.prompt({
|
|
32
|
+
message: (0, i18next_1.t)('command.new_app.input.samples'),
|
|
33
|
+
type: 'confirm',
|
|
34
|
+
name: 'samples'
|
|
35
|
+
});
|
|
28
36
|
const integration = await (0, integration_1.getIntegration)({
|
|
29
|
-
message: (0, i18next_1.t)('command.
|
|
30
|
-
customIntegrationRepositoryMessage: (0, i18next_1.t)('command.
|
|
37
|
+
message: (0, i18next_1.t)('command.new_app.input.integration'),
|
|
38
|
+
customIntegrationRepositoryMessage: (0, i18next_1.t)('command.new_app.input.custom_integration_repository')
|
|
31
39
|
});
|
|
32
40
|
const modules = [
|
|
33
41
|
{
|
|
34
|
-
template:
|
|
42
|
+
template: withSamples && samples ? {
|
|
43
|
+
...spree,
|
|
44
|
+
...samples
|
|
45
|
+
} : { ...spree },
|
|
35
46
|
path: variables.pathBackend,
|
|
36
47
|
buildOptions: { encoding: 'utf-8', stdio: 'inherit', shell: true }
|
|
37
48
|
},
|
|
@@ -40,21 +51,29 @@ class GenerateStore extends core_1.Command {
|
|
|
40
51
|
path: variables.pathIntegration,
|
|
41
52
|
buildOptions: { stdio: 'inherit', shell: true }
|
|
42
53
|
}
|
|
43
|
-
].map((m) => ({
|
|
44
|
-
|
|
54
|
+
].map((m) => ({
|
|
55
|
+
...m,
|
|
56
|
+
template: {
|
|
57
|
+
...m.template,
|
|
58
|
+
runScriptLocalPath: m.template.runScriptURL ? `run-${m.path}` : undefined
|
|
59
|
+
},
|
|
60
|
+
absolutePath: `${projectDir}/${m.path}`
|
|
61
|
+
}));
|
|
62
|
+
const mountGitRepository = async (dir, gitRepositoryURL, gitRef) => {
|
|
45
63
|
if (await (0, existsDirectory_1.default)(dir)) {
|
|
46
64
|
await (0, directory_2.removeFileOrDirectory)(dir);
|
|
47
65
|
}
|
|
48
|
-
await (0, git_repository_1.cloneGitRepository)({ dir, gitRepositoryURL });
|
|
66
|
+
await (0, git_repository_1.cloneGitRepository)({ dir, gitRepositoryURL, gitRef });
|
|
49
67
|
await (0, git_repository_1.terminateGitRepository)(projectDir);
|
|
50
68
|
};
|
|
51
69
|
const repositoriesToMount = [];
|
|
52
|
-
await
|
|
53
|
-
for (const { absolutePath, template: { gitRepositoryURL, name } } of modules) {
|
|
70
|
+
await (0, validateDependencies_1.default)(modules);
|
|
71
|
+
for (const { absolutePath, template: { gitRepositoryURL, name, gitRef } } of modules) {
|
|
54
72
|
if (!gitRepositoryURL)
|
|
55
73
|
continue;
|
|
74
|
+
const gitRefWithDefault = gitRef || 'main';
|
|
56
75
|
const shouldCreateDirectory = await (0, directory_1.createDirectory)(absolutePath);
|
|
57
|
-
const fn = shouldCreateDirectory ? (async () => await mountGitRepository(absolutePath, gitRepositoryURL)) : undefined;
|
|
76
|
+
const fn = shouldCreateDirectory ? (async () => await mountGitRepository(absolutePath, gitRepositoryURL, gitRefWithDefault)) : undefined;
|
|
58
77
|
repositoriesToMount.push({ name, fn });
|
|
59
78
|
}
|
|
60
79
|
for (const { name, fn } of repositoriesToMount) {
|
|
@@ -62,16 +81,16 @@ class GenerateStore extends core_1.Command {
|
|
|
62
81
|
await fn();
|
|
63
82
|
}
|
|
64
83
|
else {
|
|
65
|
-
this.log((0, i18next_1.t)('command.
|
|
84
|
+
this.log((0, i18next_1.t)('command.new_app.message.skipping', { name }));
|
|
66
85
|
}
|
|
67
86
|
}
|
|
68
87
|
this.log('');
|
|
69
|
-
this.log((0, i18next_1.t)('command.
|
|
88
|
+
this.log((0, i18next_1.t)('command.new_app.message.success', { projectName: variables.projectName }));
|
|
70
89
|
this.log('');
|
|
71
90
|
const logModuleDocumentation = ({ template: { documentationURL, name } }) => {
|
|
72
91
|
if (!documentationURL)
|
|
73
92
|
return;
|
|
74
|
-
this.log((0, i18next_1.t)('command.
|
|
93
|
+
this.log((0, i18next_1.t)('command.new_app.message.configure', { documentationURL, name }));
|
|
75
94
|
this.log('');
|
|
76
95
|
};
|
|
77
96
|
modules.forEach(logModuleDocumentation);
|
|
@@ -82,19 +101,43 @@ class GenerateStore extends core_1.Command {
|
|
|
82
101
|
const buildScript = await (0, build_1.getBuildScript)(url);
|
|
83
102
|
return preBuildScript.concat(buildScript);
|
|
84
103
|
};
|
|
85
|
-
core_1.CliUx.ux.action.start((0, i18next_1.t)('command.
|
|
104
|
+
core_1.CliUx.ux.action.start((0, i18next_1.t)('command.new_app.message.build_scripts'));
|
|
86
105
|
const buildScripts = await Promise.all(modules.map(fetchBuildScript));
|
|
87
|
-
core_1.CliUx.ux.action.stop(color_1.default.green((0, i18next_1.t)('command.
|
|
106
|
+
core_1.CliUx.ux.action.stop(color_1.default.green((0, i18next_1.t)('command.new_app.message.done')));
|
|
107
|
+
const fetchRunScript = async ({ template: { runScriptURL: url } }) => {
|
|
108
|
+
if (!(0, typescript_1.notEmpty)(url))
|
|
109
|
+
return;
|
|
110
|
+
const runScript = await (0, run_1.getRunScript)(url);
|
|
111
|
+
return runScript;
|
|
112
|
+
};
|
|
113
|
+
core_1.CliUx.ux.action.start((0, i18next_1.t)('command.new_app.message.run_scripts'));
|
|
114
|
+
const runScripts = await Promise.all(modules.map(fetchRunScript));
|
|
115
|
+
core_1.CliUx.ux.action.stop(color_1.default.green((0, i18next_1.t)('command.new_app.message.done')));
|
|
88
116
|
const runnersMap = modules.reduce((res, { path, buildOptions, template: { name } }, i) => ({
|
|
89
117
|
...res,
|
|
90
|
-
[path]: { name, buildOptions, buildScript: buildScripts[i] }
|
|
118
|
+
[path]: { name, buildOptions, buildScript: buildScripts[i], runScript: runScripts[i] }
|
|
91
119
|
}), {});
|
|
120
|
+
const runModules = modules.map(({ path, buildOptions, template: { name, runScriptPath, runScriptLocalPath, dependencies } }) => ({
|
|
121
|
+
path: path,
|
|
122
|
+
buildOptions: buildOptions,
|
|
123
|
+
template: {
|
|
124
|
+
name: name,
|
|
125
|
+
runScriptPath: runScriptPath,
|
|
126
|
+
runScriptLocalPath: runScriptLocalPath,
|
|
127
|
+
dependencies: dependencies
|
|
128
|
+
}
|
|
129
|
+
}));
|
|
130
|
+
fs.writeFileSync(`${projectDir}/${variables.projectDetailsFileName}.json`, JSON.stringify(runModules, null, 2));
|
|
131
|
+
for (const [runnerKey, runner] of Object.entries(runnersMap)) {
|
|
132
|
+
if (runner.runScript)
|
|
133
|
+
fs.writeFileSync(`${projectDir}/run-${runnerKey}`, runner.runScript);
|
|
134
|
+
}
|
|
92
135
|
const executeRunner = ({ buildScript, buildOptions, name }) => {
|
|
93
136
|
if (buildScript) {
|
|
94
137
|
(0, child_process_1.spawn)(buildScript, buildOptions);
|
|
95
138
|
}
|
|
96
139
|
else {
|
|
97
|
-
this.
|
|
140
|
+
this.debug((0, i18next_1.t)('command.new_app.message.build_scripts_skipping', { name }));
|
|
98
141
|
}
|
|
99
142
|
};
|
|
100
143
|
[variables.pathBackend, variables.pathIntegration]
|
|
@@ -102,36 +145,10 @@ class GenerateStore extends core_1.Command {
|
|
|
102
145
|
.filter((typescript_1.notEmpty))
|
|
103
146
|
.forEach((runner) => executeRunner(runner));
|
|
104
147
|
}
|
|
105
|
-
async _validateDependencies(modules) {
|
|
106
|
-
for (const module of modules) {
|
|
107
|
-
await this._validateDependenciesForModule(module);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async _validateDependenciesForModule(module) {
|
|
111
|
-
const { template: { dependencies } } = module;
|
|
112
|
-
if (!dependencies) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
for (const [name, versionString] of Object.entries(dependencies)) {
|
|
116
|
-
core_1.CliUx.ux.action.start((0, i18next_1.t)('command.generate_store.message.dependency_checking', { name, expectedVersion: versionString }));
|
|
117
|
-
const result = await (0, checkDependencies_1.default)(name, versionString);
|
|
118
|
-
if (result.status === 'OK') {
|
|
119
|
-
core_1.CliUx.ux.action.stop(color_1.default.green((0, i18next_1.t)('command.generate_store.message.done')));
|
|
120
|
-
}
|
|
121
|
-
else if (result.status === 'NOT_FOUND') {
|
|
122
|
-
core_1.CliUx.ux.action.stop(color_1.default.red((0, i18next_1.t)('command.generate_store.message.error')));
|
|
123
|
-
this.error((0, i18next_1.t)('command.generate_store.message.dependency_not_found', { name }));
|
|
124
|
-
}
|
|
125
|
-
else if (result.status === 'VERSION_MISMATCH') {
|
|
126
|
-
core_1.CliUx.ux.action.stop(color_1.default.red((0, i18next_1.t)('command.generate_store.message.error')));
|
|
127
|
-
this.error((0, i18next_1.t)('command.generate_store.message.dependency_version_mismatch', { name, expectedVersion: versionString, currentVersion: result.versionFound }));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
148
|
}
|
|
132
|
-
exports.default =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
//# sourceMappingURL=
|
|
149
|
+
exports.default = NewApp;
|
|
150
|
+
NewApp.description = (0, i18next_1.t)('command.new_app.description');
|
|
151
|
+
NewApp.examples = ['<%= config.bin %> <%= command.id %>'];
|
|
152
|
+
NewApp.flags = {};
|
|
153
|
+
NewApp.args = [];
|
|
154
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/commands/new/app.ts"],"names":[],"mappings":";;;AAAA,sCAA6C;AAC7C,+CAAyB;AACzB,iEAAiC;AACjC,qCAA4B;AAC5B,mDAA6B;AAC7B,gEAAgC;AAChC,iDAAsC;AAEtC,6DAA4D;AAC5D,iEAGsC;AACtC,uDAA0D;AAC1D,+CAA+C;AAC/C,2DAA2D;AAE3D,+CAAkE;AAClE,2CAAiD;AACjD,uDAAuD;AAEvD,yDAAoD;AACpD,sGAAsE;AACtE,uDAAgE;AAEhE,4HAA4F;AAG5F,MAAqB,MAAO,SAAQ,cAAO;IASzC,KAAK,CAAC,GAAG;QACP,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE;YAClC,MAAM,WAAW,GAAG,MAAM,IAAA,6BAAc,EAAC,IAAA,WAAC,EAAC,oCAAoC,CAAC,CAAC,CAAC;YAClF,OAAO,IAAA,wBAAY,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,EAAE,CAAC;QAEL,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAEvD,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,IAAA,gBAAQ,EAAC,EAA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C;IAChD,CAAC;;AAtJH,yBAuJC;AAtJiB,kBAAW,GAAG,IAAA,WAAC,EAAC,6BAA6B,CAAC,CAAC;AAE/C,eAAQ,GAAG,CAAC,qCAAqC,CAAC,CAAC;AAEnD,YAAK,GAAG,EAAE,CAAC;AAEX,WAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/commands/start/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAWtC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAC3C,OAAgB,WAAW,SAAsC;IAEjE,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK,KAAM;IAE3B,OAAgB,IAAI,UAAM;IAEpB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2B3B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const i18next_1 = require("i18next");
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const variables_1 = require("../../domains/variables");
|
|
10
|
+
const validateDependencies_1 = tslib_1.__importDefault(require("../../domains/dependencies/validate/validateDependencies"));
|
|
11
|
+
class StartApp extends core_1.Command {
|
|
12
|
+
async run() {
|
|
13
|
+
const projectDir = path.resolve();
|
|
14
|
+
const variables = await (async () => {
|
|
15
|
+
return (0, variables_1.useVariables)({ projectName: path.basename(projectDir) });
|
|
16
|
+
})();
|
|
17
|
+
const modules = JSON.parse(fs.readFileSync(`${projectDir}/${variables.projectDetailsFileName}.json`, { encoding: 'utf8', flag: 'r' }));
|
|
18
|
+
await (0, validateDependencies_1.default)(modules);
|
|
19
|
+
const runners = modules
|
|
20
|
+
.filter(({ template: { runScriptLocalPath } }) => !!runScriptLocalPath)
|
|
21
|
+
.map(({ path, buildOptions, template: { name, runScriptLocalPath } }) => ({
|
|
22
|
+
name: name,
|
|
23
|
+
module: path,
|
|
24
|
+
buildOptions: buildOptions,
|
|
25
|
+
runScript: fs.readFileSync(`${projectDir}/${runScriptLocalPath}`, { encoding: 'utf8', flag: 'r' })
|
|
26
|
+
}));
|
|
27
|
+
runners.forEach(({ name, module, buildOptions, runScript }) => {
|
|
28
|
+
if (runScript) {
|
|
29
|
+
(0, child_process_1.spawn)(runScript, buildOptions);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.log((0, i18next_1.t)('command.start_app.message.failure', { module, name }));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = StartApp;
|
|
38
|
+
StartApp.description = (0, i18next_1.t)('command.start_app.description');
|
|
39
|
+
StartApp.examples = ['<%= config.bin %> <%= command.id %>'];
|
|
40
|
+
StartApp.flags = {};
|
|
41
|
+
StartApp.args = [];
|
|
42
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/commands/start/app.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,+CAAyB;AACzB,qCAA4B;AAC5B,mDAA6B;AAC7B,iDAAsC;AAEtC,uDAAuD;AAGvD,4HAA4F;AAE5F,MAAqB,QAAS,SAAQ,cAAO;IAS3C,KAAK,CAAC,GAAG;QACP,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE;YAClC,OAAO,IAAA,wBAAY,EAAC,EAAE,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;Q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,GAAG,CAAC,qCAAqC,CAAC,CAAC;AAEnD,cAAK,GAAG,EAAE,CAAC;AAEX,aAAI,GAAG,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkDependencies.d.ts","sourceRoot":"","sources":["../../../src/domains/dependencies/checkDependencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkDependencies.d.ts","sourceRoot":"","sources":["../../../src/domains/dependencies/checkDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,sBAAsB,CAAC;AAiB9D,QAAA,MAAM,eAAe,mBAA0B,MAAM,iBAAiB,MAAM,KAAG,QAAQ,qBAAqB,CAM3G,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const checkRubyVersion_1 = tslib_1.__importDefault(require("./checkRubyVersion"));
|
|
6
|
-
const checkNodeVersion_1 = tslib_1.__importDefault(require("./checkNodeVersion"));
|
|
4
|
+
const checkVersionByShellCommand_1 = tslib_1.__importDefault(require("./checkVersionByShellCommand"));
|
|
7
5
|
const dependencyMapping = {
|
|
8
|
-
ruby:
|
|
9
|
-
docker:
|
|
10
|
-
|
|
6
|
+
ruby: 'ruby --version',
|
|
7
|
+
docker: 'docker --version',
|
|
8
|
+
'docker-compose': 'docker-compose --version',
|
|
9
|
+
vips: 'vips --version',
|
|
10
|
+
gpg: 'gpg --version',
|
|
11
|
+
psql: 'psql --version',
|
|
12
|
+
redis: 'redis-server --version',
|
|
13
|
+
node: 'node -v',
|
|
14
|
+
yarn: 'yarn --version'
|
|
11
15
|
};
|
|
12
16
|
const checkDependency = async (dependencyName, versionString) => {
|
|
13
17
|
if (Object.keys(dependencyMapping).includes(dependencyName)) {
|
|
14
|
-
return await dependencyMapping[dependencyName]
|
|
18
|
+
return await (0, checkVersionByShellCommand_1.default)(dependencyMapping[dependencyName], versionString);
|
|
15
19
|
}
|
|
16
20
|
else {
|
|
17
21
|
throw new Error(`Unsupported dependency ${dependencyName}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkDependencies.js","sourceRoot":"","sources":["../../../src/domains/dependencies/checkDependencies.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"checkDependencies.js","sourceRoot":"","sources":["../../../src/domains/dependencies/checkDependencies.ts"],"names":[],"mappings":";;;AACA,sGAAsE;AAItE,MAAM,iBAAiB,GAAwC;IAC7D,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE,kBAAkB;IAC1B,gBAAgB,EAAE,0BAA0B;IAC5C,IAAI,EAAE,gBAAgB;IACtB,GAAG,EAAE,eAAe;IACpB,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,wBAAwB;IAC/B,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,gBAAgB;CACvB,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,EAAE,cAAsB,EAAE,aAAqB,EAAkC,EAAE;IAC9G,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QAC3D,OAAO,MAAM,IAAA,oCAA0B,EAAC,iBAAiB,CAAC,cAAqC,CAAC,EAAE,aAAa,CAAC,CAAC;KAClH;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,0BAA0B,cAAc,EAAE,CAAC,CAAC;KAC7D;AACH,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type DependencyCheckResult from './VersionCheckResult';
|
|
2
|
-
declare const checkVersionByShellCommand: (command: string, versionString: string
|
|
2
|
+
declare const checkVersionByShellCommand: (command: string, versionString: string) => Promise<DependencyCheckResult>;
|
|
3
3
|
export default checkVersionByShellCommand;
|
|
4
4
|
//# sourceMappingURL=checkVersionByShellCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkVersionByShellCommand.d.ts","sourceRoot":"","sources":["../../../src/domains/dependencies/checkVersionByShellCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkVersionByShellCommand.d.ts","sourceRoot":"","sources":["../../../src/domains/dependencies/checkVersionByShellCommand.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,qBAAqB,MAAM,sBAAsB,CAAC;AAK9D,QAAA,MAAM,0BAA0B,YAAmB,MAAM,iBAAiB,MAAM,KAAG,QAAQ,qBAAqB,CAqC/G,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -4,13 +4,14 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const util_1 = require("util");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const parseVersionCondition_1 = tslib_1.__importDefault(require("./parseVersionCondition"));
|
|
7
|
+
const extractVersion_1 = tslib_1.__importDefault(require("./extractVersion"));
|
|
7
8
|
const compareVersions_1 = tslib_1.__importDefault(require("./compareVersions"));
|
|
8
9
|
const execute = (0, util_1.promisify)(child_process_1.exec);
|
|
9
|
-
const checkVersionByShellCommand = async (command, versionString
|
|
10
|
+
const checkVersionByShellCommand = async (command, versionString) => {
|
|
10
11
|
try {
|
|
11
12
|
const result = await execute(command);
|
|
12
13
|
const output = result.stdout;
|
|
13
|
-
const currentVersion =
|
|
14
|
+
const currentVersion = (0, extractVersion_1.default)(output);
|
|
14
15
|
let compareResult;
|
|
15
16
|
const versionCondition = (0, parseVersionCondition_1.default)(versionString);
|
|
16
17
|
if (Array.isArray(versionCondition.expectedVersion)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkVersionByShellCommand.js","sourceRoot":"","sources":["../../../src/domains/dependencies/checkVersionByShellCommand.ts"],"names":[],"mappings":";;;AAAA,+BAAiC;AACjC,iDAAqC;AAC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AAM,yBAAyB,GAAG,gBAAgB,CAAC,yBAA+C,CAAA;YAClG,aAAa,GAAG,yBAAyB,CAAC,QAAQ,CAAC,IAAA,yBAAe,EAAC,cAAc,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAA;SACtH;QAED,IAAI,aAAa,EAAE;YACjB,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,eAAe,EAAE,aAAa;gBAC9B,YAAY,EAAE,cAAc;aAC7B,CAAC;SACH;aAAM;YACL,OAAO;gBACL,MAAM,EAAE,kBAAkB;gBAC1B,eAAe,EAAE,aAAa;gBAC9B,YAAY,EAAE,cAAc;aAC7B,CAAC;SACH;KACF;IAAC,OAAO,CAAC,EAAE;QACV,OAAO;YACL,MAAM,EAAE,WAAW;YACnB,eAAe,EAAE,aAAa;SAC/B,CAAC;KACH;AACH,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractVersion.d.ts","sourceRoot":"","sources":["../../../src/domains/dependencies/extractVersion.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,kBAAmB,MAAM,KAAG,MAO/C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const versionRegExp = /(\d+)(\.\d+)(\.\d+)?/g;
|
|
4
|
+
const extractVersion = (versionString) => {
|
|
5
|
+
const regexResult = versionString.trim().match(versionRegExp);
|
|
6
|
+
if (!regexResult || !regexResult[0]) {
|
|
7
|
+
throw new Error(`Invalid version string: ${versionString}`);
|
|
8
|
+
}
|
|
9
|
+
return regexResult[0];
|
|
10
|
+
};
|
|
11
|
+
exports.default = extractVersion;
|
|
12
|
+
//# sourceMappingURL=extractVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractVersion.js","sourceRoot":"","sources":["../../../src/domains/dependencies/extractVersion.ts"],"names":[],"mappings":";;AAAA,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAE9C,MAAM,cAAc,GAAG,CAAC,aAAqB,EAAU,EAAE;IACvD,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAE9D,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,2BAA2B,aAAa,EAAE,CAAC,CAAC;KAC7D;IACD,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateDependencies.d.ts","sourceRoot":"","sources":["../../../../src/domains/dependencies/validate/validateDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA2B9D,QAAA,MAAM,oBAAoB,YAAmB,MAAM,EAAE,GAAG,UAAU,EAAE,kBAInE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const i18next_1 = require("i18next");
|
|
6
|
+
const checkDependencies_1 = tslib_1.__importDefault(require("../checkDependencies"));
|
|
7
|
+
const color_1 = tslib_1.__importDefault(require("@oclif/color"));
|
|
8
|
+
const validateDependenciesForModule = async (module) => {
|
|
9
|
+
const { template: { dependencies } } = module;
|
|
10
|
+
if (!dependencies) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
for (const [name, versionString] of Object.entries(dependencies)) {
|
|
14
|
+
core_1.CliUx.ux.action.start((0, i18next_1.t)('command.new_app.message.dependency_checking', { name, expectedVersion: versionString }));
|
|
15
|
+
const result = await (0, checkDependencies_1.default)(name, versionString);
|
|
16
|
+
if (result.status === 'OK') {
|
|
17
|
+
core_1.CliUx.ux.action.stop(color_1.default.green((0, i18next_1.t)('command.new_app.message.done')));
|
|
18
|
+
}
|
|
19
|
+
else if (result.status === 'NOT_FOUND') {
|
|
20
|
+
core_1.CliUx.ux.action.stop(color_1.default.red((0, i18next_1.t)('command.new_app.message.error')));
|
|
21
|
+
throw new Error((0, i18next_1.t)('command.new_app.message.dependency_not_found', { name }));
|
|
22
|
+
}
|
|
23
|
+
else if (result.status === 'VERSION_MISMATCH') {
|
|
24
|
+
core_1.CliUx.ux.action.stop(color_1.default.red((0, i18next_1.t)('command.new_app.message.error')));
|
|
25
|
+
throw new Error((0, i18next_1.t)('command.new_app.message.dependency_version_mismatch', { name, expectedVersion: versionString, currentVersion: result.versionFound }));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const validateDependencies = async (modules) => {
|
|
30
|
+
for (const module of modules) {
|
|
31
|
+
await validateDependenciesForModule(module);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.default = validateDependencies;
|
|
35
|
+
//# sourceMappingURL=validateDependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateDependencies.js","sourceRoot":"","sources":["../../../../src/domains/dependencies/validate/validateDependencies.ts"],"names":[],"mappings":";;;AACA,sCAAoC;AACpC,qCAA4B;AAC5B,qFAAmD;AACnD,iEAAiC;AACjC,MAAM,6BAA6B,GAAG,KAAK,EAAE,MAA2B,EAAE,EAAE;IAC1E,MAAM,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE,EAAC,GAAG,MAAM,CAAC;IAC7C,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO;KACR;IAED,KAAK,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC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C;AACH,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
|
|
@@ -9,7 +9,7 @@ const createDirectory = async (dir) => {
|
|
|
9
9
|
const { overwrite } = await inquirer_1.default.prompt({
|
|
10
10
|
type: 'confirm',
|
|
11
11
|
name: 'overwrite',
|
|
12
|
-
message: () => (0, i18next_1.t)('command.
|
|
12
|
+
message: () => (0, i18next_1.t)('command.new_app.input.overwrite', { dir })
|
|
13
13
|
});
|
|
14
14
|
return overwrite;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDirectory.js","sourceRoot":"","sources":["../../../src/domains/directory/createDirectory.ts"],"names":[],"mappings":";;;AAAA,qCAA4B;AAC5B,gEAAgC;AAChC,gFAAgD;AAEhD,MAAM,eAAe,GAAG,KAAK,EAAE,GAAW,EAAoB,EAAE;IAC9D,IAAI,MAAM,IAAA,yBAAe,EAAC,GAAG,CAAC,EAAE;QAC9B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAyB;YAClE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,WAAC,EAAC,
|
|
1
|
+
{"version":3,"file":"createDirectory.js","sourceRoot":"","sources":["../../../src/domains/directory/createDirectory.ts"],"names":[],"mappings":";;;AAAA,qCAA4B;AAC5B,gEAAgC;AAChC,gFAAgD;AAEhD,MAAM,eAAe,GAAG,KAAK,EAAE,GAAW,EAAoB,EAAE;IAC9D,IAAI,MAAM,IAAA,yBAAe,EAAC,GAAG,CAAC,EAAE;QAC9B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAyB;YAClE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,WAAC,EAAC,iCAAiC,EAAE,EAAE,GAAG,EAAE,CAAC;SAC7D,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloneGitRepository.d.ts","sourceRoot":"","sources":["../../../src/domains/git-repository/cloneGitRepository.ts"],"names":[],"mappings":"AAKA,aAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"cloneGitRepository.d.ts","sourceRoot":"","sources":["../../../src/domains/git-repository/cloneGitRepository.ts"],"names":[],"mappings":"AAKA,aAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gFAAgF;AAChF,QAAA,MAAM,kBAAkB,YAAmB,OAAO,KAAG,QAAQ,IAAI,CA6BhE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|