ts-init-template 1.0.3 → 1.0.5

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.
Files changed (3) hide show
  1. package/index.js +6 -1
  2. package/package.json +2 -2
  3. package/readme.md +13 -1
package/index.js CHANGED
@@ -9,7 +9,12 @@ const __dirname = import.meta.dirname
9
9
  const execAsync = promisify(exec);
10
10
  //install dependencies
11
11
  try{
12
- const { stdout, stderr } = await execAsync('yarn add -D typescript ts-node @types/node fast-glob esbuild');
12
+ const isYarn = await fs.access('yarn.lock').then(() => true).catch(() => false);
13
+ const installCmd = isYarn
14
+ ? 'yarn add -D yarn add -D typescript ts-node @types/node fast-glob esbuild'
15
+ : 'npm install -D yarn add -D typescript ts-node @types/node fast-glob esbuild';
16
+
17
+ const { stdout, stderr } = await execAsync(installCmd);
13
18
  console.log('Dependencies installed successfully:', stdout);
14
19
  if(stderr){
15
20
  console.error('Error during installation:', stderr);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ts-init-template",
3
- "version": "1.0.3",
4
- "description": "A TS project template for my ts projects. This script will setup all the ts enviroment with 1 command. ",
3
+ "version": "1.0.5",
4
+ "description": "A TS project template for TS projects. This script will setup all the ts enviroment with 1 command. ",
5
5
  "main": "index.js",
6
6
  "author": "SigismundBT",
7
7
  "license": "MIT",
package/readme.md CHANGED
@@ -9,14 +9,26 @@
9
9
  - 🛠 Installs required devDependencies
10
10
  - 📦 Sets up `tsconfig.json` and `build.js`
11
11
  - 🔧 Updates `package.json` (`type`, `scripts`)
12
+ - 📁 Creates a `src/` directory if it doesn't exist
12
13
  - ⚡ Runs in seconds with a single command
13
14
 
14
15
  ---
15
16
 
16
17
  ## 📦 Usage
17
18
 
19
+ ### 💡 With Yarn
20
+
18
21
  ```bash
22
+
19
23
  yarn init
20
24
  npx ts-init-template
21
25
  yarn build
22
- yarn start
26
+ yarn start
27
+
28
+ ### 💡 With NPM
29
+
30
+ ```bash
31
+ npm init
32
+ npx ts-init-template
33
+ npm run build
34
+ npm run start