@fugood/bricks-ctor 2.25.5-beta.2 → 2.25.6
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/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-ctor",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.6",
|
|
4
4
|
"description": "Deprecated: ctor tooling moved to the `bricks ctor` commands in @fugood/bricks-cli. This package now only forwards legacy project scripts and triggers migration.",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@fugood/bricks-cli": "^2.25.
|
|
6
|
+
"@fugood/bricks-cli": "^2.25.6"
|
|
7
7
|
},
|
|
8
|
-
"gitHead": "
|
|
8
|
+
"gitHead": "4ad8588eed6f0161b0aa66d863a36e6c623c4a83"
|
|
9
9
|
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
const mockSpawnSync = jest.fn()
|
|
2
|
-
const mockExistsSync = jest.fn()
|
|
3
|
-
|
|
4
|
-
jest.mock('node:child_process', () => ({
|
|
5
|
-
__esModule: true,
|
|
6
|
-
spawnSync: (...args) => mockSpawnSync(...args),
|
|
7
|
-
}))
|
|
8
|
-
|
|
9
|
-
jest.mock('node:fs', () => ({
|
|
10
|
-
__esModule: true,
|
|
11
|
-
existsSync: (...args) => mockExistsSync(...args),
|
|
12
|
-
}))
|
|
13
|
-
|
|
14
|
-
const loadForwarder = () => require('../_forward.ts')
|
|
15
|
-
|
|
16
|
-
describe('legacy bricks-ctor forwarder', () => {
|
|
17
|
-
let exitSpy
|
|
18
|
-
let errorSpy
|
|
19
|
-
|
|
20
|
-
beforeEach(() => {
|
|
21
|
-
jest.resetModules()
|
|
22
|
-
mockSpawnSync.mockReset()
|
|
23
|
-
mockExistsSync.mockReset()
|
|
24
|
-
exitSpy = jest.spyOn(process, 'exit').mockImplementation(() => {})
|
|
25
|
-
errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
exitSpy.mockRestore()
|
|
30
|
-
errorSpy.mockRestore()
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('prefers the local bricks CLI next to the legacy package', () => {
|
|
34
|
-
mockExistsSync.mockReturnValue(true)
|
|
35
|
-
mockSpawnSync.mockReturnValue({ status: 0 })
|
|
36
|
-
const { forwardLegacyCtorTool } = loadForwarder()
|
|
37
|
-
|
|
38
|
-
forwardLegacyCtorTool(
|
|
39
|
-
'deploy',
|
|
40
|
-
'file:///repo/node_modules/@fugood/bricks-ctor/tools/deploy.ts',
|
|
41
|
-
['--target', 'device'],
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
expect(mockSpawnSync).toHaveBeenCalledWith(
|
|
45
|
-
'/repo/node_modules/.bin/bricks',
|
|
46
|
-
['ctor', 'deploy', '--target', 'device'],
|
|
47
|
-
{ stdio: 'inherit' },
|
|
48
|
-
)
|
|
49
|
-
expect(exitSpy).toHaveBeenCalledWith(0)
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('falls back to PATH when the local bricks CLI is missing', () => {
|
|
53
|
-
mockExistsSync.mockReturnValue(false)
|
|
54
|
-
mockSpawnSync.mockReturnValue({ status: 3 })
|
|
55
|
-
const { forwardLegacyCtorTool } = loadForwarder()
|
|
56
|
-
|
|
57
|
-
forwardLegacyCtorTool('pull', 'file:///repo/node_modules/@fugood/bricks-ctor/tools/pull.ts', [])
|
|
58
|
-
|
|
59
|
-
expect(mockSpawnSync).toHaveBeenCalledWith('bricks', ['ctor', 'pull'], { stdio: 'inherit' })
|
|
60
|
-
expect(exitSpy).toHaveBeenCalledWith(3)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('reports spawn errors and exits with failure', () => {
|
|
64
|
-
mockExistsSync.mockReturnValue(false)
|
|
65
|
-
mockSpawnSync.mockReturnValue({ error: new Error('ENOENT') })
|
|
66
|
-
const { forwardLegacyCtorTool } = loadForwarder()
|
|
67
|
-
|
|
68
|
-
forwardLegacyCtorTool(
|
|
69
|
-
'mcp',
|
|
70
|
-
'file:///repo/node_modules/@fugood/bricks-ctor/tools/mcp-server.ts',
|
|
71
|
-
[],
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
expect(errorSpy).toHaveBeenCalledWith('bricks-ctor forwarder failed to run `bricks`: ENOENT')
|
|
75
|
-
expect(exitSpy).toHaveBeenCalledWith(1)
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it('treats a missing child status as failure', () => {
|
|
79
|
-
mockExistsSync.mockReturnValue(false)
|
|
80
|
-
mockSpawnSync.mockReturnValue({})
|
|
81
|
-
const { forwardLegacyCtorTool } = loadForwarder()
|
|
82
|
-
|
|
83
|
-
forwardLegacyCtorTool(
|
|
84
|
-
'simulator',
|
|
85
|
-
'file:///repo/node_modules/@fugood/bricks-ctor/tools/simulator.ts',
|
|
86
|
-
[],
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
expect(exitSpy).toHaveBeenCalledWith(1)
|
|
90
|
-
})
|
|
91
|
-
})
|