create-tanstack-app 1.0.1 → 1.0.2
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 +26 -7
- package/package.json +13 -13
- package/create.js +0 -29
package/index.js
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { exec } = require('child_process');
|
|
1
|
+
const degit = require('degit');
|
|
4
2
|
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
async function initApp() {
|
|
6
|
+
const projectName = process.argv[2] || 'my-tanstack-app'; // default to 'my-tanstack-app' if no name is provided
|
|
7
|
+
const dest = path.join(process.cwd(), projectName);
|
|
8
|
+
|
|
9
|
+
// Check if the destination already exists
|
|
10
|
+
if (fs.existsSync(dest)) {
|
|
11
|
+
console.log('Directory already exists. Please choose another name or delete the existing directory.');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
console.log(`Downloading Tanstack app template from GitHub...`);
|
|
16
|
+
|
|
17
|
+
// Use degit to download the template
|
|
18
|
+
const emitter = degit('SH20RAJ/tanstack-start', { cache: false, force: true });
|
|
19
|
+
emitter.on('info', info => console.log(info));
|
|
5
20
|
|
|
6
|
-
|
|
7
|
-
|
|
21
|
+
try {
|
|
22
|
+
await emitter.clone(dest);
|
|
23
|
+
console.log(`Template successfully downloaded! Navigate to ${dest} and start working on your project.`);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error during template download:', error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
8
28
|
|
|
9
|
-
|
|
10
|
-
// If needed, you could also provide further customization options for users or more handling.
|
|
29
|
+
initApp();
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
2
|
+
"name": "create-tanstack-app",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"bin": {
|
|
6
|
+
"create-gi": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"author": "sh20raj",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"description": "A CLI tool to create a Tanstack app",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"degit": "^2.8.4"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/create.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const degit = require('degit');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
async function initApp() {
|
|
6
|
-
const projectName = process.argv[2] || 'my-tanstack-app'; // default to 'my-tanstack-app' if no name is provided
|
|
7
|
-
const dest = path.join(process.cwd(), projectName);
|
|
8
|
-
|
|
9
|
-
// Check if the destination already exists
|
|
10
|
-
if (fs.existsSync(dest)) {
|
|
11
|
-
console.log('Directory already exists. Please choose another name or delete the existing directory.');
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
console.log(`Downloading Tanstack app template from GitHub...`);
|
|
16
|
-
|
|
17
|
-
// Use degit to download the template
|
|
18
|
-
const emitter = degit('SH20RAJ/tanstack-start', { cache: false, force: true });
|
|
19
|
-
emitter.on('info', info => console.log(info));
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
await emitter.clone(dest);
|
|
23
|
-
console.log(`Template successfully downloaded! Navigate to ${dest} and start working on your project.`);
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error('Error during template download:', error);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
initApp();
|