@contember/cli 1.1.1 → 1.2.0-alpha.10
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/Dockerfile +2 -2
- package/dist/src/commands/deploy/DeployCommand.d.ts +3 -1
- package/dist/src/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/src/commands/deploy/DeployCommand.js +15 -15
- package/dist/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationAmendCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.js +8 -2
- package/dist/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationCreateHelper.d.ts +5 -4
- package/dist/src/commands/migrations/MigrationCreateHelper.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationCreateHelper.js +2 -9
- package/dist/src/commands/migrations/MigrationCreateHelper.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.d.ts +4 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.js +8 -3
- package/dist/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.js +9 -2
- package/dist/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationExecuteCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteCommand.js +8 -5
- package/dist/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationRebaseCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationRebaseCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationRebaseCommand.js +8 -2
- package/dist/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.d.ts +4 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.js +8 -3
- package/dist/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/src/commands/migrations/SystemApiClientResolver.d.ts +3 -3
- package/dist/src/commands/migrations/SystemApiClientResolver.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.d.ts +3 -0
- package/dist/src/commands/project/ProjectCreateCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.js +5 -1
- package/dist/src/commands/project/ProjectCreateCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts +4 -2
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.js +8 -4
- package/dist/src/commands/project/ProjectGenerateDocumentation.js.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts +4 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js +10 -6
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.d.ts +4 -2
- package/dist/src/commands/project/ProjectValidateCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.js +8 -5
- package/dist/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/src/commands/tenant/CreateApiKeyCommand.d.ts +3 -0
- package/dist/src/commands/tenant/CreateApiKeyCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/CreateApiKeyCommand.js +5 -2
- package/dist/src/commands/tenant/CreateApiKeyCommand.js.map +1 -1
- package/dist/src/commands/tenant/InviteCommand.d.ts +3 -0
- package/dist/src/commands/tenant/InviteCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/InviteCommand.js +5 -2
- package/dist/src/commands/tenant/InviteCommand.js.map +1 -1
- package/dist/src/commands/tenant/ResetPasswordCommand.d.ts +3 -0
- package/dist/src/commands/tenant/ResetPasswordCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/ResetPasswordCommand.js +5 -2
- package/dist/src/commands/tenant/ResetPasswordCommand.js.map +1 -1
- package/dist/src/commands/tenant/SignInCommand.d.ts +3 -0
- package/dist/src/commands/tenant/SignInCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/SignInCommand.js +5 -2
- package/dist/src/commands/tenant/SignInCommand.js.map +1 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.d.ts +3 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.d.ts.map +1 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js +5 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/src/run.js +22 -23
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/instance/interactiveUtils.d.ts +1 -1
- package/dist/src/utils/instance/interactiveUtils.d.ts.map +1 -1
- package/dist/src/utils/project/resources/out.css +97 -14
- package/dist/src/utils/schema.d.ts +2 -2
- package/dist/src/utils/schema.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/commands/deploy/DeployCommand.ts +20 -15
- package/src/commands/migrations/MigrationAmendCommand.ts +12 -3
- package/src/commands/migrations/MigrationCreateHelper.ts +2 -7
- package/src/commands/migrations/MigrationDescribeCommand.ts +11 -3
- package/src/commands/migrations/MigrationDiffCommand.ts +14 -4
- package/src/commands/migrations/MigrationExecuteCommand.ts +11 -6
- package/src/commands/migrations/MigrationRebaseCommand.ts +13 -3
- package/src/commands/migrations/MigrationStatusCommand.ts +11 -3
- package/src/commands/project/ProjectCreateCommand.ts +7 -1
- package/src/commands/project/ProjectGenerateDocumentation.ts +12 -7
- package/src/commands/project/ProjectPrintSchemaCommand.ts +12 -5
- package/src/commands/project/ProjectValidateCommand.ts +11 -6
- package/src/commands/tenant/CreateApiKeyCommand.ts +7 -1
- package/src/commands/tenant/InviteCommand.ts +7 -1
- package/src/commands/tenant/ResetPasswordCommand.ts +7 -1
- package/src/commands/tenant/SignInCommand.ts +7 -1
- package/src/commands/workspace/WorkspaceUpdateApiCommand.ts +7 -1
- package/src/run.ts +24 -26
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
Authorizator,
|
|
11
11
|
} from '@contember/engine-content-api'
|
|
12
12
|
import { DocumentNode, printSchema } from 'graphql'
|
|
13
|
-
import { mergeSchemas } from '@graphql-tools/
|
|
13
|
+
import { mergeSchemas } from '@graphql-tools/schema'
|
|
14
14
|
import { loadSchema } from '../../utils/project/loadSchema'
|
|
15
15
|
|
|
16
16
|
type Args = {
|
|
17
|
-
project
|
|
17
|
+
project?: string
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
type Options = {
|
|
@@ -23,19 +23,26 @@ type Options = {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export class ProjectPrintSchemaCommand extends Command<Args, Options> {
|
|
26
|
+
constructor(
|
|
27
|
+
private readonly workspace: Workspace,
|
|
28
|
+
) {
|
|
29
|
+
super()
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
27
33
|
configuration.description('Prints project schema')
|
|
28
|
-
|
|
34
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
35
|
+
configuration.argument('project')
|
|
36
|
+
}
|
|
29
37
|
configuration.option('format').valueRequired().description('graphql|introspection|schema')
|
|
30
38
|
configuration.option('role').valueArray()
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
34
42
|
const projectName = input.getArgument('project')
|
|
35
|
-
const workspace =
|
|
43
|
+
const workspace = this.workspace
|
|
36
44
|
const format = input.getOption('format') || 'graphql'
|
|
37
45
|
|
|
38
|
-
validateProjectName(projectName)
|
|
39
46
|
const project = await workspace.projects.getProject(projectName, { fuzzy: true })
|
|
40
47
|
const schema = await loadSchema(project)
|
|
41
48
|
if (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {
|
|
@@ -6,25 +6,30 @@ import { validateMigrations } from '../migrations/MigrationValidationHelper'
|
|
|
6
6
|
import { loadSchema } from '../../utils/project/loadSchema'
|
|
7
7
|
|
|
8
8
|
type Args = {
|
|
9
|
-
project
|
|
9
|
+
project?: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
type Options = {}
|
|
13
13
|
|
|
14
14
|
export class ProjectValidateCommand extends Command<Args, Options> {
|
|
15
|
+
constructor(
|
|
16
|
+
private readonly workspace: Workspace,
|
|
17
|
+
) {
|
|
18
|
+
super()
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
16
22
|
configuration.description('Validates project schema')
|
|
17
|
-
|
|
23
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
24
|
+
configuration.argument('project')
|
|
25
|
+
}
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
21
29
|
const [projectName] = [input.getArgument('project')]
|
|
22
|
-
const workspace =
|
|
30
|
+
const workspace = this.workspace
|
|
23
31
|
|
|
24
32
|
const allProjects = projectName === '.'
|
|
25
|
-
if (!allProjects) {
|
|
26
|
-
validateProjectName(projectName)
|
|
27
|
-
}
|
|
28
33
|
const projects = allProjects
|
|
29
34
|
? await workspace.projects.listProjects()
|
|
30
35
|
: [await workspace.projects.getProject(projectName, { fuzzy: true })]
|
|
@@ -10,6 +10,12 @@ type Args = {
|
|
|
10
10
|
type Options = {}
|
|
11
11
|
|
|
12
12
|
export class CreateApiKeyCommand extends Command<Args, Options> {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly workspace: Workspace,
|
|
15
|
+
) {
|
|
16
|
+
super()
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
14
20
|
configuration.description('Creates an API key')
|
|
15
21
|
configuration //
|
|
@@ -22,7 +28,7 @@ export class CreateApiKeyCommand extends Command<Args, Options> {
|
|
|
22
28
|
if (!process.stdin.isTTY) {
|
|
23
29
|
throw 'This command is interactive and requires TTY'
|
|
24
30
|
}
|
|
25
|
-
const workspace =
|
|
31
|
+
const workspace = this.workspace
|
|
26
32
|
const instance = await interactiveResolveInstanceEnvironmentFromInput(workspace, input.getArgument('instance'))
|
|
27
33
|
const apiToken = await interactiveResolveApiToken({ workspace, instance })
|
|
28
34
|
const tenantClient = TenantClient.create(instance.baseUrl, apiToken)
|
|
@@ -10,6 +10,12 @@ type Args = {
|
|
|
10
10
|
type Options = {}
|
|
11
11
|
|
|
12
12
|
export class InviteCommand extends Command<Args, Options> {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly workspace: Workspace,
|
|
15
|
+
) {
|
|
16
|
+
super()
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
14
20
|
configuration.description('Invites a user by an email')
|
|
15
21
|
configuration //
|
|
@@ -22,7 +28,7 @@ export class InviteCommand extends Command<Args, Options> {
|
|
|
22
28
|
if (!process.stdin.isTTY) {
|
|
23
29
|
throw 'This command is interactive and requires TTY'
|
|
24
30
|
}
|
|
25
|
-
const workspace =
|
|
31
|
+
const workspace = this.workspace
|
|
26
32
|
const instance = await interactiveResolveInstanceEnvironmentFromInput(workspace, input.getArgument('instance'))
|
|
27
33
|
const apiToken = await interactiveResolveApiToken({ workspace, instance })
|
|
28
34
|
const tenantClient = TenantClient.create(instance.baseUrl, apiToken)
|
|
@@ -10,6 +10,12 @@ type Args = {
|
|
|
10
10
|
type Options = {}
|
|
11
11
|
|
|
12
12
|
export class ResetPasswordCommand extends Command<Args, Options> {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly workspace: Workspace,
|
|
15
|
+
) {
|
|
16
|
+
super()
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
14
20
|
configuration.description('Resets user password')
|
|
15
21
|
configuration //
|
|
@@ -22,7 +28,7 @@ export class ResetPasswordCommand extends Command<Args, Options> {
|
|
|
22
28
|
if (!process.stdin.isTTY) {
|
|
23
29
|
throw 'This command is interactive and requires TTY'
|
|
24
30
|
}
|
|
25
|
-
const workspace =
|
|
31
|
+
const workspace = this.workspace
|
|
26
32
|
const instance = await interactiveResolveInstanceEnvironmentFromInput(workspace, input.getArgument('instance'))
|
|
27
33
|
const loginToken = await interactiveResolveLoginToken(workspace)
|
|
28
34
|
await interactiveResetPassword({ apiUrl: instance.baseUrl, loginToken })
|
|
@@ -10,6 +10,12 @@ type Args = {
|
|
|
10
10
|
type Options = {}
|
|
11
11
|
|
|
12
12
|
export class SignInCommand extends Command<Args, Options> {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly workspace: Workspace,
|
|
15
|
+
) {
|
|
16
|
+
super()
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
14
20
|
configuration.description('Signs in a user')
|
|
15
21
|
configuration //
|
|
@@ -22,7 +28,7 @@ export class SignInCommand extends Command<Args, Options> {
|
|
|
22
28
|
if (!process.stdin.isTTY) {
|
|
23
29
|
throw 'This command is interactive and requires TTY'
|
|
24
30
|
}
|
|
25
|
-
const workspace =
|
|
31
|
+
const workspace = this.workspace
|
|
26
32
|
const instance = await interactiveResolveInstanceEnvironmentFromInput(workspace, input.getArgument('instance'))
|
|
27
33
|
const loginToken = await interactiveResolveLoginToken(workspace)
|
|
28
34
|
const { sessionToken } = await interactiveSignIn({ apiUrl: instance.baseUrl, loginToken })
|
|
@@ -10,6 +10,12 @@ type Args = {
|
|
|
10
10
|
type Options = {}
|
|
11
11
|
|
|
12
12
|
export class WorkspaceUpdateApiCommand extends Command<Args, Options> {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly workspace: Workspace,
|
|
15
|
+
) {
|
|
16
|
+
super()
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
14
20
|
configuration.description('Updates Contember API version and all related packages')
|
|
15
21
|
configuration.argument('version')
|
|
@@ -17,7 +23,7 @@ export class WorkspaceUpdateApiCommand extends Command<Args, Options> {
|
|
|
17
23
|
|
|
18
24
|
protected async execute(input: Input<Args, Options>): Promise<void> {
|
|
19
25
|
const version = input.getArgument('version')
|
|
20
|
-
const workspace =
|
|
26
|
+
const workspace = this.workspace
|
|
21
27
|
const upgradablePackages = ['@contember/schema', '@contember/schema-definition', '@contember/cli']
|
|
22
28
|
|
|
23
29
|
await updateNpmPackages(upgradablePackages.map(it => ({ name: it, version })), workspace.directory)
|
package/src/run.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Application, CommandManager, getPackageVersion } from '@contember/cli-common'
|
|
2
|
+
import { Application, CommandFactoryList, CommandManager, getPackageVersion, Workspace } from '@contember/cli-common'
|
|
3
3
|
import {
|
|
4
4
|
CreateApiKeyCommand,
|
|
5
5
|
DeployCommand,
|
|
@@ -18,34 +18,32 @@ import {
|
|
|
18
18
|
SignInCommand,
|
|
19
19
|
VersionCommand,
|
|
20
20
|
WorkspaceUpdateApiCommand,
|
|
21
|
-
} from './commands'
|
|
21
|
+
} from './commands'
|
|
22
22
|
|
|
23
23
|
(async () => {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
['deploy']: () => new DeployCommand(),
|
|
24
|
+
const workspace = await Workspace.get(process.cwd())
|
|
25
|
+
const commands: CommandFactoryList = {
|
|
26
|
+
['deploy']: () => new DeployCommand(workspace),
|
|
28
27
|
['version']: () => new VersionCommand(),
|
|
29
|
-
['migrations:diff']:
|
|
30
|
-
['migrations:amend']: () => new MigrationAmendCommand(),
|
|
31
|
-
['migrations:describe']:
|
|
32
|
-
['migrations:execute']: () => new MigrationExecuteCommand(),
|
|
33
|
-
['migrations:rebase']: () => new MigrationRebaseCommand(),
|
|
34
|
-
['migrations:status']: () => new MigrationStatusCommand(),
|
|
35
|
-
['workspace:update:api']: () => new WorkspaceUpdateApiCommand(),
|
|
36
|
-
['project:
|
|
37
|
-
['project:
|
|
38
|
-
['project:
|
|
39
|
-
['
|
|
40
|
-
['tenant:
|
|
41
|
-
['tenant:
|
|
42
|
-
['tenant:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
28
|
+
['migrations:diff']: () => new MigrationDiffCommand(workspace),
|
|
29
|
+
['migrations:amend']: () => new MigrationAmendCommand(workspace),
|
|
30
|
+
['migrations:describe']: () => new MigrationDescribeCommand(workspace),
|
|
31
|
+
['migrations:execute']: () => new MigrationExecuteCommand(workspace),
|
|
32
|
+
['migrations:rebase']: () => new MigrationRebaseCommand(workspace),
|
|
33
|
+
['migrations:status']: () => new MigrationStatusCommand(workspace),
|
|
34
|
+
['workspace:update:api']: () => new WorkspaceUpdateApiCommand(workspace),
|
|
35
|
+
['project:validate']: () => new ProjectValidateCommand(workspace),
|
|
36
|
+
['project:print-schema']: () => new ProjectPrintSchemaCommand(workspace),
|
|
37
|
+
['project:generate-doc']: () => new ProjectGenerateDocumentation(workspace),
|
|
38
|
+
['tenant:sign-in']: () => new SignInCommand(workspace),
|
|
39
|
+
['tenant:create-api-key']: () => new CreateApiKeyCommand(workspace),
|
|
40
|
+
['tenant:invite']: () => new InviteCommand(workspace),
|
|
41
|
+
['tenant:reset-password']: () => new ResetPasswordCommand(workspace),
|
|
42
|
+
}
|
|
43
|
+
if (!workspace.isSingleProjectMode()) {
|
|
44
|
+
commands['project:create'] = () => new ProjectCreateCommand(workspace)
|
|
45
|
+
}
|
|
46
|
+
const commandManager = new CommandManager(commands)
|
|
49
47
|
|
|
50
48
|
const nodeVersion = process.version.match(/^v?(\d+)\..+$/)
|
|
51
49
|
if (nodeVersion && Number(nodeVersion[1]) < 12) {
|