@biffo/cli 0.324.12 → 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.
- package/dist/index.js +32 -0
- package/package.json +1 -1
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
|
);
|