-
Notifications
You must be signed in to change notification settings - Fork 65
feat: add @containerbase/base package with the supported tool list
#7435
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
11 commits
Select commit
Hold shift + click to select a range
a876c09
feat: add `@containerbase/base` package with the supported tool list
viceice 1ca665a
Merge remote-tracking branch 'origin/main' into feat/supported-tools-…
viceice 9004bd0
feat: mark root only tools in the tool list
viceice e576cec
fix: reject unknown tool metadata keys in the zod schemas
viceice 144d419
Merge remote-tracking branch 'origin/main' into feat/supported-tools-…
viceice 0d03998
test: keep the zod schemas and the zod free types in sync
viceice 2631b10
docs(base): limit the compatibility rule to the same major version
viceice 7a0e788
docs(tools): document the generated file writer
viceice 03e10e8
docs: clarify the version comparison and fix the wording
viceice 53b17ae
Merge remote-tracking branch 'origin/main' into feat/supported-tools-…
viceice 04bbad4
fix: list no v2 tools when their folder is missing
viceice 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
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 |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ node_modules/ | |
| /bin/ | ||
| /tmp/ | ||
| /dist/ | ||
| /packages/*/dist/ | ||
| /coverage | ||
| /html/ | ||
|
|
||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # `@containerbase/base` | ||
|
|
||
| Metadata about the tools that [Containerbase](https://github.com/containerbase/base) supports. | ||
|
|
||
| The data is generated from the Containerbase sources and released with the same version as Containerbase itself. | ||
| This allows a consumer of this library to determine which tools can be used with a given version of Containerbase (via `/usr/local/containerbase/version`): if the image has the same major version as this package and a version greater than or equal to the package version, every tool listed here can be installed in that image. | ||
| A new major version may remove tools, so compare against the package of the image's major version. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```ts | ||
| import { toolNames, tools, type ToolName } from '@containerbase/base'; | ||
|
|
||
| tools.composer; // { parent: 'php' } | ||
| tools.kas; // { type: 'pip', parent: 'python' } | ||
|
|
||
| function install(tool: ToolName): void { | ||
| // `ToolName` is a union of all supported names | ||
| } | ||
| ``` | ||
|
|
||
| The raw data and its json schema are also exported, for consumers which don't use TypeScript: | ||
|
|
||
| ```ts | ||
| import tools from '@containerbase/base/tools.json' with { type: 'json' }; | ||
| ``` | ||
|
|
||
| The zod schemas live behind a separate entry point, so the default export stays dependency free: | ||
|
|
||
| ```ts | ||
| import { SupportedTools, ToolName } from '@containerbase/base/zod'; | ||
| ``` | ||
|
|
||
| ## Contents | ||
|
|
||
| Each entry may carry the following metadata: | ||
|
|
||
| | Field | Description | | ||
| | ------------ | --------------------------------------------------------------------------------------------------------------- | | ||
| | `type` | the installer used for the tool, one of `gem`, `npm` or `pip` | | ||
| | `parent` | the tool it depends on, eg. `composer` depends on `php`, which requires `php` to be installed before `composer` | | ||
| | `deprecated` | the tool should not be used any more | | ||
| | `root` | the tool can only be installed as root, so at image build time | | ||
|
|
||
| Only the names `install-tool` accepts are listed. | ||
| Packages installed with an arbitrary name via `install-gem`, `install-npm` or `install-pip` are not, as that list is unbounded. | ||
|
|
||
| ## Development | ||
|
|
||
| The files in `data/` and `src/data.ts` are generated, run `pnpm tools` in the repository root to update them. |
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,81 @@ | ||
| { | ||
| "tools": { | ||
| "android-sdk-cmdline-tools": { "parent": "java" }, | ||
| "apko": {}, | ||
| "apm": {}, | ||
| "bazelisk": {}, | ||
| "bower": { "type": "npm", "parent": "node", "deprecated": true }, | ||
| "buf": {}, | ||
| "buildx": { "parent": "docker" }, | ||
| "bun": {}, | ||
| "bundler": { "type": "gem", "parent": "ruby" }, | ||
| "cabal": {}, | ||
| "checkov": { "type": "pip", "parent": "python" }, | ||
| "cocoapods": { "parent": "ruby" }, | ||
| "composer": { "parent": "php" }, | ||
| "conan": { "parent": "python" }, | ||
| "copier": { "type": "pip", "parent": "python" }, | ||
| "corepack": { "type": "npm", "parent": "node" }, | ||
| "dart": {}, | ||
| "deno": {}, | ||
| "devbox": {}, | ||
| "docker": {}, | ||
| "docker-compose": { "parent": "docker" }, | ||
| "dotnet": {}, | ||
| "elixir": { "parent": "erlang" }, | ||
| "erlang": {}, | ||
| "flutter": {}, | ||
| "flux": {}, | ||
| "gh": {}, | ||
| "ghc": {}, | ||
| "git": { "root": true }, | ||
| "git-lfs": { "parent": "git" }, | ||
| "gleam": {}, | ||
| "golang": {}, | ||
| "gradle": { "parent": "java" }, | ||
| "hashin": { "type": "pip", "parent": "python" }, | ||
| "helm": {}, | ||
| "helmfile": {}, | ||
| "java": {}, | ||
| "java-jdk": {}, | ||
| "java-jre": {}, | ||
| "jb": {}, | ||
| "kas": { "type": "pip", "parent": "python" }, | ||
| "kubectl": {}, | ||
| "kustomize": {}, | ||
| "lerna": { "type": "npm", "parent": "node", "deprecated": true }, | ||
| "maven": { "parent": "java" }, | ||
| "mise": {}, | ||
| "mono": {}, | ||
| "nix": {}, | ||
| "node": {}, | ||
| "npm": { "type": "npm", "parent": "node" }, | ||
| "nuget": { "parent": "mono" }, | ||
| "paket": { "parent": "dotnet" }, | ||
| "pdm": { "type": "pip", "parent": "python" }, | ||
| "php": {}, | ||
| "pip-tools": { "type": "pip", "parent": "python" }, | ||
| "pipenv": { "type": "pip", "parent": "python" }, | ||
| "pixi": {}, | ||
| "pnpm": { "type": "npm", "parent": "node" }, | ||
| "poetry": { "type": "pip", "parent": "python" }, | ||
| "powershell": {}, | ||
| "protoc": {}, | ||
| "python": {}, | ||
| "renovate": { "parent": "node" }, | ||
| "ruby": {}, | ||
| "rust": {}, | ||
| "sbt": { "parent": "java" }, | ||
| "scala": { "parent": "java" }, | ||
| "skopeo": {}, | ||
| "sops": {}, | ||
| "swift": {}, | ||
| "terraform": {}, | ||
| "tofu": {}, | ||
| "uv": { "type": "pip", "parent": "python" }, | ||
| "vendir": {}, | ||
| "wally": {}, | ||
| "yarn": { "parent": "node" }, | ||
| "yarn-slim": { "parent": "node" } | ||
| } | ||
| } |
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 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "object", | ||
| "properties": { | ||
| "tools": { | ||
| "type": "object", | ||
| "propertyNames": { "type": "string" }, | ||
| "additionalProperties": { | ||
| "type": "object", | ||
| "properties": { | ||
| "type": { | ||
| "type": "string", | ||
| "enum": ["gem", "npm", "pip"], | ||
| "description": "the installer used for this tool, only set for dynamically installed tools" | ||
| }, | ||
| "parent": { | ||
| "type": "string", | ||
| "description": "the tool this tool depends on, eg. composer depends on php" | ||
| }, | ||
| "deprecated": { | ||
| "type": "boolean", | ||
| "const": true, | ||
| "description": "deprecated tools should not be used any more" | ||
| }, | ||
| "root": { | ||
| "type": "boolean", | ||
| "const": true, | ||
| "description": "the tool can only be installed as root, so only at image build time" | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
| }, | ||
| "description": "all supported tools, keyed by tool name" | ||
| } | ||
| }, | ||
| "required": ["tools"], | ||
| "additionalProperties": false | ||
| } |
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,48 @@ | ||
| { | ||
| "name": "@containerbase/base", | ||
| "version": "0.0.0-semantic-release", | ||
| "description": "Metadata about the tools supported by containerbase", | ||
| "keywords": [ | ||
| "containerbase", | ||
| "tools" | ||
| ], | ||
| "homepage": "https://github.com/containerbase/base#readme", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/containerbase/base.git", | ||
| "directory": "packages/base" | ||
| }, | ||
| "license": "MIT", | ||
| "type": "module", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| }, | ||
| "./zod": { | ||
| "types": "./dist/zod.d.ts", | ||
| "default": "./dist/zod.js" | ||
| }, | ||
| "./tools.json": "./data/tools.json", | ||
| "./tools.schema.json": "./data/tools.schema.json" | ||
| }, | ||
| "files": [ | ||
| "data", | ||
| "dist" | ||
| ], | ||
| "devDependencies": { | ||
| "zod": "4.6.5" | ||
| }, | ||
| "peerDependencies": { | ||
| "zod": "^4.0.0" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "zod": { | ||
| "optional": true | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "provenance": true | ||
| } | ||
| } |
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,85 @@ | ||
| // generated by `pnpm tools`, do not edit | ||
| import type { ToolMetadata } from './types.ts'; | ||
|
|
||
| /** | ||
| * All tools `install-tool` supports, sorted by name. | ||
| */ | ||
| export const tools = { | ||
| 'android-sdk-cmdline-tools': { parent: 'java' }, | ||
| apko: {}, | ||
| apm: {}, | ||
| bazelisk: {}, | ||
| bower: { type: 'npm', parent: 'node', deprecated: true }, | ||
| buf: {}, | ||
| buildx: { parent: 'docker' }, | ||
| bun: {}, | ||
| bundler: { type: 'gem', parent: 'ruby' }, | ||
| cabal: {}, | ||
| checkov: { type: 'pip', parent: 'python' }, | ||
| cocoapods: { parent: 'ruby' }, | ||
| composer: { parent: 'php' }, | ||
| conan: { parent: 'python' }, | ||
| copier: { type: 'pip', parent: 'python' }, | ||
| corepack: { type: 'npm', parent: 'node' }, | ||
| dart: {}, | ||
| deno: {}, | ||
| devbox: {}, | ||
| docker: {}, | ||
| 'docker-compose': { parent: 'docker' }, | ||
| dotnet: {}, | ||
| elixir: { parent: 'erlang' }, | ||
| erlang: {}, | ||
| flutter: {}, | ||
| flux: {}, | ||
| gh: {}, | ||
| ghc: {}, | ||
| git: { root: true }, | ||
|
viceice marked this conversation as resolved.
|
||
| 'git-lfs': { parent: 'git' }, | ||
| gleam: {}, | ||
| golang: {}, | ||
| gradle: { parent: 'java' }, | ||
| hashin: { type: 'pip', parent: 'python' }, | ||
| helm: {}, | ||
| helmfile: {}, | ||
| java: {}, | ||
| 'java-jdk': {}, | ||
| 'java-jre': {}, | ||
| jb: {}, | ||
| kas: { type: 'pip', parent: 'python' }, | ||
| kubectl: {}, | ||
| kustomize: {}, | ||
| lerna: { type: 'npm', parent: 'node', deprecated: true }, | ||
| maven: { parent: 'java' }, | ||
| mise: {}, | ||
| mono: {}, | ||
| nix: {}, | ||
| node: {}, | ||
| npm: { type: 'npm', parent: 'node' }, | ||
| nuget: { parent: 'mono' }, | ||
| paket: { parent: 'dotnet' }, | ||
| pdm: { type: 'pip', parent: 'python' }, | ||
| php: {}, | ||
| 'pip-tools': { type: 'pip', parent: 'python' }, | ||
| pipenv: { type: 'pip', parent: 'python' }, | ||
| pixi: {}, | ||
| pnpm: { type: 'npm', parent: 'node' }, | ||
| poetry: { type: 'pip', parent: 'python' }, | ||
| powershell: {}, | ||
| protoc: {}, | ||
| python: {}, | ||
| renovate: { parent: 'node' }, | ||
| ruby: {}, | ||
| rust: {}, | ||
| sbt: { parent: 'java' }, | ||
| scala: { parent: 'java' }, | ||
| skopeo: {}, | ||
| sops: {}, | ||
| swift: {}, | ||
| terraform: {}, | ||
| tofu: {}, | ||
| uv: { type: 'pip', parent: 'python' }, | ||
| vendir: {}, | ||
| wally: {}, | ||
| yarn: { parent: 'node' }, | ||
| 'yarn-slim': { parent: 'node' }, | ||
| } as const satisfies Record<string, ToolMetadata>; | ||
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,14 @@ | ||
| import { tools } from './data.ts'; | ||
|
|
||
| export { tools } from './data.ts'; | ||
| export type { InstallToolType, ToolMetadata } from './types.ts'; | ||
|
|
||
| /** | ||
| * A tool name `install-tool` accepts. | ||
| */ | ||
| export type ToolName = keyof typeof tools; | ||
|
|
||
| /** | ||
| * All supported tool names, sorted alphabetically. | ||
| */ | ||
| export const toolNames = Object.keys(tools) as ToolName[]; |
Oops, something went wrong.
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.