Skip to content
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

improve: @roots/bud-typescript configurability #1062

Merged
merged 4 commits into from Jan 31, 2022

Conversation

kellymears
Copy link
Member

Overview

Moves loader options to extension options store

options: {
transpileOnly: true,
},

options: app =>
app.extensions.get('@roots/bud-typescript').options.all(),

Improves bud.typecheck options

/**
* fork-ts-webpack-plugin options callback
*
* @remarks
* Passed the registered fork-ts-checker-webpack-plugin options
* It is expected to return replacement options.
*
* @public
*/
interface OptionsMutator {
(
options: Container<ForkTsCheckerWebpackPluginOptions>,
): ForkTsCheckerWebpackPluginOptions
}
type Options = OptionsMutator | ForkTsCheckerWebpackPluginOptions | boolean
export interface typecheck {
(this: Framework, options?: Options): Promise<Framework>
}
export interface facade {
(this: Framework, options?: Options): Framework
}

Improves default fork-ts-webpack-plugin options

Explicitly resolving ts gives us a better degree of confidence that ts will be found. But there are other improvements.

/**
* Configuration to use when bud.mode is `production`.
*/
export const PRODUCTION_OPTIONS: OptionsFactory = (app: Framework) => ({
async: false,
logger: {
infrastructure: app.logger.instance,
issues: app.logger.instance,
},
typescript: {
useTypescriptIncrementalApi: true,
memoryLimit: 4096,
typescriptPath: require.resolve('typescript'),
diagnosticOptions: {
semantic: true,
syntactic: true,
},
},
})
/**
* options to use when bud.mode is `development`.
*/
export const DEVELOPMENT_OPTIONS = (app: Framework) => ({
async: false,
logger: {
infrastructure: app.logger.instance,
issues: app.logger.instance,
},
typescript: {
useTypescriptIncrementalApi: true,
typescriptPath: require.resolve('typescript'),
diagnosticOptions: {
semantic: true,
syntactic: true,
},
},
})

generally improves typings and api docblocks
The biggest improvement here is intellisense for bud.typecheck.

refers: none
closes: none

Type of change

  • NONE: does not change the API

This PR includes breaking changes to the following core packages:

  • none

This PR includes breaking changes to the follow extensions:

  • none

Proposed changes

  • forthcoming

Dependency changes

  • none

Todo

  • covered by unit and/or integration tests
  • include documentation updates
  • featured in the changelog

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Jan 31, 2022
@kellymears kellymears merged commit 92a376a into main Jan 31, 2022
@kellymears kellymears deleted the improve-bud-typescript-2 branch January 31, 2022 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file @roots/bud-typescript @roots/sage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant