Skip to content

Commit

Permalink
✨ improve(patch): upgradeable community extensions (#2448)
Browse files Browse the repository at this point in the history
Allow for community extensions to be versioned independently of bud.js packages.

Extension authors can add a `bud.version` field to their `package.json`:

```json
{
  "bud": {"version": ">=6.1.0"}
}
```

If no versioning information is present or a match cannot be found, bud.js will try to install `[extension-name]@latest` when upgrading.

This upgrade logic is applied to any `dependency` or `devDependency` which starts with `bud-` or includes `/bud-` (so packages can be namespaced).

## Type of change

**PATCH: backwards compatible change**
  • Loading branch information
kellymears authored Sep 22, 2023
1 parent ee11bed commit 2558245
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 71 deletions.
4 changes: 2 additions & 2 deletions sources/@repo/markdown-kit/readme/templates/root.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Quickly scaffold a new project with `create-bud-app`:

> npx create-bud-app
If you want to add bud.js to an existing project or want to further customize the scaffolded app check out the [Getting Started guide]({{projectConfig.url.docs}}/guides/getting-started).
If you want to add bud.js to an existing project or want to further customize the scaffolded app check out the [Getting Started guide]({{projectConfig.url.docs}}/learn/getting-started).

There are [many example implementations available]({{projectConfig.url.web}}/tree/master/examples).

Expand Down Expand Up @@ -58,7 +58,7 @@ There are [many example implementations available]({{projectConfig.url.web}}/tre

Have you produced a bud.js extension and want to share it here? Please, create an issue sharing information about your project.

For more information on authoring your own extension [consult the documentation](https://bud.js.org/guides/extending/) and the source code of the extensions in this repository.
For more information on authoring your own extension [consult the documentation](https://bud.js.org/learn/extending/) and the source code of the extensions in this repository.

### Packages

Expand Down
6 changes: 6 additions & 0 deletions sources/@roots/bud-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"./patch-console": "./lib/patch-console/index.js",
"./pretty-format": "./lib/pretty-format/index.js",
"./remark-loader": "./lib/remark-loader/index.cjs",
"./semver": "./lib/semver/index.js",
"./strip-ansi": "./lib/strip-ansi/index.js",
"./style-loader": "./lib/style-loader/index.cjs",
"./toml": "./lib/toml/index.js",
Expand Down Expand Up @@ -248,6 +249,9 @@
"remark-loader": [
"./lib/remark-loader/index.d.ts"
],
"semver": [
"./lib/semver/index.d.ts"
],
"strip-ansi": [
"./lib/strip-ansi/index.d.ts"
],
Expand Down Expand Up @@ -298,6 +302,7 @@
"@types/minimist": "1.2.2",
"@types/node-notifier": "8.0.2",
"@types/react": "18.2.22",
"@types/semver": "7.5.0",
"@types/signale": "1.4.4",
"@types/webpack-manifest-plugin": "3.0.5"
},
Expand Down Expand Up @@ -349,6 +354,7 @@
"remark": "15.0.1",
"remark-html": "15.0.2",
"remark-loader": "5.0.0",
"semver": "7.5.4",
"signale": "1.4.0",
"strip-ansi": "7.1.0",
"style-loader": "3.3.3",
Expand Down
1 change: 1 addition & 0 deletions sources/@roots/bud-support/src/semver/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from 'semver'
6 changes: 0 additions & 6 deletions sources/@roots/bud/src/cli/commands/build/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BudCommand from '@roots/bud/cli/commands'
import ci from '@roots/bud/cli/flags/ci'
import clean from '@roots/bud/cli/flags/clean'
import dashboard from '@roots/bud/cli/flags/dashboard'
import dashboardAssets from '@roots/bud/cli/flags/dashboard.assets'
import dashboardCompact from '@roots/bud/cli/flags/dashboard.compact'
Expand All @@ -24,7 +23,6 @@ import runtime from '@roots/bud/cli/flags/runtime'
import silent from '@roots/bud/cli/flags/silent'
import splitChunks from '@roots/bud/cli/flags/splitChunks'
import storage from '@roots/bud/cli/flags/storage'
import verbose from '@roots/bud/cli/flags/verbose'
import isBoolean from '@roots/bud-support/lodash/isBoolean'

/**
Expand Down Expand Up @@ -65,8 +63,6 @@ export default class BudBuildCommand extends BudCommand {

public ci = ci

public clean = clean

public devtool = devtool

public discover = discover
Expand Down Expand Up @@ -101,8 +97,6 @@ export default class BudBuildCommand extends BudCommand {

public override storage = storage

public override verbose = verbose

/**
* {@link BudCommand.execute}
*/
Expand Down
6 changes: 5 additions & 1 deletion sources/@roots/bud/src/cli/commands/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {env, exit} from 'node:process'

import basedir from '@roots/bud/cli/flags/basedir'
import cache from '@roots/bud/cli/flags/cache'
import clean from '@roots/bud/cli/flags/clean'
import color from '@roots/bud/cli/flags/color'
import debug from '@roots/bud/cli/flags/debug'
import dry from '@roots/bud/cli/flags/dry'
Expand Down Expand Up @@ -88,12 +89,15 @@ export default class BudCommand extends Command<BaseContext & Context> {
</Static>,
).unmount()
}

public basedir = basedir

public declare bud?: Bud | undefined

public cache = cache

public clean = clean

public color = color

public debug = debug
Expand All @@ -116,7 +120,7 @@ export default class BudCommand extends Command<BaseContext & Context> {

public use = use

public verbose: typeof verbose = false
public verbose = verbose

/**
* Execute arbitrary sh command with inherited stdio
Expand Down
Loading

0 comments on commit 2558245

Please sign in to comment.