@xfilecom/xframe 0.1.24 → 0.1.26
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/bin/xframe.js
CHANGED
|
@@ -400,6 +400,31 @@ function patchWebTsconfigFrontCorePath(targetRoot) {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Vite 에서 @xfilecom/front-core 를 node_modules 패키지 "루트"만 alias 하면
|
|
405
|
+
* `tokens.css` 같은 서브패스가 exports 를 타지 못해 깨짐 → alias 제거 후 npm 기본 해석.
|
|
406
|
+
*/
|
|
407
|
+
function patchWebViteFrontCoreAlias(targetRoot) {
|
|
408
|
+
for (const sub of ['client', 'admin']) {
|
|
409
|
+
const p = path.join(targetRoot, 'web', sub, 'vite.config.ts');
|
|
410
|
+
if (!fs.existsSync(p)) continue;
|
|
411
|
+
let s = fs.readFileSync(p, 'utf8');
|
|
412
|
+
const orig = s;
|
|
413
|
+
s = s.replace(/\s*'@xfilecom\/front-core':\s*frontCoreSrc,\s*\r?\n/, '\n');
|
|
414
|
+
s = s.replace(
|
|
415
|
+
/\r?\n\/\*\*[\s\S]*?front-core[\s\S]*?\*\/\s*\r?\nconst frontCoreSrc = path\.resolve\([^;]+\);\s*/m,
|
|
416
|
+
'\n',
|
|
417
|
+
);
|
|
418
|
+
s = s.replace(/\r?\nconst frontCoreSrc = path\.resolve\([^;]+\);\s*/g, '\n');
|
|
419
|
+
if (s.includes('frontCoreSrc')) {
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
if (s !== orig) {
|
|
423
|
+
fs.writeFileSync(p, s, 'utf8');
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
403
428
|
function isValidNpmName(name) {
|
|
404
429
|
if (!name || typeof name !== 'string') return false;
|
|
405
430
|
if (name.length > 214) return false;
|
|
@@ -518,6 +543,7 @@ async function main() {
|
|
|
518
543
|
|
|
519
544
|
/** 템플릿은 모노레포 기준 front-core 소스를 가리키고, 생성 앱은 설치된 패키지로 바꿉니다. */
|
|
520
545
|
patchWebTsconfigFrontCorePath(targetRoot);
|
|
546
|
+
patchWebViteFrontCoreAlias(targetRoot);
|
|
521
547
|
|
|
522
548
|
console.log(`Created ${packageName} at ${targetRoot}
|
|
523
549
|
|
package/defaults.json
CHANGED
package/package.json
CHANGED
|
@@ -7,8 +7,11 @@ import react from '@vitejs/plugin-react';
|
|
|
7
7
|
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* xframe 레포 안 템플릿: …/packages/xframe/packages/front-core/src
|
|
12
|
+
* (`npx @xfilecom/xframe <dir>` 생성 시 CLI 가 front-core alias·const 를 제거 → npm exports 로 해석)
|
|
13
|
+
*/
|
|
14
|
+
const frontCoreSrc = path.resolve(__dirname, '../../../..', 'front-core', 'src');
|
|
12
15
|
|
|
13
16
|
const webSharedSrc = path.resolve(__dirname, '../shared/src');
|
|
14
17
|
|
|
@@ -7,8 +7,11 @@ import react from '@vitejs/plugin-react';
|
|
|
7
7
|
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* xframe 레포 안 템플릿: …/packages/xframe/packages/front-core/src
|
|
12
|
+
* (`npx @xfilecom/xframe <dir>` 생성 시 CLI 가 front-core alias·const 를 제거 → npm exports 로 해석)
|
|
13
|
+
*/
|
|
14
|
+
const frontCoreSrc = path.resolve(__dirname, '../../../..', 'front-core', 'src');
|
|
12
15
|
|
|
13
16
|
/** file:../shared 복사본이 아닌 워크스페이스 web/shared/src (플레이스홀더 패키지 이름과 동일 키) */
|
|
14
17
|
const webSharedSrc = path.resolve(__dirname, '../shared/src');
|