@minnai/create-aura-app 0.0.10 → 0.0.14
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
CHANGED
|
@@ -11,26 +11,15 @@ const colors_1 = require("kleur/colors");
|
|
|
11
11
|
async function scaffold(options) {
|
|
12
12
|
const { root, template, install, git, projectName } = options;
|
|
13
13
|
console.log((0, colors_1.dim)(`Scaffolding project in ${root}...`));
|
|
14
|
-
console.log((0, colors_1.dim)(`Current working directory: ${process.cwd()}`));
|
|
15
|
-
console.log((0, colors_1.dim)(`PATH: ${process.env.PATH?.substring(0, 100)}...`));
|
|
16
14
|
// Determine template path
|
|
17
15
|
const templateDir = path_1.default.resolve(__dirname, '..', 'templates', template);
|
|
18
|
-
console.log((0, colors_1.dim)(`Template source: ${templateDir}`));
|
|
19
16
|
if (!fs_extra_1.default.existsSync(templateDir)) {
|
|
20
|
-
console.error((0, colors_1.red)(`FATAL: Template source does not exist!`));
|
|
21
17
|
throw new Error(`Template "${template}" not found at ${templateDir}`);
|
|
22
18
|
}
|
|
23
19
|
// Ensure target directory exists
|
|
24
|
-
|
|
25
|
-
fs_extra_1.default.ensureDirSync(root);
|
|
26
|
-
console.log((0, colors_1.dim)(`Confirmed target directory exists: ${root}`));
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
console.error((0, colors_1.red)(`Failed to create directory: ${e.message}`));
|
|
30
|
-
}
|
|
20
|
+
await fs_extra_1.default.ensureDir(root);
|
|
31
21
|
// Copy template files
|
|
32
22
|
try {
|
|
33
|
-
console.log((0, colors_1.dim)('Copying files...'));
|
|
34
23
|
await fs_extra_1.default.copy(templateDir, root, {
|
|
35
24
|
overwrite: true,
|
|
36
25
|
filter: (src) => {
|
|
@@ -39,21 +28,14 @@ async function scaffold(options) {
|
|
|
39
28
|
return !parts.includes('node_modules') && !parts.includes('.git');
|
|
40
29
|
}
|
|
41
30
|
});
|
|
42
|
-
// Immediate verification
|
|
43
|
-
const files = fs_extra_1.default.readdirSync(root);
|
|
44
|
-
console.log((0, colors_1.dim)(`Copy complete. Files in target: ${files.join(', ')}`));
|
|
45
|
-
if (files.length === 0) {
|
|
46
|
-
console.error((0, colors_1.red)('WARNING: Target directory is empty after copy!'));
|
|
47
|
-
}
|
|
48
31
|
}
|
|
49
32
|
catch (e) {
|
|
50
33
|
console.error((0, colors_1.red)(`Failed to copy template: ${e.message}`));
|
|
51
34
|
}
|
|
52
|
-
//
|
|
35
|
+
// Restore .gitignore
|
|
53
36
|
const gitignorePath = path_1.default.join(root, '_gitignore');
|
|
54
37
|
if (fs_extra_1.default.existsSync(gitignorePath)) {
|
|
55
38
|
await fs_extra_1.default.move(gitignorePath, path_1.default.join(root, '.gitignore'), { overwrite: true });
|
|
56
|
-
console.log((0, colors_1.dim)('Restored .gitignore'));
|
|
57
39
|
}
|
|
58
40
|
// Update package.json name
|
|
59
41
|
const pkgPath = path_1.default.join(root, 'package.json');
|
|
@@ -62,24 +44,18 @@ async function scaffold(options) {
|
|
|
62
44
|
const pkg = await fs_extra_1.default.readJson(pkgPath);
|
|
63
45
|
pkg.name = projectName;
|
|
64
46
|
await fs_extra_1.default.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
65
|
-
console.log((0, colors_1.dim)(`Updated package.json name to ${projectName}`));
|
|
66
47
|
}
|
|
67
48
|
catch (e) {
|
|
68
49
|
console.error((0, colors_1.red)(`Failed to update package.json: ${e.message}`));
|
|
69
50
|
}
|
|
70
51
|
}
|
|
71
|
-
else {
|
|
72
|
-
console.warn((0, colors_1.yellow)(`Warning: No package.json found at ${pkgPath}`));
|
|
73
|
-
}
|
|
74
52
|
// Initialize Git
|
|
75
53
|
if (git) {
|
|
76
54
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
(0, child_process_1.execSync)(`${gitCmd}
|
|
81
|
-
(0, child_process_1.execSync)(`${gitCmd} add -A`, { cwd: root, stdio: 'ignore', shell: true, env: process.env });
|
|
82
|
-
(0, child_process_1.execSync)(`${gitCmd} commit -m "Initial commit from create-aura-app"`, { cwd: root, stdio: 'ignore', shell: true, env: process.env });
|
|
55
|
+
const gitCmd = 'git';
|
|
56
|
+
(0, child_process_1.execSync)(`${gitCmd} init`, { cwd: root, stdio: 'ignore', shell: true });
|
|
57
|
+
(0, child_process_1.execSync)(`${gitCmd} add -A`, { cwd: root, stdio: 'ignore', shell: true });
|
|
58
|
+
(0, child_process_1.execSync)(`${gitCmd} commit -m "Initial commit from create-aura-app"`, { cwd: root, stdio: 'ignore', shell: true });
|
|
83
59
|
console.log((0, colors_1.dim)('Initialized a git repository.'));
|
|
84
60
|
}
|
|
85
61
|
catch (e) {
|
|
@@ -91,8 +67,8 @@ async function scaffold(options) {
|
|
|
91
67
|
console.log((0, colors_1.dim)('Installing dependencies... This might take a moment.'));
|
|
92
68
|
try {
|
|
93
69
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
94
|
-
(0, child_process_1.execSync)(`${npmCmd} install`, { cwd: root, stdio: 'inherit', shell: true
|
|
95
|
-
console.log((0, colors_1.green)('Dependencies installed successfully.'));
|
|
70
|
+
(0, child_process_1.execSync)(`${npmCmd} install`, { cwd: root, stdio: 'inherit', shell: true });
|
|
71
|
+
console.log((0, colors_1.green)('✔ Dependencies installed successfully.'));
|
|
96
72
|
}
|
|
97
73
|
catch (e) {
|
|
98
74
|
console.error((0, colors_1.red)(`Dependency installation failed: ${e.message}`));
|
package/package.json
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"lint": "eslint .",
|
|
10
10
|
"preview": "vite preview"
|
|
11
11
|
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18.0.0"
|
|
14
|
+
},
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@minnai/aura": "^0.1.6",
|
|
14
17
|
"@monaco-editor/react": "^4.7.0",
|
|
@@ -32,6 +35,6 @@
|
|
|
32
35
|
"globals": "^16.5.0",
|
|
33
36
|
"typescript": "~5.9.3",
|
|
34
37
|
"typescript-eslint": "^8.46.4",
|
|
35
|
-
"vite": "^
|
|
38
|
+
"vite": "^5.4.11"
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -271,15 +271,6 @@ export default {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
],
|
|
274
|
-
resolve: {
|
|
275
|
-
alias: {
|
|
276
|
-
// Alias @minnai/aura to the local source directory for verifying changes
|
|
277
|
-
'@minnai/aura': path.resolve(__dirname, '../../Aura/src'),
|
|
278
|
-
'react': path.resolve(__dirname, './node_modules/react'),
|
|
279
|
-
'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
|
|
280
|
-
},
|
|
281
|
-
dedupe: ['react', 'react-dom']
|
|
282
|
-
},
|
|
283
274
|
server: {
|
|
284
275
|
port: 5175
|
|
285
276
|
}
|