bc-pkg 1.0.2 → 1.0.3
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/README.md +3 -2
- package/bin/bc-pkg.js +0 -70
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,8 +51,9 @@ initialized directory between local and GitHub (or to a different local path) is
|
|
|
51
51
|
a hard error, just like a repo/ref/SHA mismatch.
|
|
52
52
|
|
|
53
53
|
Notes: TypeScript local dev requires the local package to be built (its
|
|
54
|
-
`dist/`); Python local dev installs the package editable
|
|
55
|
-
`resources
|
|
54
|
+
`dist/`); Python local dev installs the package editable. Python template data
|
|
55
|
+
ships as a top-level `resources` package, which BigConfig's renderer resolves
|
|
56
|
+
through `importlib.resources`, so no `./resources` directory is created.
|
|
56
57
|
|
|
57
58
|
## What is created
|
|
58
59
|
|
package/bin/bc-pkg.js
CHANGED
|
@@ -496,75 +496,6 @@ function writeNativeManifestLocal(local, target) {
|
|
|
496
496
|
|
|
497
497
|
// --- target dependency setup and execution -------------------------------
|
|
498
498
|
|
|
499
|
-
function pythonSitePackagesDirs() {
|
|
500
|
-
const venv = path.join(process.cwd(), '.venv');
|
|
501
|
-
const candidates = [path.join(venv, 'Lib', 'site-packages')];
|
|
502
|
-
for (const libName of ['lib', 'lib64']) {
|
|
503
|
-
const libDir = path.join(venv, libName);
|
|
504
|
-
let entries = [];
|
|
505
|
-
try {
|
|
506
|
-
entries = fs.readdirSync(libDir);
|
|
507
|
-
} catch {
|
|
508
|
-
entries = [];
|
|
509
|
-
}
|
|
510
|
-
for (const e of entries.sort()) {
|
|
511
|
-
if (e.startsWith('python')) candidates.push(path.join(libDir, e, 'site-packages'));
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
const seen = new Set();
|
|
515
|
-
const result = [];
|
|
516
|
-
for (const c of candidates) {
|
|
517
|
-
if (seen.has(c)) continue;
|
|
518
|
-
seen.add(c);
|
|
519
|
-
try {
|
|
520
|
-
if (fs.statSync(c).isDirectory()) result.push(c);
|
|
521
|
-
} catch {
|
|
522
|
-
// not present
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
return result;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
// Python wheels install templates as top-level package data under
|
|
529
|
-
// site-packages/resources; BigConfig's renderer resolves them from ./resources.
|
|
530
|
-
// For editable local installs the source tree is used instead (resources live
|
|
531
|
-
// under <path>/src/resources or <path>/resources, never in site-packages).
|
|
532
|
-
function exposePythonResources(meta) {
|
|
533
|
-
const target = path.join(process.cwd(), 'resources');
|
|
534
|
-
try {
|
|
535
|
-
if (fs.statSync(target)) return;
|
|
536
|
-
} catch {
|
|
537
|
-
// not present; continue
|
|
538
|
-
}
|
|
539
|
-
try {
|
|
540
|
-
if (fs.lstatSync(target)) fs.rmSync(target, { force: true, recursive: true });
|
|
541
|
-
} catch {
|
|
542
|
-
// nothing to remove (e.g. broken symlink already gone)
|
|
543
|
-
}
|
|
544
|
-
const candidates = [];
|
|
545
|
-
if (meta && meta.local && meta.path) {
|
|
546
|
-
candidates.push(path.join(meta.path, 'src', 'resources'), path.join(meta.path, 'resources'));
|
|
547
|
-
}
|
|
548
|
-
for (const site of pythonSitePackagesDirs()) candidates.push(path.join(site, 'resources'));
|
|
549
|
-
let source = null;
|
|
550
|
-
for (const c of candidates) {
|
|
551
|
-
try {
|
|
552
|
-
if (fs.statSync(c).isDirectory()) {
|
|
553
|
-
source = c;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
} catch {
|
|
557
|
-
// not a dir
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
if (!source) return;
|
|
561
|
-
try {
|
|
562
|
-
fs.symlinkSync(source, target, 'dir');
|
|
563
|
-
} catch {
|
|
564
|
-
fs.cpSync(source, target, { recursive: true });
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
499
|
async function ensureTargetDeps(meta) {
|
|
569
500
|
if (meta.language === 'typescript') {
|
|
570
501
|
requireCommand('node', 'Install Node.js and try again.');
|
|
@@ -585,7 +516,6 @@ async function ensureTargetDeps(meta) {
|
|
|
585
516
|
const code = await runCommand('uv', ['sync']);
|
|
586
517
|
if (code !== 0) process.exit(code);
|
|
587
518
|
}
|
|
588
|
-
exposePythonResources(meta);
|
|
589
519
|
return;
|
|
590
520
|
}
|
|
591
521
|
}
|