@sprucelabs/spruce-cli 17.1.55 → 18.1.0
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 +12 -0
- package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js +1 -1
- package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js.map +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js +4 -4
- package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js.map +1 -1
- package/build/__tests__/behavioral/WatchingSkillViews.test.js +3 -3
- package/build/__tests__/behavioral/WatchingSkillViews.test.js.map +1 -1
- package/build/__tests__/behavioral/errors/SettingUpErrors.test.js +1 -1
- package/build/__tests__/behavioral/errors/SettingUpErrors.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAListener.test.d.ts +2 -0
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +118 -59
- package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
- package/build/__tests__/behavioral/events/EverythingInstalledInstaller.d.ts +17 -0
- package/build/__tests__/behavioral/events/EverythingInstalledInstaller.js +137 -0
- package/build/__tests__/behavioral/events/EverythingInstalledInstaller.js.map +1 -0
- package/build/__tests__/behavioral/onboard/StartingOnboarding.test.js +46 -45
- package/build/__tests__/behavioral/onboard/StartingOnboarding.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/CreatingATest.test.js +1 -1
- package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js +4 -4
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpdatingDependencies2.test.js +2 -2
- package/build/__tests__/behavioral/upgrading/UpdatingDependencies2.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js +2 -2
- package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js +2 -2
- package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingWithListeners.test.js +2 -2
- package/build/__tests__/behavioral/upgrading/UpgradingWithListeners.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingATheme.test.js +1 -1
- package/build/__tests__/behavioral/views/CreatingATheme.test.js.map +1 -1
- package/build/__tests__/behavioral/watchers/WatchingForChanges.test.d.ts +3 -3
- package/build/__tests__/behavioral/watchers/WatchingForChanges.test.js +153 -156
- package/build/__tests__/behavioral/watchers/WatchingForChanges.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter.test.js +2 -2
- package/build/__tests__/implementation/ActionExecuter.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter4.test.js +1 -1
- package/build/__tests__/implementation/ActionExecuter4.test.js.map +1 -1
- package/build/__tests__/implementation/FeatureInstaller.test.js +8 -4
- package/build/__tests__/implementation/FeatureInstaller.test.js.map +1 -1
- package/build/__tests__/implementation/GlobalEmitter.d.ts +1 -1
- package/build/__tests__/implementation/GlobalEmitter.js +9 -10
- package/build/__tests__/implementation/GlobalEmitter.js.map +1 -1
- package/build/__tests__/implementation/SettingUpANodeModule.test.js +1 -1
- package/build/__tests__/implementation/SettingUpANodeModule.test.js.map +1 -1
- package/build/__tests__/implementation/SkillStore.test.d.ts +3 -1
- package/build/__tests__/implementation/SkillStore.test.js +67 -50
- package/build/__tests__/implementation/SkillStore.test.js.map +1 -1
- package/build/__tests__/implementation/StoreFeature.test.js +1 -1
- package/build/__tests__/implementation/StoreFeature.test.js.map +1 -1
- package/build/cli.js +3 -3
- package/build/cli.js.map +1 -1
- package/build/features/AbstractAction.d.ts +2 -2
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/AbstractFeature.d.ts +22 -22
- package/build/features/AbstractFeature.js.map +1 -1
- package/build/features/ActionExecuter.d.ts +8 -8
- package/build/features/ActionExecuter.js.map +1 -1
- package/build/features/FeatureInstaller.d.ts +15 -2
- package/build/features/FeatureInstaller.js +36 -36
- package/build/features/FeatureInstaller.js.map +1 -1
- package/build/features/FeatureInstallerFactory.d.ts +12 -10
- package/build/features/FeatureInstallerFactory.js +2 -2
- package/build/features/FeatureInstallerFactory.js.map +1 -1
- package/build/features/OverrideActionDecorator.js +4 -5
- package/build/features/OverrideActionDecorator.js.map +1 -1
- package/build/features/event/actions/ListenAction.js.map +1 -1
- package/build/features/event/actions/SetRemoteAction.d.ts +1 -0
- package/build/features/event/actions/SetRemoteAction.js +2 -1
- package/build/features/event/actions/SetRemoteAction.js.map +1 -1
- package/build/features/event/actions/SyncListenersAction.js.map +1 -1
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/skill/SkillFeature.js.map +1 -1
- package/build/features/skill/stores/SkillStore.d.ts +4 -1
- package/build/features/skill/stores/SkillStore.js +127 -100
- package/build/features/skill/stores/SkillStore.js.map +1 -1
- package/build/features/watch/WatchFeature.js +1 -1
- package/build/features/watch/WatchFeature.js.map +1 -1
- package/build/interfaces/SpyInterface.d.ts +2 -0
- package/build/interfaces/SpyInterface.js +16 -4
- package/build/interfaces/SpyInterface.js.map +1 -1
- package/build/stores/AbstractStore.d.ts +9 -7
- package/build/stores/AbstractStore.js.map +1 -1
- package/build/stores/StoreFactory.d.ts +19 -13
- package/build/stores/StoreFactory.js +15 -13
- package/build/stores/StoreFactory.js.map +1 -1
- package/build/tests/AbstractCliTest.d.ts +9 -6
- package/build/tests/AbstractCliTest.js +53 -45
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/AbstractSchemaTest.js +18 -20
- package/build/tests/AbstractSchemaTest.js.map +1 -1
- package/build/utilities/action.utility.js +3 -1
- package/build/utilities/action.utility.js.map +1 -1
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/package.json +28 -86
- package/src/__tests__/behavioral/EnablingAndDisablingCache.test.ts +1 -1
- package/src/__tests__/behavioral/RememberingUpgradeSelections.test.ts +1 -1
- package/src/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.ts +4 -4
- package/src/__tests__/behavioral/WatchingSkillViews.test.ts +3 -3
- package/src/__tests__/behavioral/errors/SettingUpErrors.test.ts +1 -1
- package/src/__tests__/behavioral/events/CreatingAListener.test.ts +41 -14
- package/src/__tests__/behavioral/events/EverythingInstalledInstaller.ts +46 -0
- package/src/__tests__/behavioral/onboard/StartingOnboarding.test.ts +10 -5
- package/src/__tests__/behavioral/tests/CreatingATest.test.ts +1 -1
- package/src/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.ts +4 -4
- package/src/__tests__/behavioral/upgrading/UpdatingDependencies2.test.ts +2 -2
- package/src/__tests__/behavioral/upgrading/UpgradingANodeModule.test.ts +2 -2
- package/src/__tests__/behavioral/upgrading/UpgradingASkill5.test.ts +2 -2
- package/src/__tests__/behavioral/upgrading/UpgradingWithListeners.test.ts +2 -2
- package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +1 -1
- package/src/__tests__/behavioral/views/CreatingATheme.test.ts +1 -1
- package/src/__tests__/behavioral/watchers/WatchingForChanges.test.ts +35 -35
- package/src/__tests__/implementation/ActionExecuter.test.ts +2 -2
- package/src/__tests__/implementation/ActionExecuter2.test.ts +1 -1
- package/src/__tests__/implementation/ActionExecuter4.test.ts +1 -1
- package/src/__tests__/implementation/FeatureInstaller.test.ts +8 -1
- package/src/__tests__/implementation/GlobalEmitter.ts +2 -4
- package/src/__tests__/implementation/SettingUpANodeModule.test.ts +1 -1
- package/src/__tests__/implementation/SkillStore.test.ts +23 -24
- package/src/__tests__/implementation/StoreFeature.test.ts +1 -1
- package/src/cli.ts +7 -3
- package/src/features/AbstractAction.ts +3 -3
- package/src/features/AbstractFeature.ts +26 -26
- package/src/features/ActionExecuter.ts +9 -9
- package/src/features/FeatureInstaller.ts +32 -12
- package/src/features/FeatureInstallerFactory.ts +17 -13
- package/src/features/OverrideActionDecorator.ts +2 -5
- package/src/features/event/actions/ListenAction.ts +1 -0
- package/src/features/event/actions/SetRemoteAction.ts +2 -1
- package/src/features/event/actions/SyncListenersAction.ts +0 -1
- package/src/features/node/NodeFeature.ts +3 -1
- package/src/features/skill/SkillFeature.ts +3 -3
- package/src/features/skill/stores/SkillStore.ts +18 -11
- package/src/features/watch/WatchFeature.ts +1 -1
- package/src/interfaces/SpyInterface.ts +10 -0
- package/src/stores/AbstractStore.ts +14 -8
- package/src/stores/StoreFactory.ts +56 -44
- package/src/tests/AbstractCliTest.ts +53 -45
- package/src/tests/AbstractSchemaTest.ts +1 -3
- package/src/utilities/action.utility.ts +3 -1
|
@@ -10,14 +10,6 @@ import {
|
|
|
10
10
|
ApiClientFactoryOptions,
|
|
11
11
|
} from '../types/apiClient.types'
|
|
12
12
|
|
|
13
|
-
export interface StoreOptions {
|
|
14
|
-
serviceFactory: ServiceFactory
|
|
15
|
-
cwd: string
|
|
16
|
-
homeDir: string
|
|
17
|
-
apiClientFactory: ApiClientFactory
|
|
18
|
-
emitter: GlobalEmitter
|
|
19
|
-
}
|
|
20
|
-
|
|
21
13
|
export default abstract class AbstractStore implements ServiceProvider {
|
|
22
14
|
protected cwd: string
|
|
23
15
|
protected homeDir: string
|
|
@@ -46,3 +38,17 @@ export default abstract class AbstractStore implements ServiceProvider {
|
|
|
46
38
|
return this.apiClientFactory(options)
|
|
47
39
|
}
|
|
48
40
|
}
|
|
41
|
+
|
|
42
|
+
interface AbstractStoreOptions {
|
|
43
|
+
serviceFactory: ServiceFactory
|
|
44
|
+
cwd: string
|
|
45
|
+
homeDir: string
|
|
46
|
+
apiClientFactory: ApiClientFactory
|
|
47
|
+
emitter: GlobalEmitter
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type StoreOptions<
|
|
51
|
+
Options extends Record<string, any> | undefined = undefined
|
|
52
|
+
> = Options extends Record<string, any>
|
|
53
|
+
? AbstractStoreOptions & Options
|
|
54
|
+
: AbstractStoreOptions
|
|
@@ -4,52 +4,14 @@ import ListenerStore from '../features/event/stores/ListenerStore'
|
|
|
4
4
|
import OnboardingStore from '../features/onboard/stores/OnboardingStore'
|
|
5
5
|
import OrganizationStore from '../features/organization/stores/OrganizationStore'
|
|
6
6
|
import SchemaStore from '../features/schema/stores/SchemaStore'
|
|
7
|
-
import SkillStore
|
|
7
|
+
import SkillStore, {
|
|
8
|
+
SkillStoreOptions,
|
|
9
|
+
} from '../features/skill/stores/SkillStore'
|
|
8
10
|
import StoreStore from '../features/store/stores/StoreStore'
|
|
9
11
|
import ViewStore from '../features/view/stores/ViewStore'
|
|
10
12
|
import { GlobalEmitter } from '../GlobalEmitter'
|
|
11
13
|
import ServiceFactory from '../services/ServiceFactory'
|
|
12
14
|
import { ApiClientFactory } from '../types/apiClient.types'
|
|
13
|
-
import { StoreOptions } from './AbstractStore'
|
|
14
|
-
|
|
15
|
-
export interface StoreMap {
|
|
16
|
-
onboarding: OnboardingStore
|
|
17
|
-
schema: SchemaStore
|
|
18
|
-
event: EventStore
|
|
19
|
-
skill: SkillStore
|
|
20
|
-
organization: OrganizationStore
|
|
21
|
-
conversation: ConversationStore
|
|
22
|
-
store: StoreStore
|
|
23
|
-
view: ViewStore
|
|
24
|
-
listener: ListenerStore
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type StoreCode = keyof StoreMap
|
|
28
|
-
|
|
29
|
-
const storeMap = {
|
|
30
|
-
onboarding: OnboardingStore,
|
|
31
|
-
schema: SchemaStore,
|
|
32
|
-
event: EventStore,
|
|
33
|
-
skill: SkillStore,
|
|
34
|
-
organization: OrganizationStore,
|
|
35
|
-
conversation: ConversationStore,
|
|
36
|
-
store: StoreStore,
|
|
37
|
-
view: ViewStore,
|
|
38
|
-
listener: ListenerStore,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface StoreFactoryMethodOptions {
|
|
42
|
-
cwd?: string
|
|
43
|
-
apiClientFactory?: ApiClientFactory
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface StoreFactoryOptions {
|
|
47
|
-
cwd: string
|
|
48
|
-
serviceFactory: ServiceFactory
|
|
49
|
-
homeDir: string
|
|
50
|
-
apiClientFactory: ApiClientFactory
|
|
51
|
-
emitter: GlobalEmitter
|
|
52
|
-
}
|
|
53
15
|
|
|
54
16
|
export default class StoreFactory {
|
|
55
17
|
private serviceFactory: ServiceFactory
|
|
@@ -70,22 +32,72 @@ export default class StoreFactory {
|
|
|
70
32
|
|
|
71
33
|
public Store<C extends StoreCode>(
|
|
72
34
|
code: C,
|
|
73
|
-
options?:
|
|
35
|
+
options?: CreateStoreOptions<C>
|
|
74
36
|
): StoreMap[C] {
|
|
75
|
-
const storeOptions
|
|
37
|
+
const storeOptions = {
|
|
76
38
|
cwd: options?.cwd ?? this.cwd,
|
|
77
39
|
serviceFactory: this.serviceFactory,
|
|
78
40
|
homeDir: this.homeDir,
|
|
79
41
|
apiClientFactory: options?.apiClientFactory ?? this.apiClientFactory,
|
|
80
42
|
emitter: this.emitter,
|
|
43
|
+
...options,
|
|
81
44
|
}
|
|
82
45
|
|
|
83
46
|
if (!storeMap[code]) {
|
|
84
47
|
throw new Error(`Could not find store with code '${code}'.`)
|
|
85
48
|
}
|
|
86
49
|
|
|
87
|
-
const store = new storeMap[code](storeOptions)
|
|
50
|
+
const store = new storeMap[code](storeOptions as any)
|
|
88
51
|
|
|
89
52
|
return store as StoreMap[C]
|
|
90
53
|
}
|
|
91
54
|
}
|
|
55
|
+
|
|
56
|
+
interface UniversalOptions {
|
|
57
|
+
cwd?: string
|
|
58
|
+
apiClientFactory?: ApiClientFactory
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type CreateStoreOptions<Code extends StoreCode> =
|
|
62
|
+
Code extends keyof StoreOptionsMap
|
|
63
|
+
? //@ts-ignore
|
|
64
|
+
StoreOptionsMap[Code] & UniversalOptions
|
|
65
|
+
: UniversalOptions
|
|
66
|
+
|
|
67
|
+
export interface StoreMap {
|
|
68
|
+
onboarding: OnboardingStore
|
|
69
|
+
schema: SchemaStore
|
|
70
|
+
event: EventStore
|
|
71
|
+
skill: SkillStore
|
|
72
|
+
organization: OrganizationStore
|
|
73
|
+
conversation: ConversationStore
|
|
74
|
+
store: StoreStore
|
|
75
|
+
view: ViewStore
|
|
76
|
+
listener: ListenerStore
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type StoreCode = keyof StoreMap
|
|
80
|
+
|
|
81
|
+
const storeMap = {
|
|
82
|
+
onboarding: OnboardingStore,
|
|
83
|
+
schema: SchemaStore,
|
|
84
|
+
event: EventStore,
|
|
85
|
+
skill: SkillStore,
|
|
86
|
+
organization: OrganizationStore,
|
|
87
|
+
conversation: ConversationStore,
|
|
88
|
+
store: StoreStore,
|
|
89
|
+
view: ViewStore,
|
|
90
|
+
listener: ListenerStore,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface StoreFactoryOptions {
|
|
94
|
+
cwd: string
|
|
95
|
+
serviceFactory: ServiceFactory
|
|
96
|
+
homeDir: string
|
|
97
|
+
apiClientFactory: ApiClientFactory
|
|
98
|
+
emitter: GlobalEmitter
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface StoreOptionsMap {
|
|
102
|
+
skill: SkillStoreOptions
|
|
103
|
+
}
|
|
@@ -28,7 +28,7 @@ import LintService from '../services/LintService'
|
|
|
28
28
|
import ServiceFactory, { Service, ServiceMap } from '../services/ServiceFactory'
|
|
29
29
|
import StoreFactory, {
|
|
30
30
|
StoreCode,
|
|
31
|
-
|
|
31
|
+
CreateStoreOptions,
|
|
32
32
|
StoreFactoryOptions,
|
|
33
33
|
StoreMap,
|
|
34
34
|
} from '../stores/StoreFactory'
|
|
@@ -56,12 +56,12 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
56
56
|
protected static commandFaker: CommandFaker
|
|
57
57
|
|
|
58
58
|
private static _ui: SpyInterface
|
|
59
|
-
private static
|
|
59
|
+
private static _emitter?: GlobalEmitter
|
|
60
60
|
private static mercuryFixture?: MercuryFixture
|
|
61
61
|
private static personFixture?: PersonFixture
|
|
62
62
|
private static organizationFixture?: OrganizationFixture
|
|
63
63
|
private static skillFixture?: SkillFixture
|
|
64
|
-
private static
|
|
64
|
+
private static _featureInstaller?: FeatureInstaller
|
|
65
65
|
private static viewFixture?: ViewFixture
|
|
66
66
|
private static originalEnv: { [x: string]: string | undefined }
|
|
67
67
|
|
|
@@ -92,8 +92,8 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
92
92
|
this.cwd = this.freshTmpDir()
|
|
93
93
|
this.homeDir = this.freshTmpDir()
|
|
94
94
|
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
95
|
+
this._emitter = undefined
|
|
96
|
+
this._featureInstaller = undefined
|
|
97
97
|
|
|
98
98
|
OnboardingStore.overrideCwd(diskUtil.createRandomTempDir())
|
|
99
99
|
|
|
@@ -153,7 +153,7 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
private static clearFixtures() {
|
|
156
|
-
this.
|
|
156
|
+
this._emitter = undefined
|
|
157
157
|
this.mercuryFixture = undefined
|
|
158
158
|
this.organizationFixture = undefined
|
|
159
159
|
this.personFixture = undefined
|
|
@@ -175,11 +175,15 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
175
175
|
return this._ui
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
protected static
|
|
179
|
-
if (!this.
|
|
180
|
-
this.
|
|
178
|
+
protected static get emitter() {
|
|
179
|
+
if (!this._emitter) {
|
|
180
|
+
this._emitter = CliGlobalEmitter.Emitter()
|
|
181
181
|
}
|
|
182
|
-
return this.
|
|
182
|
+
return this._emitter
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
protected static set emitter(emitter: GlobalEmitter) {
|
|
186
|
+
this._emitter = emitter
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
protected static resolveTestPath(...pathAfterTestDirsAndFiles: string[]) {
|
|
@@ -217,15 +221,13 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
217
221
|
}
|
|
218
222
|
|
|
219
223
|
protected static FeatureFixture(options?: Partial<FeatureFixtureOptions>) {
|
|
220
|
-
const emitter = options?.emitter ?? this.getEmitter()
|
|
221
|
-
|
|
222
224
|
return new FeatureFixture({
|
|
223
225
|
cwd: this.cwd,
|
|
224
226
|
serviceFactory: this.ServiceFactory(),
|
|
225
227
|
ui: this.ui,
|
|
226
|
-
emitter,
|
|
227
228
|
apiClientFactory: this.getMercuryFixture().getApiClientFactory(),
|
|
228
|
-
featureInstaller: this.
|
|
229
|
+
featureInstaller: this.featureInstaller,
|
|
230
|
+
emitter: this.emitter,
|
|
229
231
|
...options,
|
|
230
232
|
})
|
|
231
233
|
}
|
|
@@ -316,28 +318,38 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
316
318
|
return diskUtil.resolveHashSprucePath(this.cwd, ...filePath)
|
|
317
319
|
}
|
|
318
320
|
|
|
319
|
-
protected static
|
|
320
|
-
if (!this.
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
const emitter = this.getEmitter()
|
|
324
|
-
const apiClientFactory = this.getMercuryFixture().getApiClientFactory()
|
|
325
|
-
|
|
326
|
-
const actionExecuter = this.ActionExecuter()
|
|
327
|
-
|
|
328
|
-
this.featureInstaller = FeatureInstallerFactory.WithAllFeatures({
|
|
329
|
-
cwd: this.cwd,
|
|
330
|
-
serviceFactory,
|
|
331
|
-
storeFactory,
|
|
332
|
-
ui: this.ui,
|
|
333
|
-
emitter,
|
|
334
|
-
apiClientFactory,
|
|
335
|
-
actionExecuter,
|
|
336
|
-
...options,
|
|
337
|
-
})
|
|
321
|
+
protected static get featureInstaller() {
|
|
322
|
+
if (!this._featureInstaller) {
|
|
323
|
+
const installer = this.FeatureInstaller()
|
|
324
|
+
this._featureInstaller = installer
|
|
338
325
|
}
|
|
339
326
|
|
|
340
|
-
return this.
|
|
327
|
+
return this._featureInstaller
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
protected static set featureInstaller(installer: FeatureInstaller) {
|
|
331
|
+
this._featureInstaller = installer
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
protected static FeatureInstaller(options?: Partial<FeatureOptions>) {
|
|
335
|
+
const serviceFactory = this.ServiceFactory()
|
|
336
|
+
const storeFactory = this.StoreFactory(options)
|
|
337
|
+
const emitter = options?.emitter ?? this.emitter
|
|
338
|
+
const apiClientFactory = this.getMercuryFixture().getApiClientFactory()
|
|
339
|
+
|
|
340
|
+
const actionExecuter = this.ActionExecuter()
|
|
341
|
+
|
|
342
|
+
const installer = FeatureInstallerFactory.WithAllFeatures({
|
|
343
|
+
cwd: this.cwd,
|
|
344
|
+
serviceFactory,
|
|
345
|
+
storeFactory,
|
|
346
|
+
ui: this.ui,
|
|
347
|
+
emitter,
|
|
348
|
+
apiClientFactory,
|
|
349
|
+
actionExecuter,
|
|
350
|
+
...options,
|
|
351
|
+
})
|
|
352
|
+
return installer
|
|
341
353
|
}
|
|
342
354
|
|
|
343
355
|
protected static StoreFactory(options?: Partial<StoreFactoryOptions>) {
|
|
@@ -348,18 +360,18 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
348
360
|
serviceFactory,
|
|
349
361
|
homeDir: this.homeDir,
|
|
350
362
|
apiClientFactory: this.getMercuryFixture().getApiClientFactory(),
|
|
351
|
-
emitter: this.
|
|
363
|
+
emitter: this.emitter,
|
|
352
364
|
...options,
|
|
353
365
|
})
|
|
354
366
|
}
|
|
355
367
|
|
|
356
368
|
protected static Store<C extends StoreCode>(
|
|
357
369
|
code: C,
|
|
358
|
-
options?:
|
|
370
|
+
options?: CreateStoreOptions<C>
|
|
359
371
|
): StoreMap[C] {
|
|
360
372
|
return this.StoreFactory().Store(code, {
|
|
361
373
|
cwd: this.cwd,
|
|
362
|
-
...options,
|
|
374
|
+
...(options as any),
|
|
363
375
|
})
|
|
364
376
|
}
|
|
365
377
|
|
|
@@ -368,9 +380,7 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
368
380
|
}
|
|
369
381
|
|
|
370
382
|
protected static async assertIsFeatureInstalled(code: FeatureCode) {
|
|
371
|
-
const
|
|
372
|
-
const isInstalled = await featureInstaller.isInstalled(code)
|
|
373
|
-
|
|
383
|
+
const isInstalled = await this.featureInstaller.isInstalled(code)
|
|
374
384
|
assert.isTrue(isInstalled)
|
|
375
385
|
}
|
|
376
386
|
|
|
@@ -438,12 +448,10 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
438
448
|
const serviceFactory = this.ServiceFactory()
|
|
439
449
|
const writerFactory = this.WriterFactory()
|
|
440
450
|
|
|
441
|
-
const emitter = this.getEmitter()
|
|
442
|
-
|
|
443
451
|
const actionFactory = new ActionFactory({
|
|
444
452
|
writerFactory,
|
|
445
453
|
ui: this.ui,
|
|
446
|
-
emitter,
|
|
454
|
+
emitter: this.emitter,
|
|
447
455
|
apiClientFactory: this.getMercuryFixture().getApiClientFactory(),
|
|
448
456
|
cwd: this.cwd,
|
|
449
457
|
serviceFactory,
|
|
@@ -459,10 +467,10 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
459
467
|
|
|
460
468
|
const executer = new ActionExecuter({
|
|
461
469
|
ui: this.ui,
|
|
462
|
-
emitter,
|
|
470
|
+
emitter: this.emitter,
|
|
463
471
|
actionFactory,
|
|
464
472
|
featureInstallerFactory: () => {
|
|
465
|
-
return this.
|
|
473
|
+
return this.featureInstaller
|
|
466
474
|
},
|
|
467
475
|
shouldAutoHandleDependencies: false,
|
|
468
476
|
...options,
|
|
@@ -96,10 +96,8 @@ export default abstract class AbstractSchemaTest extends AbstractCliTest {
|
|
|
96
96
|
const packageContents = diskUtil.readFile(this.resolvePath('package.json'))
|
|
97
97
|
assert.doesInclude(packageContents, name)
|
|
98
98
|
|
|
99
|
-
const installer = this.getFeatureInstaller()
|
|
100
|
-
|
|
101
99
|
for (const code of expectedInstalledSkills) {
|
|
102
|
-
const isInstalled = await
|
|
100
|
+
const isInstalled = await this.featureInstaller.isInstalled(code)
|
|
103
101
|
assert.isTrue(isInstalled)
|
|
104
102
|
}
|
|
105
103
|
}
|
|
@@ -31,7 +31,9 @@ const actionUtil = {
|
|
|
31
31
|
},
|
|
32
32
|
|
|
33
33
|
assertNoErrorsInResponse(response: MercuryAggregateResponse<any>) {
|
|
34
|
-
|
|
34
|
+
if (response.totalContracts > 0) {
|
|
35
|
+
eventResponseUtil.getFirstResponseOrThrow(response)
|
|
36
|
+
}
|
|
35
37
|
},
|
|
36
38
|
}
|
|
37
39
|
|