@pure-ds/core 0.5.22 → 0.5.23
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { readFile, writeFile, mkdir, access } from 'fs/promises';
|
|
3
|
+
import { readFile, writeFile, mkdir, access, rename, rm } from 'fs/promises';
|
|
4
4
|
import { existsSync } from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { spawn } from 'child_process';
|
|
@@ -546,8 +546,30 @@ async function runDevServer() {
|
|
|
546
546
|
|
|
547
547
|
async function ensurePdsAssets() {
|
|
548
548
|
const pdsAssetsDir = path.join(projectRoot, 'public', 'assets', 'pds');
|
|
549
|
+
const repoAssetsDir = path.join(projectRoot, 'assets', 'pds');
|
|
550
|
+
|
|
551
|
+
const normalizeAssetsLocation = async () => {
|
|
552
|
+
if (!existsSync(repoAssetsDir)) return;
|
|
553
|
+
|
|
554
|
+
if (!existsSync(pdsAssetsDir)) {
|
|
555
|
+
await ensureDir(path.dirname(pdsAssetsDir));
|
|
556
|
+
await rename(repoAssetsDir, pdsAssetsDir);
|
|
557
|
+
log('✅ Moved assets/pds to public/assets/pds');
|
|
558
|
+
return true;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
await rm(repoAssetsDir, { recursive: true, force: true });
|
|
562
|
+
log('🧹 Removed duplicate assets/pds folder');
|
|
563
|
+
return false;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
const movedAssets = await normalizeAssetsLocation();
|
|
567
|
+
if (movedAssets) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
|
|
549
571
|
if (existsSync(pdsAssetsDir)) {
|
|
550
|
-
log('↪️
|
|
572
|
+
log('↪️ public/assets/pds already present');
|
|
551
573
|
return;
|
|
552
574
|
}
|
|
553
575
|
|
|
@@ -566,6 +588,8 @@ async function ensurePdsAssets() {
|
|
|
566
588
|
else reject(new Error(`npm run pds:build exited with code ${code}`));
|
|
567
589
|
});
|
|
568
590
|
});
|
|
591
|
+
|
|
592
|
+
await normalizeAssetsLocation();
|
|
569
593
|
}
|
|
570
594
|
|
|
571
595
|
async function main() {
|