@biffo/cli 0.324.10 → 0.324.12

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
@@ -10716,6 +10716,10 @@ function malformedRegistryError(cwd, pluginSlug) {
10716
10716
  `${PLUGIN_REGISTRY_RELATIVE_PATH} in ${cwd} does not carry the managed "${REGISTRY_START_MARKER}" / "${REGISTRY_END_MARKER}" region that plugin "${pluginSlug}"'s install needs to write into. Add that managed region around the INSTALLED_PLUGINS array contents (see plugin-frontend-registry.ts's module docstring) rather than hand-editing the array.`
10717
10717
  );
10718
10718
  }
10719
+ function detectEol(source) {
10720
+ const firstLf = source.indexOf("\n");
10721
+ return firstLf > 0 && source[firstLf - 1] === "\r" ? "\r\n" : "\n";
10722
+ }
10719
10723
  function findManagedRegion(source) {
10720
10724
  const startIdx = source.indexOf(REGISTRY_START_MARKER);
10721
10725
  if (startIdx === -1) return null;
@@ -10725,7 +10729,11 @@ function findManagedRegion(source) {
10725
10729
  const lineStart = source.lastIndexOf("\n", endIdx - 1) + 1;
10726
10730
  const seam = lineStart >= bodyStart && /^[ \t]*$/.test(source.slice(lineStart, endIdx)) ? lineStart : endIdx;
10727
10731
  return {
10728
- region: { before: source.slice(0, bodyStart), after: source.slice(seam) },
10732
+ region: {
10733
+ before: source.slice(0, bodyStart),
10734
+ after: source.slice(seam),
10735
+ eol: detectEol(source)
10736
+ },
10729
10737
  body: source.slice(bodyStart, seam)
10730
10738
  };
10731
10739
  }
@@ -10771,12 +10779,8 @@ function splitEntries(body) {
10771
10779
  }
10772
10780
  return entries;
10773
10781
  }
10774
- function serializeEntryRaw(entry) {
10775
- return `
10776
- slug: ${JSON.stringify(entry.slug)},
10777
- title: ${JSON.stringify(entry.title)},
10778
- frontendUrl: ${JSON.stringify(entry.frontendUrl)},
10779
- `;
10782
+ function serializeEntryRaw(entry, eol) {
10783
+ return `${eol} slug: ${JSON.stringify(entry.slug)},${eol} title: ${JSON.stringify(entry.title)},${eol} frontendUrl: ${JSON.stringify(entry.frontendUrl)},${eol} `;
10780
10784
  }
10781
10785
  function assertPluginRegistryReady(cwd, pluginSlug) {
10782
10786
  readManagedEntries(cwd, pluginSlug);
@@ -10790,14 +10794,14 @@ function readManagedEntries(cwd, pluginSlug) {
10790
10794
  return { source, region: found.region, entries: splitEntries(found.body) };
10791
10795
  }
10792
10796
  function writeManagedEntries(cwd, region, entries) {
10793
- const body = entries.length > 0 ? "\n" + entries.map((e) => ` {${e.raw}},
10794
- `).join("") : "\n";
10797
+ const { eol } = region;
10798
+ const body = eol + entries.map((e) => ` {${e.raw}},${eol}`).join("");
10795
10799
  writeFileSync12(registryPath2(cwd), region.before + body + region.after, "utf8");
10796
10800
  }
10797
10801
  function upsertPluginRegistryEntry(cwd, entry) {
10798
10802
  const { region, entries } = readManagedEntries(cwd, entry.slug);
10799
10803
  const preserved = entries.filter((e) => e.slug !== entry.slug);
10800
- const next = { raw: serializeEntryRaw(entry), slug: entry.slug };
10804
+ const next = { raw: serializeEntryRaw(entry, region.eol), slug: entry.slug };
10801
10805
  writeManagedEntries(cwd, region, [...preserved, next]);
10802
10806
  }
10803
10807
  function removePluginRegistryEntry(cwd, pluginSlug) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.324.10",
3
+ "version": "0.324.12",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",