bmdl-sdk 1.5.3 → 1.5.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.
- package/bin/dev.js +30 -26
- package/bmdl-sdk-1.5.4.tgz +0 -0
- package/bmdl-sdk-1.5.5.tgz +0 -0
- package/package.json +1 -1
- package/vite.config.ts +16 -9
package/bin/dev.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawn } from 'child_process'
|
|
4
|
-
import { resolve, dirname } from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
4
|
import { existsSync } from 'fs'
|
|
5
|
+
import { dirname, resolve } from 'path'
|
|
6
|
+
import { fileURLToPath } from 'url'
|
|
7
7
|
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url)
|
|
9
9
|
const __dirname = dirname(__filename)
|
|
@@ -11,56 +11,60 @@ const projectRoot = process.cwd()
|
|
|
11
11
|
const sdkRoot = resolve(__dirname, '..')
|
|
12
12
|
|
|
13
13
|
console.log('🚀 BMDL SDK Development Server')
|
|
14
|
-
console.log('
|
|
15
|
-
console.log(
|
|
14
|
+
console.log('═══════════════════════════════════════')
|
|
15
|
+
console.log(`📂 Project root: ${projectRoot}`)
|
|
16
|
+
console.log(`📦 SDK root: ${sdkRoot}`)
|
|
17
|
+
console.log('═══════════════════════════════════════')
|
|
16
18
|
|
|
17
19
|
// Проверяем наличие необходимых файлов в проекте
|
|
18
20
|
const requiredFiles = [
|
|
19
21
|
'src/app/App.tsx',
|
|
20
22
|
'src/config.ts',
|
|
21
23
|
'src/dataOptions.ts',
|
|
22
|
-
'src/viewOptions.ts'
|
|
24
|
+
'src/viewOptions.ts',
|
|
23
25
|
]
|
|
24
26
|
|
|
25
27
|
let missingFiles = []
|
|
26
28
|
requiredFiles.forEach(file => {
|
|
27
|
-
|
|
29
|
+
const fullPath = resolve(projectRoot, file)
|
|
30
|
+
if (!existsSync(fullPath)) {
|
|
28
31
|
missingFiles.push(file)
|
|
29
32
|
}
|
|
30
33
|
})
|
|
31
34
|
|
|
32
35
|
if (missingFiles.length > 0) {
|
|
33
|
-
console.log('⚠️ Missing required files:')
|
|
34
|
-
missingFiles.forEach(file => console.log(`
|
|
36
|
+
console.log('⚠️ Missing required files in your project:')
|
|
37
|
+
missingFiles.forEach(file => console.log(` ❌ ${file}`))
|
|
35
38
|
console.log('')
|
|
36
39
|
console.log('💡 Run "npx bmdl-sdk init" to create the missing files')
|
|
40
|
+
console.log('')
|
|
41
|
+
} else {
|
|
42
|
+
console.log('✅ All required files found')
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
console.log('')
|
|
40
46
|
console.log('🔧 Starting Vite development server...')
|
|
41
47
|
console.log('🌐 http://localhost:3000')
|
|
48
|
+
console.log('')
|
|
42
49
|
|
|
43
|
-
// Запускаем Vite
|
|
44
|
-
const vite = spawn(
|
|
45
|
-
'
|
|
46
|
-
'--port', '3000',
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
50
|
+
// Запускаем Vite - убираем --root, используем только --config
|
|
51
|
+
const vite = spawn(
|
|
52
|
+
'npx',
|
|
53
|
+
['vite', '--port', '3000', '--config', resolve(sdkRoot, 'vite.config.ts')],
|
|
54
|
+
{
|
|
55
|
+
stdio: 'inherit',
|
|
56
|
+
shell: true,
|
|
57
|
+
cwd: sdkRoot, // Работаем из папки SDK
|
|
58
|
+
env: {
|
|
59
|
+
...process.env,
|
|
60
|
+
PROJECT_ROOT: projectRoot,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
)
|
|
57
64
|
|
|
58
|
-
vite.on('close',
|
|
65
|
+
vite.on('close', code => {
|
|
59
66
|
if (code !== 0) {
|
|
60
67
|
console.log(`❌ Vite process exited with code ${code}`)
|
|
61
68
|
}
|
|
62
69
|
process.exit(code)
|
|
63
70
|
})
|
|
64
|
-
|
|
65
|
-
console.log('✅ Development server is running!')
|
|
66
|
-
console.log('🔄 Hot reload enabled')
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
1
|
import react from '@vitejs/plugin-react'
|
|
3
2
|
import { resolve } from 'path'
|
|
3
|
+
import { defineConfig } from 'vite'
|
|
4
|
+
|
|
5
|
+
// Получаем корень проекта разработчика
|
|
6
|
+
const projectRoot = process.env.PROJECT_ROOT || process.cwd()
|
|
7
|
+
const sdkRoot = process.cwd()
|
|
8
|
+
|
|
9
|
+
console.log('📂 SDK Root:', sdkRoot)
|
|
10
|
+
console.log('📂 Project Root:', projectRoot)
|
|
4
11
|
|
|
5
12
|
export default defineConfig({
|
|
6
13
|
plugins: [react()],
|
|
@@ -9,17 +16,17 @@ export default defineConfig({
|
|
|
9
16
|
open: true,
|
|
10
17
|
watch: {
|
|
11
18
|
// Следим за изменениями в проекте разработчика
|
|
12
|
-
ignored: ['!**/node_modules/**']
|
|
13
|
-
}
|
|
19
|
+
ignored: ['!**/node_modules/**'],
|
|
20
|
+
},
|
|
14
21
|
},
|
|
15
22
|
resolve: {
|
|
16
23
|
alias: {
|
|
17
24
|
// Перенаправляем импорты из /src в проект разработчика
|
|
18
|
-
'/src': resolve(
|
|
19
|
-
}
|
|
25
|
+
'/src': resolve(projectRoot, 'src'),
|
|
26
|
+
},
|
|
20
27
|
},
|
|
21
|
-
root: process.cwd(),
|
|
22
28
|
optimizeDeps: {
|
|
23
|
-
include: ['react', 'react-dom']
|
|
24
|
-
}
|
|
25
|
-
|
|
29
|
+
include: ['react', 'react-dom'],
|
|
30
|
+
},
|
|
31
|
+
publicDir: resolve(sdkRoot, 'public'),
|
|
32
|
+
})
|