@ramme-io/create-app 1.3.18 ā 1.3.19
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/index.js +18 -17
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -6,29 +6,26 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = path.dirname(__filename);
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
9
|
+
const projectName = process.argv[2];
|
|
10
|
+
if (!projectName) {
|
|
11
11
|
console.error('Error: Please specify the project directory.');
|
|
12
|
+
console.log(' Usage: npx @ramme-io/create-app <project-name>');
|
|
12
13
|
process.exit(1);
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const templatePath = path.resolve(__dirname, 'template');
|
|
16
|
-
const destinationPath = path.resolve(process.cwd(),
|
|
17
|
+
const destinationPath = path.resolve(process.cwd(), projectName);
|
|
17
18
|
|
|
18
19
|
// THE STABILITY PACT: Hardcoded target versions for the public release
|
|
19
20
|
const RELEASE_VERSION = "^1.4.5";
|
|
20
21
|
|
|
21
22
|
try {
|
|
22
|
-
console.log(
|
|
23
|
+
console.log(`\nš Creating new Ramme app in: ${destinationPath}`);
|
|
23
24
|
|
|
24
|
-
// 1.
|
|
25
|
-
if (fs.existsSync(destinationPath)) {
|
|
26
|
-
console.warn("ā ļø Directory exists. Overwriting...");
|
|
27
|
-
}
|
|
25
|
+
// 1. Copy template
|
|
28
26
|
fs.copySync(templatePath, destinationPath);
|
|
29
27
|
|
|
30
|
-
// 2. Identify package.json
|
|
31
|
-
// We check for both names to ensure we catch it regardless of NPM filters
|
|
28
|
+
// 2. Identify package.json (handle renamed source)
|
|
32
29
|
let targetPkgPath = path.join(destinationPath, 'package.json');
|
|
33
30
|
const fallbackPkgPath = path.join(destinationPath, 'pkg.json');
|
|
34
31
|
|
|
@@ -38,21 +35,18 @@ try {
|
|
|
38
35
|
|
|
39
36
|
// 3. HARDEN SUPPLY CHAIN (Force Injection)
|
|
40
37
|
if (fs.existsSync(targetPkgPath)) {
|
|
41
|
-
console.log("š ļø Hardening Supply Chain...");
|
|
42
38
|
const pkg = fs.readJsonSync(targetPkgPath);
|
|
43
39
|
|
|
44
|
-
// Direct Overwrite
|
|
40
|
+
// Direct Overwrite
|
|
45
41
|
pkg.dependencies["@ramme-io/kernel"] = RELEASE_VERSION;
|
|
46
42
|
pkg.dependencies["@ramme-io/ui"] = RELEASE_VERSION;
|
|
47
43
|
|
|
48
|
-
//
|
|
44
|
+
// Cleanup
|
|
49
45
|
delete pkg.devDependencies["@ramme-io/kernel"];
|
|
50
46
|
delete pkg.devDependencies["@ramme-io/ui"];
|
|
51
47
|
|
|
52
48
|
fs.writeJsonSync(targetPkgPath, pkg, { spaces: 2 });
|
|
53
|
-
console.log(`ā
|
|
54
|
-
} else {
|
|
55
|
-
throw new Error("Critical Failure: package.json not found in template.");
|
|
49
|
+
console.log(`ā
Hardened Supply Chain: Pinned to ${RELEASE_VERSION}`);
|
|
56
50
|
}
|
|
57
51
|
|
|
58
52
|
// 4. Handle Gitignore
|
|
@@ -61,7 +55,14 @@ try {
|
|
|
61
55
|
fs.renameSync(gitignorePath, path.join(destinationPath, '.gitignore'));
|
|
62
56
|
}
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
// 5. ONBOARDING INSTRUCTIONS
|
|
59
|
+
console.log(`\n⨠Success! Your Ramme project is ready.`);
|
|
60
|
+
console.log(`\nNext steps:`);
|
|
61
|
+
console.log(` 1. cd ${projectName}`);
|
|
62
|
+
console.log(` 2. pnpm install`);
|
|
63
|
+
console.log(` 3. pnpm dev`);
|
|
64
|
+
console.log(`\nHappy building! š ļø\n`);
|
|
65
|
+
|
|
65
66
|
} catch (err) {
|
|
66
67
|
console.error('\nā Critical Failure:', err.message);
|
|
67
68
|
process.exit(1);
|