-
Notifications
You must be signed in to change notification settings - Fork 1
CLI: Refactor build and authenticate commands #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b4d14be
Cli: Refactor build and authenticate commands
alavarello 3cfe3e7
Improve types
alavarello fa9010e
Improve descriptions
alavarello b028655
Improve compile output description
alavarello 56ba32a
Fix generic flags
alavarello 5cd88cc
Fix lint
alavarello d9e4f29
Fix test command
alavarello 43af418
Fix integrations
alavarello 27d5eee
Fix test
alavarello 7868770
Fix PR comments
alavarello b060ce9
Rename full into abs
alavarello ac7b8d1
Add changeset
alavarello cc87f1a
Fix exit
alavarello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@mimicprotocol/cli": patch | ||
| "@mimicprotocol/lib-ts": patch | ||
| "@mimicprotocol/test-ts": patch | ||
| --- | ||
|
|
||
| Refactor codegen, compile, build, deploy and test commands and their parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,31 @@ | ||
| import { Command, Flags } from '@oclif/core' | ||
| import { Command } from '@oclif/core' | ||
|
|
||
| import { FlagsType } from '../types' | ||
|
|
||
| import Codegen from './codegen' | ||
| import Compile from './compile' | ||
|
|
||
| export type BuildFlags = FlagsType<typeof Build> | ||
|
|
||
| export default class Build extends Command { | ||
| static override description = 'Runs code generation and then compiles the function' | ||
|
|
||
| static override examples = [ | ||
| '<%= config.bin %> <%= command.id %> --manifest ./manifest.yaml --function src/function.ts --output ./build --types ./src/types', | ||
| '<%= config.bin %> <%= command.id %> --manifest ./manifest.yaml --function src/function.ts --build-directory ./build --types-directory ./src/types', | ||
| ] | ||
|
|
||
| static override flags = { | ||
| manifest: Flags.string({ char: 'm', description: 'manifest to use', default: 'manifest.yaml' }), | ||
| function: Flags.string({ char: 'f', description: 'function to compile', default: 'src/function.ts' }), | ||
| output: Flags.string({ char: 'o', description: 'output directory for build artifacts', default: './build' }), | ||
| types: Flags.string({ char: 'y', description: 'output directory for generated types', default: './src/types' }), | ||
| clean: Flags.boolean({ | ||
| char: 'c', | ||
| description: 'remove existing generated types before generating new files', | ||
| default: false, | ||
| }), | ||
| ...Codegen.flags, | ||
| ...Compile.flags, | ||
| } | ||
|
|
||
| public async run(): Promise<void> { | ||
| const { flags } = await this.parse(Build) | ||
| const { manifest, function: functionFile, output, types, clean } = flags | ||
|
|
||
| const codegenArgs: string[] = ['--manifest', manifest, '--output', types] | ||
| if (clean) codegenArgs.push('--clean') | ||
|
|
||
| await Codegen.run(codegenArgs) | ||
| await Build.build(this, flags) | ||
| } | ||
|
|
||
| const compileArgs: string[] = ['--function', functionFile, '--manifest', manifest, '--output', output] | ||
| await Compile.run(compileArgs) | ||
| public static async build(cmd: Command, flags: BuildFlags): Promise<void> { | ||
| await Codegen.codegen(cmd, flags) | ||
| await Compile.compile(cmd, flags) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.