create-tanstack-app 1.2.2 ā 1.12.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.ts +6 -0
- package/index.js +53 -8
- package/package.json +11 -5
- package/src/index.ts +8 -0
package/dist/index.ts
ADDED
package/index.js
CHANGED
|
@@ -1,20 +1,65 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { execSync } = require("child_process");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const readline = require("readline");
|
|
7
|
+
|
|
8
|
+
// Prompt the user for input
|
|
9
|
+
const rl = readline.createInterface({
|
|
10
|
+
input: process.stdin,
|
|
11
|
+
output: process.stdout,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
async function getFolderName(defaultName) {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
rl.question(
|
|
17
|
+
`Enter the folder name (or use './' for the current directory) [${defaultName}]: `,
|
|
18
|
+
(input) => {
|
|
19
|
+
resolve(input || defaultName);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
4
24
|
|
|
5
25
|
async function initApp() {
|
|
6
26
|
try {
|
|
7
|
-
// Get
|
|
8
|
-
const
|
|
27
|
+
// Get the folder name from the user or command-line argument
|
|
28
|
+
const argFolderName = process.argv[2];
|
|
29
|
+
const folderName = argFolderName || (await getFolderName("my-tanstack-app"));
|
|
30
|
+
rl.close();
|
|
31
|
+
|
|
32
|
+
const dest =
|
|
33
|
+
folderName === "./" ? process.cwd() : path.join(process.cwd(), folderName);
|
|
34
|
+
|
|
35
|
+
// Check if the destination already exists
|
|
36
|
+
if (fs.existsSync(dest)) {
|
|
37
|
+
console.log(
|
|
38
|
+
"ā Directory already exists. Please choose another name or delete the existing directory."
|
|
39
|
+
);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log("š„ Cloning TanStack app template from GitHub...");
|
|
44
|
+
|
|
45
|
+
// Clone the repository
|
|
46
|
+
execSync(
|
|
47
|
+
`git clone https://github.com/SH20RAJ/tanstack-start.git ${dest}`,
|
|
48
|
+
{
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
}
|
|
51
|
+
);
|
|
9
52
|
|
|
10
|
-
console.log("
|
|
53
|
+
console.log("ā
Template successfully cloned!");
|
|
11
54
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
55
|
+
// Install dependencies
|
|
56
|
+
console.log("š¦ Installing dependencies...");
|
|
57
|
+
execSync("npm install", { cwd: dest, stdio: "inherit" });
|
|
16
58
|
|
|
17
|
-
console.log(
|
|
59
|
+
console.log(`š Setup complete! Navigate to your project folder:\n`);
|
|
60
|
+
console.log(` cd ${folderName === "./" ? "." : folderName}`);
|
|
61
|
+
console.log(` npm run dev`);
|
|
62
|
+
console.log("\nš Happy coding with TanStack!");
|
|
18
63
|
} catch (error) {
|
|
19
64
|
console.error("ā Error during setup:", error.message);
|
|
20
65
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tanstack-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"main": "index.js",
|
|
5
|
-
"bin":
|
|
6
|
-
|
|
7
|
-
},
|
|
5
|
+
"bin": "./dist/index.js",
|
|
6
|
+
"type": "module",
|
|
8
7
|
"author": "Shaswat Raj",
|
|
9
8
|
"license": "ISC",
|
|
10
9
|
"description": "A CLI tool to create a Tanstack app",
|
|
@@ -13,5 +12,12 @@
|
|
|
13
12
|
"type": "git",
|
|
14
13
|
"url": "https://github.com/SH20RAJ/create-tanstack-app.git"
|
|
15
14
|
},
|
|
16
|
-
"dependencies": {
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@tanstack/cta-engine": "0.12.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^22.13.4",
|
|
20
|
+
"typescript": "^5.6.3"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {}
|
|
17
23
|
}
|