@onexapis/cli 1.1.3 → 1.1.5
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/cli.js +201 -192
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +200 -191
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +157 -148
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +156 -147
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import chalk4 from 'chalk';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import * as esbuild from 'esbuild';
|
|
5
|
-
import
|
|
5
|
+
import path8 from 'path';
|
|
6
6
|
import fs7 from 'fs/promises';
|
|
7
7
|
import crypto from 'crypto';
|
|
8
8
|
import { glob } from 'glob';
|
|
@@ -100,12 +100,12 @@ __export(compile_theme_exports, {
|
|
|
100
100
|
async function resolveNodeModulesFile(startDir, relativePath) {
|
|
101
101
|
let dir = startDir;
|
|
102
102
|
while (true) {
|
|
103
|
-
const candidate =
|
|
103
|
+
const candidate = path8.join(dir, "node_modules", relativePath);
|
|
104
104
|
try {
|
|
105
105
|
await fs7.access(candidate);
|
|
106
106
|
return candidate;
|
|
107
107
|
} catch {
|
|
108
|
-
const parent =
|
|
108
|
+
const parent = path8.dirname(dir);
|
|
109
109
|
if (parent === dir) break;
|
|
110
110
|
dir = parent;
|
|
111
111
|
}
|
|
@@ -131,10 +131,16 @@ function createCoreGlobalPlugin(themePath) {
|
|
|
131
131
|
namedExports = exportsBySubpath[cacheKey];
|
|
132
132
|
} else {
|
|
133
133
|
const distFileName = subpath ? `${subpath}.mjs` : "index.mjs";
|
|
134
|
-
|
|
134
|
+
let distPath = await resolveNodeModulesFile(
|
|
135
135
|
themePath,
|
|
136
|
-
|
|
136
|
+
path8.join("@onexapis", "core", "dist", distFileName)
|
|
137
137
|
);
|
|
138
|
+
if (!distPath) {
|
|
139
|
+
distPath = await resolveNodeModulesFile(
|
|
140
|
+
__dirname,
|
|
141
|
+
path8.join("@onexapis", "core", "dist", distFileName)
|
|
142
|
+
);
|
|
143
|
+
}
|
|
138
144
|
try {
|
|
139
145
|
if (!distPath) throw new Error("not found");
|
|
140
146
|
const distContent = await fs7.readFile(distPath, "utf-8");
|
|
@@ -187,7 +193,7 @@ async function generateThemeData(themePath, outputDir, themeId) {
|
|
|
187
193
|
const pages = {};
|
|
188
194
|
for (const ext of [".ts", ".js"]) {
|
|
189
195
|
try {
|
|
190
|
-
const mod = await jiti.import(
|
|
196
|
+
const mod = await jiti.import(path8.join(themePath, `theme.config${ext}`));
|
|
191
197
|
themeConfig = mod.default || mod;
|
|
192
198
|
break;
|
|
193
199
|
} catch {
|
|
@@ -195,20 +201,20 @@ async function generateThemeData(themePath, outputDir, themeId) {
|
|
|
195
201
|
}
|
|
196
202
|
for (const ext of [".ts", ".js"]) {
|
|
197
203
|
try {
|
|
198
|
-
const mod = await jiti.import(
|
|
204
|
+
const mod = await jiti.import(path8.join(themePath, `theme.layout${ext}`));
|
|
199
205
|
layoutConfig = mod.default || mod;
|
|
200
206
|
break;
|
|
201
207
|
} catch {
|
|
202
208
|
}
|
|
203
209
|
}
|
|
204
|
-
const pagesDir =
|
|
210
|
+
const pagesDir = path8.join(themePath, "pages");
|
|
205
211
|
try {
|
|
206
212
|
const files = await fs7.readdir(pagesDir);
|
|
207
213
|
for (const file of files) {
|
|
208
214
|
if (!file.match(/\.(ts|js)$/)) continue;
|
|
209
215
|
const name = file.replace(/\.(ts|js)$/, "");
|
|
210
216
|
try {
|
|
211
|
-
const mod = await jiti.import(
|
|
217
|
+
const mod = await jiti.import(path8.join(pagesDir, file));
|
|
212
218
|
const config = mod.default || mod;
|
|
213
219
|
pages[name] = {
|
|
214
220
|
id: name,
|
|
@@ -224,7 +230,7 @@ async function generateThemeData(themePath, outputDir, themeId) {
|
|
|
224
230
|
} catch {
|
|
225
231
|
}
|
|
226
232
|
await fs7.writeFile(
|
|
227
|
-
|
|
233
|
+
path8.join(outputDir, "theme-data.json"),
|
|
228
234
|
JSON.stringify(
|
|
229
235
|
{
|
|
230
236
|
themeId,
|
|
@@ -247,17 +253,17 @@ async function generateThemeData(themePath, outputDir, themeId) {
|
|
|
247
253
|
logger.info(`Generated theme-data.json (${Object.keys(pages).length} pages)`);
|
|
248
254
|
}
|
|
249
255
|
async function contentHashEntry(outputDir) {
|
|
250
|
-
const entryPath =
|
|
251
|
-
const mapPath =
|
|
256
|
+
const entryPath = path8.join(outputDir, "bundle-entry.js");
|
|
257
|
+
const mapPath = path8.join(outputDir, "bundle-entry.js.map");
|
|
252
258
|
const oldFiles = await glob("bundle-entry-*.js*", { cwd: outputDir });
|
|
253
259
|
for (const f of oldFiles) {
|
|
254
|
-
await fs7.unlink(
|
|
260
|
+
await fs7.unlink(path8.join(outputDir, f));
|
|
255
261
|
}
|
|
256
262
|
let entryContent;
|
|
257
263
|
try {
|
|
258
264
|
entryContent = await fs7.readFile(entryPath, "utf-8");
|
|
259
265
|
} catch {
|
|
260
|
-
const indexPath =
|
|
266
|
+
const indexPath = path8.join(outputDir, "index.js");
|
|
261
267
|
try {
|
|
262
268
|
entryContent = await fs7.readFile(indexPath, "utf-8");
|
|
263
269
|
} catch {
|
|
@@ -266,17 +272,17 @@ async function contentHashEntry(outputDir) {
|
|
|
266
272
|
}
|
|
267
273
|
const hash2 = crypto.createHash("sha256").update(entryContent).digest("hex").slice(0, 8);
|
|
268
274
|
const hashedName2 = `bundle-entry-${hash2}.js`;
|
|
269
|
-
const indexMapPath =
|
|
275
|
+
const indexMapPath = path8.join(outputDir, "index.js.map");
|
|
270
276
|
const hashedMapName2 = `bundle-entry-${hash2}.js.map`;
|
|
271
277
|
entryContent = entryContent.replace(
|
|
272
278
|
/\/\/# sourceMappingURL=index\.js\.map/,
|
|
273
279
|
`//# sourceMappingURL=${hashedMapName2}`
|
|
274
280
|
);
|
|
275
|
-
await fs7.writeFile(
|
|
281
|
+
await fs7.writeFile(path8.join(outputDir, hashedName2), entryContent);
|
|
276
282
|
await fs7.unlink(indexPath);
|
|
277
283
|
try {
|
|
278
284
|
await fs7.access(indexMapPath);
|
|
279
|
-
await fs7.rename(indexMapPath,
|
|
285
|
+
await fs7.rename(indexMapPath, path8.join(outputDir, hashedMapName2));
|
|
280
286
|
} catch {
|
|
281
287
|
}
|
|
282
288
|
logger.info(`Entry hashed: ${hashedName2}`);
|
|
@@ -289,11 +295,11 @@ async function contentHashEntry(outputDir) {
|
|
|
289
295
|
/\/\/# sourceMappingURL=bundle-entry\.js\.map/,
|
|
290
296
|
`//# sourceMappingURL=${hashedMapName}`
|
|
291
297
|
);
|
|
292
|
-
await fs7.writeFile(
|
|
298
|
+
await fs7.writeFile(path8.join(outputDir, hashedName), entryContent);
|
|
293
299
|
await fs7.unlink(entryPath);
|
|
294
300
|
try {
|
|
295
301
|
await fs7.access(mapPath);
|
|
296
|
-
await fs7.rename(mapPath,
|
|
302
|
+
await fs7.rename(mapPath, path8.join(outputDir, hashedMapName));
|
|
297
303
|
} catch {
|
|
298
304
|
}
|
|
299
305
|
logger.info(`Entry hashed: ${hashedName}`);
|
|
@@ -305,7 +311,7 @@ async function extractDataRequirements(themePath) {
|
|
|
305
311
|
const requirements = {};
|
|
306
312
|
for (const file of schemaFiles) {
|
|
307
313
|
try {
|
|
308
|
-
const mod = await jiti.import(
|
|
314
|
+
const mod = await jiti.import(path8.join(themePath, file));
|
|
309
315
|
const exports$1 = mod;
|
|
310
316
|
for (const value of Object.values(exports$1)) {
|
|
311
317
|
if (value && typeof value === "object" && typeof value.type === "string" && value.dataRequirements && typeof value.dataRequirements === "object") {
|
|
@@ -325,7 +331,7 @@ async function generateManifest2(themeName, themePath, outputDir) {
|
|
|
325
331
|
let themeId = themeName;
|
|
326
332
|
try {
|
|
327
333
|
const pkgContent = await fs7.readFile(
|
|
328
|
-
|
|
334
|
+
path8.join(themePath, "package.json"),
|
|
329
335
|
"utf-8"
|
|
330
336
|
);
|
|
331
337
|
const pkg = JSON.parse(pkgContent);
|
|
@@ -343,7 +349,7 @@ async function generateManifest2(themeName, themePath, outputDir) {
|
|
|
343
349
|
const dataRequirements = await extractDataRequirements(themePath);
|
|
344
350
|
let hasThemeConfig = false;
|
|
345
351
|
try {
|
|
346
|
-
await fs7.access(
|
|
352
|
+
await fs7.access(path8.join(themePath, "theme.config.ts"));
|
|
347
353
|
hasThemeConfig = true;
|
|
348
354
|
} catch {
|
|
349
355
|
}
|
|
@@ -385,21 +391,21 @@ async function generateManifest2(themeName, themePath, outputDir) {
|
|
|
385
391
|
dataRequirements
|
|
386
392
|
};
|
|
387
393
|
await fs7.writeFile(
|
|
388
|
-
|
|
394
|
+
path8.join(outputDir, "manifest.json"),
|
|
389
395
|
JSON.stringify(manifest, null, 2)
|
|
390
396
|
);
|
|
391
397
|
}
|
|
392
398
|
async function compileStandaloneTheme(themePath, themeName) {
|
|
393
|
-
const outputDir =
|
|
394
|
-
const bundleEntry =
|
|
395
|
-
const indexEntry =
|
|
399
|
+
const outputDir = path8.join(themePath, "dist");
|
|
400
|
+
const bundleEntry = path8.join(themePath, "bundle-entry.ts");
|
|
401
|
+
const indexEntry = path8.join(themePath, "index.ts");
|
|
396
402
|
let entryPoint = indexEntry;
|
|
397
403
|
try {
|
|
398
404
|
await fs7.access(bundleEntry);
|
|
399
405
|
entryPoint = bundleEntry;
|
|
400
406
|
} catch {
|
|
401
407
|
}
|
|
402
|
-
const shimPath =
|
|
408
|
+
const shimPath = path8.join(outputDir, ".process-shim.js");
|
|
403
409
|
await fs7.mkdir(outputDir, { recursive: true });
|
|
404
410
|
await fs7.writeFile(shimPath, PROCESS_SHIM);
|
|
405
411
|
const buildOptions = {
|
|
@@ -473,16 +479,16 @@ async function compileStandaloneTheme(themePath, themeName) {
|
|
|
473
479
|
}
|
|
474
480
|
}
|
|
475
481
|
async function compileStandaloneThemeDev(themePath, themeName) {
|
|
476
|
-
const outputDir =
|
|
477
|
-
const bundleEntry =
|
|
478
|
-
const indexEntry =
|
|
482
|
+
const outputDir = path8.join(themePath, "dist");
|
|
483
|
+
const bundleEntry = path8.join(themePath, "bundle-entry.ts");
|
|
484
|
+
const indexEntry = path8.join(themePath, "index.ts");
|
|
479
485
|
let entryPoint = indexEntry;
|
|
480
486
|
try {
|
|
481
487
|
await fs7.access(bundleEntry);
|
|
482
488
|
entryPoint = bundleEntry;
|
|
483
489
|
} catch {
|
|
484
490
|
}
|
|
485
|
-
const shimPath =
|
|
491
|
+
const shimPath = path8.join(outputDir, ".process-shim.js");
|
|
486
492
|
await fs7.mkdir(outputDir, { recursive: true });
|
|
487
493
|
await fs7.writeFile(shimPath, PROCESS_SHIM);
|
|
488
494
|
const buildOptions = {
|
|
@@ -533,13 +539,13 @@ async function compileStandaloneThemeDev(themePath, themeName) {
|
|
|
533
539
|
return { context: context2, outputDir };
|
|
534
540
|
}
|
|
535
541
|
async function compilePreviewRuntime(themePath) {
|
|
536
|
-
const outputDir =
|
|
542
|
+
const outputDir = path8.join(themePath, "dist");
|
|
537
543
|
await fs7.mkdir(outputDir, { recursive: true });
|
|
538
|
-
const outputPath =
|
|
544
|
+
const outputPath = path8.join(outputDir, "preview-runtime.js");
|
|
539
545
|
const locations = [
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
546
|
+
path8.join(__dirname, "..", "preview", "preview-app.tsx"),
|
|
547
|
+
path8.join(__dirname, "preview", "preview-app.tsx"),
|
|
548
|
+
path8.join(__dirname, "..", "..", "src", "preview", "preview-app.tsx")
|
|
543
549
|
];
|
|
544
550
|
let previewEntryPath = null;
|
|
545
551
|
for (const loc of locations) {
|
|
@@ -714,7 +720,7 @@ export function headers() { return new Headers(); }
|
|
|
714
720
|
});
|
|
715
721
|
}
|
|
716
722
|
};
|
|
717
|
-
const shimPath =
|
|
723
|
+
const shimPath = path8.join(outputDir, ".process-shim-preview.js");
|
|
718
724
|
await fs7.writeFile(shimPath, PROCESS_SHIM);
|
|
719
725
|
await esbuild.build({
|
|
720
726
|
entryPoints: [previewEntryPath],
|
|
@@ -883,18 +889,18 @@ async function renderTemplate(templatePath, data) {
|
|
|
883
889
|
return ejs.render(template, data);
|
|
884
890
|
}
|
|
885
891
|
async function writeFile(filePath, content) {
|
|
886
|
-
await fs.ensureDir(
|
|
892
|
+
await fs.ensureDir(path8.dirname(filePath));
|
|
887
893
|
await fs.writeFile(filePath, content, "utf-8");
|
|
888
894
|
}
|
|
889
895
|
function getTemplatesDir() {
|
|
890
896
|
const locations = [
|
|
891
|
-
|
|
897
|
+
path8.join(__dirname, "../../templates"),
|
|
892
898
|
// Development
|
|
893
|
-
|
|
899
|
+
path8.join(__dirname, "../templates"),
|
|
894
900
|
// Production (dist/)
|
|
895
|
-
|
|
901
|
+
path8.join(process.cwd(), "templates"),
|
|
896
902
|
// Fallback
|
|
897
|
-
|
|
903
|
+
path8.join(process.cwd(), "packages/cli/templates")
|
|
898
904
|
// Monorepo
|
|
899
905
|
];
|
|
900
906
|
for (const location of locations) {
|
|
@@ -906,7 +912,7 @@ function getTemplatesDir() {
|
|
|
906
912
|
}
|
|
907
913
|
async function copyTemplate(templateName, targetDir, data) {
|
|
908
914
|
const templatesDir = getTemplatesDir();
|
|
909
|
-
const templateDir =
|
|
915
|
+
const templateDir = path8.join(templatesDir, templateName);
|
|
910
916
|
if (!fs.existsSync(templateDir)) {
|
|
911
917
|
throw new Error(
|
|
912
918
|
`Template "${templateName}" not found at ${templateDir}. Available templates: ${fs.readdirSync(templatesDir).join(", ")}`
|
|
@@ -915,8 +921,8 @@ async function copyTemplate(templateName, targetDir, data) {
|
|
|
915
921
|
await fs.ensureDir(targetDir);
|
|
916
922
|
const files = await fs.readdir(templateDir);
|
|
917
923
|
for (const file of files) {
|
|
918
|
-
const templatePath =
|
|
919
|
-
const targetPath =
|
|
924
|
+
const templatePath = path8.join(templateDir, file);
|
|
925
|
+
const targetPath = path8.join(targetDir, file);
|
|
920
926
|
const stat = await fs.stat(templatePath);
|
|
921
927
|
if (stat.isDirectory()) {
|
|
922
928
|
await copyTemplateDir(templatePath, targetPath, data);
|
|
@@ -933,8 +939,8 @@ async function copyTemplateDir(templateDir, targetDir, data) {
|
|
|
933
939
|
await fs.ensureDir(targetDir);
|
|
934
940
|
const files = await fs.readdir(templateDir);
|
|
935
941
|
for (const file of files) {
|
|
936
|
-
const templatePath =
|
|
937
|
-
const targetPath =
|
|
942
|
+
const templatePath = path8.join(templateDir, file);
|
|
943
|
+
const targetPath = path8.join(targetDir, file);
|
|
938
944
|
const stat = await fs.stat(templatePath);
|
|
939
945
|
if (stat.isDirectory()) {
|
|
940
946
|
await copyTemplateDir(templatePath, targetPath, data);
|
|
@@ -949,32 +955,32 @@ async function copyTemplateDir(templateDir, targetDir, data) {
|
|
|
949
955
|
}
|
|
950
956
|
function getProjectRoot() {
|
|
951
957
|
let currentDir = process.cwd();
|
|
952
|
-
while (currentDir !==
|
|
953
|
-
const packageJsonPath =
|
|
958
|
+
while (currentDir !== path8.parse(currentDir).root) {
|
|
959
|
+
const packageJsonPath = path8.join(currentDir, "package.json");
|
|
954
960
|
if (fs.existsSync(packageJsonPath)) {
|
|
955
961
|
const packageJson = fs.readJsonSync(packageJsonPath);
|
|
956
|
-
if (packageJson.workspaces || fs.existsSync(
|
|
962
|
+
if (packageJson.workspaces || fs.existsSync(path8.join(currentDir, "src/themes")) || fs.existsSync(path8.join(currentDir, "themes"))) {
|
|
957
963
|
return currentDir;
|
|
958
964
|
}
|
|
959
965
|
}
|
|
960
|
-
currentDir =
|
|
966
|
+
currentDir = path8.dirname(currentDir);
|
|
961
967
|
}
|
|
962
968
|
return process.cwd();
|
|
963
969
|
}
|
|
964
970
|
function getThemesDir() {
|
|
965
971
|
const root = getProjectRoot();
|
|
966
|
-
if (fs.existsSync(
|
|
967
|
-
return
|
|
968
|
-
if (fs.existsSync(
|
|
969
|
-
return
|
|
970
|
-
return
|
|
972
|
+
if (fs.existsSync(path8.join(root, "themes")))
|
|
973
|
+
return path8.join(root, "themes");
|
|
974
|
+
if (fs.existsSync(path8.join(root, "src/themes")))
|
|
975
|
+
return path8.join(root, "src/themes");
|
|
976
|
+
return path8.dirname(root);
|
|
971
977
|
}
|
|
972
978
|
function getFeaturesDir() {
|
|
973
|
-
return
|
|
979
|
+
return path8.join(getProjectRoot(), "src/features");
|
|
974
980
|
}
|
|
975
981
|
function isOneXProject() {
|
|
976
982
|
const root = getProjectRoot();
|
|
977
|
-
return fs.existsSync(
|
|
983
|
+
return fs.existsSync(path8.join(root, "themes")) || fs.existsSync(path8.join(root, "src/themes")) || fs.existsSync(path8.join(root, "theme.config.ts")) || fs.existsSync(path8.join(root, "bundle-entry.ts"));
|
|
978
984
|
}
|
|
979
985
|
function ensureOneXProject() {
|
|
980
986
|
if (!isOneXProject()) {
|
|
@@ -990,13 +996,13 @@ function listThemes() {
|
|
|
990
996
|
return [];
|
|
991
997
|
}
|
|
992
998
|
return fs.readdirSync(themesDir).filter((name) => {
|
|
993
|
-
const themePath =
|
|
994
|
-
return fs.statSync(themePath).isDirectory() && (fs.existsSync(
|
|
999
|
+
const themePath = path8.join(themesDir, name);
|
|
1000
|
+
return fs.statSync(themePath).isDirectory() && (fs.existsSync(path8.join(themePath, "theme.config.ts")) || fs.existsSync(path8.join(themePath, "bundle-entry.ts")) || fs.existsSync(path8.join(themePath, "manifest.ts")));
|
|
995
1001
|
});
|
|
996
1002
|
}
|
|
997
1003
|
function themeExists(themeName) {
|
|
998
|
-
const themePath =
|
|
999
|
-
return fs.existsSync(themePath) && (fs.existsSync(
|
|
1004
|
+
const themePath = path8.join(getThemesDir(), themeName);
|
|
1005
|
+
return fs.existsSync(themePath) && (fs.existsSync(path8.join(themePath, "theme.config.ts")) || fs.existsSync(path8.join(themePath, "bundle-entry.ts")) || fs.existsSync(path8.join(themePath, "manifest.ts")));
|
|
1000
1006
|
}
|
|
1001
1007
|
function detectPackageManager() {
|
|
1002
1008
|
const userAgent = process.env.npm_config_user_agent || "";
|
|
@@ -1004,9 +1010,9 @@ function detectPackageManager() {
|
|
|
1004
1010
|
if (userAgent.includes("yarn")) return "yarn";
|
|
1005
1011
|
if (userAgent.includes("bun")) return "bun";
|
|
1006
1012
|
const cwd = process.cwd();
|
|
1007
|
-
if (fs.existsSync(
|
|
1008
|
-
if (fs.existsSync(
|
|
1009
|
-
if (fs.existsSync(
|
|
1013
|
+
if (fs.existsSync(path8.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
1014
|
+
if (fs.existsSync(path8.join(cwd, "yarn.lock"))) return "yarn";
|
|
1015
|
+
if (fs.existsSync(path8.join(cwd, "bun.lockb"))) return "bun";
|
|
1010
1016
|
return "npm";
|
|
1011
1017
|
}
|
|
1012
1018
|
async function installDependencies(projectPath, packageManager = "npm") {
|
|
@@ -1072,7 +1078,7 @@ async function initCommand(projectName, options = {}) {
|
|
|
1072
1078
|
if (!validateThemeName(kebabName)) {
|
|
1073
1079
|
return "Invalid project name. Use lowercase letters, numbers, and hyphens only.";
|
|
1074
1080
|
}
|
|
1075
|
-
if (fs2.existsSync(
|
|
1081
|
+
if (fs2.existsSync(path8.join(process.cwd(), kebabName))) {
|
|
1076
1082
|
return `Directory "${kebabName}" already exists`;
|
|
1077
1083
|
}
|
|
1078
1084
|
return true;
|
|
@@ -1083,7 +1089,7 @@ async function initCommand(projectName, options = {}) {
|
|
|
1083
1089
|
} else {
|
|
1084
1090
|
name = toKebabCase(projectName);
|
|
1085
1091
|
}
|
|
1086
|
-
const projectPath =
|
|
1092
|
+
const projectPath = path8.join(process.cwd(), name);
|
|
1087
1093
|
if (fs2.existsSync(projectPath)) {
|
|
1088
1094
|
logger.error(`Directory "${name}" already exists.`);
|
|
1089
1095
|
process.exit(1);
|
|
@@ -1146,38 +1152,38 @@ async function initCommand(projectName, options = {}) {
|
|
|
1146
1152
|
try {
|
|
1147
1153
|
fs2.mkdirSync(projectPath, { recursive: true });
|
|
1148
1154
|
await copyTemplate(template, projectPath, data);
|
|
1149
|
-
const srcPath =
|
|
1155
|
+
const srcPath = path8.join(projectPath, "src");
|
|
1150
1156
|
fs2.mkdirSync(srcPath, { recursive: true });
|
|
1151
1157
|
const manifestContent = generateManifest(data);
|
|
1152
|
-
await writeFile(
|
|
1158
|
+
await writeFile(path8.join(srcPath, "manifest.ts"), manifestContent);
|
|
1153
1159
|
const configContent = generateThemeConfig(data);
|
|
1154
|
-
await writeFile(
|
|
1160
|
+
await writeFile(path8.join(srcPath, "config.ts"), configContent);
|
|
1155
1161
|
const layoutContent = generateThemeLayout(data);
|
|
1156
|
-
await writeFile(
|
|
1162
|
+
await writeFile(path8.join(srcPath, "layout.ts"), layoutContent);
|
|
1157
1163
|
const indexContent = generateThemeIndex(data);
|
|
1158
|
-
await writeFile(
|
|
1159
|
-
const sectionsPath =
|
|
1164
|
+
await writeFile(path8.join(srcPath, "index.ts"), indexContent);
|
|
1165
|
+
const sectionsPath = path8.join(srcPath, "sections");
|
|
1160
1166
|
fs2.mkdirSync(sectionsPath, { recursive: true });
|
|
1161
1167
|
await writeFile(
|
|
1162
|
-
|
|
1168
|
+
path8.join(sectionsPath, "README.md"),
|
|
1163
1169
|
`# ${displayName} Sections
|
|
1164
1170
|
|
|
1165
1171
|
Add your theme-specific sections here.
|
|
1166
1172
|
`
|
|
1167
1173
|
);
|
|
1168
|
-
const blocksPath =
|
|
1174
|
+
const blocksPath = path8.join(srcPath, "blocks");
|
|
1169
1175
|
fs2.mkdirSync(blocksPath, { recursive: true });
|
|
1170
1176
|
await writeFile(
|
|
1171
|
-
|
|
1177
|
+
path8.join(blocksPath, "README.md"),
|
|
1172
1178
|
`# ${displayName} Blocks
|
|
1173
1179
|
|
|
1174
1180
|
Add your theme-specific blocks here.
|
|
1175
1181
|
`
|
|
1176
1182
|
);
|
|
1177
|
-
const pagesPath =
|
|
1183
|
+
const pagesPath = path8.join(srcPath, "pages");
|
|
1178
1184
|
fs2.mkdirSync(pagesPath, { recursive: true });
|
|
1179
1185
|
const homePageContent = generateHomePage(data);
|
|
1180
|
-
await writeFile(
|
|
1186
|
+
await writeFile(path8.join(pagesPath, "home.ts"), homePageContent);
|
|
1181
1187
|
logger.stopSpinner(true, "Project structure created!");
|
|
1182
1188
|
if (options.git) {
|
|
1183
1189
|
logger.startSpinner("Initializing git repository...");
|
|
@@ -1476,10 +1482,10 @@ async function createSectionCommand(name, options) {
|
|
|
1476
1482
|
ensureOneXProject();
|
|
1477
1483
|
if (!options.theme) {
|
|
1478
1484
|
const isStandaloneTheme = ["theme.config.ts", "bundle-entry.ts"].some(
|
|
1479
|
-
(f) => fs.existsSync(
|
|
1485
|
+
(f) => fs.existsSync(path8.join(process.cwd(), f))
|
|
1480
1486
|
);
|
|
1481
1487
|
if (isStandaloneTheme) {
|
|
1482
|
-
options.theme =
|
|
1488
|
+
options.theme = path8.basename(process.cwd());
|
|
1483
1489
|
}
|
|
1484
1490
|
}
|
|
1485
1491
|
const sectionName = toKebabCase(name);
|
|
@@ -1542,35 +1548,35 @@ async function createSectionCommand(name, options) {
|
|
|
1542
1548
|
};
|
|
1543
1549
|
logger.startSpinner("Creating section files...");
|
|
1544
1550
|
try {
|
|
1545
|
-
const themePath =
|
|
1546
|
-
const sectionPath =
|
|
1551
|
+
const themePath = path8.join(getThemesDir(), themeName);
|
|
1552
|
+
const sectionPath = path8.join(themePath, "sections", sectionName);
|
|
1547
1553
|
const schemaContent = generateSectionSchema(data);
|
|
1548
1554
|
await writeFile(
|
|
1549
|
-
|
|
1555
|
+
path8.join(sectionPath, `${sectionName}.schema.ts`),
|
|
1550
1556
|
schemaContent
|
|
1551
1557
|
);
|
|
1552
1558
|
if (createTemplate) {
|
|
1553
1559
|
const templateContent = generateSectionTemplate(data);
|
|
1554
1560
|
await writeFile(
|
|
1555
|
-
|
|
1561
|
+
path8.join(sectionPath, `${sectionName}-default.tsx`),
|
|
1556
1562
|
templateContent
|
|
1557
1563
|
);
|
|
1558
1564
|
}
|
|
1559
1565
|
const indexContent = generateSectionIndex(data, createTemplate);
|
|
1560
|
-
await writeFile(
|
|
1566
|
+
await writeFile(path8.join(sectionPath, "index.ts"), indexContent);
|
|
1561
1567
|
logger.stopSpinner(true, "Section files created successfully!");
|
|
1562
1568
|
logger.newLine();
|
|
1563
1569
|
logger.section("Next steps:");
|
|
1564
1570
|
logger.log(
|
|
1565
|
-
` 1. Edit schema: ${
|
|
1571
|
+
` 1. Edit schema: ${path8.relative(process.cwd(), path8.join(sectionPath, `${sectionName}.schema.ts`))}`
|
|
1566
1572
|
);
|
|
1567
1573
|
if (createTemplate) {
|
|
1568
1574
|
logger.log(
|
|
1569
|
-
` 2. Edit template: ${
|
|
1575
|
+
` 2. Edit template: ${path8.relative(process.cwd(), path8.join(sectionPath, `${sectionName}-default.tsx`))}`
|
|
1570
1576
|
);
|
|
1571
1577
|
}
|
|
1572
1578
|
logger.log(
|
|
1573
|
-
` 3. Add to theme manifest: ${
|
|
1579
|
+
` 3. Add to theme manifest: ${path8.relative(process.cwd(), path8.join(themePath, "manifest.ts"))}`
|
|
1574
1580
|
);
|
|
1575
1581
|
logger.newLine();
|
|
1576
1582
|
logger.success("Section created successfully!");
|
|
@@ -1718,10 +1724,10 @@ async function createBlockCommand(name, options) {
|
|
|
1718
1724
|
ensureOneXProject();
|
|
1719
1725
|
if (!options.theme) {
|
|
1720
1726
|
const isStandaloneTheme = ["theme.config.ts", "bundle-entry.ts"].some(
|
|
1721
|
-
(f) => fs.existsSync(
|
|
1727
|
+
(f) => fs.existsSync(path8.join(process.cwd(), f))
|
|
1722
1728
|
);
|
|
1723
1729
|
if (isStandaloneTheme) {
|
|
1724
|
-
options.theme =
|
|
1730
|
+
options.theme = path8.basename(process.cwd());
|
|
1725
1731
|
}
|
|
1726
1732
|
}
|
|
1727
1733
|
const blockName = toKebabCase(name);
|
|
@@ -1796,24 +1802,24 @@ async function createBlockCommand(name, options) {
|
|
|
1796
1802
|
};
|
|
1797
1803
|
logger.startSpinner("Creating block files...");
|
|
1798
1804
|
try {
|
|
1799
|
-
const blockPath = scope === "shared" ?
|
|
1805
|
+
const blockPath = scope === "shared" ? path8.join(getFeaturesDir(), "blocks", blockName) : path8.join(getThemesDir(), themeName, "blocks", blockName);
|
|
1800
1806
|
const schemaContent = generateBlockSchema(data);
|
|
1801
1807
|
await writeFile(
|
|
1802
|
-
|
|
1808
|
+
path8.join(blockPath, `${blockName}.schema.ts`),
|
|
1803
1809
|
schemaContent
|
|
1804
1810
|
);
|
|
1805
1811
|
const componentContent = generateBlockComponent(data);
|
|
1806
|
-
await writeFile(
|
|
1812
|
+
await writeFile(path8.join(blockPath, `${blockName}.tsx`), componentContent);
|
|
1807
1813
|
const indexContent = generateBlockIndex(data);
|
|
1808
|
-
await writeFile(
|
|
1814
|
+
await writeFile(path8.join(blockPath, "index.ts"), indexContent);
|
|
1809
1815
|
logger.stopSpinner(true, "Block files created successfully!");
|
|
1810
1816
|
logger.newLine();
|
|
1811
1817
|
logger.section("Next steps:");
|
|
1812
1818
|
logger.log(
|
|
1813
|
-
` 1. Edit schema: ${
|
|
1819
|
+
` 1. Edit schema: ${path8.relative(process.cwd(), path8.join(blockPath, `${blockName}.schema.ts`))}`
|
|
1814
1820
|
);
|
|
1815
1821
|
logger.log(
|
|
1816
|
-
` 2. Edit component: ${
|
|
1822
|
+
` 2. Edit component: ${path8.relative(process.cwd(), path8.join(blockPath, `${blockName}.tsx`))}`
|
|
1817
1823
|
);
|
|
1818
1824
|
logger.log(
|
|
1819
1825
|
` 3. Register in block registry: src/lib/registry/block-registry.ts`
|
|
@@ -1991,31 +1997,31 @@ async function createComponentCommand(name, options) {
|
|
|
1991
1997
|
};
|
|
1992
1998
|
logger.startSpinner("Creating component files...");
|
|
1993
1999
|
try {
|
|
1994
|
-
const componentPath =
|
|
2000
|
+
const componentPath = path8.join(
|
|
1995
2001
|
getFeaturesDir(),
|
|
1996
2002
|
"components",
|
|
1997
2003
|
componentName
|
|
1998
2004
|
);
|
|
1999
2005
|
const schemaContent = generateComponentSchema(data);
|
|
2000
2006
|
await writeFile(
|
|
2001
|
-
|
|
2007
|
+
path8.join(componentPath, `${componentName}.schema.ts`),
|
|
2002
2008
|
schemaContent
|
|
2003
2009
|
);
|
|
2004
2010
|
const componentContent = generateComponent(data);
|
|
2005
2011
|
await writeFile(
|
|
2006
|
-
|
|
2012
|
+
path8.join(componentPath, `${componentName}.tsx`),
|
|
2007
2013
|
componentContent
|
|
2008
2014
|
);
|
|
2009
2015
|
const indexContent = generateComponentIndex(data);
|
|
2010
|
-
await writeFile(
|
|
2016
|
+
await writeFile(path8.join(componentPath, "index.ts"), indexContent);
|
|
2011
2017
|
logger.stopSpinner(true, "Component files created successfully!");
|
|
2012
2018
|
logger.newLine();
|
|
2013
2019
|
logger.section("Next steps:");
|
|
2014
2020
|
logger.log(
|
|
2015
|
-
` 1. Edit schema: ${
|
|
2021
|
+
` 1. Edit schema: ${path8.relative(process.cwd(), path8.join(componentPath, `${componentName}.schema.ts`))}`
|
|
2016
2022
|
);
|
|
2017
2023
|
logger.log(
|
|
2018
|
-
` 2. Edit component: ${
|
|
2024
|
+
` 2. Edit component: ${path8.relative(process.cwd(), path8.join(componentPath, `${componentName}.tsx`))}`
|
|
2019
2025
|
);
|
|
2020
2026
|
logger.log(
|
|
2021
2027
|
` 3. Register in component registry: src/lib/registry/component-registry.ts`
|
|
@@ -2172,13 +2178,13 @@ async function listSections(themeFilter) {
|
|
|
2172
2178
|
return;
|
|
2173
2179
|
}
|
|
2174
2180
|
for (const theme of themes) {
|
|
2175
|
-
const sectionsDir =
|
|
2181
|
+
const sectionsDir = path8.join(getThemesDir(), theme, "sections");
|
|
2176
2182
|
if (!fs.existsSync(sectionsDir)) {
|
|
2177
2183
|
continue;
|
|
2178
2184
|
}
|
|
2179
2185
|
const sections = fs.readdirSync(sectionsDir).filter((name) => {
|
|
2180
|
-
const sectionPath =
|
|
2181
|
-
return fs.statSync(sectionPath).isDirectory() && fs.existsSync(
|
|
2186
|
+
const sectionPath = path8.join(sectionsDir, name);
|
|
2187
|
+
return fs.statSync(sectionPath).isDirectory() && fs.existsSync(path8.join(sectionPath, "index.ts"));
|
|
2182
2188
|
});
|
|
2183
2189
|
if (sections.length > 0) {
|
|
2184
2190
|
logger.log(chalk4.cyan(`
|
|
@@ -2192,11 +2198,11 @@ async function listSections(themeFilter) {
|
|
|
2192
2198
|
}
|
|
2193
2199
|
async function listBlocks(themeFilter) {
|
|
2194
2200
|
logger.section("\u{1F9F1} Blocks");
|
|
2195
|
-
const sharedBlocksDir =
|
|
2201
|
+
const sharedBlocksDir = path8.join(getFeaturesDir(), "blocks");
|
|
2196
2202
|
if (fs.existsSync(sharedBlocksDir)) {
|
|
2197
2203
|
const sharedBlocks = fs.readdirSync(sharedBlocksDir).filter((name) => {
|
|
2198
|
-
const blockPath =
|
|
2199
|
-
return fs.statSync(blockPath).isDirectory() && fs.existsSync(
|
|
2204
|
+
const blockPath = path8.join(sharedBlocksDir, name);
|
|
2205
|
+
return fs.statSync(blockPath).isDirectory() && fs.existsSync(path8.join(blockPath, "index.ts"));
|
|
2200
2206
|
});
|
|
2201
2207
|
if (sharedBlocks.length > 0) {
|
|
2202
2208
|
logger.log(chalk4.cyan("\n Shared:"));
|
|
@@ -2207,13 +2213,13 @@ async function listBlocks(themeFilter) {
|
|
|
2207
2213
|
}
|
|
2208
2214
|
const themes = themeFilter ? [themeFilter] : listThemes();
|
|
2209
2215
|
for (const theme of themes) {
|
|
2210
|
-
const blocksDir =
|
|
2216
|
+
const blocksDir = path8.join(getThemesDir(), theme, "blocks");
|
|
2211
2217
|
if (!fs.existsSync(blocksDir)) {
|
|
2212
2218
|
continue;
|
|
2213
2219
|
}
|
|
2214
2220
|
const blocks = fs.readdirSync(blocksDir).filter((name) => {
|
|
2215
|
-
const blockPath =
|
|
2216
|
-
return fs.statSync(blockPath).isDirectory() && fs.existsSync(
|
|
2221
|
+
const blockPath = path8.join(blocksDir, name);
|
|
2222
|
+
return fs.statSync(blockPath).isDirectory() && fs.existsSync(path8.join(blockPath, "index.ts"));
|
|
2217
2223
|
});
|
|
2218
2224
|
if (blocks.length > 0) {
|
|
2219
2225
|
logger.log(chalk4.cyan(`
|
|
@@ -2227,14 +2233,14 @@ async function listBlocks(themeFilter) {
|
|
|
2227
2233
|
}
|
|
2228
2234
|
async function listComponents() {
|
|
2229
2235
|
logger.section("\u2699\uFE0F Components");
|
|
2230
|
-
const componentsDir =
|
|
2236
|
+
const componentsDir = path8.join(getFeaturesDir(), "components");
|
|
2231
2237
|
if (!fs.existsSync(componentsDir)) {
|
|
2232
2238
|
logger.warning("No components directory found");
|
|
2233
2239
|
return;
|
|
2234
2240
|
}
|
|
2235
2241
|
const components = fs.readdirSync(componentsDir).filter((name) => {
|
|
2236
|
-
const componentPath =
|
|
2237
|
-
return fs.statSync(componentPath).isDirectory() && fs.existsSync(
|
|
2242
|
+
const componentPath = path8.join(componentsDir, name);
|
|
2243
|
+
return fs.statSync(componentPath).isDirectory() && fs.existsSync(path8.join(componentPath, "index.ts"));
|
|
2238
2244
|
});
|
|
2239
2245
|
if (components.length === 0) {
|
|
2240
2246
|
logger.warning("No components found");
|
|
@@ -2255,11 +2261,11 @@ async function listThemesInfo() {
|
|
|
2255
2261
|
}
|
|
2256
2262
|
logger.log("");
|
|
2257
2263
|
for (const theme of themes) {
|
|
2258
|
-
const themeDir =
|
|
2264
|
+
const themeDir = path8.join(getThemesDir(), theme);
|
|
2259
2265
|
const candidates = ["theme.config.ts", "bundle-entry.ts", "manifest.ts"];
|
|
2260
2266
|
let manifestContent = "";
|
|
2261
2267
|
for (const candidate of candidates) {
|
|
2262
|
-
const candidatePath =
|
|
2268
|
+
const candidatePath = path8.join(themeDir, candidate);
|
|
2263
2269
|
if (fs.existsSync(candidatePath)) {
|
|
2264
2270
|
manifestContent = fs.readFileSync(candidatePath, "utf-8");
|
|
2265
2271
|
break;
|
|
@@ -2297,9 +2303,9 @@ async function validateCommand(options) {
|
|
|
2297
2303
|
"theme.config.ts",
|
|
2298
2304
|
"bundle-entry.ts",
|
|
2299
2305
|
"manifest.ts"
|
|
2300
|
-
].some((f) => fs.existsSync(
|
|
2306
|
+
].some((f) => fs.existsSync(path8.join(process.cwd(), f)));
|
|
2301
2307
|
if (isThemeDir) {
|
|
2302
|
-
themeToValidate =
|
|
2308
|
+
themeToValidate = path8.basename(process.cwd());
|
|
2303
2309
|
logger.info(`Validating current theme: ${themeToValidate}`);
|
|
2304
2310
|
} else {
|
|
2305
2311
|
logger.error(
|
|
@@ -2308,11 +2314,11 @@ async function validateCommand(options) {
|
|
|
2308
2314
|
process.exit(1);
|
|
2309
2315
|
}
|
|
2310
2316
|
}
|
|
2311
|
-
const themePath =
|
|
2317
|
+
const themePath = path8.join(getThemesDir(), themeToValidate);
|
|
2312
2318
|
logger.startSpinner("Running validation checks...");
|
|
2313
2319
|
const entryFiles = ["manifest.ts", "theme.config.ts", "bundle-entry.ts"];
|
|
2314
2320
|
const foundEntry = entryFiles.find(
|
|
2315
|
-
(f) => fs.existsSync(
|
|
2321
|
+
(f) => fs.existsSync(path8.join(themePath, f))
|
|
2316
2322
|
);
|
|
2317
2323
|
if (!foundEntry) {
|
|
2318
2324
|
issues.push({
|
|
@@ -2322,7 +2328,7 @@ async function validateCommand(options) {
|
|
|
2322
2328
|
});
|
|
2323
2329
|
} else if (foundEntry === "manifest.ts") {
|
|
2324
2330
|
const manifestContent = fs.readFileSync(
|
|
2325
|
-
|
|
2331
|
+
path8.join(themePath, foundEntry),
|
|
2326
2332
|
"utf-8"
|
|
2327
2333
|
);
|
|
2328
2334
|
if (!manifestContent.includes("export const") && !manifestContent.includes("export default") && !manifestContent.includes("export interface")) {
|
|
@@ -2333,7 +2339,7 @@ async function validateCommand(options) {
|
|
|
2333
2339
|
});
|
|
2334
2340
|
}
|
|
2335
2341
|
}
|
|
2336
|
-
const configPath =
|
|
2342
|
+
const configPath = path8.join(themePath, "theme.config.ts");
|
|
2337
2343
|
if (!fs.existsSync(configPath)) {
|
|
2338
2344
|
issues.push({
|
|
2339
2345
|
type: "warning",
|
|
@@ -2341,7 +2347,7 @@ async function validateCommand(options) {
|
|
|
2341
2347
|
message: "Theme config file not found (recommended)"
|
|
2342
2348
|
});
|
|
2343
2349
|
}
|
|
2344
|
-
const indexPath =
|
|
2350
|
+
const indexPath = path8.join(themePath, "index.ts");
|
|
2345
2351
|
if (!fs.existsSync(indexPath)) {
|
|
2346
2352
|
issues.push({
|
|
2347
2353
|
type: "warning",
|
|
@@ -2349,7 +2355,7 @@ async function validateCommand(options) {
|
|
|
2349
2355
|
message: "Index file not found (recommended)"
|
|
2350
2356
|
});
|
|
2351
2357
|
}
|
|
2352
|
-
const sectionsDir =
|
|
2358
|
+
const sectionsDir = path8.join(themePath, "sections");
|
|
2353
2359
|
if (!fs.existsSync(sectionsDir)) {
|
|
2354
2360
|
issues.push({
|
|
2355
2361
|
type: "warning",
|
|
@@ -2358,16 +2364,16 @@ async function validateCommand(options) {
|
|
|
2358
2364
|
});
|
|
2359
2365
|
} else {
|
|
2360
2366
|
const sections = fs.readdirSync(sectionsDir).filter(
|
|
2361
|
-
(name) => fs.statSync(
|
|
2367
|
+
(name) => fs.statSync(path8.join(sectionsDir, name)).isDirectory()
|
|
2362
2368
|
);
|
|
2363
2369
|
for (const sectionName of sections) {
|
|
2364
|
-
const sectionPath =
|
|
2365
|
-
const schemaFile =
|
|
2366
|
-
const defaultTemplate =
|
|
2370
|
+
const sectionPath = path8.join(sectionsDir, sectionName);
|
|
2371
|
+
const schemaFile = path8.join(sectionPath, `${sectionName}.schema.ts`);
|
|
2372
|
+
const defaultTemplate = path8.join(
|
|
2367
2373
|
sectionPath,
|
|
2368
2374
|
`${sectionName}-default.tsx`
|
|
2369
2375
|
);
|
|
2370
|
-
const indexFile =
|
|
2376
|
+
const indexFile = path8.join(sectionPath, "index.ts");
|
|
2371
2377
|
if (!fs.existsSync(schemaFile)) {
|
|
2372
2378
|
issues.push({
|
|
2373
2379
|
type: "error",
|
|
@@ -2391,14 +2397,14 @@ async function validateCommand(options) {
|
|
|
2391
2397
|
}
|
|
2392
2398
|
}
|
|
2393
2399
|
}
|
|
2394
|
-
const blocksDir =
|
|
2400
|
+
const blocksDir = path8.join(themePath, "blocks");
|
|
2395
2401
|
if (fs.existsSync(blocksDir)) {
|
|
2396
|
-
const blocks = fs.readdirSync(blocksDir).filter((name) => fs.statSync(
|
|
2402
|
+
const blocks = fs.readdirSync(blocksDir).filter((name) => fs.statSync(path8.join(blocksDir, name)).isDirectory());
|
|
2397
2403
|
for (const blockName of blocks) {
|
|
2398
|
-
const blockPath =
|
|
2399
|
-
const schemaFile =
|
|
2400
|
-
const componentFile =
|
|
2401
|
-
const indexFile =
|
|
2404
|
+
const blockPath = path8.join(blocksDir, blockName);
|
|
2405
|
+
const schemaFile = path8.join(blockPath, `${blockName}.schema.ts`);
|
|
2406
|
+
const componentFile = path8.join(blockPath, `${blockName}.tsx`);
|
|
2407
|
+
const indexFile = path8.join(blockPath, "index.ts");
|
|
2402
2408
|
if (!fs.existsSync(schemaFile)) {
|
|
2403
2409
|
issues.push({
|
|
2404
2410
|
type: "error",
|
|
@@ -2470,14 +2476,14 @@ async function buildCommand(options) {
|
|
|
2470
2476
|
if (options.theme) {
|
|
2471
2477
|
themeName = options.theme;
|
|
2472
2478
|
try {
|
|
2473
|
-
const workspaceThemePath =
|
|
2479
|
+
const workspaceThemePath = path8.join(getThemesDir(), themeName);
|
|
2474
2480
|
if (fs.existsSync(workspaceThemePath)) {
|
|
2475
2481
|
themePath = workspaceThemePath;
|
|
2476
2482
|
} else {
|
|
2477
|
-
themePath =
|
|
2483
|
+
themePath = path8.join(process.cwd(), themeName);
|
|
2478
2484
|
}
|
|
2479
2485
|
} catch {
|
|
2480
|
-
themePath =
|
|
2486
|
+
themePath = path8.join(process.cwd(), themeName);
|
|
2481
2487
|
}
|
|
2482
2488
|
if (!fs.existsSync(themePath)) {
|
|
2483
2489
|
logger.error(`Theme "${themeName}" not found.`);
|
|
@@ -2488,10 +2494,10 @@ async function buildCommand(options) {
|
|
|
2488
2494
|
"theme.config.ts",
|
|
2489
2495
|
"bundle-entry.ts",
|
|
2490
2496
|
"manifest.ts"
|
|
2491
|
-
].some((f) => fs.existsSync(
|
|
2497
|
+
].some((f) => fs.existsSync(path8.join(process.cwd(), f)));
|
|
2492
2498
|
if (isThemeDir) {
|
|
2493
2499
|
themePath = process.cwd();
|
|
2494
|
-
themeName =
|
|
2500
|
+
themeName = path8.basename(themePath);
|
|
2495
2501
|
logger.info(`Building current theme: ${themeName}`);
|
|
2496
2502
|
} else {
|
|
2497
2503
|
logger.error(
|
|
@@ -2500,7 +2506,7 @@ async function buildCommand(options) {
|
|
|
2500
2506
|
process.exit(1);
|
|
2501
2507
|
}
|
|
2502
2508
|
}
|
|
2503
|
-
const packageJsonPath =
|
|
2509
|
+
const packageJsonPath = path8.join(themePath, "package.json");
|
|
2504
2510
|
const hasPkgJson = fs.existsSync(packageJsonPath);
|
|
2505
2511
|
if (!hasPkgJson) {
|
|
2506
2512
|
logger.warning(
|
|
@@ -2556,9 +2562,9 @@ async function buildCommand(options) {
|
|
|
2556
2562
|
logger.success("\u2713 Theme built successfully!");
|
|
2557
2563
|
logger.newLine();
|
|
2558
2564
|
logger.info(`Theme: ${themeName}`);
|
|
2559
|
-
const distPath =
|
|
2565
|
+
const distPath = path8.join(themePath, "dist");
|
|
2560
2566
|
if (fs.existsSync(distPath)) {
|
|
2561
|
-
logger.log(`Output: ${
|
|
2567
|
+
logger.log(`Output: ${path8.relative(process.cwd(), distPath)}`);
|
|
2562
2568
|
const files = fs.readdirSync(distPath);
|
|
2563
2569
|
logger.log(`Files: ${files.length}`);
|
|
2564
2570
|
}
|
|
@@ -2596,7 +2602,7 @@ async function packageCommand(options) {
|
|
|
2596
2602
|
let themeName;
|
|
2597
2603
|
if (options.theme) {
|
|
2598
2604
|
themeName = options.theme;
|
|
2599
|
-
themePath =
|
|
2605
|
+
themePath = path8.join(getThemesDir(), themeName);
|
|
2600
2606
|
if (!fs.existsSync(themePath)) {
|
|
2601
2607
|
logger.error(`Theme "${themeName}" not found.`);
|
|
2602
2608
|
process.exit(1);
|
|
@@ -2606,10 +2612,10 @@ async function packageCommand(options) {
|
|
|
2606
2612
|
"theme.config.ts",
|
|
2607
2613
|
"bundle-entry.ts",
|
|
2608
2614
|
"manifest.ts"
|
|
2609
|
-
].some((f) => fs.existsSync(
|
|
2615
|
+
].some((f) => fs.existsSync(path8.join(process.cwd(), f)));
|
|
2610
2616
|
if (isThemeDir) {
|
|
2611
2617
|
themePath = process.cwd();
|
|
2612
|
-
themeName =
|
|
2618
|
+
themeName = path8.basename(themePath);
|
|
2613
2619
|
logger.info(`Packaging current theme: ${themeName}`);
|
|
2614
2620
|
} else {
|
|
2615
2621
|
logger.error(
|
|
@@ -2618,7 +2624,7 @@ async function packageCommand(options) {
|
|
|
2618
2624
|
process.exit(1);
|
|
2619
2625
|
}
|
|
2620
2626
|
}
|
|
2621
|
-
const packageJsonPath =
|
|
2627
|
+
const packageJsonPath = path8.join(themePath, "package.json");
|
|
2622
2628
|
let version = "1.0.0";
|
|
2623
2629
|
if (fs.existsSync(packageJsonPath)) {
|
|
2624
2630
|
const packageJson = await fs.readJson(packageJsonPath);
|
|
@@ -2628,7 +2634,7 @@ async function packageCommand(options) {
|
|
|
2628
2634
|
logger.info(`Theme: ${themeName}`);
|
|
2629
2635
|
logger.info(`Version: ${version}`);
|
|
2630
2636
|
logger.newLine();
|
|
2631
|
-
const compiledThemePath =
|
|
2637
|
+
const compiledThemePath = path8.join(
|
|
2632
2638
|
process.cwd(),
|
|
2633
2639
|
"themes",
|
|
2634
2640
|
themeName,
|
|
@@ -2662,8 +2668,8 @@ async function packageCommand(options) {
|
|
|
2662
2668
|
logger.newLine();
|
|
2663
2669
|
logger.section("Step 2: Create Package");
|
|
2664
2670
|
const packageName = options.name || `${themeName}-${version}`;
|
|
2665
|
-
const outputDir = options.output ||
|
|
2666
|
-
const outputPath =
|
|
2671
|
+
const outputDir = options.output || path8.join(process.cwd(), "dist");
|
|
2672
|
+
const outputPath = path8.join(outputDir, `${packageName}.zip`);
|
|
2667
2673
|
await fs.ensureDir(outputDir);
|
|
2668
2674
|
logger.startSpinner("Creating zip archive...");
|
|
2669
2675
|
try {
|
|
@@ -2676,11 +2682,11 @@ async function packageCommand(options) {
|
|
|
2676
2682
|
logger.newLine();
|
|
2677
2683
|
logger.info(`Package: ${packageName}.zip`);
|
|
2678
2684
|
logger.log(`Size: ${sizeMB} MB`);
|
|
2679
|
-
logger.log(`Location: ${
|
|
2685
|
+
logger.log(`Location: ${path8.relative(process.cwd(), outputPath)}`);
|
|
2680
2686
|
logger.newLine();
|
|
2681
2687
|
logger.section("Next steps:");
|
|
2682
2688
|
logger.log(
|
|
2683
|
-
` onex deploy --package ${
|
|
2689
|
+
` onex deploy --package ${path8.relative(process.cwd(), outputPath)}`
|
|
2684
2690
|
);
|
|
2685
2691
|
} catch (error) {
|
|
2686
2692
|
logger.stopSpinner(false, "Failed to create package");
|
|
@@ -2738,9 +2744,9 @@ async function deployCommand(options) {
|
|
|
2738
2744
|
ensureOneXProject();
|
|
2739
2745
|
let packagePath;
|
|
2740
2746
|
if (options.package) {
|
|
2741
|
-
packagePath =
|
|
2747
|
+
packagePath = path8.resolve(options.package);
|
|
2742
2748
|
} else if (options.theme) {
|
|
2743
|
-
const distDir =
|
|
2749
|
+
const distDir = path8.join(process.cwd(), "dist");
|
|
2744
2750
|
if (!fs.existsSync(distDir)) {
|
|
2745
2751
|
logger.error("No dist/ directory found. Run 'onex package' first.");
|
|
2746
2752
|
process.exit(1);
|
|
@@ -2755,7 +2761,7 @@ async function deployCommand(options) {
|
|
|
2755
2761
|
process.exit(1);
|
|
2756
2762
|
}
|
|
2757
2763
|
packageFiles.sort().reverse();
|
|
2758
|
-
packagePath =
|
|
2764
|
+
packagePath = path8.join(distDir, packageFiles[0]);
|
|
2759
2765
|
} else {
|
|
2760
2766
|
logger.error("Either --package or --theme must be specified.");
|
|
2761
2767
|
logger.info("Examples:");
|
|
@@ -2769,11 +2775,11 @@ async function deployCommand(options) {
|
|
|
2769
2775
|
}
|
|
2770
2776
|
const stats = await fs.stat(packagePath);
|
|
2771
2777
|
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
2772
|
-
const fileName =
|
|
2778
|
+
const fileName = path8.basename(packagePath);
|
|
2773
2779
|
logger.newLine();
|
|
2774
2780
|
logger.info(`Package: ${fileName}`);
|
|
2775
2781
|
logger.log(`Size: ${sizeMB} MB`);
|
|
2776
|
-
logger.log(`Path: ${
|
|
2782
|
+
logger.log(`Path: ${path8.relative(process.cwd(), packagePath)}`);
|
|
2777
2783
|
logger.newLine();
|
|
2778
2784
|
const apiUrl = options.apiUrl || process.env.ONEX_API_URL || "http://localhost:3001";
|
|
2779
2785
|
const uploadEndpoint = `${apiUrl}/api/themes/upload`;
|
|
@@ -2877,11 +2883,11 @@ function getBucketName(env) {
|
|
|
2877
2883
|
return environment === "production" ? "onex-themes-prod" : "onex-themes-staging";
|
|
2878
2884
|
}
|
|
2879
2885
|
async function findCompiledThemeDir(themeId, version) {
|
|
2880
|
-
const searchPaths = [
|
|
2886
|
+
const searchPaths = [path8.resolve(process.cwd(), "dist")];
|
|
2881
2887
|
for (const dir of searchPaths) {
|
|
2882
2888
|
if (await fs.pathExists(dir)) {
|
|
2883
|
-
const hasManifest = await fs.pathExists(
|
|
2884
|
-
const hasThemeEntry = await fs.pathExists(
|
|
2889
|
+
const hasManifest = await fs.pathExists(path8.join(dir, "manifest.json"));
|
|
2890
|
+
const hasThemeEntry = await fs.pathExists(path8.join(dir, "bundle-entry.js")) || await fs.pathExists(path8.join(dir, "theme.config.js")) || await fs.pathExists(path8.join(dir, "index.js"));
|
|
2885
2891
|
if (hasManifest || hasThemeEntry) {
|
|
2886
2892
|
return dir;
|
|
2887
2893
|
}
|
|
@@ -2890,7 +2896,7 @@ async function findCompiledThemeDir(themeId, version) {
|
|
|
2890
2896
|
return null;
|
|
2891
2897
|
}
|
|
2892
2898
|
async function readManifest() {
|
|
2893
|
-
const manifestTsPath =
|
|
2899
|
+
const manifestTsPath = path8.resolve(process.cwd(), "manifest.ts");
|
|
2894
2900
|
if (await fs.pathExists(manifestTsPath)) {
|
|
2895
2901
|
try {
|
|
2896
2902
|
const module = await import(manifestTsPath);
|
|
@@ -2899,7 +2905,7 @@ async function readManifest() {
|
|
|
2899
2905
|
logger.warning("Failed to import manifest.ts, trying package.json");
|
|
2900
2906
|
}
|
|
2901
2907
|
}
|
|
2902
|
-
const packageJsonPath =
|
|
2908
|
+
const packageJsonPath = path8.resolve(process.cwd(), "package.json");
|
|
2903
2909
|
if (await fs.pathExists(packageJsonPath)) {
|
|
2904
2910
|
const pkg = await fs.readJson(packageJsonPath);
|
|
2905
2911
|
return {
|
|
@@ -2933,13 +2939,13 @@ async function findSourceDir(themeId, explicitDir) {
|
|
|
2933
2939
|
}
|
|
2934
2940
|
const searchPaths = [
|
|
2935
2941
|
process.cwd(),
|
|
2936
|
-
|
|
2937
|
-
|
|
2942
|
+
path8.resolve(process.cwd(), `../../themes/${themeId}`),
|
|
2943
|
+
path8.resolve(process.cwd(), `../themes/${themeId}`)
|
|
2938
2944
|
];
|
|
2939
2945
|
const markers = ["theme.config.ts", "bundle-entry.ts"];
|
|
2940
2946
|
for (const dir of searchPaths) {
|
|
2941
2947
|
for (const marker of markers) {
|
|
2942
|
-
if (await fs.pathExists(
|
|
2948
|
+
if (await fs.pathExists(path8.join(dir, marker))) {
|
|
2943
2949
|
return dir;
|
|
2944
2950
|
}
|
|
2945
2951
|
}
|
|
@@ -2991,7 +2997,7 @@ async function uploadCommand(options) {
|
|
|
2991
2997
|
spinner.succeed(`Found compiled theme at: ${compiledDir}`);
|
|
2992
2998
|
spinner.start("Creating bundle.zip...");
|
|
2993
2999
|
const tmpDir = os.tmpdir();
|
|
2994
|
-
const bundleZipPath =
|
|
3000
|
+
const bundleZipPath = path8.join(tmpDir, `${themeId}-${version}-bundle.zip`);
|
|
2995
3001
|
await createZipFromDir(compiledDir, bundleZipPath);
|
|
2996
3002
|
const bundleZipBuffer = await fs.readFile(bundleZipPath);
|
|
2997
3003
|
const bundleSizeMB = (bundleZipBuffer.length / 1024 / 1024).toFixed(2);
|
|
@@ -3045,7 +3051,7 @@ async function uploadCommand(options) {
|
|
|
3045
3051
|
if (sourceDir) {
|
|
3046
3052
|
spinner.succeed(`Found source at: ${sourceDir}`);
|
|
3047
3053
|
spinner.start("Creating source.zip...");
|
|
3048
|
-
const sourceZipPath =
|
|
3054
|
+
const sourceZipPath = path8.join(
|
|
3049
3055
|
tmpDir,
|
|
3050
3056
|
`${themeId}-${version}-source.zip`
|
|
3051
3057
|
);
|
|
@@ -3179,8 +3185,8 @@ async function resolveLatestVersion(s3Client, bucket, themeId) {
|
|
|
3179
3185
|
async function createCompatibilityFiles(outputDir, manifest) {
|
|
3180
3186
|
const entryFile = manifest.output?.entry || "bundle-entry.js";
|
|
3181
3187
|
if (entryFile !== "bundle-entry.js" && entryFile.startsWith("bundle-entry-")) {
|
|
3182
|
-
const hashedPath =
|
|
3183
|
-
const stablePath =
|
|
3188
|
+
const hashedPath = path8.join(outputDir, entryFile);
|
|
3189
|
+
const stablePath = path8.join(outputDir, "bundle-entry.js");
|
|
3184
3190
|
if (await fs.pathExists(hashedPath)) {
|
|
3185
3191
|
await fs.copy(hashedPath, stablePath);
|
|
3186
3192
|
const mapPath = hashedPath + ".map";
|
|
@@ -3189,13 +3195,13 @@ async function createCompatibilityFiles(outputDir, manifest) {
|
|
|
3189
3195
|
}
|
|
3190
3196
|
}
|
|
3191
3197
|
}
|
|
3192
|
-
const sectionsRegistryPath =
|
|
3198
|
+
const sectionsRegistryPath = path8.join(outputDir, "sections-registry.js");
|
|
3193
3199
|
const content = `// Re-export all sections from bundle-entry
|
|
3194
3200
|
// This file exists to maintain compatibility with the import path
|
|
3195
3201
|
export * from './bundle-entry.js';
|
|
3196
3202
|
`;
|
|
3197
3203
|
await fs.writeFile(sectionsRegistryPath, content, "utf-8");
|
|
3198
|
-
const pkgJsonPath =
|
|
3204
|
+
const pkgJsonPath = path8.join(outputDir, "package.json");
|
|
3199
3205
|
await fs.writeFile(pkgJsonPath, '{\n "type": "module"\n}\n', "utf-8");
|
|
3200
3206
|
}
|
|
3201
3207
|
function showDownloadFailureHelp(themeId, bucket) {
|
|
@@ -3278,7 +3284,7 @@ async function downloadCommand(options) {
|
|
|
3278
3284
|
zip.extractAllTo(outputDir, true);
|
|
3279
3285
|
const entries = zip.getEntries().filter((e) => !e.isDirectory);
|
|
3280
3286
|
spinner.succeed(`Extracted ${entries.length} files to ${outputDir}`);
|
|
3281
|
-
const manifestPath =
|
|
3287
|
+
const manifestPath = path8.join(outputDir, "manifest.json");
|
|
3282
3288
|
const manifest = await fs.readJson(manifestPath);
|
|
3283
3289
|
await createCompatibilityFiles(outputDir, manifest);
|
|
3284
3290
|
console.log();
|
|
@@ -3412,7 +3418,7 @@ async function renameTheme(themeDir, oldName, newName) {
|
|
|
3412
3418
|
const oldPrefix = `${oldName}-`;
|
|
3413
3419
|
const newPrefix = `${newName}-`;
|
|
3414
3420
|
const newDisplayName = newName.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
3415
|
-
const pkgPath =
|
|
3421
|
+
const pkgPath = path8.join(themeDir, "package.json");
|
|
3416
3422
|
if (await fs.pathExists(pkgPath)) {
|
|
3417
3423
|
const pkg = await fs.readJson(pkgPath);
|
|
3418
3424
|
pkg.name = `@onex-themes/${newName}`;
|
|
@@ -3423,9 +3429,12 @@ async function renameTheme(themeDir, oldName, newName) {
|
|
|
3423
3429
|
);
|
|
3424
3430
|
}
|
|
3425
3431
|
pkg.version = "1.0.0";
|
|
3432
|
+
if (pkg.devDependencies?.["@onexapis/cli"]) {
|
|
3433
|
+
delete pkg.devDependencies["@onexapis/cli"];
|
|
3434
|
+
}
|
|
3426
3435
|
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
3427
3436
|
}
|
|
3428
|
-
const configPath =
|
|
3437
|
+
const configPath = path8.join(themeDir, "theme.config.ts");
|
|
3429
3438
|
if (await fs.pathExists(configPath)) {
|
|
3430
3439
|
let content = await fs.readFile(configPath, "utf-8");
|
|
3431
3440
|
content = content.replace(/id:\s*"[^"]*"/, `id: "${newName}"`);
|
|
@@ -3435,7 +3444,7 @@ async function renameTheme(themeDir, oldName, newName) {
|
|
|
3435
3444
|
);
|
|
3436
3445
|
await fs.writeFile(configPath, content);
|
|
3437
3446
|
}
|
|
3438
|
-
const layoutPath =
|
|
3447
|
+
const layoutPath = path8.join(themeDir, "theme.layout.ts");
|
|
3439
3448
|
if (await fs.pathExists(layoutPath)) {
|
|
3440
3449
|
let content = await fs.readFile(layoutPath, "utf-8");
|
|
3441
3450
|
content = content.replace(/id:\s*"[^"]*"/, `id: "${newName}"`);
|
|
@@ -3448,7 +3457,7 @@ async function renameTheme(themeDir, oldName, newName) {
|
|
|
3448
3457
|
const oldDisplayName = oldName.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
3449
3458
|
const tsFiles = await glob("**/*.ts", { cwd: themeDir, nodir: true });
|
|
3450
3459
|
for (const file of tsFiles) {
|
|
3451
|
-
const filePath =
|
|
3460
|
+
const filePath = path8.join(themeDir, file);
|
|
3452
3461
|
let content = await fs.readFile(filePath, "utf-8");
|
|
3453
3462
|
const original = content;
|
|
3454
3463
|
content = content.replace(
|
|
@@ -3477,7 +3486,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3477
3486
|
const spinner = ora("Initializing clone...").start();
|
|
3478
3487
|
try {
|
|
3479
3488
|
const bucket = options.bucket || getBucketName3(options.environment);
|
|
3480
|
-
const outputDir = options.output ||
|
|
3489
|
+
const outputDir = options.output || path8.resolve(process.cwd(), newName);
|
|
3481
3490
|
const s3Client = getS3Client3();
|
|
3482
3491
|
if (await fs.pathExists(outputDir)) {
|
|
3483
3492
|
spinner.fail(chalk4.red(`Directory already exists: ${outputDir}`));
|
|
@@ -3532,7 +3541,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3532
3541
|
spinner.succeed(
|
|
3533
3542
|
`Renamed theme: ${chalk4.gray(themeName)} \u2192 ${chalk4.cyan(newName)}`
|
|
3534
3543
|
);
|
|
3535
|
-
const envExamplePath =
|
|
3544
|
+
const envExamplePath = path8.join(outputDir, ".env.example");
|
|
3536
3545
|
if (!await fs.pathExists(envExamplePath)) {
|
|
3537
3546
|
await fs.writeFile(
|
|
3538
3547
|
envExamplePath,
|
|
@@ -3547,7 +3556,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3547
3556
|
}
|
|
3548
3557
|
if (options.install !== false) {
|
|
3549
3558
|
const hasPkgJson = await fs.pathExists(
|
|
3550
|
-
|
|
3559
|
+
path8.join(outputDir, "package.json")
|
|
3551
3560
|
);
|
|
3552
3561
|
if (hasPkgJson) {
|
|
3553
3562
|
spinner.start("Installing dependencies...");
|
|
@@ -3574,7 +3583,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3574
3583
|
console.log(chalk4.cyan(" Files: ") + chalk4.white(entries.length));
|
|
3575
3584
|
console.log();
|
|
3576
3585
|
console.log(chalk4.cyan("Next steps:"));
|
|
3577
|
-
console.log(chalk4.gray(` cd ${
|
|
3586
|
+
console.log(chalk4.gray(` cd ${path8.relative(process.cwd(), outputDir)}`));
|
|
3578
3587
|
console.log(chalk4.gray(" cp .env.example .env # then add your Company ID"));
|
|
3579
3588
|
if (options.install === false) {
|
|
3580
3589
|
console.log(chalk4.gray(" pnpm install"));
|
|
@@ -3627,7 +3636,7 @@ function createDevServer(options) {
|
|
|
3627
3636
|
serveFile(res, options.previewRuntimePath);
|
|
3628
3637
|
return;
|
|
3629
3638
|
}
|
|
3630
|
-
const filePath =
|
|
3639
|
+
const filePath = path8.join(options.distDir, pathname);
|
|
3631
3640
|
if (!filePath.startsWith(options.distDir)) {
|
|
3632
3641
|
res.writeHead(403);
|
|
3633
3642
|
res.end("Forbidden");
|
|
@@ -3668,7 +3677,7 @@ function serveFile(res, filePath) {
|
|
|
3668
3677
|
res.end("Not Found");
|
|
3669
3678
|
return;
|
|
3670
3679
|
}
|
|
3671
|
-
const ext =
|
|
3680
|
+
const ext = path8.extname(filePath);
|
|
3672
3681
|
const contentType = MIME_TYPES[ext] || "application/octet-stream";
|
|
3673
3682
|
const content = fs2.readFileSync(filePath);
|
|
3674
3683
|
res.writeHead(200, { "Content-Type": contentType });
|
|
@@ -3728,14 +3737,14 @@ async function devCommand(options) {
|
|
|
3728
3737
|
if (options.theme) {
|
|
3729
3738
|
themeName = options.theme;
|
|
3730
3739
|
try {
|
|
3731
|
-
const workspaceThemePath =
|
|
3740
|
+
const workspaceThemePath = path8.join(getThemesDir(), themeName);
|
|
3732
3741
|
if (fs.existsSync(workspaceThemePath)) {
|
|
3733
3742
|
themePath = workspaceThemePath;
|
|
3734
3743
|
} else {
|
|
3735
|
-
themePath =
|
|
3744
|
+
themePath = path8.join(process.cwd(), themeName);
|
|
3736
3745
|
}
|
|
3737
3746
|
} catch {
|
|
3738
|
-
themePath =
|
|
3747
|
+
themePath = path8.join(process.cwd(), themeName);
|
|
3739
3748
|
}
|
|
3740
3749
|
if (!fs.existsSync(themePath)) {
|
|
3741
3750
|
logger.error(`Theme "${themeName}" not found.`);
|
|
@@ -3746,10 +3755,10 @@ async function devCommand(options) {
|
|
|
3746
3755
|
"theme.config.ts",
|
|
3747
3756
|
"bundle-entry.ts",
|
|
3748
3757
|
"manifest.ts"
|
|
3749
|
-
].some((f) => fs.existsSync(
|
|
3758
|
+
].some((f) => fs.existsSync(path8.join(process.cwd(), f)));
|
|
3750
3759
|
if (isThemeDir) {
|
|
3751
3760
|
themePath = process.cwd();
|
|
3752
|
-
themeName =
|
|
3761
|
+
themeName = path8.basename(themePath);
|
|
3753
3762
|
} else {
|
|
3754
3763
|
logger.error(
|
|
3755
3764
|
"Not in a theme directory and no --theme specified. Run from theme root or use --theme flag."
|
|
@@ -3817,7 +3826,7 @@ async function devCommand(options) {
|
|
|
3817
3826
|
watcher.close();
|
|
3818
3827
|
await context2.dispose();
|
|
3819
3828
|
server.close();
|
|
3820
|
-
const shimPath =
|
|
3829
|
+
const shimPath = path8.join(outputDir, ".process-shim.js");
|
|
3821
3830
|
try {
|
|
3822
3831
|
await fs7.unlink(shimPath);
|
|
3823
3832
|
} catch {
|
|
@@ -3830,14 +3839,14 @@ async function devCommand(options) {
|
|
|
3830
3839
|
try {
|
|
3831
3840
|
const projectRoot = getProjectRoot();
|
|
3832
3841
|
dotenv.config({
|
|
3833
|
-
path:
|
|
3842
|
+
path: path8.join(projectRoot, ".env.local"),
|
|
3834
3843
|
quiet: true
|
|
3835
3844
|
});
|
|
3836
|
-
dotenv.config({ path:
|
|
3845
|
+
dotenv.config({ path: path8.join(projectRoot, ".env"), quiet: true });
|
|
3837
3846
|
} catch {
|
|
3838
3847
|
}
|
|
3839
3848
|
dotenv.config({
|
|
3840
|
-
path:
|
|
3849
|
+
path: path8.join(os.homedir(), ".onex", ".env"),
|
|
3841
3850
|
quiet: true
|
|
3842
3851
|
});
|
|
3843
3852
|
var program = new Command();
|