Skip to content

Commit

Permalink
Merge pull request #1485 from boostercloud/upgrade/package-cli-and-fr…
Browse files Browse the repository at this point in the history
…amework-types
  • Loading branch information
Javier Toledo authored Oct 27, 2023
2 parents d0b97c5 + 641d023 commit 7e638f6
Show file tree
Hide file tree
Showing 40 changed files with 567 additions and 907 deletions.
793 changes: 207 additions & 586 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/cli/bin/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node

require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'))
require('@oclif/core').run()
.then(require('@oclif/core/flush'))
.catch(require('@oclif/core/handle'))
12 changes: 4 additions & 8 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
"dependencies": {
"@boostercloud/framework-core": "workspace:^1.20.0",
"@boostercloud/framework-types": "workspace:^1.20.0",
"@oclif/command": "^1.8",
"@oclif/config": "^1.18",
"@oclif/errors": "^1.3",
"@oclif/parser": "^3.8.7",
"@oclif/plugin-help": "^5.1",
"@oclif/core" : "^3.9.0",
"@oclif/plugin-help": "^5",
"chalk": "^2.4.2",
"child-process-promise": "^2.2.1",
"execa": "^2.0.3",
Expand All @@ -35,8 +32,7 @@
"devDependencies": {
"@boostercloud/eslint-config": "workspace:^1.20.0",
"@boostercloud/application-tester": "workspace:^1.20.0",
"@oclif/dev-cli": "^1.26",
"@oclif/test": "^2.1",
"@oclif/test": "^3.0.3",
"@types/chai": "4.2.18",
"@types/chai-as-promised": "7.1.4",
"@types/child-process-promise": "^2.2.1",
Expand All @@ -60,7 +56,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "3.4.0",
"faker": "5.1.0",
"fancy-test": "1.4.3",
"fancy-test": "^3.0.1",
"mocha": "10.2.0",
"nyc": "^15.1.0",
"prettier": "2.3.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/commands/add/projection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Oclif from '@oclif/command'
import { Flags } from '@oclif/core'
import BaseCommand from '../../common/base-command'
import { HasName, HasProjection, joinParsers, parseName, parseProjectionField } from '../../services/generator/target'
import { Script } from '../../common/script'
Expand All @@ -17,14 +17,14 @@ export default class Projection extends BaseCommand {
]

public static flags = {
help: Oclif.flags.help({ char: 'h' }),
'read-model': Oclif.flags.string({
help: Flags.help({ char: 'h' }),
'read-model': Flags.string({
description: 'read-model name',
required: true,
multiple: false,
dependsOn: ['entity'],
}),
entity: Oclif.flags.string({
entity: Flags.string({
description: 'an entity name',
required: true,
multiple: false,
Expand All @@ -33,7 +33,7 @@ export default class Projection extends BaseCommand {
}

public async run(): Promise<void> {
const { flags } = this.parse(Projection)
const { flags } = await this.parse(Projection)
const readModel = flags['read-model']
const entity = flags.entity

Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/commands/add/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Oclif from '@oclif/command'
import { Flags } from '@oclif/core'
import BaseCommand from '../../common/base-command'
import { HasName, HasReaction, joinParsers, parseName, parseReaction } from '../../services/generator/target'
import { Script } from '../../common/script'
Expand All @@ -17,14 +17,14 @@ export default class Reducer extends BaseCommand {
]

public static flags = {
help: Oclif.flags.help({ char: 'h' }),
entity: Oclif.flags.string({
help: Flags.help({ char: 'h' }),
entity: Flags.string({
description: 'an entity name',
required: true,
multiple: false,
dependsOn: ['event'],
}),
event: Oclif.flags.string({
event: Flags.string({
description: 'an event name',
required: true,
multiple: true,
Expand All @@ -33,7 +33,7 @@ export default class Reducer extends BaseCommand {
}

public async run(): Promise<void> {
const { flags } = this.parse(Reducer)
const { flags } = await this.parse(Reducer)
const entity = flags.entity
const events = flags.event

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flags } from '@oclif/command'
import { Flags } from '@oclif/core'
import BaseCommand from '../common/base-command'
import { compileProject } from '../services/config-service'
import { checkCurrentDirIsABoosterProject } from '../services/project-checker'
Expand All @@ -16,8 +16,8 @@ export default class Build extends BaseCommand {
public static description = 'Build the current application as configured in your `index.ts` file.'

public static flags = {
help: flags.help({ char: 'h' }),
verbose: flags.boolean({
help: Flags.help({ char: 'h' }),
verbose: Flags.boolean({
description: 'display full error messages',
default: false,
}),
Expand All @@ -30,7 +30,7 @@ export default class Build extends BaseCommand {
async catch(fullError: Error) {
const {
flags: { verbose },
} = this.parse(Build)
} = await this.parse(Build)

if (verbose) {
console.error(fullError.message)
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/commands/clean.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flags } from '@oclif/command'
import { Flags } from '@oclif/core'
import BaseCommand from '../common/base-command'
import { cleanProject } from '../services/config-service'
import { checkCurrentDirIsABoosterProject } from '../services/project-checker'
Expand All @@ -16,8 +16,8 @@ export default class Clean extends BaseCommand {
public static description = 'Clean the current application as configured in your `index.ts` file.'

public static flags = {
help: flags.help({ char: 'h' }),
verbose: flags.boolean({
help: Flags.help({ char: 'h' }),
verbose: Flags.boolean({
description: 'display full error messages',
default: false,
}),
Expand All @@ -30,7 +30,7 @@ export default class Clean extends BaseCommand {
async catch(fullError: Error) {
const {
flags: { verbose },
} = this.parse(Clean)
} = await this.parse(Clean)

if (verbose) {
console.error(fullError.message)
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flags } from '@oclif/command'
import { Flags } from '@oclif/core'
import BaseCommand from '../common/base-command'
import { deployToCloudProvider } from '../services/provider-service'
import {
Expand Down Expand Up @@ -26,19 +26,19 @@ export default class Deploy extends BaseCommand {
public static description = 'Deploy the current application as configured in your `index.ts` file.'

public static flags = {
help: flags.help({ char: 'h' }),
environment: flags.string({
help: Flags.help({ char: 'h' }),
environment: Flags.string({
char: 'e',
description: 'environment configuration to run',
}),
verbose: flags.boolean({
verbose: Flags.boolean({
description: 'display full error messages',
default: false,
}),
}

public async run(): Promise<void> {
const { flags } = this.parse(Deploy)
const { flags } = await this.parse(Deploy)

if (initializeEnvironment(logger, flags.environment)) {
const deploymentProjectPath = await createDeploymentSandbox()
Expand All @@ -49,7 +49,7 @@ export default class Deploy extends BaseCommand {
async catch(fullError: Error) {
const {
flags: { verbose },
} = this.parse(Deploy)
} = await this.parse(Deploy)

if (verbose) {
console.error(fullError.message)
Expand Down
17 changes: 10 additions & 7 deletions packages/cli/src/commands/new/command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Oclif from '@oclif/command'
import { Flags, Args } from '@oclif/core'
import BaseCommand from '../../common/base-command'
import { Script } from '../../common/script'
import Brand from '../../common/brand'
Expand All @@ -15,20 +15,23 @@ import * as path from 'path'
import { checkCurrentDirIsABoosterProject } from '../../services/project-checker'

export default class Command extends BaseCommand {
public static description = "generate new resource, write 'boost new' to see options"
public static description = "Generate new resource, write 'boost new' to see options"

public static flags = {
help: Oclif.flags.help({ char: 'h' }),
fields: Oclif.flags.string({
help: Flags.help({ char: 'h' }),
fields: Flags.string({
char: 'f',
description: 'field that this command will contain',
description: 'Field that this command will contain',
multiple: true,
}),
}

public static args = [{ name: 'commandName' }]
public static args = {
commandName: Args.string(),
}

public async run(): Promise<void> {
const { args, flags } = this.parse(Command)
const { args, flags } = await this.parse(Command)
try {
const fields = flags.fields || []
if (!args.commandName) throw "You haven't provided a command name, but it is required, run with --help for usage"
Expand Down
14 changes: 8 additions & 6 deletions packages/cli/src/commands/new/entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Oclif from '@oclif/command'
import { Flags, Args } from '@oclif/core'
import BaseCommand from '../../common/base-command'
import { Script } from '../../common/script'
import Brand from '../../common/brand'
Expand All @@ -20,23 +20,25 @@ import { classNameToFileName } from '../../common/filenames'
export default class Entity extends BaseCommand {
public static description = 'create a new entity'
public static flags = {
help: Oclif.flags.help({ char: 'h' }),
fields: Oclif.flags.string({
help: Flags.help({ char: 'h' }),
fields: Flags.string({
char: 'f',
description: 'fields that this entity will contain',
multiple: true,
}),
reduces: Oclif.flags.string({
reduces: Flags.string({
char: 'r',
description: 'events that this entity will reduce to build its state',
multiple: true,
}),
}

public static args = [{ name: 'entityName' }]
public static args = {
entityName: Args.string(),
}

public async run(): Promise<void> {
const { args, flags } = this.parse(Entity)
const { args, flags } = await this.parse(Entity)

try {
const fields = flags.fields || []
Expand Down
12 changes: 7 additions & 5 deletions packages/cli/src/commands/new/event-handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Oclif from '@oclif/command'
import { Flags, Args } from '@oclif/core'
import BaseCommand from '../../common/base-command'
import {
HasEvent,
Expand All @@ -18,18 +18,20 @@ import { classNameToFileName } from '../../common/filenames'
export default class EventHandler extends BaseCommand {
public static description = 'create a new event handler'
public static flags = {
help: Oclif.flags.help({ char: 'h' }),
event: Oclif.flags.string({
help: Flags.help({ char: 'h' }),
event: Flags.string({
char: 'e',
description: 'event that this event handler with handle',
multiple: false,
}),
}

public static args = [{ name: 'eventHandlerName' }]
public static args = {
eventHandlerName: Args.string(),
}

public async run(): Promise<void> {
const { args, flags } = this.parse(EventHandler)
const { args, flags } = await this.parse(EventHandler)

try {
const event = flags.event
Expand Down
12 changes: 7 additions & 5 deletions packages/cli/src/commands/new/event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Oclif from '@oclif/command'
import { Flags, Args } from '@oclif/core'
import BaseCommand from '../../common/base-command'
import { Script } from '../../common/script'
import Brand from '../../common/brand'
Expand All @@ -17,18 +17,20 @@ import { checkCurrentDirIsABoosterProject } from '../../services/project-checker
export default class Event extends BaseCommand {
public static description = 'create a new event'
public static flags = {
help: Oclif.flags.help({ char: 'h' }),
fields: Oclif.flags.string({
help: Flags.help({ char: 'h' }),
fields: Flags.string({
char: 'f',
description: 'field that this event will contain',
multiple: true,
}),
}

public static args = [{ name: 'eventName' }]
public static args = {
eventName: Args.string(),
}

public async run(): Promise<void> {
const { args, flags } = this.parse(Event)
const { args, flags } = await this.parse(Event)

try {
const fields = flags.fields || []
Expand Down
Loading

0 comments on commit 7e638f6

Please sign in to comment.