@vv0rkz/js-template 1.0.2 → 1.1.1

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/bin/cli.js +7 -13
  2. package/bin/init.js +10 -24
  3. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -2,20 +2,14 @@
2
2
  import { fileURLToPath } from 'url'
3
3
  import { dirname, join } from 'path'
4
4
  import { spawnSync } from 'child_process'
5
- import { existsSync } from 'fs'
6
5
 
7
6
  const __dirname = dirname(fileURLToPath(import.meta.url))
8
- const toolsDir = join(__dirname, '../tools-gh')
7
+ const toolsDir = join(__dirname, '../tools-gh') // ВСЕГДА из node_modules
9
8
 
10
9
  const args = process.argv.slice(2)
11
10
  const command = args[0]
12
11
  const commandArgs = args.slice(1)
13
12
 
14
- // Проверка наличия tools-gh в текущем проекте
15
- const projectToolsDir = join(process.cwd(), 'tools-gh')
16
- const useProjectTools = existsSync(projectToolsDir)
17
- const scriptsDir = useProjectTools ? projectToolsDir : toolsDir
18
-
19
13
  const commands = {
20
14
  init: () => {
21
15
  const initScript = join(__dirname, 'init.js')
@@ -29,7 +23,7 @@ const commands = {
29
23
  release: () => {
30
24
  console.log('🚀 Запуск релиза...\n')
31
25
 
32
- const checkDemo = spawnSync('node', [join(scriptsDir, 'check-demo-for-release.js')], { stdio: 'inherit' })
26
+ const checkDemo = spawnSync('node', [join(toolsDir, 'check-demo-for-release.js')], { stdio: 'inherit' })
33
27
  if (checkDemo.status !== 0) {
34
28
  console.error('❌ Проверка демо не прошла')
35
29
  process.exit(1)
@@ -41,16 +35,16 @@ const commands = {
41
35
  process.exit(1)
42
36
  }
43
37
 
44
- spawnSync('node', [join(scriptsDir, 'update-readme.js')], { stdio: 'inherit' })
38
+ spawnSync('node', [join(toolsDir, 'update-readme.js')], { stdio: 'inherit' })
45
39
  console.log('\n✅ Релиз успешно создан!')
46
40
  },
47
41
 
48
42
  'update-readme': () => {
49
- spawnSync('node', [join(scriptsDir, 'update-readme.js')], { stdio: 'inherit' })
43
+ spawnSync('node', [join(toolsDir, 'update-readme.js')], { stdio: 'inherit' })
50
44
  },
51
45
 
52
46
  'push-release': () => {
53
- spawnSync('node', [join(scriptsDir, 'push-release-to-main.js')], { stdio: 'inherit' })
47
+ spawnSync('node', [join(toolsDir, 'push-release-to-main.js')], { stdio: 'inherit' })
54
48
  },
55
49
 
56
50
  bugs: () => {
@@ -59,7 +53,7 @@ const commands = {
59
53
 
60
54
  'create-bug': () => {
61
55
  if (commandArgs.length === 0) {
62
- spawnSync('node', [join(scriptsDir, 'create-bug.js')], { stdio: 'inherit' })
56
+ spawnSync('node', [join(toolsDir, 'create-bug.js')], { stdio: 'inherit' })
63
57
  } else {
64
58
  const title = commandArgs.join(' ')
65
59
  spawnSync('gh', ['issue', 'create', '--label', 'bug', '--title', title], { stdio: 'inherit', shell: true })
@@ -72,7 +66,7 @@ const commands = {
72
66
 
73
67
  'create-task': () => {
74
68
  if (commandArgs.length === 0) {
75
- spawnSync('node', [join(scriptsDir, 'create-task.js')], { stdio: 'inherit' })
69
+ spawnSync('node', [join(toolsDir, 'create-task.js')], { stdio: 'inherit' })
76
70
  } else {
77
71
  const title = commandArgs.join(' ')
78
72
  spawnSync('gh', ['issue', 'create', '--label', 'task', '--title', title], { stdio: 'inherit', shell: true })
package/bin/init.js CHANGED
@@ -58,25 +58,9 @@ if (existsSync(huskyTemplateDir)) {
58
58
  console.log(' ✅ Хуки скопированы')
59
59
  }
60
60
 
61
- // 3. Копирование tools-gh
62
- console.log('\n🔧 Копирование GitHub скриптов...')
63
- const toolsDir = join(targetDir, 'tools-gh')
64
- if (!existsSync(toolsDir)) {
65
- mkdirSync(toolsDir, { recursive: true })
66
- }
67
-
68
- const toolsSourceDir = join(__dirname, '../tools-gh')
69
- if (existsSync(toolsSourceDir)) {
70
- const toolFiles = readdirSync(toolsSourceDir)
71
- toolFiles.forEach((file) => {
72
- const src = join(toolsSourceDir, file)
73
- const dest = join(toolsDir, file)
74
- if (statSync(src).isFile()) {
75
- copyFileSync(src, dest)
76
- console.log(` ✅ ${file}`)
77
- }
78
- })
79
- }
61
+ // 3. НЕ копируем tools-gh — они остаются в node_modules
62
+ console.log('\n🔧 GitHub скрипты...')
63
+ console.log(' ✅ Используются из @vv0rkz/js-template (не копируются)')
80
64
 
81
65
  // 4. Добавление скриптов в package.json
82
66
  console.log('\n📦 Обновление package.json...')
@@ -128,14 +112,16 @@ console.log(`
128
112
  🎉 JS Template успешно установлен!
129
113
 
130
114
  📖 БЫСТРЫЕ КОМАНДЫ:
131
- npm run jst changelog # или: npm run _ changelog
132
- npm run jst release # или: npm run _ release
133
- npm run jst tasks # или: npm run _ tasks
134
- npm run jst create-task # или: npm run _ create-task
115
+ npm run _ changelog # Создать changelog
116
+ npm run _ release # Полный релиз
117
+ npm run _ tasks # Список задач
118
+ npm run _ create-task # Создать задачу
135
119
 
136
120
  📚 ПОЛНЫЙ СПИСОК:
137
- npm run jst
121
+ npm run _
138
122
 
139
123
  🚀 Начни работу:
140
124
  npm run _ create-task "Моя первая задача"
125
+
126
+ 💡 ВАЖНО: tools-gh скрипты используются из node_modules, не копируются в проект
141
127
  `)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vv0rkz/js-template",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "description": "Reusable setup for JS projects with husky, changelog, gh tools",
5
5
  "type": "module",
6
6
  "bin": {