-
Notifications
You must be signed in to change notification settings - Fork 72
CLOUDP-352308 Fix tsc script and share build commands #3323
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
4 commits
Select commit
Hold shift + click to select a range
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,6 @@ | ||
| --- | ||
| '@lg-tools/build': patch | ||
| '@lg-tools/cli': patch | ||
| --- | ||
|
|
||
| Refactored lg and lg-build scripts to share build command registration logic, ensuring consistent options and argument handling which fixes an issue where lg-build tsc was not processing args (e.g. --verbose) correctly. Also removed the unused --direct option from the build commands/scripts. |
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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { Command } from 'commander'; | ||
|
|
||
| import { buildPackage } from './rollup/build-package'; | ||
| import { buildTSDoc } from './tsdoc/build-tsdoc'; | ||
| import { buildTypescript } from './typescript/build-ts'; | ||
|
|
||
| export function registerBundleCommand(command: Command) { | ||
| command | ||
| .description('Builds a package using Rollup') | ||
| .option('-v, --verbose', 'Enable verbose logging', false) | ||
| .action(buildPackage); | ||
| } | ||
|
|
||
| export function registerBuildTSCommand(command: Command) { | ||
| command | ||
| .description("Builds a package's TypeScript definitions") | ||
| .argument('[pass-through...]', 'Pass-through options for `tsc`') | ||
| .option('-v, --verbose', 'Enable verbose logging', false) | ||
| .option( | ||
| '-d, --downlevel', | ||
| 'Downlevel TypeScript packages based on the typesVersions field in package.json', | ||
| false, | ||
| ) | ||
| .option( | ||
| '-u, --update', | ||
| 'Update package.json typesVersions and exports fields', | ||
| false, | ||
| ) | ||
| .allowUnknownOption(true) | ||
| .action(buildTypescript); | ||
| } | ||
|
|
||
| export function registerBuildDocsCommand(command: Command) { | ||
| command | ||
| .description('Build TSDoc documentation') | ||
| .option('-v, --verbose', 'Enable verbose logging', false) | ||
| .action(buildTSDoc); | ||
| } | ||
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,43 +1,16 @@ | ||
| import { Command } from 'commander'; | ||
|
|
||
| import { buildPackage } from './rollup/build-package'; | ||
| import { buildTSDoc } from './tsdoc/build-tsdoc'; | ||
| import { buildTypescript } from './typescript/build-ts'; | ||
| import { | ||
| registerBuildDocsCommand, | ||
| registerBuildTSCommand, | ||
| registerBundleCommand, | ||
| } from './cli-commands'; | ||
|
|
||
| const build = new Command('lg-build'); | ||
| build.description('Build LeafyGreen packages'); | ||
|
|
||
| build | ||
| .command('bundle') | ||
| .description('Bundle packages with Rollup') | ||
| .option('-v, --verbose', 'Enable verbose logging', false) | ||
| .option( | ||
| '-d, --direct', | ||
| 'Build package using the lg-build rollup command directly from @lg-tools/build', | ||
| true, | ||
| ) | ||
| .action(buildPackage); | ||
|
|
||
| build | ||
| .command('tsc') | ||
| .description('Build TypeScript packages') | ||
| .option('-v, --verbose', 'Enable verbose logging', false) | ||
| .option( | ||
| '-d, --downlevel', | ||
| 'Downlevel TypeScript packages based on the typesVersions field in package.json', | ||
| false, | ||
| ) | ||
| .option( | ||
| '-u, --update', | ||
| 'Update package.json typesVersions and exports fields', | ||
| false, | ||
| ) | ||
| .action(buildTypescript); | ||
|
|
||
| build | ||
| .command('docs') | ||
| .description('Build TSDoc documentation') | ||
| .option('-v, --verbose', 'Enable verbose logging', false) | ||
| .action(buildTSDoc); | ||
| registerBundleCommand(build.command('bundle')); | ||
| registerBuildTSCommand(build.command('tsc')); | ||
| registerBuildDocsCommand(build.command('docs')); | ||
|
|
||
| build.parse(process.argv); |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍 Been wanting to do something like this for a while. It always bothered me that the cli definitions weren't collocated in the same package as the actual logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Adam for the quick feedback, glad that the change resonated with you too! 😁💐