ts-init-template 1.0.2 → 1.0.4
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 +15 -1
- package/package.json +1 -1
- package/readme.md +23 -0
package/index.js
CHANGED
@@ -44,6 +44,7 @@ catch (error) {
|
|
44
44
|
process.exit(1);
|
45
45
|
};
|
46
46
|
|
47
|
+
// Copy the template files
|
47
48
|
try{
|
48
49
|
const templatePath = path.join(__dirname, 'template');
|
49
50
|
|
@@ -53,7 +54,20 @@ try{
|
|
53
54
|
} catch (error) {
|
54
55
|
console.error('❌ Failed to copy files:', error);
|
55
56
|
process.exit(1);
|
56
|
-
}
|
57
|
+
};
|
58
|
+
|
59
|
+
// Create the src directory if it does not exist
|
60
|
+
try {
|
61
|
+
const srcPath = path.join(process.cwd(), 'src');
|
62
|
+
// Check if the src directory exists
|
63
|
+
await fs.access(srcPath);
|
64
|
+
console.log('✅ src directory exists.');
|
65
|
+
}catch{
|
66
|
+
// Create the src directory if it does not exist
|
67
|
+
console.log('The src directory does not exist, Creating it now...');
|
68
|
+
await fs.mkdir(path.join(process.cwd(), 'src'), { recursive: true });
|
69
|
+
console.log('✅ src directory created successfully. You can now add your source files.');
|
70
|
+
};
|
57
71
|
|
58
72
|
console.log('✅ All operations completed successfully!');
|
59
73
|
process.exit(0);
|
package/package.json
CHANGED
package/readme.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# ts-init-template
|
2
|
+
|
3
|
+
> A minimal CLI to bootstrap a clean TypeScript project with zero friction.
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
## 🚀 Features
|
8
|
+
|
9
|
+
- 🛠 Installs required devDependencies
|
10
|
+
- 📦 Sets up `tsconfig.json` and `build.js`
|
11
|
+
- 🔧 Updates `package.json` (`type`, `scripts`)
|
12
|
+
- 📁 Creates a `src/` directory if it doesn't exist
|
13
|
+
- ⚡ Runs in seconds with a single command
|
14
|
+
|
15
|
+
---
|
16
|
+
|
17
|
+
## 📦 Usage
|
18
|
+
|
19
|
+
```bash
|
20
|
+
yarn init
|
21
|
+
npx ts-init-template
|
22
|
+
yarn build
|
23
|
+
yarn start
|