diff --git a/sources/@repo/docs/content/docs/bud.serve.mdx b/sources/@repo/docs/content/docs/bud.serve.mdx index f93d0a1d36..18b5f35b67 100644 --- a/sources/@repo/docs/content/docs/bud.serve.mdx +++ b/sources/@repo/docs/content/docs/bud.serve.mdx @@ -10,7 +10,7 @@ Configure the development server. ## Server information -By default bud will serve at the following address: +By default bud.js will serve at the following address: | Property | Value | | -------- | --------- | @@ -48,7 +48,8 @@ bud.serve(new URL('http://example.test:3000')) Serve over `https`: ```ts title='bud.config.js' -bud.serve('https://example.test', { +bud.serve({ + host: new URL('example.test'), cert: '/path/to/example.test.crt', key: '/path/to/example.test.key', }) diff --git a/sources/@repo/docs/content/guides/general-use/config-layers.mdx b/sources/@repo/docs/content/guides/general-use/config-layers.mdx index 7275bf2e67..326e840b38 100644 --- a/sources/@repo/docs/content/guides/general-use/config-layers.mdx +++ b/sources/@repo/docs/content/guides/general-use/config-layers.mdx @@ -4,6 +4,8 @@ description: Utilize multiple configuration files to manage different environmen sidebar_label: Layered configurations --- +## Configuration files + It is possible to create more than one bud configuration file. Each configuration file is applied in the following order: @@ -11,3 +13,53 @@ in the following order: 2. `bud.config.local` - the local configuration. always applied. 3. `bud.config.${mode}` - the mode-specific configuration. applied if the mode matches. 4. `bud.config.${mode}.local` - the mode-specific local configuration. applied if the mode matches. + +## .env values + +The following `.env` will be applied to your build automatically, if present: + +- `APP_BASE_PATH` - the base path for your app +- `APP_PUBLIC_PATH` - the public path for your app +- `APP_SRC_PATH` - the `@src` path for your app +- `APP_DIST_PATH` - the `@dist` path for your app +- `APP_STORAGE_PATH` - the `@storage` path for your app +- `APP_MODE` - desired build mode + +## `package.json` values + +You may also use the `bud` key in `package.json` to modify certain base values: + +```json5 +{ + "bud": { + "paths": { + "base": string, + "src": string, + "dist": string, + "storage": string + }, + "publicPath": string, + "extensions": { + "allowlist": string[], + "denylist": string[], + "discovery": boolean + } + } +} +``` + +## CLI arguments and flags + +The CLI has many flags for configuring your build. Check the [CLI documentation](/guides/cli) for more information. + +## Order of application + +The following is the order in which bud will apply configuration values: + +1. `.env` values +2. `package.json` values +3. all config files +4. CLI arguments and flags + +So, your `bud.config.mjs` will override any values set in `package.json` or `.env`. Likewise, the CLI arguments will override +any values set in the config. diff --git a/sources/@repo/docs/content/guides/general-use/development-server.mdx b/sources/@repo/docs/content/guides/general-use/development-server.mdx index 943fa60a0c..2fd0d6c633 100644 --- a/sources/@repo/docs/content/guides/general-use/development-server.mdx +++ b/sources/@repo/docs/content/guides/general-use/development-server.mdx @@ -41,7 +41,8 @@ The development server can be [configured to use SSL](/docs/bud.serve#ssl). ```js title='bud.config.mjs' export default async bud => { - bud.serve(new URL(`https://example.test`), { + bud.serve({ + url: new URL(`https://example.test`) cert: `/path/to/example.test.crt`, key: `/path/to/example.test.key`, }) diff --git a/sources/@repo/docs/content/guides/general-use/multi-instance.mdx b/sources/@repo/docs/content/guides/general-use/multi-instance.mdx index b9466951b6..306c157701 100644 --- a/sources/@repo/docs/content/guides/general-use/multi-instance.mdx +++ b/sources/@repo/docs/content/guides/general-use/multi-instance.mdx @@ -82,7 +82,7 @@ $ yarn bud build --target theme --target plugin By default, all extensions will be applied to all compilers in the project. -You can use the `--no-inject` flag to prevent any extensions from being registered (except for core extensions). +You can use the `--no-discovery` flag to prevent any extensions from being registered (except for core extensions). In that case you will need to manually register the extensions you want to use per compiler: diff --git a/sources/@repo/docs/content/releases/6.5.1.mdx b/sources/@repo/docs/content/releases/6.5.1.mdx new file mode 100644 index 0000000000..826ddacc0d --- /dev/null +++ b/sources/@repo/docs/content/releases/6.5.1.mdx @@ -0,0 +1,90 @@ +--- +slug: 6.5.1 +title: 6.5.1 +description: Release notes for bud.js 6.5.1 +date: 2022-10-18 +author: Kelly Mears +author_title: Lead developer +author_url: https://github.com/kellymears +author_image_url: https://avatars.githubusercontent.com/u/397606?v=4 +tags: [release, 6.5] +--- + +Small fixes and improvements related to `argv`, `package.json` and `.env` settings. + + + +## 🩹 Fix: `argv` parsing + +These flags were janky but now they are golden: + +- `--devtool` - Set desired devtool +- `--clean` - Enable or disable build cleaning +- `--discovery` - Enable or disable automatic extension registration +- `--flush` - Clean webpack cache + +This release also adds a `--runtime` flag, which is new. It doesn't accept everything `bud.runtime` does, but you can use it to specify basic options like `single` or `multiple`. + +## ✨ Improve: `env` context + +You can now set certain values in your `.env`: + +- `APP_BASE_PATH` - the base path for your app +- `APP_PUBLIC_PATH` - the public path for your app +- `APP_SRC_PATH` - the `@src` path for your app +- `APP_DIST_PATH` - the `@dist` path for your app +- `APP_STORAGE_PATH` - the `@storage` path for your app +- `APP_MODE` - desired build mode + +## ✨ Improve: `package.json` context + +The options available under the `bud` key in `package.json` have been expanded: + +```json5 +{ + "bud": { + "paths": { + "base": string, + "src": string, + "dist": string, + "storage": string + }, + "publicPath": string, + "extensions": { + "allowlist": string[], + "denylist": string[], + "discovery": boolean + } + } +} +``` + +If you are using `bud.allowlist` or `bud.denylist`, please update to `bud.extensions.allowlist` and `bud.extensions.denylist`. You'll get a warning in your terminal for now; in a future release this will cause an error. + +## 🩹 Fix: SSL proxy rewrites and documentation + +The implementation and documentation for the `bud.serve` function had fallen out-of-sync. The `bud.serve` documentation and development server configuration guides are now up-to-date. + +Additionally, path rewrites for proxied URLs served over SSL were defaulting to `0.0.0.0` for `hostname`. This has been fixed. + +Example of the config which served as a test case for this release: + +```typescript +.proxy("https://ssl-test.test") +.serve({ + host: "ssl-test.test", + cert: `${process.env.HOME}/.config/valet/Certificates/ssl-test.test.crt`, + key: `${process.env.HOME}/.config/valet/Certificates/ssl-test.test.key`, +}) +``` + +To apply the hostname fix to earlier versions of bud you will need to apply the rewrite in your config: + +```typescript +// This is no longer necessary in 6.5.1 +bud.proxy('https://ssl-test.test', [['0.0.0.0', 'ssl-test.test']]) +``` + +## ℹ️ Release information + +For more information [review the diff to see what's changed](https://github.com/roots/bud/compare/v6.5.0...v6.5.1). diff --git a/sources/@repo/docs/src/components/cli-output/build.development.help.md b/sources/@repo/docs/src/components/cli-output/build.development.help.md index e34f308974..d7935e829d 100644 --- a/sources/@repo/docs/src/components/cli-output/build.development.help.md +++ b/sources/@repo/docs/src/components/cli-output/build.development.help.md @@ -8,6 +8,7 @@ $ bud build development --input,-i,--@src,--src #0 Source directory (relative to project) --output,-o,--@dist,--dist #0 Distribution directory (relative to project) + --discovery Automatically register extensions --notify Enable notfication center messages --cache Utilize compiler's filesystem cache --ci Simple build summaries for CI @@ -23,6 +24,7 @@ $ bud build development --manifest Generate a manifest of compiled assets --minimize Minimize compiled assets --publicPath #0 public path of emitted assets + --runtime #0 Set runtime chunk --splitChunks,--vendor Separate vendor bundle --storage #0 Storage directory (relative to project) --browser Open browser on successful development build. diff --git a/sources/@repo/docs/src/components/cli-output/build.help.md b/sources/@repo/docs/src/components/cli-output/build.help.md index 131457db6f..a4278d5d17 100644 --- a/sources/@repo/docs/src/components/cli-output/build.help.md +++ b/sources/@repo/docs/src/components/cli-output/build.help.md @@ -8,6 +8,7 @@ $ bud build --input,-i,--@src,--src #0 Source directory (relative to project) --output,-o,--@dist,--dist #0 Distribution directory (relative to project) + --discovery Automatically register extensions --notify Enable notfication center messages --cache Utilize compiler's filesystem cache --ci Simple build summaries for CI @@ -23,6 +24,7 @@ $ bud build --manifest Generate a manifest of compiled assets --minimize Minimize compiled assets --publicPath #0 public path of emitted assets + --runtime #0 Set runtime chunk --splitChunks,--vendor Separate vendor bundle --storage #0 Storage directory (relative to project) diff --git a/sources/@repo/docs/src/components/cli-output/build.production.help.md b/sources/@repo/docs/src/components/cli-output/build.production.help.md index 8eb69d0404..a6843216a9 100644 --- a/sources/@repo/docs/src/components/cli-output/build.production.help.md +++ b/sources/@repo/docs/src/components/cli-output/build.production.help.md @@ -8,6 +8,7 @@ $ bud build production --input,-i,--@src,--src #0 Source directory (relative to project) --output,-o,--@dist,--dist #0 Distribution directory (relative to project) + --discovery Automatically register extensions --notify Enable notfication center messages --cache Utilize compiler's filesystem cache --ci Simple build summaries for CI @@ -23,6 +24,7 @@ $ bud build production --manifest Generate a manifest of compiled assets --minimize Minimize compiled assets --publicPath #0 public path of emitted assets + --runtime #0 Set runtime chunk --splitChunks,--vendor Separate vendor bundle --storage #0 Storage directory (relative to project) diff --git a/sources/@repo/docs/src/components/cli-output/dev.help.md b/sources/@repo/docs/src/components/cli-output/dev.help.md index e34f308974..d7935e829d 100644 --- a/sources/@repo/docs/src/components/cli-output/dev.help.md +++ b/sources/@repo/docs/src/components/cli-output/dev.help.md @@ -8,6 +8,7 @@ $ bud build development --input,-i,--@src,--src #0 Source directory (relative to project) --output,-o,--@dist,--dist #0 Distribution directory (relative to project) + --discovery Automatically register extensions --notify Enable notfication center messages --cache Utilize compiler's filesystem cache --ci Simple build summaries for CI @@ -23,6 +24,7 @@ $ bud build development --manifest Generate a manifest of compiled assets --minimize Minimize compiled assets --publicPath #0 public path of emitted assets + --runtime #0 Set runtime chunk --splitChunks,--vendor Separate vendor bundle --storage #0 Storage directory (relative to project) --browser Open browser on successful development build. diff --git a/sources/@repo/docs/src/components/cli-output/help.md b/sources/@repo/docs/src/components/cli-output/help.md index 9ef7150389..024108605a 100644 --- a/sources/@repo/docs/src/components/cli-output/help.md +++ b/sources/@repo/docs/src/components/cli-output/help.md @@ -15,13 +15,13 @@ ━━━ build ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - bud build [--input,-i,--@src,--src #0] [--output,-o,--@dist,--dist #0] [--notify] [--cache] [--ci] [--clean] [--debug] [--devtool #0] [--editor] [--esm] [--flush] [--hash] [--html] [--immutable] [--manifest] [--minimize] [--publicPath #0] [--splitChunks,--vendor] [--storage #0] + bud build [--input,-i,--@src,--src #0] [--output,-o,--@dist,--dist #0] [--discovery] [--notify] [--cache] [--ci] [--clean] [--debug] [--devtool #0] [--editor] [--esm] [--flush] [--hash] [--html] [--immutable] [--manifest] [--minimize] [--publicPath #0] [--runtime #0] [--splitChunks,--vendor] [--storage #0] Compile source assets - bud build development [--input,-i,--@src,--src #0] [--output,-o,--@dist,--dist #0] [--notify] [--cache] [--ci] [--clean] [--debug] [--devtool #0] [--editor] [--esm] [--flush] [--hash] [--html] [--immutable] [--manifest] [--minimize] [--publicPath #0] [--splitChunks,--vendor] [--storage #0] [--browser] [--indicator] [--overlay] [--reload] + bud build development [--input,-i,--@src,--src #0] [--output,-o,--@dist,--dist #0] [--discovery] [--notify] [--cache] [--ci] [--clean] [--debug] [--devtool #0] [--editor] [--esm] [--flush] [--hash] [--html] [--immutable] [--manifest] [--minimize] [--publicPath #0] [--runtime #0] [--splitChunks,--vendor] [--storage #0] [--browser] [--indicator] [--overlay] [--reload] Compiles source assets in `development` mode. - bud build production [--input,-i,--@src,--src #0] [--output,-o,--@dist,--dist #0] [--notify] [--cache] [--ci] [--clean] [--debug] [--devtool #0] [--editor] [--esm] [--flush] [--hash] [--html] [--immutable] [--manifest] [--minimize] [--publicPath #0] [--splitChunks,--vendor] [--storage #0] + bud build production [--input,-i,--@src,--src #0] [--output,-o,--@dist,--dist #0] [--discovery] [--notify] [--cache] [--ci] [--clean] [--debug] [--devtool #0] [--editor] [--esm] [--flush] [--hash] [--html] [--immutable] [--manifest] [--minimize] [--publicPath #0] [--runtime #0] [--splitChunks,--vendor] [--storage #0] Compiles source assets in `production` mode. ━━━ tasks ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/sources/@roots/bud-api/src/methods/serve/index.ts b/sources/@roots/bud-api/src/methods/serve/index.ts index 1db4adf104..1d675d7140 100644 --- a/sources/@roots/bud-api/src/methods/serve/index.ts +++ b/sources/@roots/bud-api/src/methods/serve/index.ts @@ -4,7 +4,7 @@ import type Http from 'node:https' import type {Bud} from '@roots/bud-framework' import {isEmpty, isNumber, isString} from '@roots/bud-support/lodash-es' import {externalNetworkInterface} from '@roots/bud-support/os' -import getPort, {Options as GetPortOptions} from 'get-port' +import getPort from 'get-port' /** * Specification object @@ -12,12 +12,6 @@ import getPort, {Options as GetPortOptions} from 'get-port' * @public */ export interface Specification { - /** - * A preferred port or anArray of preferred ports to use. - * @public - */ - port?: number | Array - /** * Use ssl connection * @public @@ -30,12 +24,24 @@ export interface Specification { */ exclude?: number | Array + /** + * Server URL + * @public + */ + url?: string | URL + /** * Hostname * @public */ host?: string + /** + * port + * @public + */ + port?: number | Array + /** * SSL certificate (path) * @public @@ -55,12 +61,6 @@ export interface Specification { options?: Https.ServerOptions | Http.ServerOptions } -/** - * Permissable options - * @public - */ -export type Options = Specification | number | Array | URL | string - /** * bud.serve * @public @@ -92,7 +92,7 @@ export type facade = Serve * @public */ export const method: Serve = async function ( - input: Options, + input: Specification | URL | string | number | Array, ): Promise { const app = this as Bud @@ -103,16 +103,17 @@ export const method: Serve = async function ( new URL(`http://${externalNetworkInterface.ipv4}:3000`), ) - app.log(`current dev url`, current) + app.log(`current dev url:`, current) if (Array.isArray(input) || isNumber(input)) { app.log(`serve input is an array or number`, input) - const port = await requestPort(app, current, input) + const port = await requestPorts(app, portOrPortsToNumbers(input)) app.log(`port`, port, `is available. assigning.`) + current.port = port - app.log(`dev url set to`, current) + app.log(`dev url set to:`, current) app.hooks.on(`dev.url`, current) return app @@ -120,16 +121,13 @@ export const method: Serve = async function ( if (input instanceof URL || isString(input)) { app.log(`input is a URL or a string`, input) - const url = input instanceof URL ? input : new URL(input) + const url = input instanceof URL ? input : new URL(input) app.log(`parsed as url:`, url) - const requestedPort = (url.port ?? current.port ?? `:3000`).replace( - `:`, - ``, - ) + const requestedPort = url.port ?? current.port ?? `3000` - url.port = await requestPort(app, url, Number(requestedPort)) + url.port = await requestPorts(app, portOrPortsToNumbers(requestedPort)) app.log(`port`, url.port, `is available. assigning.`) app.hooks.on(`dev.url`, url) @@ -138,7 +136,7 @@ export const method: Serve = async function ( return app } - await assignSpec(app, current, input) + await assignSpec.bind(app)(input, current) return app } @@ -147,50 +145,67 @@ export const method: Serve = async function ( * Process specification object * @public */ -const assignSpec = async (app: Bud, url: URL, spec: Specification) => { +const assignSpec = async function (spec: Specification, url: URL) { const options: Partial = {} - if ([spec.ssl, spec.cert, spec.key].filter(Boolean).length > 0) { + if (spec.url) + url = spec.url instanceof URL ? spec.url : new URL(spec.url) + + if ([spec.ssl, spec.cert, spec.key].some(Boolean)) { url.protocol = `https:` } - if (spec.cert) options.cert = await app.fs.read(spec.cert) - if (spec.key) options.key = await app.fs.read(spec.key) - - if (spec.port) { - url.port = await requestPort(app, url, Number(spec.port)) + if (spec.host) { + if ( + [spec.host.startsWith(`http:`), spec.host.startsWith(`https:`)].some( + Boolean, + ) + ) + url = new URL(spec.host) + else url.hostname = spec.host } - if (spec.host) url.hostname = spec.host + if (spec.port) + url.port = await requestPorts(this, portOrPortsToNumbers(spec.port)) + + this.hooks.on(`dev.url`, url) - !isEmpty(options) && app.hooks.on(`dev.options`, options) - app.hooks.on(`dev.url`, url) + if (spec.cert) options.cert = await this.fs.read(spec.cert) + if (spec.key) options.key = await this.fs.read(spec.key) + if (!isEmpty(options)) this.hooks.on(`dev.options`, options) } /** - * Process Node URL + * Get a free port + * * @public */ -const requestPort = async ( +const requestPorts = async ( app: Bud, - url: URL, - request: number | Array, - exclude: number | Array = [], + port: Array, + exclude: Array = [], ) => { - const opts: GetPortOptions & { - port: Array - exclude: Array - } = { - port: Array.isArray(request) ? request : [request], - exclude: Array.isArray(exclude) ? exclude : [exclude], - } + const request = {port, exclude} - url.port = await getPort(opts).then(p => `${p}`) + const freePort = await getPort(request).then(p => `${p}`) - if (!opts.port?.includes(Number(url.port))) { + if (!request.port?.includes(Number(freePort))) { app.warn(`None of the requested ports could be resolved.`) - app.warn(`A port was automatically selected: ${url.port}`) + app.warn(`A port was automatically selected: ${freePort}`) } - return url.port + return freePort +} + +/** + * Convert a string, number, or array of strings or numbers + * to an array of portOrPortsToNumbers + * + * @public + */ +const portOrPortsToNumbers = ( + port: number | string | Array, +): Array => { + if (Array.isArray(port)) return port.map(port => Number(port)) + return [Number(port)] } diff --git a/sources/@roots/bud-extensions/src/service.ts b/sources/@roots/bud-extensions/src/service.ts index 3230fc7ca2..7393529c55 100644 --- a/sources/@roots/bud-extensions/src/service.ts +++ b/sources/@roots/bud-extensions/src/service.ts @@ -40,6 +40,37 @@ export default class Extensions extends Service { - */ public unresolvable: Set = new Set() + /** + * `register` callback + * + * @remarks + * All this is doing is helping transition people to using `bud.extensions` key for + * `allowList` and `denyList`. It can be removed in a future release. + * βΈΊ 2022-10-18 + * + * @public + */ + public async register(): Promise { + if (this.app.context.manifest?.bud?.allowlist) { + this.app.context.manifest.bud.extensions = { + ...(this.app.context.manifest.bud.extensions ?? {}), + allowlist: this.app.context.manifest.bud.allowlist, + } + this.logger.warn( + `package.json: bud.allowlist is deprecated. Use bud.extensions.allowlist instead.`, + ) + } + if (this.app.context.manifest?.bud?.denylist) { + this.app.context.manifest.bud.extensions = { + ...(this.app.context.manifest.bud.extensions ?? {}), + denylist: this.app.context.manifest.bud.denylist, + } + this.logger.warn( + `package.json: bud.denylist is deprecated. Use bud.extensions.denylist instead.`, + ) + } + } + /** * `booted` callback * @@ -48,7 +79,11 @@ export default class Extensions extends Service { */ @bind public async booted(): Promise { - if (this.app.context.args.discovery === false) return + if ( + this.app.context.args.discovery === false || + this.app.context.manifest?.bud?.extensions?.discovery + ) + return await Promise.all( this.app.context.extensions .filter(Boolean) @@ -157,10 +192,14 @@ export default class Extensions extends Service { @bind public isAllowed(signifier: string) { return ( - (!this.app.context.manifest?.bud?.denylist || - !this.app.context.manifest.bud.denylist.includes(signifier)) && - (!this.app.context.manifest?.bud?.allowlist || - this.app.context.manifest.bud.allowlist.includes(signifier)) + (!this.app.context.manifest?.bud?.extensions?.denylist || + !this.app.context.manifest.bud?.extensions?.denylist.includes( + signifier, + )) && + (!this.app.context.manifest?.bud?.extensions?.allowlist || + this.app.context.manifest.bud?.extensions?.allowlist.includes( + signifier, + )) ) } diff --git a/sources/@roots/bud-framework/src/types/registry/flags.ts b/sources/@roots/bud-framework/src/types/registry/flags.ts index e94b601b4e..69be49bb67 100644 --- a/sources/@roots/bud-framework/src/types/registry/flags.ts +++ b/sources/@roots/bud-framework/src/types/registry/flags.ts @@ -20,13 +20,6 @@ export interface Flags { */ html: boolean - /** - * Automatically register installed extensions - * - * @public - */ - inject: boolean - /** * Log build status informatino to the terminal * diff --git a/sources/@roots/bud/src/cli/commands/base.tsx b/sources/@roots/bud/src/cli/commands/base.tsx index 5870c229a4..34feff233f 100644 --- a/sources/@roots/bud/src/cli/commands/base.tsx +++ b/sources/@roots/bud/src/cli/commands/base.tsx @@ -91,7 +91,7 @@ export default abstract class BaseCommand extends Command { }) /** - * --inject + * --discovery * @public */ public discovery = Option.Boolean(`--discovery`, true, { @@ -152,6 +152,7 @@ export default abstract class BaseCommand extends Command { public get baseArgs() { return { basedir: this.basedir, + discovery: this.discovery, input: this.input, output: this.output, dry: this.dry, diff --git a/sources/@roots/bud/src/cli/commands/build.base.tsx b/sources/@roots/bud/src/cli/commands/build.base.tsx index f8bc7560ab..ca31e5f96d 100644 --- a/sources/@roots/bud/src/cli/commands/build.base.tsx +++ b/sources/@roots/bud/src/cli/commands/build.base.tsx @@ -97,6 +97,7 @@ export default class BuildCommand extends BaseCommand { /** * --clean + * @public */ public clean = Option.Boolean(`--clean`, undefined, { description: `Clean artifacts and distributables prior to compilation`, @@ -104,6 +105,7 @@ export default class BuildCommand extends BaseCommand { /** * --debug + * @public */ public debug = Option.Boolean(`--debug`, undefined, { description: `Write debug files to storage directory`, @@ -111,6 +113,7 @@ export default class BuildCommand extends BaseCommand { /** * --devtool + * @public */ public devtool = Option.String(`--devtool`, undefined, { description: `Set devtool option`, @@ -146,6 +149,7 @@ export default class BuildCommand extends BaseCommand { /** * --notify + * @public */ public editor = Option.Boolean(`--editor`, undefined, { description: `Open editor to file containing errors on unsuccessful development build`, @@ -153,6 +157,7 @@ export default class BuildCommand extends BaseCommand { /** * --esm + * @public */ public esm = Option.Boolean(`--esm`, undefined, { description: `build as es modules`, @@ -160,6 +165,7 @@ export default class BuildCommand extends BaseCommand { /** * --flush + * @public */ public flush = Option.Boolean(`--flush`, undefined, { description: `Force clearing bud internal cache`, @@ -167,6 +173,7 @@ export default class BuildCommand extends BaseCommand { /** * --hash + * @public */ public hash = Option.Boolean(`--hash`, undefined, { description: `Hash compiled filenames`, @@ -174,6 +181,7 @@ export default class BuildCommand extends BaseCommand { /** * --html + * @public */ public html = Option.String(`--html`, undefined, { description: `Generate an html template`, @@ -182,21 +190,23 @@ export default class BuildCommand extends BaseCommand { /** * --immutable + * @public */ public immutable = Option.Boolean(`--immutable`, undefined, { description: `bud.http: immutable module lockfile`, }) /** - * --inject + * --discovery + * @public */ - public inject = Option.Boolean(`--inject`, undefined, { - description: `Automatically inject extensions`, - hidden: true, + public discovery = Option.Boolean(`--discovery`, undefined, { + description: `Automatically register extensions`, }) /** * --manifest + * @public */ public manifest = Option.Boolean(`--manifest`, undefined, { description: `Generate a manifest of compiled assets`, @@ -204,6 +214,7 @@ export default class BuildCommand extends BaseCommand { /** * --minimize + * @public */ public minimize = Option.Boolean(`--minimize`, undefined, { description: `Minimize compiled assets`, @@ -211,12 +222,17 @@ export default class BuildCommand extends BaseCommand { /** * --publicPath + * @public */ public publicPath = Option.String(`--publicPath`, undefined, { description: `public path of emitted assets`, env: `APP_PUBLIC_PATH`, }) + /** + * --runtime + * @public + */ public runtime: `single` | `multiple` | boolean = Option.String( `--runtime`, undefined, @@ -232,6 +248,7 @@ export default class BuildCommand extends BaseCommand { /** * --splitChunks + * @public */ public splitChunks = Option.Boolean( `--splitChunks,--vendor`, @@ -243,6 +260,7 @@ export default class BuildCommand extends BaseCommand { /** * --storage + * @public */ public storage = Option.String(`--storage`, undefined, { description: `Storage directory (relative to project)`, @@ -298,6 +316,11 @@ export default class BuildCommand extends BaseCommand { await this.app.run() } + /** + * Apply context from .env + * + * @public + */ @bind public async applyEnv() { if (this.app.env.isString(`APP_MODE`)) { @@ -347,6 +370,7 @@ export default class BuildCommand extends BaseCommand { `location.@dist`, this.app.env.get(`APP_DIST_PATH`), ) + this.app.success( `dist path set to`, this.app.env.get(`APP_DIST_PATH`), @@ -367,6 +391,11 @@ export default class BuildCommand extends BaseCommand { } } + /** + * Apply context from `package.json` + * + * @public + */ @bind public async applyManifestOptions() { if (isset(this.app.context.manifest?.bud?.paths?.[`base`])) { @@ -392,12 +421,6 @@ export default class BuildCommand extends BaseCommand { this.app.context.manifest.bud.paths[`dist`], ) - if (isset(this.app.context.manifest?.bud?.extensions?.inject)) - this.app.hooks.on( - `feature.inject`, - this.app.context.manifest.bud.extensions.inject, - ) - if (isset(this.app.context.manifest?.bud?.paths?.[`storage`])) this.app.hooks.on( `location.@storage`, @@ -406,7 +429,7 @@ export default class BuildCommand extends BaseCommand { } /** - * Apply arguments + * Apply context from argv * * @public */ @@ -445,9 +468,6 @@ export default class BuildCommand extends BaseCommand { if (isset(this.app.context.args.minimize)) await this.app.api.call(`minimize`, this.app.context.args.minimize) - if (isset(this.app.context.args.html)) - await this.app.api.call(`template`) - if (isset(this.app.context.args.devtool)) await this.app.api.call(`devtool`, this.app.context.args.devtool) diff --git a/storage/package.json b/storage/package.json index 00a7d7552e..acd3997d45 100644 --- a/storage/package.json +++ b/storage/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "pm2": "^5.2.0", + "pm2": "^5.2.2", "verdaccio": "^5.15.4" } } diff --git a/tests/util/project/package.json b/tests/util/project/package.json index db8c1e1c88..c994892cda 100644 --- a/tests/util/project/package.json +++ b/tests/util/project/package.json @@ -5,10 +5,12 @@ "extends @roots/browserslist-config/current" ], "bud": { - "denylist": [ - "@roots/bud-esbuild", - "@roots/bud-swc" - ] + "extensions": { + "denylist": [ + "@roots/bud-esbuild", + "@roots/bud-swc" + ] + } }, "devDependencies": { "@roots/bud": "workspace:sources/@roots/bud",