@marcuth/create-package 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/bin/index.js +18 -12
  2. package/package.json +7 -2
package/bin/index.js CHANGED
@@ -47,7 +47,8 @@ function writePackageJson(root, packageName) {
47
47
  ],
48
48
  scripts: {
49
49
  build: "tsc",
50
- dev: "ts-node ./src/index.ts"
50
+ dev: "ts-node ./src/index.ts",
51
+ format: "prettier --write \"src/**/*.ts\""
51
52
  },
52
53
  keywords: [
53
54
  "marcuth"
@@ -89,9 +90,11 @@ function writeTsConfig(root) {
89
90
  }
90
91
 
91
92
  function writeSourceFile(root, projectDir) {
92
- const content = `export function hello() {
93
- return "Hello from ${projectDir}"
93
+ const content = `function main() {
94
+ console.log("Hello from ${projectDir}")
94
95
  }
96
+
97
+ main()
95
98
  `
96
99
 
97
100
  fs.writeFileSync(
@@ -361,15 +364,18 @@ function installDevDependencies(root, deps) {
361
364
  }
362
365
 
363
366
  console.log("📦 Installing dev dependencies using", pm)
367
+ console.log("📦 Command:", pm, commands[pm].join(" "))
364
368
 
365
- const result = spawnSync(
366
- pm,
367
- commands[pm],
368
- {
369
- cwd: root,
370
- stdio: "inherit"
371
- }
372
- )
369
+ const result = spawnSync(pm, commands[pm], {
370
+ cwd: root,
371
+ stdio: "inherit",
372
+ shell: true
373
+ })
374
+
375
+ if (result.error) {
376
+ console.error("❌ Spawn error:", result.error)
377
+ process.exit(1)
378
+ }
373
379
 
374
380
  if (result.status !== 0) {
375
381
  console.error("❌ Failed to install dev dependencies")
@@ -435,7 +441,7 @@ function main() {
435
441
  writeSourceFile(root, projectDir)
436
442
  writeLicenseFile(root)
437
443
  writeGitignoreFile(root)
438
- installDevDependencies(devDependencies)
444
+ installDevDependencies(root, devDependencies)
439
445
  initGitRepo(root)
440
446
  createNpmIgnore(root)
441
447
  createReadme(root, packageName)
package/package.json CHANGED
@@ -1,13 +1,18 @@
1
1
  {
2
2
  "name": "@marcuth/create-package",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Create a new package",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "create-package": "./bin/index.js"
9
9
  },
10
- "keywords": ["package generator"],
10
+ "scripts": {
11
+ "playground": "node ./bin/index.js playground/debug_test"
12
+ },
13
+ "keywords": [
14
+ "package generator"
15
+ ],
11
16
  "author": "Marcuth",
12
17
  "license": "MIT"
13
18
  }