create-zephyr-apps 0.0.6 → 0.0.8
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/.github/workflows/pull_request.yml +56 -0
- package/.vscode/settings.json +75 -0
- package/biome.json +37 -0
- package/dist/index.cjs +135 -89
- package/dist/index.mjs +133 -87
- package/dist/package/utils/constants.d.ts +1 -1
- package/dist/package/utils/end.d.ts +1 -1
- package/package/index.ts +178 -113
- package/package/utils/constants.ts +64 -58
- package/package/utils/end.ts +19 -13
- package/package/utils/types.ts +1 -1
- package/package.json +33 -20
- package/rslib.config.ts +36 -37
- package/tsconfig.json +1 -2
- package/vite-mf/host/README.md +0 -50
- package/vite-mf/host/eslint.config.js +0 -25
- package/vite-mf/host/index.html +0 -13
- package/vite-mf/host/package.json +0 -31
- package/vite-mf/host/public/vite.svg +0 -1
- package/vite-mf/host/src/App.css +0 -42
- package/vite-mf/host/src/App.tsx +0 -37
- package/vite-mf/host/src/assets/react.svg +0 -1
- package/vite-mf/host/src/bootstrap.tsx +0 -10
- package/vite-mf/host/src/index.css +0 -68
- package/vite-mf/host/src/main.tsx +0 -8
- package/vite-mf/host/src/vite-env.d.ts +0 -1
- package/vite-mf/host/tsconfig.app.json +0 -24
- package/vite-mf/host/tsconfig.json +0 -4
- package/vite-mf/host/tsconfig.node.json +0 -22
- package/vite-mf/host/vite.config.ts +0 -40
- package/vite-mf/image.png +0 -0
- package/vite-mf/package.json +0 -12
- package/vite-mf/pnpm-lock.yaml +0 -9440
- package/vite-mf/pnpm-workspace.yaml +0 -2
- package/vite-mf/readme.md +0 -17
- package/vite-mf/remote/eslint.config.js +0 -25
- package/vite-mf/remote/index.html +0 -13
- package/vite-mf/remote/package.json +0 -31
- package/vite-mf/remote/public/vite.svg +0 -1
- package/vite-mf/remote/src/App.css +0 -38
- package/vite-mf/remote/src/App.tsx +0 -24
- package/vite-mf/remote/src/Button.css +0 -9
- package/vite-mf/remote/src/Button.tsx +0 -20
- package/vite-mf/remote/src/assets/react.svg +0 -1
- package/vite-mf/remote/src/bootstrap.tsx +0 -10
- package/vite-mf/remote/src/index.css +0 -68
- package/vite-mf/remote/src/main.tsx +0 -10
- package/vite-mf/remote/src/vite-env.d.ts +0 -1
- package/vite-mf/remote/tsconfig.app.json +0 -24
- package/vite-mf/remote/tsconfig.json +0 -4
- package/vite-mf/remote/tsconfig.node.json +0 -22
- package/vite-mf/remote/vite.config.ts +0 -25
- package/vite-mf/rspack/.babelrc +0 -6
- package/vite-mf/rspack/compilation.config.js +0 -31
- package/vite-mf/rspack/package.json +0 -32
- package/vite-mf/rspack/postcss.config.js +0 -6
- package/vite-mf/rspack/rspack.config.js +0 -110
- package/vite-mf/rspack/src/App.tsx +0 -21
- package/vite-mf/rspack/src/Image.tsx +0 -18
- package/vite-mf/rspack/src/assets/rspack-logo.png +0 -0
- package/vite-mf/rspack/src/global.d.ts +0 -4
- package/vite-mf/rspack/src/index.css +0 -7
- package/vite-mf/rspack/src/index.html +0 -12
- package/vite-mf/rspack/src/index.tsx +0 -1
- package/vite-mf/rspack/tailwind.config.js +0 -11
- package/vite-mf/rspack/tsconfig.json +0 -29
- package/vite-mf/webpack/.babelrc +0 -13
- package/vite-mf/webpack/compilation.config.js +0 -31
- package/vite-mf/webpack/package.json +0 -46
- package/vite-mf/webpack/postcss.config.js +0 -6
- package/vite-mf/webpack/src/App.tsx +0 -16
- package/vite-mf/webpack/src/Image.tsx +0 -18
- package/vite-mf/webpack/src/assets/webpack-logo.png +0 -0
- package/vite-mf/webpack/src/global.d.ts +0 -4
- package/vite-mf/webpack/src/index.html +0 -12
- package/vite-mf/webpack/src/index.scss +0 -7
- package/vite-mf/webpack/src/index.ts +0 -1
- package/vite-mf/webpack/tailwind.config.js +0 -11
- package/vite-mf/webpack/tsconfig.json +0 -29
- package/vite-mf/webpack/webpack.config.js +0 -91
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: pull_request
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
inputs:
|
|
7
|
+
branch:
|
|
8
|
+
description: "Branch to run workflow on"
|
|
9
|
+
required: true
|
|
10
|
+
default: "main"
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
NX_BRANCH: ${{ github.event.number || github.ref_name }}
|
|
14
|
+
NODE_VERSION: 18
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
18
|
+
cancel-in-progress: true
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
cache:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
- uses: pnpm/action-setup@v4
|
|
28
|
+
|
|
29
|
+
- name: Setup Node.js
|
|
30
|
+
uses: actions/setup-node@v3
|
|
31
|
+
with:
|
|
32
|
+
node-version-file: ".nvmrc"
|
|
33
|
+
cache: "pnpm"
|
|
34
|
+
- run: pnpm i --frozen-lockfile
|
|
35
|
+
|
|
36
|
+
lint:
|
|
37
|
+
needs: cache
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
with:
|
|
42
|
+
fetch-depth: 0
|
|
43
|
+
- uses: nrwl/nx-set-shas@v4
|
|
44
|
+
- uses: pnpm/action-setup@v4
|
|
45
|
+
|
|
46
|
+
- name: Setup Node.js
|
|
47
|
+
uses: actions/setup-node@v3
|
|
48
|
+
with:
|
|
49
|
+
node-version-file: ".nvmrc"
|
|
50
|
+
cache: "pnpm"
|
|
51
|
+
|
|
52
|
+
- name: Install dependencies
|
|
53
|
+
run: pnpm i --frozen-lockfile
|
|
54
|
+
|
|
55
|
+
- name: Lint
|
|
56
|
+
run: pnpm lint
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files.associations": {
|
|
3
|
+
".code-workspace": "jsonc",
|
|
4
|
+
".stylelintrc": "jsonc",
|
|
5
|
+
"stylelintrc": "jsonc",
|
|
6
|
+
"README": "markdown"
|
|
7
|
+
},
|
|
8
|
+
"search.useIgnoreFiles": true,
|
|
9
|
+
"search.exclude": {
|
|
10
|
+
"**/dist": true,
|
|
11
|
+
"**/*.log": true,
|
|
12
|
+
"**/*.pid": true,
|
|
13
|
+
"**/.git": true,
|
|
14
|
+
"**/node_modules": true
|
|
15
|
+
},
|
|
16
|
+
"files.eol": "\n",
|
|
17
|
+
"files.trimTrailingWhitespace": true,
|
|
18
|
+
"files.insertFinalNewline": true,
|
|
19
|
+
//
|
|
20
|
+
"javascript.validate.enable": false,
|
|
21
|
+
"typescript.validate.enable": true,
|
|
22
|
+
"css.validate": false,
|
|
23
|
+
"[css]": {
|
|
24
|
+
"editor.formatOnType": true,
|
|
25
|
+
"editor.formatOnPaste": true,
|
|
26
|
+
"editor.formatOnSave": true
|
|
27
|
+
},
|
|
28
|
+
"editor.codeActionsOnSave": {
|
|
29
|
+
"quickfix.biome": "explicit"
|
|
30
|
+
},
|
|
31
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
32
|
+
"editor.formatOnSave": true,
|
|
33
|
+
"[typescript]": {
|
|
34
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
35
|
+
"editor.codeActionsOnSave": {
|
|
36
|
+
"quickfix.biome": "explicit",
|
|
37
|
+
"source.organizeImports": "never",
|
|
38
|
+
"source.organizeImports.biome": "explicit"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"[typescriptreact]": {
|
|
42
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
43
|
+
"editor.codeActionsOnSave": {
|
|
44
|
+
"quickfix.biome": "explicit",
|
|
45
|
+
"source.organizeImports": "never",
|
|
46
|
+
"source.organizeImports.biome": "explicit"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"[json]": {
|
|
50
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
51
|
+
},
|
|
52
|
+
"[jsonc]": {
|
|
53
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
54
|
+
},
|
|
55
|
+
"[javascriptreact]": {
|
|
56
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
57
|
+
"editor.codeActionsOnSave": {
|
|
58
|
+
"quickfix.biome": "explicit",
|
|
59
|
+
"source.organizeImports": "never",
|
|
60
|
+
"source.organizeImports.biome": "explicit"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"[javascript]": {
|
|
64
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
65
|
+
"editor.codeActionsOnSave": {
|
|
66
|
+
"quickfix.biome": "explicit",
|
|
67
|
+
"source.organizeImports": "never",
|
|
68
|
+
"source.organizeImports.biome": "explicit"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
72
|
+
"[github-actions-workflow]": {
|
|
73
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
74
|
+
}
|
|
75
|
+
}
|
package/biome.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"defaultBranch": "main",
|
|
6
|
+
"clientKind": "git",
|
|
7
|
+
"useIgnoreFile": true
|
|
8
|
+
},
|
|
9
|
+
"formatter": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"indentStyle": "space"
|
|
12
|
+
},
|
|
13
|
+
"javascript": {
|
|
14
|
+
"formatter": {
|
|
15
|
+
"quoteStyle": "single",
|
|
16
|
+
"arrowParentheses": "asNeeded",
|
|
17
|
+
"jsxQuoteStyle": "double",
|
|
18
|
+
"lineWidth": 80
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"linter": {
|
|
22
|
+
"enabled": true,
|
|
23
|
+
"rules": {
|
|
24
|
+
"recommended": true,
|
|
25
|
+
"suspicious": {
|
|
26
|
+
"noDuplicateFontNames": "off"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"organizeImports": {
|
|
31
|
+
"enabled": true
|
|
32
|
+
},
|
|
33
|
+
"files": {
|
|
34
|
+
"ignoreUnknown": true,
|
|
35
|
+
"ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -28,33 +28,15 @@ var __webpack_require__ = {};
|
|
|
28
28
|
};
|
|
29
29
|
})();
|
|
30
30
|
var __webpack_exports__ = {};
|
|
31
|
-
const promises_namespaceObject = require("node:timers/promises");
|
|
32
31
|
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
32
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
33
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
34
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
35
|
+
const promises_namespaceObject = require("node:timers/promises");
|
|
36
|
+
const prompts_namespaceObject = require("@clack/prompts");
|
|
33
37
|
const external_chalk_namespaceObject = require("chalk");
|
|
34
38
|
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
35
|
-
const
|
|
36
|
-
const prompts_namespaceObject = require("@clack/prompts");
|
|
37
|
-
function end_note({ project }) {
|
|
38
|
-
try {
|
|
39
|
-
(0, external_child_process_namespaceObject.exec)(`${project.path} && git config user.name`, (err, stdout, stderr)=>{
|
|
40
|
-
console.log(stdout);
|
|
41
|
-
const user_name = stdout.toString().trim();
|
|
42
|
-
const repo_name = project.path.split('/').pop();
|
|
43
|
-
let next_steps;
|
|
44
|
-
next_steps = 'web' === project.type ? `cd ${repo_name} \npnpm install\nrm -rf .git\ngit remote add origin https://github.com/${user_name.length >= 1 ? user_name : 'YourUsername'}/${repo_name}.git\npnpm run build` : `cd ${repo_name} \npnpm install\nrm -rf .git\npnpm run build\nMake your first commit and link it to the remote repository!`;
|
|
45
|
-
(0, prompts_namespaceObject.note)(next_steps, 'Next steps.');
|
|
46
|
-
});
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error(error);
|
|
49
|
-
} finally{
|
|
50
|
-
const end_notes = [
|
|
51
|
-
`Discord: ${external_chalk_default().underline(external_chalk_default().cyan('https://zephyr-cloud.io/discord'))}`,
|
|
52
|
-
`Documentation: ${external_chalk_default().underline(external_chalk_default().cyan('https://zephyr-cloud.io/docs'))}`,
|
|
53
|
-
`Open an issue: ${external_chalk_default().underline(external_chalk_default().cyan('https://github.com/ZephyrCloudIO/create-zephyr-apps/issues'))}`
|
|
54
|
-
];
|
|
55
|
-
(0, prompts_namespaceObject.note)(Object.values(end_notes).join('\n'), 'Problems?');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
39
|
+
const external_tempy_namespaceObject = require("tempy");
|
|
58
40
|
const TEMPLATES = {
|
|
59
41
|
'rspack-project': {
|
|
60
42
|
label: 'React + Rspack',
|
|
@@ -112,10 +94,69 @@ const TEMPLATES = {
|
|
|
112
94
|
framework: 'react'
|
|
113
95
|
}
|
|
114
96
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
97
|
+
function end_note({ project }) {
|
|
98
|
+
try {
|
|
99
|
+
(0, external_node_child_process_namespaceObject.exec)('git config user.name', (err, stdout, stderr)=>{
|
|
100
|
+
const user_name = stdout.toString().trim();
|
|
101
|
+
const repo_name = project.path.split('/').pop();
|
|
102
|
+
let next_steps;
|
|
103
|
+
next_steps = 'web' === project.type ? [
|
|
104
|
+
`cd ${repo_name}`,
|
|
105
|
+
'pnpm install',
|
|
106
|
+
'pnpm run build'
|
|
107
|
+
] : [
|
|
108
|
+
`cd ${repo_name}`,
|
|
109
|
+
'pnpm install',
|
|
110
|
+
external_chalk_default().magenta(`git remote add origin https://github.com/${user_name.length >= 1 ? user_name : 'YourUsername'}/${repo_name}.git`),
|
|
111
|
+
'ZC=1 pnpm run start',
|
|
112
|
+
'\n--------------------------------\n',
|
|
113
|
+
'Make sure to commit and add a remote to the remote repository!',
|
|
114
|
+
`Read more about how Module Federation works with Zephyr: ${external_chalk_default().underline(external_chalk_default().cyan('https://docs.zephyr-cloud.io/how-to/mf-guide'))}`
|
|
115
|
+
];
|
|
116
|
+
(0, prompts_namespaceObject.note)(external_chalk_default().cyan(next_steps.join('\n')), 'Next steps.');
|
|
117
|
+
});
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error(error);
|
|
120
|
+
} finally{
|
|
121
|
+
const end_notes = [
|
|
122
|
+
`Discord: ${external_chalk_default().underline(external_chalk_default().cyan('https://zephyr-cloud.io/discord'))}`,
|
|
123
|
+
`Documentation: ${'web' === project.type ? external_chalk_default().underline(external_chalk_default().cyan('https://docs.zephyr-cloud.io/recipes')) : external_chalk_default().underline(external_chalk_default().cyan('https://docs.zephyr-cloud.io/recipes/repack-mf'))}`,
|
|
124
|
+
`Open an issue: ${external_chalk_default().underline(external_chalk_default().cyan('https://github.com/ZephyrCloudIO/create-zephyr-apps/issues'))}`
|
|
125
|
+
];
|
|
126
|
+
(0, prompts_namespaceObject.note)(Object.values(end_notes).join('\n'), 'Problems?');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function runCmd(cmd, cwd) {
|
|
130
|
+
return new Promise((resolve, reject)=>{
|
|
131
|
+
(0, external_node_child_process_namespaceObject.exec)(cmd, {
|
|
132
|
+
cwd
|
|
133
|
+
}, (err, stdout, stderr)=>{
|
|
134
|
+
if (err) {
|
|
135
|
+
console.error(`Error executing command: ${cmd}`, err);
|
|
136
|
+
reject(err);
|
|
137
|
+
} else resolve();
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async function initializeGit(projectPath) {
|
|
142
|
+
const shouldInit = await (0, prompts_namespaceObject.confirm)({
|
|
143
|
+
message: 'Would you like to initialize a new Git repository?',
|
|
144
|
+
initialValue: true
|
|
145
|
+
});
|
|
146
|
+
if ((0, prompts_namespaceObject.isCancel)(shouldInit)) {
|
|
147
|
+
(0, prompts_namespaceObject.cancel)('Operation cancelled');
|
|
148
|
+
process.exit(0);
|
|
149
|
+
}
|
|
150
|
+
if (shouldInit) {
|
|
151
|
+
await runCmd('git init', projectPath);
|
|
152
|
+
await runCmd('git config user.email "zephyrbot@zephyr-cloud.io"', projectPath);
|
|
153
|
+
await runCmd('git config user.name "Zephyr Bot"', projectPath);
|
|
154
|
+
await runCmd('git add .', projectPath);
|
|
155
|
+
await runCmd('git commit -m "Initial commit from Zephyr"', projectPath);
|
|
156
|
+
await runCmd('git config --unset user.email', projectPath);
|
|
157
|
+
await runCmd('git config --unset user.name', projectPath);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
119
160
|
async function main() {
|
|
120
161
|
console.clear();
|
|
121
162
|
await (0, promises_namespaceObject.setTimeout)(1000);
|
|
@@ -144,12 +185,13 @@ async function main() {
|
|
|
144
185
|
options: [
|
|
145
186
|
{
|
|
146
187
|
value: 'web',
|
|
147
|
-
label: 'Web'
|
|
188
|
+
label: 'Web',
|
|
189
|
+
hint: 'You will be choosing from a selection of templates provided by us.'
|
|
148
190
|
},
|
|
149
191
|
{
|
|
150
192
|
value: 'react-native',
|
|
151
193
|
label: 'React Native',
|
|
152
|
-
hint: 'You will be building React Native powered by Re.Pack.'
|
|
194
|
+
hint: 'This is a comprehensive example project provided by us. You will be building React Native powered by Re.Pack.'
|
|
153
195
|
}
|
|
154
196
|
]
|
|
155
197
|
}),
|
|
@@ -177,65 +219,69 @@ async function main() {
|
|
|
177
219
|
const project_path = project.path.replace('./', '').trim();
|
|
178
220
|
const s = (0, prompts_namespaceObject.spinner)();
|
|
179
221
|
s.start(external_chalk_default().cyan(`Creating project in ${project_path}`));
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
222
|
+
const outputPath = external_node_path_default().join(process.cwd(), project.path);
|
|
223
|
+
try {
|
|
224
|
+
if ('web' === project.type) await new Promise((resolve, reject)=>{
|
|
225
|
+
(0, external_node_child_process_namespaceObject.exec)(command_web, async (err)=>{
|
|
226
|
+
if (err) {
|
|
227
|
+
s.stop(external_chalk_default().bgRed(external_chalk_default().black(`Error cloning repository to ${project_path}...`)));
|
|
228
|
+
return reject(err);
|
|
229
|
+
}
|
|
230
|
+
const clonedPath = external_node_path_default().join(temp_dir, 'examples', project.templates);
|
|
231
|
+
try {
|
|
232
|
+
await external_node_fs_namespaceObject.promises.rm(external_node_path_default().join(clonedPath, '.git'), {
|
|
233
|
+
recursive: true,
|
|
234
|
+
force: true
|
|
235
|
+
});
|
|
236
|
+
await external_node_fs_namespaceObject.promises.cp(clonedPath, outputPath, {
|
|
237
|
+
recursive: true,
|
|
238
|
+
force: true
|
|
239
|
+
});
|
|
240
|
+
s.stop(external_chalk_default().green(`Project successfully created at ${external_chalk_default().underline(project_path)}`));
|
|
241
|
+
resolve();
|
|
242
|
+
} catch (copyErr) {
|
|
243
|
+
s.stop(external_chalk_default().bgRed(external_chalk_default().black(`Error copying template to ${project_path}...`)));
|
|
244
|
+
reject(copyErr);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
else if ('react-native' === project.type) await new Promise((resolve, reject)=>{
|
|
249
|
+
(0, external_node_child_process_namespaceObject.exec)(command_react_native, async (err)=>{
|
|
250
|
+
if (err) {
|
|
251
|
+
s.stop(external_chalk_default().bgRed(external_chalk_default().black(`Error cloning repository to ${project_path}...`)));
|
|
252
|
+
return reject(err);
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
await external_node_fs_namespaceObject.promises.rm(external_node_path_default().join(temp_dir, '.git'), {
|
|
256
|
+
recursive: true,
|
|
257
|
+
force: true
|
|
258
|
+
});
|
|
259
|
+
await external_node_fs_namespaceObject.promises.cp(temp_dir, outputPath, {
|
|
260
|
+
recursive: true,
|
|
261
|
+
force: true
|
|
262
|
+
});
|
|
263
|
+
s.stop(external_chalk_default().green(`Project successfully created at ${external_chalk_default().underline(project_path)}`));
|
|
264
|
+
resolve();
|
|
265
|
+
} catch (copyErr) {
|
|
266
|
+
s.stop(external_chalk_default().bgRed(external_chalk_default().black(`Error copying files to ${project_path}...`)));
|
|
267
|
+
reject(copyErr);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
await initializeGit(outputPath);
|
|
272
|
+
(0, prompts_namespaceObject.note)('Git repository and initial commit created successfully!');
|
|
273
|
+
} catch (error) {
|
|
274
|
+
console.error(error);
|
|
275
|
+
process.exit(2);
|
|
276
|
+
} finally{
|
|
277
|
+
await external_node_fs_namespaceObject.promises.rm(temp_dir, {
|
|
278
|
+
recursive: true,
|
|
279
|
+
force: true
|
|
280
|
+
});
|
|
281
|
+
end_note({
|
|
282
|
+
project
|
|
283
|
+
});
|
|
284
|
+
}
|
|
239
285
|
}
|
|
240
286
|
main().catch(console.error);
|
|
241
287
|
var __webpack_export_target__ = exports;
|