@biffo/cli 0.324.11 → 0.324.13
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.
|
@@ -99,7 +99,9 @@ loudly (ADR-0005 §4) rather than silently re-applying or silently skipping. A
|
|
|
99
99
|
later change to your baseline data ships as a new, additively-numbered file —
|
|
100
100
|
see `db/seed/000_default_widget.sql`'s own header comment for the full
|
|
101
101
|
contract and the `INSERT ... SELECT ... WHERE NOT EXISTS` shape every file
|
|
102
|
-
here must follow.
|
|
102
|
+
here must follow. Every seed file also opens with `SET search_path TO public;` (after its
|
|
103
|
+
banner comment) — the instance's DDL guard requires it, and your tables and
|
|
104
|
+
`users` live in `public`.
|
|
103
105
|
|
|
104
106
|
This is a second, complementary mechanism to the one below — not a
|
|
105
107
|
replacement for it. `seed_default_widget()` in `plugin.py` still demonstrates
|
|
@@ -29,6 +29,15 @@
|
|
|
29
29
|
-- known tenant in a single statement, from the instance's own deploy step.
|
|
30
30
|
-- Both are legitimate; which one to use for YOUR plugin is exactly the
|
|
31
31
|
-- question BiffoPluginBase's class docstring answers.
|
|
32
|
+
--
|
|
33
|
+
-- SET search_path: the instance's DDL guard (test_ddl_import_conventions.py,
|
|
34
|
+
-- biffo-template#1338) requires every module to open with one, so its bare
|
|
35
|
+
-- names resolve the same however the chain is applied. This seed's table and
|
|
36
|
+
-- `users` both live in `public` (created by Alembic, not by a per-import
|
|
37
|
+
-- schema), and the guard resolves a vendored `_plugin-<name>/` directory to
|
|
38
|
+
-- `public` — do not change this to the directory name (biffo-template#2132).
|
|
39
|
+
SET search_path TO public;
|
|
40
|
+
|
|
32
41
|
INSERT INTO example_widgets (id, tenant_id, name, description, is_active, created_at, updated_at)
|
|
33
42
|
SELECT
|
|
34
43
|
gen_random_uuid()::text,
|
package/dist/index.js
CHANGED
|
@@ -9787,6 +9787,30 @@ function findInstalledPlugins(cwd) {
|
|
|
9787
9787
|
].sort((a, b) => a.relDir.localeCompare(b.relDir));
|
|
9788
9788
|
}
|
|
9789
9789
|
|
|
9790
|
+
// src/lib/plugin-import-sort.ts
|
|
9791
|
+
async function sortScaffoldedImports(destDir, pythonFiles) {
|
|
9792
|
+
if (pythonFiles.length === 0) return;
|
|
9793
|
+
const manual = `Run \`uvx ruff check --select I --fix ${destDir}\` before committing.`;
|
|
9794
|
+
try {
|
|
9795
|
+
await execa(
|
|
9796
|
+
"uvx",
|
|
9797
|
+
["ruff", "check", "--select", "I", "--fix", "--no-cache", "--quiet", ...pythonFiles],
|
|
9798
|
+
{
|
|
9799
|
+
cwd: destDir
|
|
9800
|
+
}
|
|
9801
|
+
);
|
|
9802
|
+
} catch (err) {
|
|
9803
|
+
const cause = err;
|
|
9804
|
+
if (cause.code === "ENOENT") {
|
|
9805
|
+
log.warn(`\`uv\` is not on PATH, so the scaffold's imports were not re-sorted. ${manual}`);
|
|
9806
|
+
return;
|
|
9807
|
+
}
|
|
9808
|
+
throw new Error(
|
|
9809
|
+
`Failed to sort the scaffold's imports (ruff isort pass): ${cause.stderr?.trim() || err.message}. ${manual}`
|
|
9810
|
+
);
|
|
9811
|
+
}
|
|
9812
|
+
}
|
|
9813
|
+
|
|
9790
9814
|
// src/lib/plugin-workspace-sources.ts
|
|
9791
9815
|
import { existsSync as existsSync31, readdirSync as readdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
9792
9816
|
import { join as join32 } from "path";
|
|
@@ -10219,6 +10243,10 @@ async function runPluginCreate(name, options, deps) {
|
|
|
10219
10243
|
const { files, skipped } = scaffoldPlugin(skeletonRoot, destDir, names);
|
|
10220
10244
|
restorePackagedDotfiles(destDir);
|
|
10221
10245
|
log.success(`Scaffolded ${files.length} file(s) into ${relDir}/`);
|
|
10246
|
+
await sortScaffoldedImports(
|
|
10247
|
+
destDir,
|
|
10248
|
+
files.filter((f) => f.endsWith(".py")).map((f) => join34(destDir, f))
|
|
10249
|
+
);
|
|
10222
10250
|
for (const { entry, reason } of skipped) {
|
|
10223
10251
|
log.info(`Skipped ${entry} \u2014 ${reason}`);
|
|
10224
10252
|
}
|
|
@@ -10264,6 +10292,10 @@ async function runStandaloneCreate(names, options, deps) {
|
|
|
10264
10292
|
const { files } = scaffoldPlugin(skeletonRoot, destDir, names, { layout: "standalone" });
|
|
10265
10293
|
restorePackagedDotfiles(destDir);
|
|
10266
10294
|
log.success(`Scaffolded ${String(files.length)} file(s) into ${names.dist}/`);
|
|
10295
|
+
await sortScaffoldedImports(
|
|
10296
|
+
destDir,
|
|
10297
|
+
files.filter((f) => f.endsWith(".py")).map((f) => join34(destDir, f))
|
|
10298
|
+
);
|
|
10267
10299
|
const manifest = validateManifest(
|
|
10268
10300
|
JSON.parse(readFileSync23(join34(destDir, "biffo.plugin.json"), "utf8"))
|
|
10269
10301
|
);
|