@sprucelabs/spruce-cli 22.1.13 → 22.2.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/.DS_Store +0 -0
- package/.env +25 -0
- package/.env-dev +24 -0
- package/.eslintcache +1 -0
- package/build/.spruce/errors/errors.types.d.ts +137 -123
- package/build/.spruce/errors/options.types.d.ts +9 -3
- package/build/.spruce/errors/spruceCli/actionCancelled.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/actionCancelled.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/appViewControllerAlreadyExists.schema.d.ts +3 -0
- package/build/.spruce/errors/spruceCli/appViewControllerAlreadyExists.schema.js +12 -0
- package/build/.spruce/errors/spruceCli/appViewControllerAlreadyExists.schema.js.map +1 -0
- package/build/.spruce/errors/spruceCli/bootError.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/bootError.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/buildFailed.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/buildFailed.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/cacheNotEnabled.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/cacheNotEnabled.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/cannotPromptInCi.schema.d.ts +3 -0
- package/build/.spruce/errors/spruceCli/cannotPromptInCi.schema.js +12 -0
- package/build/.spruce/errors/spruceCli/cannotPromptInCi.schema.js.map +1 -0
- package/build/.spruce/errors/spruceCli/commandAborted.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/commandAborted.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/commandBlocked.schema.js +5 -5
- package/build/.spruce/errors/spruceCli/commandBlocked.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/commandNotImplemented.schema.js +5 -5
- package/build/.spruce/errors/spruceCli/commandNotImplemented.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/createAutoloaderFailed.schema.js +10 -10
- package/build/.spruce/errors/spruceCli/createAutoloaderFailed.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/deployFailed.schema.js +3 -13
- package/build/.spruce/errors/spruceCli/deployFailed.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/directoryEmpty.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/directoryEmpty.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/directoryNotSkill.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/directoryNotSkill.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/dockerNotStarted.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/dockerNotStarted.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/executingCommandFailed.schema.js +11 -11
- package/build/.spruce/errors/spruceCli/executingCommandFailed.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/failedToImport.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/failedToImport.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/featureNotInstalled.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/featureNotInstalled.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/fileExists.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/fileExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/generic.schema.js +4 -4
- package/build/.spruce/errors/spruceCli/generic.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/invalidCommand.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/invalidCommand.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/invalidEventContract.schema.js +5 -5
- package/build/.spruce/errors/spruceCli/invalidEventContract.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/invalidFeatureCode.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/invalidFeatureCode.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/invalidTestDirectory.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/invalidTestDirectory.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/lintFailed.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/lintFailed.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/mercuryResponseError.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/mercuryResponseError.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/missingDependencies.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/missingDependencies.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/missingDependenciesDependency.schema.js +5 -5
- package/build/.spruce/errors/spruceCli/missingDependenciesDependency.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/noOrganizationsFound.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/noOrganizationsFound.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/noSkillsRegistered.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/noSkillsRegistered.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/notImplemented.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/notImplemented.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/notLoggedIn.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/notLoggedIn.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/schemaExists.schema.js +5 -5
- package/build/.spruce/errors/spruceCli/schemaExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/schemaFailedToImport.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/schemaFailedToImport.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/schemaTemplateItemBuildingFailed.schema.js +9 -9
- package/build/.spruce/errors/spruceCli/schemaTemplateItemBuildingFailed.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/skillNotFound.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/skillNotFound.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/skillNotRegistered.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/skillNotRegistered.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/skillViewExists.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/skillViewExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/storeExists.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/storeExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/testFailed.schema.js +7 -7
- package/build/.spruce/errors/spruceCli/testFailed.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/themeExists.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/themeExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/transportAlreadyExists.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/transportAlreadyExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/viewPluginAlreadyExists.schema.js +3 -3
- package/build/.spruce/errors/spruceCli/viewPluginAlreadyExists.schema.js.map +1 -1
- package/build/.spruce/errors/spruceCli/vscodeNotInstalled.schema.js +1 -1
- package/build/.spruce/errors/spruceCli/vscodeNotInstalled.schema.js.map +1 -1
- package/build/GlobalEmitter.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingAnAppViewController.test.d.ts +23 -0
- package/build/__tests__/behavioral/views/CreatingAnAppViewController.test.js +136 -0
- package/build/__tests__/behavioral/views/CreatingAnAppViewController.test.js.map +1 -0
- package/build/__tests__/behavioral/views/KeepingViewsInSync.test.js +1 -1
- package/build/__tests__/behavioral/views/KeepingViewsInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.js +1 -1
- package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.js.map +1 -1
- package/build/__tests__/implementation/TerminalInterface.test.d.ts +1 -0
- package/build/__tests__/implementation/TerminalInterface.test.js +8 -0
- package/build/__tests__/implementation/TerminalInterface.test.js.map +1 -1
- package/build/cli/Cli.js +0 -1
- package/build/cli/Cli.js.map +1 -1
- package/build/errors/SpruceError.js +6 -0
- package/build/errors/SpruceError.js.map +1 -1
- package/build/errors/appViewControllerAlreadyExists.builder.d.ts +6 -0
- package/build/errors/appViewControllerAlreadyExists.builder.js +9 -0
- package/build/errors/appViewControllerAlreadyExists.builder.js.map +1 -0
- package/build/errors/cannotPromptInCi.builder.d.ts +6 -0
- package/build/errors/cannotPromptInCi.builder.js +9 -0
- package/build/errors/cannotPromptInCi.builder.js.map +1 -0
- package/build/features/view/actions/CreateAppAction.d.ts +16 -0
- package/build/features/view/actions/CreateAppAction.js +28 -0
- package/build/features/view/actions/CreateAppAction.js.map +1 -0
- package/build/features/view/actions/SyncAction.d.ts +1 -2
- package/build/features/view/actions/SyncAction.js +13 -4
- package/build/features/view/actions/SyncAction.js.map +1 -1
- package/build/features/view/writers/ViewWriter.d.ts +1 -0
- package/build/features/view/writers/ViewWriter.js +11 -0
- package/build/features/view/writers/ViewWriter.js.map +1 -1
- package/build/index.js +0 -0
- package/build/interfaces/TerminalInterface.js +3 -0
- package/build/interfaces/TerminalInterface.js.map +1 -1
- package/build/tests/fixtures/ViewFixture.js +1 -1
- package/build/tests/fixtures/ViewFixture.js.map +1 -1
- package/build/utilities/isCi.js +3 -0
- package/build/utilities/isCi.js.map +1 -1
- package/dist/spruce-darwin-arm64 +0 -0
- package/dist/spruce-linux-arm64 +0 -0
- package/junit.xml +1782 -0
- package/package.json +29 -29
- package/src/.spruce/errors/errors.types.ts +1180 -911
- package/src/.spruce/errors/options.types.ts +131 -248
- package/src/.spruce/errors/spruceCli/actionCancelled.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/appViewControllerAlreadyExists.schema.ts +16 -0
- package/src/.spruce/errors/spruceCli/bootError.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/buildFailed.schema.ts +16 -15
- package/src/.spruce/errors/spruceCli/cacheNotEnabled.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/cannotPromptInCi.schema.ts +16 -0
- package/src/.spruce/errors/spruceCli/commandAborted.schema.ts +15 -13
- package/src/.spruce/errors/spruceCli/commandBlocked.schema.ts +20 -18
- package/src/.spruce/errors/spruceCli/commandNotImplemented.schema.ts +26 -25
- package/src/.spruce/errors/spruceCli/createAutoloaderFailed.schema.ts +43 -42
- package/src/.spruce/errors/spruceCli/dependencyExists.schema.ts +14 -12
- package/src/.spruce/errors/spruceCli/deployFailed.schema.ts +14 -22
- package/src/.spruce/errors/spruceCli/directoryEmpty.schema.ts +14 -12
- package/src/.spruce/errors/spruceCli/directoryNotSkill.schema.ts +9 -7
- package/src/.spruce/errors/spruceCli/dockerNotStarted.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/executingCommandFailed.schema.ts +41 -40
- package/src/.spruce/errors/spruceCli/failedToImport.schema.ts +17 -15
- package/src/.spruce/errors/spruceCli/featureNotInstalled.schema.ts +15 -14
- package/src/.spruce/errors/spruceCli/fileExists.schema.ts +17 -15
- package/src/.spruce/errors/spruceCli/generic.schema.ts +15 -13
- package/src/.spruce/errors/spruceCli/invalidCommand.schema.ts +17 -15
- package/src/.spruce/errors/spruceCli/invalidEventContract.schema.ts +21 -20
- package/src/.spruce/errors/spruceCli/invalidFeatureCode.schema.ts +15 -14
- package/src/.spruce/errors/spruceCli/invalidTestDirectory.schema.ts +15 -14
- package/src/.spruce/errors/spruceCli/lintFailed.schema.ts +17 -15
- package/src/.spruce/errors/spruceCli/mercuryResponseError.schema.ts +16 -15
- package/src/.spruce/errors/spruceCli/missingDependencies.schema.ts +16 -16
- package/src/.spruce/errors/spruceCli/missingDependenciesDependency.schema.ts +21 -20
- package/src/.spruce/errors/spruceCli/noOrganizationsFound.schema.ts +9 -7
- package/src/.spruce/errors/spruceCli/noSkillsRegistered.schema.ts +9 -7
- package/src/.spruce/errors/spruceCli/notImplemented.schema.ts +9 -6
- package/src/.spruce/errors/spruceCli/notLoggedIn.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/schemaExists.schema.ts +21 -19
- package/src/.spruce/errors/spruceCli/schemaFailedToImport.schema.ts +18 -17
- package/src/.spruce/errors/spruceCli/schemaTemplateItemBuildingFailed.schema.ts +33 -32
- package/src/.spruce/errors/spruceCli/skillNotFound.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/skillNotRegistered.schema.ts +9 -7
- package/src/.spruce/errors/spruceCli/skillViewExists.schema.ts +14 -12
- package/src/.spruce/errors/spruceCli/storeExists.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/testFailed.schema.ts +26 -24
- package/src/.spruce/errors/spruceCli/themeExists.schema.ts +8 -5
- package/src/.spruce/errors/spruceCli/transportAlreadyExists.schema.ts +16 -15
- package/src/.spruce/errors/spruceCli/viewPluginAlreadyExists.schema.ts +15 -14
- package/src/.spruce/errors/spruceCli/vscodeNotInstalled.schema.ts +9 -7
- package/src/GlobalEmitter.ts +0 -1
- package/src/__tests__/behavioral/views/CreatingAnAppViewController.test.ts +158 -0
- package/src/__tests__/behavioral/views/KeepingViewsInSync.test.ts +1 -1
- package/src/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.ts +1 -1
- package/src/__tests__/implementation/TerminalInterface.test.ts +14 -1
- package/src/cli/Cli.ts +1 -2
- package/src/errors/SpruceError.ts +8 -0
- package/src/errors/appViewControllerAlreadyExists.builder.ts +7 -0
- package/src/errors/cannotPromptInCi.builder.ts +7 -0
- package/src/features/view/actions/CreateAppAction.ts +33 -0
- package/src/features/view/actions/SyncAction.ts +13 -7
- package/src/features/view/writers/ViewWriter.ts +19 -0
- package/src/interfaces/TerminalInterface.ts +5 -0
- package/src/tests/fixtures/ViewFixture.ts +1 -1
- package/src/utilities/isCi.ts +4 -0
- package/yarn-error.log +597 -0
- package/LICENSE +0 -21
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
2
|
import { SpruceErrors } from '../errors.types'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const testFailedSchema: SpruceErrors.SpruceCli.TestFailedSchema = {
|
|
7
|
+
id: 'testFailed',
|
|
8
|
+
namespace: 'SpruceCli',
|
|
9
|
+
name: 'Test failed',
|
|
10
|
+
fields: {
|
|
11
|
+
/** . */
|
|
12
|
+
'fileName': {
|
|
13
|
+
type: 'text',
|
|
14
|
+
isRequired: true,
|
|
15
|
+
options: undefined
|
|
16
|
+
},
|
|
17
|
+
/** . */
|
|
18
|
+
'testName': {
|
|
19
|
+
type: 'text',
|
|
20
|
+
isRequired: true,
|
|
21
|
+
options: undefined
|
|
22
|
+
},
|
|
23
|
+
/** . */
|
|
24
|
+
'errorMessage': {
|
|
25
|
+
type: 'text',
|
|
26
|
+
isRequired: true,
|
|
27
|
+
options: undefined
|
|
28
|
+
},
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
SchemaRegistry.getInstance().trackSchema(testFailedSchema)
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
2
|
import { SpruceErrors } from '../errors.types'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const themeExistsSchema: SpruceErrors.SpruceCli.ThemeExistsSchema = {
|
|
7
|
+
id: 'themeExists',
|
|
8
|
+
namespace: 'SpruceCli',
|
|
9
|
+
name: 'Theme exists',
|
|
10
|
+
fields: {
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
SchemaRegistry.getInstance().trackSchema(themeExistsSchema)
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
2
|
import { SpruceErrors } from '../errors.types'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const transportAlreadyExistsSchema: SpruceErrors.SpruceCli.TransportAlreadyExistsSchema = {
|
|
7
|
+
id: 'transportAlreadyExists',
|
|
8
|
+
namespace: 'SpruceCli',
|
|
9
|
+
name: 'transport already exists',
|
|
10
|
+
fields: {
|
|
11
|
+
/** Transport name. */
|
|
12
|
+
'name': {
|
|
13
|
+
label: 'Transport name',
|
|
14
|
+
type: 'text',
|
|
15
|
+
isRequired: true,
|
|
16
|
+
options: undefined
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
19
20
|
|
|
20
21
|
SchemaRegistry.getInstance().trackSchema(transportAlreadyExistsSchema)
|
|
21
22
|
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
2
|
import { SpruceErrors } from '../errors.types'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const viewPluginAlreadyExistsSchema: SpruceErrors.SpruceCli.ViewPluginAlreadyExistsSchema = {
|
|
7
|
+
id: 'viewPluginAlreadyExists',
|
|
8
|
+
namespace: 'SpruceCli',
|
|
9
|
+
name: 'View plugin already exists',
|
|
10
|
+
fields: {
|
|
11
|
+
/** . */
|
|
12
|
+
'name': {
|
|
13
|
+
type: 'text',
|
|
14
|
+
isRequired: true,
|
|
15
|
+
options: undefined
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
}
|
|
18
19
|
|
|
19
20
|
SchemaRegistry.getInstance().trackSchema(viewPluginAlreadyExistsSchema)
|
|
20
21
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
2
|
import { SpruceErrors } from '../errors.types'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const vscodeNotInstalledSchema: SpruceErrors.SpruceCli.VscodeNotInstalledSchema = {
|
|
7
|
+
id: 'vscodeNotInstalled',
|
|
8
|
+
namespace: 'SpruceCli',
|
|
9
|
+
name: 'vscode not installed',
|
|
10
|
+
fields: {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
11
13
|
|
|
12
14
|
SchemaRegistry.getInstance().trackSchema(vscodeNotInstalledSchema)
|
|
13
15
|
|
package/src/GlobalEmitter.ts
CHANGED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
import { test, assert, errorAssert, generateId } from '@sprucelabs/test-utils'
|
|
3
|
+
import CreateAppAction from '../../../features/view/actions/CreateAppAction'
|
|
4
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
5
|
+
import testUtil from '../../../tests/utilities/test.utility'
|
|
6
|
+
|
|
7
|
+
export default class CreatingAnAppViewControllerTest extends AbstractSkillTest {
|
|
8
|
+
protected static skillCacheKey = 'views'
|
|
9
|
+
private static avcPath: string
|
|
10
|
+
|
|
11
|
+
private static action: CreateAppAction
|
|
12
|
+
private static lastExecution: {
|
|
13
|
+
actionCode: string
|
|
14
|
+
featureCode: string
|
|
15
|
+
}[] = []
|
|
16
|
+
|
|
17
|
+
protected static async beforeAll(): Promise<void> {
|
|
18
|
+
await super.beforeAll()
|
|
19
|
+
this.avcPath = this.resolvePath('src/App.avc.ts')
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected static async beforeEach(): Promise<void> {
|
|
23
|
+
await super.beforeEach()
|
|
24
|
+
|
|
25
|
+
this.action = this.Action('view', 'createApp')
|
|
26
|
+
await this.cli.on('feature.will-execute', (payload) => {
|
|
27
|
+
this.lastExecution.push(payload)
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@test()
|
|
32
|
+
protected static async generatesExpectedFile() {
|
|
33
|
+
const results = await this.execute()
|
|
34
|
+
assert.isFalsy(results.errors)
|
|
35
|
+
|
|
36
|
+
testUtil.assertFileByPathInGeneratedFiles(this.avcPath, results.files)
|
|
37
|
+
|
|
38
|
+
assert.doesInclude(results.files, {
|
|
39
|
+
action: 'generated',
|
|
40
|
+
name: 'App.avc.ts',
|
|
41
|
+
path: this.avcPath,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
assert.doesInclude(results.files, {
|
|
45
|
+
action: 'generated',
|
|
46
|
+
name: 'views.ts',
|
|
47
|
+
path: this.combinedViewsPath,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@test()
|
|
52
|
+
protected static async syncsViewsOnCreation() {
|
|
53
|
+
debugger
|
|
54
|
+
assert.doesInclude(this.lastExecution, {
|
|
55
|
+
actionCode: 'sync',
|
|
56
|
+
featureCode: 'view',
|
|
57
|
+
})
|
|
58
|
+
assert.isEqual(this.lastExecution[1].actionCode, 'sync')
|
|
59
|
+
assert.isTrue(
|
|
60
|
+
diskUtil.doesFileExist(this.combinedViewsPath),
|
|
61
|
+
'views.ts does not exist'
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@test()
|
|
66
|
+
protected static async throwsIfAppAlreadyExists() {
|
|
67
|
+
await this.executeAndAssertThrowsAvcExists()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@test()
|
|
71
|
+
protected static async avcIncludesExpectedContents() {
|
|
72
|
+
const contents = diskUtil.readFile(this.avcPath)
|
|
73
|
+
assert.doesInclude(
|
|
74
|
+
contents,
|
|
75
|
+
'export default class AppViewControllerImpl extends AbstractAppViewController'
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
assert.doesInclude(
|
|
79
|
+
contents,
|
|
80
|
+
'public async (_options: AppViewControllerLoadOptions)'
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@test()
|
|
85
|
+
protected static async generatedFilesAreValid() {
|
|
86
|
+
await this.Service('typeChecker').check(this.avcPath)
|
|
87
|
+
await this.assertCombinedViewsFileIsValid()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@test()
|
|
91
|
+
protected static async doesNotDropAppIntoSkillViewTypes() {
|
|
92
|
+
const expected = `interface ViewControllerMap {}`
|
|
93
|
+
this.assertCombinedViewsContains(expected)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@test()
|
|
97
|
+
protected static async callsHeartwoodImportFunctionAsExpected() {
|
|
98
|
+
this.assertCombinedViewsContains(
|
|
99
|
+
'heartwood({ vcs, pluginsByName, App: AppViewControllerImpl })'
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@test()
|
|
104
|
+
protected static async throwsEvenIfAppAvcMoves() {
|
|
105
|
+
const destination = this.resolvePath(`src/${generateId()}/App.avc.ts`)
|
|
106
|
+
diskUtil.moveFile(this.avcPath, destination)
|
|
107
|
+
|
|
108
|
+
await this.executeAndAssertThrowsAvcExists()
|
|
109
|
+
this.avcPath = destination
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@test()
|
|
113
|
+
protected static async canRenameAppAvcAndItUpdatesCombinedViews() {
|
|
114
|
+
const contents = diskUtil.readFile(this.avcPath)
|
|
115
|
+
const updatedContents = contents.replace(
|
|
116
|
+
'AppViewControllerImpl',
|
|
117
|
+
'NewAppViewControllerImpl'
|
|
118
|
+
)
|
|
119
|
+
diskUtil.writeFile(this.avcPath, updatedContents)
|
|
120
|
+
await this.Action('view', 'sync').execute({})
|
|
121
|
+
|
|
122
|
+
this.assertCombinedViewsContains(
|
|
123
|
+
'heartwood({ vcs, pluginsByName, App: NewAppViewControllerImpl })'
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
await this.assertCombinedViewsFileIsValid()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private static async assertCombinedViewsFileIsValid() {
|
|
130
|
+
await this.Service('typeChecker').check(this.combinedViewsPath)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private static assertCombinedViewsContains(expected: string) {
|
|
134
|
+
const contents = diskUtil.readFile(this.combinedViewsPath)
|
|
135
|
+
assert.doesInclude(
|
|
136
|
+
contents.replace(/\s/g, ''),
|
|
137
|
+
expected.replace(/\s/g, ''),
|
|
138
|
+
`The combined views file does not include the expected contents.`
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private static get combinedViewsPath() {
|
|
143
|
+
return this.resolveHashSprucePath('views', 'views.ts')
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private static async executeAndAssertThrowsAvcExists() {
|
|
147
|
+
const results = await this.execute()
|
|
148
|
+
assert.isTruthy(results.errors)
|
|
149
|
+
errorAssert.assertError(
|
|
150
|
+
results.errors[0],
|
|
151
|
+
'APP_VIEW_CONTROLLER_ALREADY_EXISTS'
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private static async execute() {
|
|
156
|
+
return await this.action.execute()
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -20,7 +20,7 @@ export default class KeepingViewsInSyncTest extends AbstractSkillTest {
|
|
|
20
20
|
|
|
21
21
|
@test()
|
|
22
22
|
protected static async syncingWithNoViewsGeneratesNothing() {
|
|
23
|
-
const results = await this.action.execute(
|
|
23
|
+
const results = await this.action.execute()
|
|
24
24
|
assert.isFalsy(results.errors)
|
|
25
25
|
assert.isFalsy(results.files)
|
|
26
26
|
}
|
|
@@ -92,7 +92,7 @@ export default class CreatingAViewPluginTest extends AbstractSkillTest {
|
|
|
92
92
|
`
|
|
93
93
|
|
|
94
94
|
this.assertCombinedFileIncludes(expected)
|
|
95
|
-
this.assertCombinedFileIncludes('heartwood(vcs, pluginsByName)')
|
|
95
|
+
this.assertCombinedFileIncludes('heartwood({ vcs, pluginsByName })')
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
@test()
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import AbstractSpruceTest, {
|
|
1
|
+
import AbstractSpruceTest, {
|
|
2
|
+
test,
|
|
3
|
+
assert,
|
|
4
|
+
errorAssert,
|
|
5
|
+
} from '@sprucelabs/test-utils'
|
|
2
6
|
import TerminalInterface from '../../interfaces/TerminalInterface'
|
|
3
7
|
|
|
4
8
|
export default class TerminalInterfaceTest extends AbstractSpruceTest {
|
|
@@ -33,6 +37,15 @@ export default class TerminalInterfaceTest extends AbstractSpruceTest {
|
|
|
33
37
|
assert.isTrue(this.wasOraHit)
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
@test()
|
|
41
|
+
protected static async askingToPromptThrowsIfInCi() {
|
|
42
|
+
process.env.CIRCLECI = 'true'
|
|
43
|
+
const err = await assert.doesThrowAsync(() =>
|
|
44
|
+
this.ui.prompt({ type: 'text' })
|
|
45
|
+
)
|
|
46
|
+
errorAssert.assertError(err, 'CANNOT_PROMPT_IN_CI')
|
|
47
|
+
}
|
|
48
|
+
|
|
36
49
|
private static async startLoading() {
|
|
37
50
|
await this.ui.startLoading()
|
|
38
51
|
}
|
package/src/cli/Cli.ts
CHANGED
|
@@ -269,6 +269,14 @@ export default class SpruceError extends AbstractSpruceError<ErrorOptions> {
|
|
|
269
269
|
message = `A view plugin by the name ${options.name} already exists!`
|
|
270
270
|
break
|
|
271
271
|
|
|
272
|
+
case 'CANNOT_PROMPT_IN_CI':
|
|
273
|
+
message = 'A cannot prompt in ci just happened!'
|
|
274
|
+
break
|
|
275
|
+
|
|
276
|
+
case 'APP_VIEW_CONTROLLER_ALREADY_EXISTS':
|
|
277
|
+
message = `You already have an AppViewController! Run \`spruce sync.views\` if you are having issues.`
|
|
278
|
+
break
|
|
279
|
+
|
|
272
280
|
default:
|
|
273
281
|
message = super.friendlyMessage()
|
|
274
282
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { buildSchema } from '@sprucelabs/schema'
|
|
2
|
+
import actionUtil from '../../../utilities/action.utility'
|
|
3
|
+
import AbstractAction from '../../AbstractAction'
|
|
4
|
+
import { FeatureActionResponse } from '../../features.types'
|
|
5
|
+
|
|
6
|
+
export default class CreateAppAction extends AbstractAction<OptionsSchema> {
|
|
7
|
+
public optionsSchema = optionsSchema
|
|
8
|
+
public invocationMessage = 'Creating new app view controller... '
|
|
9
|
+
|
|
10
|
+
public async execute(): Promise<FeatureActionResponse> {
|
|
11
|
+
const writer = this.Writer('view', {})
|
|
12
|
+
const files = await writer.writeAppViewController(this.cwd)
|
|
13
|
+
|
|
14
|
+
const results = await this.Action('view', 'sync').execute({})
|
|
15
|
+
const merged = actionUtil.mergeActionResults(
|
|
16
|
+
{
|
|
17
|
+
files,
|
|
18
|
+
},
|
|
19
|
+
results
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
debugger
|
|
23
|
+
|
|
24
|
+
return merged
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const optionsSchema = buildSchema({
|
|
29
|
+
id: 'createAppViewControllerOptions',
|
|
30
|
+
fields: {},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
type OptionsSchema = typeof optionsSchema
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import globby from '@sprucelabs/globby'
|
|
2
|
-
import { buildSchema
|
|
2
|
+
import { buildSchema } from '@sprucelabs/schema'
|
|
3
3
|
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
4
4
|
import {
|
|
5
5
|
VcTemplateItem,
|
|
@@ -16,12 +16,10 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
16
16
|
public commandAliases = ['sync.views']
|
|
17
17
|
public invocationMessage = 'Syncing view controller types... 🌲'
|
|
18
18
|
|
|
19
|
-
public async execute(
|
|
20
|
-
_options: SchemaValues<OptionsSchema>
|
|
21
|
-
): Promise<FeatureActionResponse> {
|
|
19
|
+
public async execute(): Promise<FeatureActionResponse> {
|
|
22
20
|
const targetDir = diskUtil.resolvePath(this.cwd, 'src')
|
|
23
21
|
const matches = await globby(
|
|
24
|
-
['**/*.svc.ts', '**/*.vc.ts', '**/*.view.plugin.ts'],
|
|
22
|
+
['**/*.svc.ts', '**/*.vc.ts', '**/*.view.plugin.ts', '**/*.avc.ts'],
|
|
25
23
|
{
|
|
26
24
|
cwd: targetDir,
|
|
27
25
|
}
|
|
@@ -35,12 +33,13 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
35
33
|
const introspect = introspectionUtil.introspect(paths)
|
|
36
34
|
|
|
37
35
|
const vcTemplateItems: VcTemplateItem[] = []
|
|
36
|
+
let appTemplateItem: VcTemplateItem | undefined
|
|
38
37
|
const svcTemplateItems: VcTemplateItem[] = []
|
|
39
38
|
const viewPluginItems: ViewControllerPluginItem[] = []
|
|
40
39
|
|
|
41
40
|
introspect.forEach(({ classes }) => {
|
|
42
41
|
for (const thisClass of classes) {
|
|
43
|
-
const { vc, svc, plugin } =
|
|
42
|
+
const { vc, svc, plugin, avc } =
|
|
44
43
|
this.mapIntrospectedClassToTemplateItem(thisClass)
|
|
45
44
|
|
|
46
45
|
if (vc) {
|
|
@@ -49,6 +48,8 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
49
48
|
viewPluginItems.push(plugin)
|
|
50
49
|
} else if (svc) {
|
|
51
50
|
svcTemplateItems.push(svc)
|
|
51
|
+
} else if (avc) {
|
|
52
|
+
appTemplateItem = avc
|
|
52
53
|
} else {
|
|
53
54
|
throw new Error('Unexpected class type.')
|
|
54
55
|
}
|
|
@@ -63,6 +64,7 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
63
64
|
vcTemplateItems,
|
|
64
65
|
svcTemplateItems,
|
|
65
66
|
viewPluginItems,
|
|
67
|
+
appTemplateItem,
|
|
66
68
|
}
|
|
67
69
|
)
|
|
68
70
|
|
|
@@ -75,6 +77,7 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
75
77
|
vc?: VcTemplateItem
|
|
76
78
|
svc?: VcTemplateItem
|
|
77
79
|
plugin?: ViewControllerPluginItem
|
|
80
|
+
avc?: VcTemplateItem
|
|
78
81
|
} {
|
|
79
82
|
const item = {
|
|
80
83
|
id: c.staticProperties.id,
|
|
@@ -84,10 +87,13 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
84
87
|
|
|
85
88
|
let vc: VcTemplateItem | undefined
|
|
86
89
|
let svc: VcTemplateItem | undefined
|
|
90
|
+
let avc: VcTemplateItem | undefined
|
|
87
91
|
let plugin: ViewControllerPluginItem | undefined
|
|
88
92
|
|
|
89
93
|
if (c.classPath.endsWith('.svc.ts')) {
|
|
90
94
|
svc = item
|
|
95
|
+
} else if (c.classPath.endsWith('avc.ts')) {
|
|
96
|
+
avc = item
|
|
91
97
|
} else if (c.classPath.endsWith('view.plugin.ts')) {
|
|
92
98
|
const nameCamel = c.classPath.match(/([^/]+).view.plugin.ts$/)![1]
|
|
93
99
|
plugin = { ...item, nameCamel }
|
|
@@ -95,7 +101,7 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
95
101
|
vc = item
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
return { svc, vc, plugin }
|
|
104
|
+
return { svc, vc, plugin, avc }
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
|
|
@@ -214,4 +214,23 @@ export default class ViewWriter extends AbstractWriter {
|
|
|
214
214
|
)
|
|
215
215
|
return { path, filename }
|
|
216
216
|
}
|
|
217
|
+
|
|
218
|
+
public async writeAppViewController(cwd: string) {
|
|
219
|
+
const match = await globby(cwd + '/**/App.avc.ts')
|
|
220
|
+
|
|
221
|
+
if (match.length > 0) {
|
|
222
|
+
throw new SpruceError({
|
|
223
|
+
code: 'APP_VIEW_CONTROLLER_ALREADY_EXISTS',
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const destination = diskUtil.resolvePath(cwd, 'src', 'App.avc.ts')
|
|
228
|
+
const contents = this.templates.appViewController()
|
|
229
|
+
|
|
230
|
+
return this.writeFileIfChangedMixinResults(
|
|
231
|
+
destination,
|
|
232
|
+
contents,
|
|
233
|
+
'Your new app view controller!'
|
|
234
|
+
)
|
|
235
|
+
}
|
|
217
236
|
}
|
|
@@ -414,6 +414,11 @@ export default class TerminalInterface implements GraphicsInterface {
|
|
|
414
414
|
definition: T
|
|
415
415
|
): Promise<FieldDefinitionValueType<T>> {
|
|
416
416
|
this.isPromptActive = true
|
|
417
|
+
|
|
418
|
+
if (isCi()) {
|
|
419
|
+
throw new SpruceError({ code: 'CANNOT_PROMPT_IN_CI' })
|
|
420
|
+
}
|
|
421
|
+
|
|
417
422
|
const name = generateInquirerFieldName()
|
|
418
423
|
const fieldDefinition: FieldDefinitions = definition
|
|
419
424
|
const { defaultValue } = fieldDefinition
|