@biffo/cli 0.167.1 → 0.168.1
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.
|
@@ -75,22 +75,24 @@ jobs:
|
|
|
75
75
|
token: ${{ secrets.REGISTRY_PUBLISH_TOKEN }}
|
|
76
76
|
path: registry
|
|
77
77
|
|
|
78
|
+
# astral-sh/setup-uv, NOT actions/setup-python. The latter fetches a
|
|
79
|
+
# prebuilt interpreter from actions/python-versions, which has no build
|
|
80
|
+
# matching the self-hosted runner fleet's OS — every run failed with
|
|
81
|
+
# "The version '3.13' ... was not found for this operating system". uv
|
|
82
|
+
# installs the interpreter itself, which is how this repo's own ci.yml
|
|
83
|
+
# gets 3.13 on the same runners.
|
|
78
84
|
- name: Set up Python
|
|
79
85
|
if: steps.token.outputs.present == 'true'
|
|
80
|
-
uses:
|
|
86
|
+
uses: astral-sh/setup-uv@v6
|
|
81
87
|
with:
|
|
82
88
|
python-version: '3.13'
|
|
83
89
|
|
|
84
|
-
- name: Install jsonschema
|
|
85
|
-
if: steps.token.outputs.present == 'true'
|
|
86
|
-
run: pip install jsonschema
|
|
87
|
-
|
|
88
90
|
- name: Upsert this plugin's entry
|
|
89
91
|
if: steps.token.outputs.present == 'true'
|
|
90
92
|
working-directory: registry
|
|
91
93
|
run: |
|
|
92
94
|
set -euo pipefail
|
|
93
|
-
python3 scripts/upsert_plugin.py \
|
|
95
|
+
uv run --with jsonschema python3 scripts/upsert_plugin.py \
|
|
94
96
|
--manifest "../plugin/biffo.plugin.json" \
|
|
95
97
|
--repo "${{ github.server_url }}/${{ github.repository }}"
|
|
96
98
|
|
|
@@ -103,8 +105,8 @@ jobs:
|
|
|
103
105
|
echo "Registry entry already current — nothing to publish."
|
|
104
106
|
exit 0
|
|
105
107
|
fi
|
|
106
|
-
version="$(python3 -c "import json;print(json.load(open('../plugin/biffo.plugin.json'))['version'])")"
|
|
107
|
-
name="$(python3 -c "import json;print(json.load(open('../plugin/biffo.plugin.json'))['name'])")"
|
|
108
|
+
version="$(uv run python3 -c "import json;print(json.load(open('../plugin/biffo.plugin.json'))['version'])")"
|
|
109
|
+
name="$(uv run python3 -c "import json;print(json.load(open('../plugin/biffo.plugin.json'))['name'])")"
|
|
108
110
|
git config user.name "github-actions[bot]"
|
|
109
111
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
110
112
|
git add plugins.json
|
package/dist/index.js
CHANGED
|
@@ -6519,12 +6519,26 @@ async function promptForConfig(awsAccountId, awsRegion, awsProfile) {
|
|
|
6519
6519
|
import { Command as Command20 } from "commander";
|
|
6520
6520
|
|
|
6521
6521
|
// src/commands/plugin-create.ts
|
|
6522
|
-
import { existsSync as existsSync23, readFileSync as readFileSync17 } from "fs";
|
|
6522
|
+
import { existsSync as existsSync23, readFileSync as readFileSync17, writeFileSync as writeFileSync9 } from "fs";
|
|
6523
6523
|
import { dirname as dirname8, join as join23, resolve as resolve11 } from "path";
|
|
6524
6524
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
6525
6525
|
import chalk13 from "chalk";
|
|
6526
6526
|
import { Command as Command13 } from "commander";
|
|
6527
6527
|
|
|
6528
|
+
// src/lib/registry-sources.ts
|
|
6529
|
+
function manifestUrlFor(repoUrl, branch = "dev") {
|
|
6530
|
+
const slug = repoUrl.replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
|
|
6531
|
+
return `https://raw.githubusercontent.com/${slug}/${branch}/biffo.plugin.json`;
|
|
6532
|
+
}
|
|
6533
|
+
function addSource(file, source) {
|
|
6534
|
+
if (file.sources.some((s) => s.name === source.name)) return null;
|
|
6535
|
+
return { ...file, sources: [...file.sources, source] };
|
|
6536
|
+
}
|
|
6537
|
+
function serialiseSources(file) {
|
|
6538
|
+
return `${JSON.stringify(file, null, 2)}
|
|
6539
|
+
`;
|
|
6540
|
+
}
|
|
6541
|
+
|
|
6528
6542
|
// src/lib/workflow-check-contexts.ts
|
|
6529
6543
|
function unquote(value) {
|
|
6530
6544
|
const trimmed = value.trim();
|
|
@@ -6933,7 +6947,7 @@ var pluginCreateCommand = new Command13("create").description("Scaffold a new pl
|
|
|
6933
6947
|
).option(
|
|
6934
6948
|
"--runner-label <label>",
|
|
6935
6949
|
"With --org, the RUNNER_LABEL the new repo\u2019s CI should run on (defaults to mirroring this checkout\u2019s)"
|
|
6936
|
-
).option(
|
|
6950
|
+
).option("--no-register", "With --org, skip adding the plugin to the registry\u2019s sources.json").option(
|
|
6937
6951
|
"--skeleton <path>",
|
|
6938
6952
|
"Path to the plugin skeleton (defaults to _skeletons/plugin-template)"
|
|
6939
6953
|
).option("--dry-run", "Print planned changes without modifying the repo").option("--no-commit", "Scaffold the files but leave them uncommitted").option("--cwd <path>", "Project root to scaffold into (defaults to the current directory)").action(
|
|
@@ -6947,6 +6961,7 @@ var pluginCreateCommand = new Command13("create").description("Scaffold a new pl
|
|
|
6947
6961
|
standalone: options.standalone ?? false,
|
|
6948
6962
|
...options.org ? { org: options.org } : {},
|
|
6949
6963
|
...options.runnerLabel ? { runnerLabel: options.runnerLabel } : {},
|
|
6964
|
+
register: options.register !== false,
|
|
6950
6965
|
...options.skeleton ? { skeletonRoot: resolve11(options.skeleton) } : {},
|
|
6951
6966
|
dryRun: options.dryRun ?? false,
|
|
6952
6967
|
commit: options.commit !== false,
|
|
@@ -7101,8 +7116,41 @@ async function createAndPushStandaloneRepo(org, names, destDir, options, deps) {
|
|
|
7101
7116
|
} else {
|
|
7102
7117
|
await github.protectSingleBranch(org, names.dist, "dev", contexts);
|
|
7103
7118
|
}
|
|
7119
|
+
if (options.register !== false) {
|
|
7120
|
+
await registerInRegistrySources(names, cloneUrl, token, deps);
|
|
7121
|
+
}
|
|
7104
7122
|
printStandaloneRemoteNextSteps(names, org);
|
|
7105
7123
|
}
|
|
7124
|
+
var REGISTRY_REPO = "https://github.com/keiranholloway/biffo-plugins-registry";
|
|
7125
|
+
async function registerInRegistrySources(names, cloneUrl, token, deps) {
|
|
7126
|
+
let dir;
|
|
7127
|
+
try {
|
|
7128
|
+
dir = await deps.git.cloneForEditing(REGISTRY_REPO, "biffo-registry", token);
|
|
7129
|
+
const path = join23(dir, "sources.json");
|
|
7130
|
+
const file = JSON.parse(readFileSync17(path, "utf8"));
|
|
7131
|
+
const next = addSource(file, {
|
|
7132
|
+
name: names.slug,
|
|
7133
|
+
repo: cloneUrl.replace(/\.git$/, ""),
|
|
7134
|
+
manifest: manifestUrlFor(cloneUrl),
|
|
7135
|
+
tags: []
|
|
7136
|
+
});
|
|
7137
|
+
if (next === null) {
|
|
7138
|
+
log.info(`${names.slug} is already listed in the registry's sources.json`);
|
|
7139
|
+
return;
|
|
7140
|
+
}
|
|
7141
|
+
writeFileSync9(path, serialiseSources(next));
|
|
7142
|
+
await deps.git.add(dir, ["sources.json"]);
|
|
7143
|
+
await deps.git.commit(dir, `feat(registry): track ${names.slug} in sources.json`);
|
|
7144
|
+
await deps.git.push(dir, "main", { token });
|
|
7145
|
+
log.success(`Registered ${names.slug} in the plugin registry's sources.json`);
|
|
7146
|
+
} catch (err) {
|
|
7147
|
+
log.warn(
|
|
7148
|
+
`Could not add ${names.slug} to the registry's sources.json: ${err.message}. Until it is listed there (or REGISTRY_PUBLISH_TOKEN is set on the new repo), the plugin will not appear in the portal's plugin store.`
|
|
7149
|
+
);
|
|
7150
|
+
} finally {
|
|
7151
|
+
if (dir !== void 0) deps.git.cleanup(dir);
|
|
7152
|
+
}
|
|
7153
|
+
}
|
|
7106
7154
|
async function propagateRunnerLabel(org, repo, options, deps, github) {
|
|
7107
7155
|
try {
|
|
7108
7156
|
let label = options.runnerLabel?.trim();
|
|
@@ -7411,7 +7459,7 @@ var PluginMigrationsAdapter = class {
|
|
|
7411
7459
|
};
|
|
7412
7460
|
|
|
7413
7461
|
// src/lib/plugin-workspace-sources.ts
|
|
7414
|
-
import { existsSync as existsSync24, readdirSync as readdirSync12, readFileSync as readFileSync18, writeFileSync as
|
|
7462
|
+
import { existsSync as existsSync24, readdirSync as readdirSync12, readFileSync as readFileSync18, writeFileSync as writeFileSync10 } from "fs";
|
|
7415
7463
|
import { join as join25 } from "path";
|
|
7416
7464
|
function readTomlStringArray(text, key) {
|
|
7417
7465
|
const open = new RegExp(`^${key}\\s*=\\s*\\[`, "m").exec(text);
|
|
@@ -7515,7 +7563,7 @@ ${lines.join("\n")}${text.slice(insertAt)}`;
|
|
|
7515
7563
|
${lines.join("\n")}
|
|
7516
7564
|
`;
|
|
7517
7565
|
}
|
|
7518
|
-
|
|
7566
|
+
writeFileSync10(pluginPyprojectPath, updated);
|
|
7519
7567
|
return toAdd;
|
|
7520
7568
|
}
|
|
7521
7569
|
|