@minnai/create-aura-app 0.0.2 → 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/dist/scaffold.js +21 -12
- package/package.json +1 -1
package/dist/scaffold.js
CHANGED
|
@@ -14,16 +14,23 @@ async function scaffold(options) {
|
|
|
14
14
|
// Determine template path
|
|
15
15
|
// Assumes templates are in ../templates relative to dist/index.js
|
|
16
16
|
const templateDir = path_1.default.resolve(__dirname, '..', 'templates', template);
|
|
17
|
+
console.log((0, colors_1.dim)(`Using template from: ${templateDir}`));
|
|
17
18
|
if (!fs_extra_1.default.existsSync(templateDir)) {
|
|
18
19
|
throw new Error(`Template "${template}" not found at ${templateDir}`);
|
|
19
20
|
}
|
|
20
21
|
// Copy template files
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
try {
|
|
23
|
+
await fs_extra_1.default.copy(templateDir, root, {
|
|
24
|
+
filter: (src) => {
|
|
25
|
+
// Filter out node_modules or other unnecessary files if they exist in templates
|
|
26
|
+
return !src.includes('node_modules');
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
console.log((0, colors_1.dim)('Successfully copied template files.'));
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
console.error((0, colors_1.red)(`Failed to copy template: ${e.message}`));
|
|
33
|
+
}
|
|
27
34
|
// Rename _gitignore to .gitignore
|
|
28
35
|
const gitignorePath = path_1.default.join(root, '_gitignore');
|
|
29
36
|
if (fs_extra_1.default.existsSync(gitignorePath)) {
|
|
@@ -39,23 +46,25 @@ async function scaffold(options) {
|
|
|
39
46
|
// Initialize Git
|
|
40
47
|
if (git) {
|
|
41
48
|
try {
|
|
42
|
-
(0,
|
|
43
|
-
(0, child_process_1.execSync)('git
|
|
44
|
-
(0, child_process_1.execSync)('git
|
|
49
|
+
console.log((0, colors_1.dim)('Initializing Git...'));
|
|
50
|
+
(0, child_process_1.execSync)('git init', { cwd: root, stdio: 'ignore', shell: true });
|
|
51
|
+
(0, child_process_1.execSync)('git add -A', { cwd: root, stdio: 'ignore', shell: true });
|
|
52
|
+
(0, child_process_1.execSync)('git commit -m "Initial commit from create-aura-app"', { cwd: root, stdio: 'ignore', shell: true });
|
|
45
53
|
console.log((0, colors_1.dim)('Initialized a git repository.'));
|
|
46
54
|
}
|
|
47
55
|
catch (e) {
|
|
48
|
-
console.warn((0, colors_1.dim)(
|
|
56
|
+
console.warn((0, colors_1.dim)(`Git initialization failed: ${e.message}`));
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
// Install dependencies
|
|
52
60
|
if (install) {
|
|
53
61
|
console.log((0, colors_1.dim)('Installing dependencies... This might take a moment.'));
|
|
54
62
|
try {
|
|
55
|
-
(0, child_process_1.execSync)('npm install', { cwd: root, stdio: 'inherit' });
|
|
63
|
+
(0, child_process_1.execSync)('npm install', { cwd: root, stdio: 'inherit', shell: true });
|
|
56
64
|
}
|
|
57
65
|
catch (e) {
|
|
58
|
-
console.
|
|
66
|
+
console.error((0, colors_1.red)(`Dependency installation failed: ${e.message}`));
|
|
67
|
+
console.warn((0, colors_1.dim)('You may need to run npm install manually.'));
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
}
|