@sprucelabs/spruce-cli 27.0.4 → 27.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.
- package/CHANGELOG.md +19 -0
- package/build/.spruce/schemas/schemas.types.d.ts +10 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/upgradeSkillOptions.schema.js +8 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/upgradeSkillOptions.schema.js.map +1 -1
- package/build/GlobalEmitter.d.ts +6 -0
- package/build/GlobalEmitter.js +6 -0
- package/build/GlobalEmitter.js.map +1 -1
- package/build/InFlightEntertainment.d.ts +2 -2
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js +4 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkillSkippingBuild.test.d.ts +5 -0
- package/build/__tests__/behavioral/upgrading/UpgradingASkillSkippingBuild.test.js +29 -0
- package/build/__tests__/behavioral/upgrading/UpgradingASkillSkippingBuild.test.js.map +1 -0
- package/build/features/ActionExecuter.js +1 -0
- package/build/features/ActionExecuter.js.map +1 -1
- package/build/features/node/NodeFeature.js +5 -3
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/schemas/v2020_07_22/upgradeSkillOptions.builder.d.ts +6 -0
- package/build/schemas/v2020_07_22/upgradeSkillOptions.builder.js +6 -0
- package/build/schemas/v2020_07_22/upgradeSkillOptions.builder.js.map +1 -1
- package/build/services/BuildService.d.ts +2 -2
- package/build/services/BuildService.js +2 -2
- package/build/services/BuildService.js.map +1 -1
- package/build/services/CommandService.d.ts +5 -1
- package/build/services/CommandService.js +6 -0
- package/build/services/CommandService.js.map +1 -1
- package/build/services/GameService.d.ts +2 -2
- package/build/services/GameService.js +1 -1
- package/build/services/GameService.js.map +1 -1
- package/build/tests/CommandFaker.js +1 -1
- package/build/tests/CommandFaker.js.map +1 -1
- package/package.json +9 -9
- package/src/.spruce/schemas/schemas.types.ts +147 -137
- package/src/.spruce/schemas/spruceCli/v2020_07_22/upgradeSkillOptions.schema.ts +8 -0
- package/src/GlobalEmitter.ts +6 -0
- package/src/InFlightEntertainment.ts +2 -2
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.ts +5 -0
- package/src/__tests__/behavioral/upgrading/UpgradingASkillSkippingBuild.test.ts +17 -0
- package/src/features/ActionExecuter.ts +1 -0
- package/src/features/node/NodeFeature.ts +6 -4
- package/src/schemas/v2020_07_22/upgradeSkillOptions.builder.ts +6 -0
- package/src/services/BuildService.ts +5 -5
- package/src/services/CommandService.ts +11 -1
- package/src/services/GameService.ts +4 -4
- package/src/tests/CommandFaker.ts +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { assert, test } from '@sprucelabs/test-utils'
|
|
2
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
3
|
+
|
|
4
|
+
export default class UpgradingASkillSkippingBuildTest extends AbstractSkillTest {
|
|
5
|
+
protected static skillCacheKey = 'skills'
|
|
6
|
+
@test()
|
|
7
|
+
protected static async canSkipCleaningAndBuildingOnUpgrade() {
|
|
8
|
+
this.commandFaker.fakeInstall()
|
|
9
|
+
this.commandFaker.fakeCleanBuild(1)
|
|
10
|
+
|
|
11
|
+
const { errors } = await this.Action('node', 'upgrade').execute({
|
|
12
|
+
shouldBuild: false,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
assert.isFalsy(errors, 'Should not have tried to build.')
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -38,9 +38,11 @@ export default class NodeFeature<
|
|
|
38
38
|
super(options)
|
|
39
39
|
|
|
40
40
|
void this.emitter.on('feature.did-execute', async (payload) => {
|
|
41
|
+
const { featureCode, actionCode, options } = payload
|
|
41
42
|
const shouldUpgrade =
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
featureCode === 'node' &&
|
|
44
|
+
actionCode === 'upgrade' &&
|
|
45
|
+
options?.shouldBuild !== false &&
|
|
44
46
|
this.features.isInSpruceModule()
|
|
45
47
|
|
|
46
48
|
if (shouldUpgrade) {
|
|
@@ -55,8 +57,8 @@ export default class NodeFeature<
|
|
|
55
57
|
try {
|
|
56
58
|
this.ui.clear()
|
|
57
59
|
this.ui.renderHero('Upgrade')
|
|
58
|
-
|
|
59
60
|
this.ui.startLoading('Cleaning build...')
|
|
61
|
+
|
|
60
62
|
await this.Service('command').execute('yarn clean.build')
|
|
61
63
|
|
|
62
64
|
const pkg = this.Service('pkg')
|
|
@@ -68,7 +70,7 @@ export default class NodeFeature<
|
|
|
68
70
|
|
|
69
71
|
return {
|
|
70
72
|
summaryLines: [
|
|
71
|
-
'
|
|
73
|
+
'Old built files cleared.',
|
|
72
74
|
'Lint rules applied to source.',
|
|
73
75
|
'Code rebuilt successfully.',
|
|
74
76
|
],
|
|
@@ -6,6 +6,12 @@ export default buildSchema({
|
|
|
6
6
|
description:
|
|
7
7
|
'Upgrade. Everything. Heads up, this can take a few minutes. ⏱',
|
|
8
8
|
fields: {
|
|
9
|
+
shouldBuild: {
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
label: 'Build after upgrade',
|
|
12
|
+
defaultValue: true,
|
|
13
|
+
hint: 'Should I build your source after the upgrade?',
|
|
14
|
+
},
|
|
9
15
|
upgradeMode: {
|
|
10
16
|
type: 'select',
|
|
11
17
|
label: 'Upgrade mode',
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CommandService } from './CommandService'
|
|
2
2
|
import LintService from './LintService'
|
|
3
3
|
|
|
4
4
|
export default class BuildService {
|
|
5
5
|
public set cwd(cwd: string) {
|
|
6
|
-
this.commandService.cwd
|
|
6
|
+
this.commandService.setCwd(cwd)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
public get cwd() {
|
|
10
|
-
return this.commandService.
|
|
10
|
+
return this.commandService.getCwd()
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
private commandService:
|
|
13
|
+
private commandService: CommandService
|
|
14
14
|
private lintService: LintService
|
|
15
15
|
|
|
16
16
|
public constructor(
|
|
17
|
-
commandService:
|
|
17
|
+
commandService: CommandService,
|
|
18
18
|
lintService: LintService
|
|
19
19
|
) {
|
|
20
20
|
this.commandService = commandService
|
|
@@ -10,7 +10,7 @@ import SpruceError from '../errors/SpruceError'
|
|
|
10
10
|
process.setMaxListeners(100)
|
|
11
11
|
|
|
12
12
|
export default class CommandServiceImpl implements CommandService {
|
|
13
|
-
|
|
13
|
+
private cwd: string
|
|
14
14
|
private activeChildProcess: ChildProcess | undefined
|
|
15
15
|
private ignoreCloseErrors = false
|
|
16
16
|
private static fakeResponses: {
|
|
@@ -23,6 +23,14 @@ export default class CommandServiceImpl implements CommandService {
|
|
|
23
23
|
this.cwd = cwd
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
public getCwd() {
|
|
27
|
+
return this.cwd
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public setCwd(cwd: string) {
|
|
31
|
+
this.cwd = cwd
|
|
32
|
+
}
|
|
33
|
+
|
|
26
34
|
public async execute(
|
|
27
35
|
cmd: string,
|
|
28
36
|
options?: ExecuteCommandOptions
|
|
@@ -206,6 +214,8 @@ export interface CommandService {
|
|
|
206
214
|
): Promise<{
|
|
207
215
|
stdout: string
|
|
208
216
|
}>
|
|
217
|
+
getCwd(): string
|
|
218
|
+
setCwd(cwd: string): void
|
|
209
219
|
kill(): void
|
|
210
220
|
pid(): number | undefined
|
|
211
221
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import TerminalInterface from '../interfaces/TerminalInterface'
|
|
3
|
-
import
|
|
3
|
+
import { CommandService } from './CommandService'
|
|
4
4
|
|
|
5
5
|
export default class GameService {
|
|
6
|
-
private command:
|
|
6
|
+
private command: CommandService
|
|
7
7
|
private ui: TerminalInterface
|
|
8
8
|
private statusMessage?: string
|
|
9
9
|
private killed = false
|
|
10
10
|
|
|
11
|
-
public constructor(command:
|
|
11
|
+
public constructor(command: CommandService, ui: TerminalInterface) {
|
|
12
12
|
this.command = command
|
|
13
13
|
this.ui = ui
|
|
14
|
-
this.command.
|
|
14
|
+
this.command.setCwd(diskUtil.resolvePath(__dirname, '../../'))
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
public setStatusMessage(message: string) {
|