create-nube-app 0.22.0 → 0.23.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/dist/index.js +39 -3
- package/package.json +3 -4
- package/templates/minimal/gitignore +33 -0
- package/templates/minimal/package.json +1 -1
- package/templates/minimal-ui/gitignore +33 -0
- package/templates/minimal-ui/package.json +1 -1
- package/templates/minimal-ui-jsx/gitignore +33 -0
- package/templates/minimal-ui-jsx/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54,8 +54,34 @@ async function installDependencies(pkgManager, dest, projectName) {
|
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
57
|
+
async function initGit(dest) {
|
|
58
|
+
const execAsync = promisify(exec);
|
|
59
|
+
const spinner = prompts.spinner();
|
|
60
|
+
try {
|
|
61
|
+
await execAsync("git --version");
|
|
62
|
+
} catch (error) {
|
|
63
|
+
prompts.log.warn("Git not found. Skipping git initialization.");
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
spinner.start("Initializing git...");
|
|
67
|
+
try {
|
|
68
|
+
await execAsync("git init", {
|
|
69
|
+
cwd: dest
|
|
70
|
+
});
|
|
71
|
+
spinner.stop("\u{1F331} Git initialized!");
|
|
72
|
+
return true;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
spinner.stop("Git failed to initialize.");
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function copyTemplateFiles(src, dest) {
|
|
79
|
+
await fs.copy(src, dest);
|
|
80
|
+
const gitignorePath = path.join(dest, "gitignore");
|
|
81
|
+
const dotGitignorePath = path.join(dest, ".gitignore");
|
|
82
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
83
|
+
await fs.move(gitignorePath, dotGitignorePath);
|
|
84
|
+
}
|
|
59
85
|
}
|
|
60
86
|
function cancel(message = "Operation cancelled") {
|
|
61
87
|
return prompts.cancel(message);
|
|
@@ -68,11 +94,12 @@ async function main() {
|
|
|
68
94
|
const defaultValue = "my-nube-app";
|
|
69
95
|
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
|
|
70
96
|
const pkgManager = pkgInfo ? pkgInfo.name : "npm";
|
|
97
|
+
prompts.intro("NubeSDK App");
|
|
71
98
|
const promptProjectName = await prompts.text({
|
|
72
99
|
message: "What is the project's name?",
|
|
73
100
|
defaultValue,
|
|
74
101
|
placeholder: defaultValue,
|
|
75
|
-
validate: validateProjectName
|
|
102
|
+
validate: (value) => validateProjectName(value ?? defaultValue)
|
|
76
103
|
});
|
|
77
104
|
const projectName = formatProjectName(
|
|
78
105
|
typeof promptProjectName === "string" ? promptProjectName : ""
|
|
@@ -100,6 +127,15 @@ async function main() {
|
|
|
100
127
|
cancel("Failed to copy template files.");
|
|
101
128
|
return;
|
|
102
129
|
}
|
|
130
|
+
const shouldInitGit = await prompts.confirm({
|
|
131
|
+
message: "Initialize git repository?",
|
|
132
|
+
initialValue: true
|
|
133
|
+
});
|
|
134
|
+
if (prompts.isCancel(shouldInitGit)) return cancel();
|
|
135
|
+
if (shouldInitGit) {
|
|
136
|
+
const gitSuccess = await initGit(dest);
|
|
137
|
+
if (!gitSuccess) return;
|
|
138
|
+
}
|
|
103
139
|
const success = await installDependencies(pkgManager, dest, projectName);
|
|
104
140
|
if (!success) return;
|
|
105
141
|
let message = "\u{1F680} Done. Now run:\n";
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Create Nube App",
|
|
4
4
|
"author": "Tiendanube / Nuvemshop",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.23.0",
|
|
7
7
|
"bin": {
|
|
8
8
|
"create-nube-app": "dist/index.js"
|
|
9
9
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@clack/prompts": "^0.
|
|
17
|
+
"@clack/prompts": "^1.0.0",
|
|
18
18
|
"fs-extra": "^11.1.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"README.md",
|
|
31
31
|
"CHANGELOG.md",
|
|
32
32
|
"LICENSE",
|
|
33
|
-
"./templates"
|
|
34
|
-
"./templates/**/.gitignore"
|
|
33
|
+
"./templates"
|
|
35
34
|
]
|
|
36
35
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
.pnpm-debug.log*
|
|
9
|
+
|
|
10
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# Dependency directories
|
|
14
|
+
node_modules/
|
|
15
|
+
|
|
16
|
+
# TypeScript cache
|
|
17
|
+
*.tsbuildinfo
|
|
18
|
+
|
|
19
|
+
# Optional npm cache directory
|
|
20
|
+
.npm
|
|
21
|
+
|
|
22
|
+
# Optional stylelint cache
|
|
23
|
+
.stylelintcache
|
|
24
|
+
|
|
25
|
+
# build
|
|
26
|
+
dist
|
|
27
|
+
|
|
28
|
+
# OS
|
|
29
|
+
.DS_Store
|
|
30
|
+
Thumbs.db
|
|
31
|
+
|
|
32
|
+
# Coverage
|
|
33
|
+
coverage
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "Tiendanube / Nuvemshop",
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@biomejs/biome": "^1.9.4",
|
|
16
|
-
"@tiendanube/nube-sdk-types": "^0.
|
|
16
|
+
"@tiendanube/nube-sdk-types": "^0.53.0",
|
|
17
17
|
"@vitest/coverage-v8": "^3.0.9",
|
|
18
18
|
"concurrently": "^9.1.2",
|
|
19
19
|
"serve": "^14.2.4",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
.pnpm-debug.log*
|
|
9
|
+
|
|
10
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# Dependency directories
|
|
14
|
+
node_modules/
|
|
15
|
+
|
|
16
|
+
# TypeScript cache
|
|
17
|
+
*.tsbuildinfo
|
|
18
|
+
|
|
19
|
+
# Optional npm cache directory
|
|
20
|
+
.npm
|
|
21
|
+
|
|
22
|
+
# Optional stylelint cache
|
|
23
|
+
.stylelintcache
|
|
24
|
+
|
|
25
|
+
# build
|
|
26
|
+
dist
|
|
27
|
+
|
|
28
|
+
# OS
|
|
29
|
+
.DS_Store
|
|
30
|
+
Thumbs.db
|
|
31
|
+
|
|
32
|
+
# Coverage
|
|
33
|
+
coverage
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@biomejs/biome": "^1.9.4",
|
|
17
17
|
"@tiendanube/nube-sdk-ui": "^0.17.0",
|
|
18
|
-
"@tiendanube/nube-sdk-types": "^0.
|
|
18
|
+
"@tiendanube/nube-sdk-types": "^0.53.0",
|
|
19
19
|
"@vitest/coverage-v8": "^3.0.9",
|
|
20
20
|
"concurrently": "^9.1.2",
|
|
21
21
|
"serve": "^14.2.4",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
.pnpm-debug.log*
|
|
9
|
+
|
|
10
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# Dependency directories
|
|
14
|
+
node_modules/
|
|
15
|
+
|
|
16
|
+
# TypeScript cache
|
|
17
|
+
*.tsbuildinfo
|
|
18
|
+
|
|
19
|
+
# Optional npm cache directory
|
|
20
|
+
.npm
|
|
21
|
+
|
|
22
|
+
# Optional stylelint cache
|
|
23
|
+
.stylelintcache
|
|
24
|
+
|
|
25
|
+
# build
|
|
26
|
+
dist
|
|
27
|
+
|
|
28
|
+
# OS
|
|
29
|
+
.DS_Store
|
|
30
|
+
Thumbs.db
|
|
31
|
+
|
|
32
|
+
# Coverage
|
|
33
|
+
coverage
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@biomejs/biome": "^1.9.4",
|
|
17
17
|
"@tiendanube/nube-sdk-ui": "^0.17.0",
|
|
18
18
|
"@tiendanube/nube-sdk-jsx": "^0.16.0",
|
|
19
|
-
"@tiendanube/nube-sdk-types": "^0.
|
|
19
|
+
"@tiendanube/nube-sdk-types": "^0.53.0",
|
|
20
20
|
"@vitest/coverage-v8": "^3.0.9",
|
|
21
21
|
"concurrently": "^9.1.2",
|
|
22
22
|
"serve": "^14.2.4",
|