@bakers-build/addon-workspace-git 0.8.0 → 0.8.1-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.js +9 -7
- package/dist/src/preset.d.ts +1 -1
- package/dist/src/preset.js +2 -2
- package/options.schema.json +24 -0
- package/package.json +9 -7
package/dist/src/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { pushCurrentEnv, runBranchGit, setNoAutoSetupMerge, } from './git-config
|
|
|
5
5
|
export { loadInstructions } from './instructions.js';
|
|
6
6
|
export { removeGitWorktree, type WorktreeGitExec, } from './remove-git-worktree.js';
|
|
7
7
|
/** Default branch template: `<prefix><key>-<title-slug>` (readable). */
|
|
8
|
-
export declare const DEFAULT_BRANCH_TEMPLATE = "{
|
|
8
|
+
export declare const DEFAULT_BRANCH_TEMPLATE = "{branch_prefix}{key}-{title_slug}";
|
|
9
9
|
/** Runs `git <args>` in a cwd; resolves with stdout when it has one. */
|
|
10
10
|
export type GitRunner = (args: string[], cwd: string) => Promise<string | undefined>;
|
|
11
11
|
export interface GitWorkspaceOptions {
|
|
@@ -16,8 +16,8 @@ export interface GitWorkspaceOptions {
|
|
|
16
16
|
/** Branch name prefix per ticket. Default: 'bakers/'. */
|
|
17
17
|
branchPrefix?: string;
|
|
18
18
|
/**
|
|
19
|
-
* Branch name template. Vars: {
|
|
20
|
-
* {identifier}, {
|
|
19
|
+
* Branch name template. Vars: {branch_prefix}, {key} (sanitized identifier),
|
|
20
|
+
* {identifier}, {title_slug}. Default: `{branch_prefix}{key}-{title_slug}`.
|
|
21
21
|
*/
|
|
22
22
|
branchTemplate?: string;
|
|
23
23
|
/**
|
|
@@ -46,5 +46,11 @@ export declare class GitWorkspace implements BbWorkspace {
|
|
|
46
46
|
/** Tear down the ticket worktree with git ({@link removeGitWorktree}). */
|
|
47
47
|
remove(branch: string, worktreePath?: string): Promise<WorktreeTeardown>;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
/** The addon entry's `with` value (see options.schema.json). */
|
|
50
|
+
export interface GitWorkspaceAddonOptions {
|
|
51
|
+
branch_prefix?: string;
|
|
52
|
+
branch_template?: string;
|
|
53
|
+
auto_setup_merge?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare function gitWorkspace(opts?: GitWorkspaceAddonOptions): WorkspacePlugin;
|
|
50
56
|
export default gitWorkspace;
|
package/dist/src/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export { pushCurrentEnv, runBranchGit, setNoAutoSetupMerge, } from './git-config
|
|
|
14
14
|
export { loadInstructions } from './instructions.js';
|
|
15
15
|
export { removeGitWorktree, } from './remove-git-worktree.js';
|
|
16
16
|
/** Default branch template: `<prefix><key>-<title-slug>` (readable). */
|
|
17
|
-
export const DEFAULT_BRANCH_TEMPLATE = '{
|
|
17
|
+
export const DEFAULT_BRANCH_TEMPLATE = '{branch_prefix}{key}-{title_slug}';
|
|
18
18
|
function renderBranchTemplate(template, vars) {
|
|
19
19
|
const rendered = template.replace(/\{(\w+)\}/g, (whole, key) => {
|
|
20
20
|
const value = vars[key];
|
|
@@ -53,10 +53,10 @@ export class GitWorkspace {
|
|
|
53
53
|
/** Render the branch name for a ticket from the configured template. */
|
|
54
54
|
branchFor(identifier, title) {
|
|
55
55
|
return renderBranchTemplate(this.branchTemplate, {
|
|
56
|
-
|
|
56
|
+
branch_prefix: this.branchPrefix,
|
|
57
57
|
key: this.keyFor(identifier),
|
|
58
58
|
identifier,
|
|
59
|
-
|
|
59
|
+
title_slug: slugify(title ?? ''),
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
keyFor(identifier) {
|
|
@@ -103,7 +103,7 @@ export class GitWorkspace {
|
|
|
103
103
|
}
|
|
104
104
|
export function gitWorkspace(opts = {}) {
|
|
105
105
|
return {
|
|
106
|
-
kind: '
|
|
106
|
+
kind: 'worktree',
|
|
107
107
|
id: 'git',
|
|
108
108
|
requiredModules: [],
|
|
109
109
|
async createWorkspace(config, deps) {
|
|
@@ -112,9 +112,11 @@ export function gitWorkspace(opts = {}) {
|
|
|
112
112
|
const root = await deriveCheckoutRoot(config.config_path);
|
|
113
113
|
return new GitWorkspace({
|
|
114
114
|
root,
|
|
115
|
-
...(opts.
|
|
116
|
-
...(opts.
|
|
117
|
-
|
|
115
|
+
...(opts.branch_prefix ? { branchPrefix: opts.branch_prefix } : {}),
|
|
116
|
+
...(opts.branch_template
|
|
117
|
+
? { branchTemplate: opts.branch_template }
|
|
118
|
+
: {}),
|
|
119
|
+
...(opts.auto_setup_merge ? { autoSetupMerge: true } : {}),
|
|
118
120
|
...(deps?.logger ? { logger: deps.logger } : {}),
|
|
119
121
|
});
|
|
120
122
|
},
|
package/dist/src/preset.d.ts
CHANGED
package/dist/src/preset.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gitWorkspace } from './index.js';
|
|
2
|
-
export const
|
|
2
|
+
export const worktrees = (acc, opts) => [
|
|
3
3
|
...acc,
|
|
4
4
|
gitWorkspace(opts),
|
|
5
5
|
];
|
|
6
|
-
// Conductor wiring of one project: list this addon in .bakers/
|
|
6
|
+
// Conductor wiring of one project: list this addon in .bakers/project.config.js addons[].
|
|
7
7
|
export const scopes = ['project'];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://bakers.build/schema/addon-workspace-git/options.schema.json",
|
|
4
|
+
"title": "@bakers-build/addon-workspace-git options",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"branch_prefix": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Prefix of every ticket branch.",
|
|
10
|
+
"default": "bakers/"
|
|
11
|
+
},
|
|
12
|
+
"branch_template": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Branch name template. Placeholders: {branch_prefix}, {key}, {identifier}, {title_slug}.",
|
|
15
|
+
"default": "{branch_prefix}{key}-{title_slug}"
|
|
16
|
+
},
|
|
17
|
+
"auto_setup_merge": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "`false` sets `branch.autoSetupMerge=false` in the root repository before creating a worktree, so run branches have no upstream and push with `push.default=current`; `true` leaves Git alone but does not revert an earlier change.",
|
|
20
|
+
"default": false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-workspace-git",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1-next.10",
|
|
4
4
|
"description": "bakers.build conductor workspace addon: plain git-worktree workspace + the WORKFLOW.md instruction loader.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dist/src/index.js",
|
|
9
|
-
"./preset": "./dist/src/preset.js"
|
|
9
|
+
"./preset": "./dist/src/preset.js",
|
|
10
|
+
"./options.schema.json": "./options.schema.json"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
12
|
-
"dist/src"
|
|
13
|
+
"dist/src",
|
|
14
|
+
"options.schema.json"
|
|
13
15
|
],
|
|
14
16
|
"publishConfig": {
|
|
15
17
|
"access": "public"
|
|
@@ -20,11 +22,11 @@
|
|
|
20
22
|
"directory": "bakers-cli/addons/workspace-git"
|
|
21
23
|
},
|
|
22
24
|
"peerDependencies": {
|
|
23
|
-
"@bakers-build/conductor": "^0.8.
|
|
24
|
-
"@bakers-build/core": "^0.8.
|
|
25
|
+
"@bakers-build/conductor": "^0.8.1-next.10",
|
|
26
|
+
"@bakers-build/core": "^0.8.1-next.10"
|
|
25
27
|
},
|
|
26
28
|
"bakersBuild": {
|
|
27
|
-
"commit": "
|
|
28
|
-
"channel": "
|
|
29
|
+
"commit": "ceb44a12624feaa85cb2b0c9f84345399b38bf50",
|
|
30
|
+
"channel": "next"
|
|
29
31
|
}
|
|
30
32
|
}
|