uc-dev 1.0.3 → 1.0.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/out/cli.js +46 -45
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -724,7 +724,7 @@ import { existsSync as existsSync4 } from "node:fs";
|
|
|
724
724
|
|
|
725
725
|
// src/utils/prompt.ts
|
|
726
726
|
import { existsSync as existsSync3, readFileSync, writeFileSync } from "node:fs";
|
|
727
|
-
import { dirname as dirname2, resolve as
|
|
727
|
+
import { dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
728
728
|
import readline from "node:readline";
|
|
729
729
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
730
730
|
|
|
@@ -1094,7 +1094,7 @@ var ImportMapResolver = class {
|
|
|
1094
1094
|
// ../ap-shared-core/out/uc-dev/ConfigHandler.js
|
|
1095
1095
|
import { createRequire } from "module";
|
|
1096
1096
|
import fs2, { readdirSync } from "node:fs";
|
|
1097
|
-
import path2, { join as join2, normalize as normalize2
|
|
1097
|
+
import path2, { join as join2, normalize as normalize2 } from "node:path";
|
|
1098
1098
|
import url2 from "node:url";
|
|
1099
1099
|
|
|
1100
1100
|
// ../ap-shared-core/out/uc-dev/userConfigManage.js
|
|
@@ -1208,7 +1208,8 @@ var ConfigHandler = class {
|
|
|
1208
1208
|
const pathAlias = prow.config?.browser?.importmap ?? {};
|
|
1209
1209
|
for (let [als, relPath] of Object.entries(pathAlias)) {
|
|
1210
1210
|
als = trimPath(als);
|
|
1211
|
-
|
|
1211
|
+
console.log([prow.projectPath, prow.rootPath]);
|
|
1212
|
+
let fpath = prow.projectPath;
|
|
1212
1213
|
let resolvPath = normalize2(path2.join(fpath, relPath));
|
|
1213
1214
|
if (!fs2.existsSync(resolvPath)) {
|
|
1214
1215
|
console.warn("ImportMap path not found:", resolvPath);
|
|
@@ -1386,10 +1387,10 @@ function ask(question, def) {
|
|
|
1386
1387
|
output: process.stdout
|
|
1387
1388
|
});
|
|
1388
1389
|
const hint = def ? ` (${def})` : "";
|
|
1389
|
-
return new Promise((
|
|
1390
|
+
return new Promise((resolve12) => {
|
|
1390
1391
|
rl.question(`${question}${hint}: `, (ans) => {
|
|
1391
1392
|
rl.close();
|
|
1392
|
-
|
|
1393
|
+
resolve12(ans.trim() || def || "");
|
|
1393
1394
|
});
|
|
1394
1395
|
});
|
|
1395
1396
|
}
|
|
@@ -1401,7 +1402,7 @@ async function askYesNo(question, def = true, autoYes = false) {
|
|
|
1401
1402
|
return ans.startsWith("y");
|
|
1402
1403
|
}
|
|
1403
1404
|
function runTemplate(tptPath, importmeta, row) {
|
|
1404
|
-
const tpath =
|
|
1405
|
+
const tpath = resolve2(dirname2(fileURLToPath4(importmeta)), tptPath);
|
|
1405
1406
|
let tptContent = readFileSync(tpath, "utf8");
|
|
1406
1407
|
const tmaker = new TemplateMaker();
|
|
1407
1408
|
const callback = tmaker.compileTemplate(tptContent);
|
|
@@ -1457,13 +1458,13 @@ var cliDependancyChecker = class {
|
|
|
1457
1458
|
const args2 = [...baseArgs, ...pkgs];
|
|
1458
1459
|
console.log("Installing:", pkgs.join(", "));
|
|
1459
1460
|
console.log(">", pm, args2.join(" "));
|
|
1460
|
-
return new Promise((
|
|
1461
|
+
return new Promise((resolve12, reject) => {
|
|
1461
1462
|
const child = spawn(pm, args2, {
|
|
1462
1463
|
stdio: "inherit",
|
|
1463
1464
|
shell: true
|
|
1464
1465
|
});
|
|
1465
1466
|
child.on("close", (code) => {
|
|
1466
|
-
if (code === 0)
|
|
1467
|
+
if (code === 0) resolve12();
|
|
1467
1468
|
else reject(new Error(`Install failed with code ${code}`));
|
|
1468
1469
|
});
|
|
1469
1470
|
child.on("error", reject);
|
|
@@ -1516,7 +1517,7 @@ function getProjectDir(startPath) {
|
|
|
1516
1517
|
|
|
1517
1518
|
// src/utils/inquiry/cliUcconfigInquiry.ts
|
|
1518
1519
|
import { existsSync as existsSync6, readFileSync as readFileSync2 } from "node:fs";
|
|
1519
|
-
import { dirname as dirname3, join as join3, resolve as
|
|
1520
|
+
import { dirname as dirname3, join as join3, resolve as resolve3 } from "node:path";
|
|
1520
1521
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
1521
1522
|
var cliUcconfigInquiry = class {
|
|
1522
1523
|
constructor(main2) {
|
|
@@ -1602,7 +1603,7 @@ var cliUcconfigInquiry = class {
|
|
|
1602
1603
|
};
|
|
1603
1604
|
try {
|
|
1604
1605
|
await writeFileSafely(
|
|
1605
|
-
|
|
1606
|
+
resolve3("ucconfig.js"),
|
|
1606
1607
|
_runTemplate("templates/js.ucconfig", JSON.parse(JSON.stringify(cfg))),
|
|
1607
1608
|
this.main.cliOptions
|
|
1608
1609
|
);
|
|
@@ -1808,16 +1809,16 @@ function splitCSSById(cssContent, rtrn) {
|
|
|
1808
1809
|
|
|
1809
1810
|
// src/lib/processes/BuildDesigner.ts
|
|
1810
1811
|
import { existsSync as existsSync9, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
1811
|
-
import { join as join6, normalize as normalize5, relative as relative2, resolve as
|
|
1812
|
+
import { join as join6, normalize as normalize5, relative as relative2, resolve as resolve6 } from "path";
|
|
1812
1813
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
1813
1814
|
|
|
1814
1815
|
// src/lib/processes/commonGeneratorX.ts
|
|
1815
1816
|
import { existsSync as existsSync8, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
1816
|
-
import { dirname as dirname5, join as join5, normalize as normalize4, resolve as
|
|
1817
|
+
import { dirname as dirname5, join as join5, normalize as normalize4, resolve as resolve5 } from "path";
|
|
1817
1818
|
|
|
1818
1819
|
// src/lib/processes/ResourceBuildEngine.ts
|
|
1819
1820
|
import { existsSync as existsSync7, readFileSync as readFileSync3 } from "fs";
|
|
1820
|
-
import { dirname as dirname4, extname, join as join4, normalize as normalize3, resolve as
|
|
1821
|
+
import { dirname as dirname4, extname, join as join4, normalize as normalize3, resolve as resolve4, sep } from "path";
|
|
1821
1822
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
1822
1823
|
var SCSS_IMPORT_RE = /@(use|import)\s+(?:url\()?["']([^"')]+)["']\)?\s*;/gi;
|
|
1823
1824
|
var CSS_URL_RE = /url\(\s*["']?([^"')]+)["']?\s*\)/gi;
|
|
@@ -1922,7 +1923,7 @@ var ResourceBuildEngine = class {
|
|
|
1922
1923
|
if (_path.startsWith("file:///")) _path = fileURLToPath6(_path);
|
|
1923
1924
|
const absPath = (
|
|
1924
1925
|
/*GetProject(path)*/
|
|
1925
|
-
|
|
1926
|
+
resolve4(_path)
|
|
1926
1927
|
);
|
|
1927
1928
|
const blueprint = new UserResource();
|
|
1928
1929
|
Object.assign(blueprint, _blueprint);
|
|
@@ -1983,7 +1984,7 @@ var ResourceBuildEngine = class {
|
|
|
1983
1984
|
css = stripCssComments(css);
|
|
1984
1985
|
css = ucUtil.devEsc(css);
|
|
1985
1986
|
css = css.replace(INSIDE_ATTR_RE, (_m, _q, rel, rest) => {
|
|
1986
|
-
const targetAbs =
|
|
1987
|
+
const targetAbs = resolve4(dirname4(absPath), rel);
|
|
1987
1988
|
const key = this.build(targetAbs);
|
|
1988
1989
|
return key ? `[inside="${key}"]${rest}` : _m;
|
|
1989
1990
|
});
|
|
@@ -2060,7 +2061,7 @@ var ResourceBuildEngine = class {
|
|
|
2060
2061
|
this.resourceMap.set(rel, res);
|
|
2061
2062
|
return ResourceKeyBridge.makeKey(guid);
|
|
2062
2063
|
}
|
|
2063
|
-
const abs =
|
|
2064
|
+
const abs = resolve4(dirname4(importerPath), rel);
|
|
2064
2065
|
if (!existsSync7(abs)) return rel;
|
|
2065
2066
|
return this.build(abs, _blueprint);
|
|
2066
2067
|
}
|
|
@@ -2184,7 +2185,7 @@ var commonGeneratorX = class _commonGeneratorX {
|
|
|
2184
2185
|
declareClassPath: BuildingProcess.configHandler.MAIN_CONFIG.projectName == "uc-runtime" ? "uc-runtime/src/core-main" : "uc-runtime/core-main"
|
|
2185
2186
|
};
|
|
2186
2187
|
const srcDec = x.srcDec;
|
|
2187
|
-
let resSrcFile =
|
|
2188
|
+
let resSrcFile = resolve5(proj.projectPath, x.srcDec.dirPath, x.cli.ResourceStorageFile);
|
|
2188
2189
|
rowForRes.projectList.forEach((s) => {
|
|
2189
2190
|
const resFullpath = s.resourceRelativePath;
|
|
2190
2191
|
s.resourceRelativePath = JSON.stringify(resFullpath);
|
|
@@ -7395,7 +7396,7 @@ var BuildDesigner = class {
|
|
|
7395
7396
|
const srcPathof = _row.src.allPathOf[pref.srcDec];
|
|
7396
7397
|
const outPathof = _row.src.allPathOf[pref.outDec];
|
|
7397
7398
|
let onSelect_xName = BuildingProcess.Event.onSelect_xName;
|
|
7398
|
-
let projectPath =
|
|
7399
|
+
let projectPath = resolve6();
|
|
7399
7400
|
let htmlcode = this.common0(_row);
|
|
7400
7401
|
if (htmlcode == void 0) return void 0;
|
|
7401
7402
|
htmlcode = ucUtil.devEsc(htmlcode);
|
|
@@ -7506,7 +7507,7 @@ var BuildDesigner = class {
|
|
|
7506
7507
|
}
|
|
7507
7508
|
};
|
|
7508
7509
|
nc(_path, fromFilePath) {
|
|
7509
|
-
let fpath = join6(
|
|
7510
|
+
let fpath = join6(resolve6(), _path);
|
|
7510
7511
|
return correctpath(ucUtil.resolveSubNode(relativeFilePath(fromFilePath, fpath)));
|
|
7511
7512
|
}
|
|
7512
7513
|
};
|
|
@@ -7793,7 +7794,7 @@ var cliMenuSource = class {
|
|
|
7793
7794
|
};
|
|
7794
7795
|
|
|
7795
7796
|
// src/utils/inquiry/cliElectronInquiry.ts
|
|
7796
|
-
import { dirname as dirname6, join as join9, resolve as
|
|
7797
|
+
import { dirname as dirname6, join as join9, resolve as resolve7 } from "node:path";
|
|
7797
7798
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
7798
7799
|
var cliElectronInquiry = class {
|
|
7799
7800
|
constructor(main2) {
|
|
@@ -7802,13 +7803,13 @@ var cliElectronInquiry = class {
|
|
|
7802
7803
|
async generate(hasAddedSampleForm = false) {
|
|
7803
7804
|
const cfg = this.main.config;
|
|
7804
7805
|
const cli = cfg.cli;
|
|
7805
|
-
const mainFilePath =
|
|
7806
|
-
const preloadFilePath =
|
|
7807
|
-
const baseHtmlPath =
|
|
7808
|
-
const baseCodePath =
|
|
7809
|
-
const baseCodeOutPath =
|
|
7810
|
-
const ResourceStorageFile =
|
|
7811
|
-
const baseCssPath =
|
|
7806
|
+
const mainFilePath = resolve7(join9(cli.srcDir, cli.mainProcessFilePath));
|
|
7807
|
+
const preloadFilePath = resolve7(join9(cli.srcDir, cli.preloadScriptFilePath));
|
|
7808
|
+
const baseHtmlPath = resolve7(cli.baseHtmlPath);
|
|
7809
|
+
const baseCodePath = resolve7(join9(cli.srcDir, cli.baseCodePath));
|
|
7810
|
+
const baseCodeOutPath = resolve7(join9(cli.outDir, cli.baseCodePath));
|
|
7811
|
+
const ResourceStorageFile = resolve7(join9(cli.srcDir, cli.ResourceStorageFile));
|
|
7812
|
+
const baseCssPath = resolve7(cli.baseCssPath);
|
|
7812
7813
|
writeFileSafely(
|
|
7813
7814
|
mainFilePath,
|
|
7814
7815
|
_runTemplate2("templates/electron/ts.main", {
|
|
@@ -7869,14 +7870,14 @@ function _runTemplate2(rel, options) {
|
|
|
7869
7870
|
}
|
|
7870
7871
|
|
|
7871
7872
|
// src/utils/inquiry/cliNewStartInquiry.ts
|
|
7872
|
-
import { dirname as dirname7, join as join10, resolve as
|
|
7873
|
+
import { dirname as dirname7, join as join10, resolve as resolve8 } from "node:path";
|
|
7873
7874
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
7874
7875
|
var cliNewStartInquiry = class {
|
|
7875
7876
|
constructor(main2) {
|
|
7876
7877
|
this.main = main2;
|
|
7877
7878
|
}
|
|
7878
7879
|
async inquiry() {
|
|
7879
|
-
const cfg = await ImportUserConfig(
|
|
7880
|
+
const cfg = await ImportUserConfig(resolve8("ucconfig.js"));
|
|
7880
7881
|
if (await askYesNo(`
|
|
7881
7882
|
+-----------------------------+
|
|
7882
7883
|
| EMPTY PROJECT |
|
|
@@ -7892,12 +7893,12 @@ ADD BLANK FORM?
|
|
|
7892
7893
|
let ddirdpath = await ask(`WHERE TO GENERATE?
|
|
7893
7894
|
INSIDE ('${renderDirPath}' DIRECTORY)
|
|
7894
7895
|
>`, "");
|
|
7895
|
-
__dpath = join10(
|
|
7896
|
+
__dpath = join10(resolve8(renderDirPath), ddirdpath);
|
|
7896
7897
|
} else {
|
|
7897
7898
|
let dirPath = await ask(`WHERE TO GENERATE?
|
|
7898
7899
|
INSIDE ('${srcdec.dirPath}' DIRECTORY)
|
|
7899
7900
|
>`, "");
|
|
7900
|
-
__dpath = join10(
|
|
7901
|
+
__dpath = join10(resolve8(srcdec.dirPath), dirPath);
|
|
7901
7902
|
}
|
|
7902
7903
|
writeFileSafely(
|
|
7903
7904
|
join10(__dpath, "form1.uc.html"),
|
|
@@ -7918,7 +7919,7 @@ function _runTemplate3(rel, options) {
|
|
|
7918
7919
|
|
|
7919
7920
|
// src/utils/inquiry/cliTypeScriptInquiry.ts
|
|
7920
7921
|
import { existsSync as existsSync10 } from "node:fs";
|
|
7921
|
-
import { dirname as dirname8, join as join11, resolve as
|
|
7922
|
+
import { dirname as dirname8, join as join11, resolve as resolve9 } from "node:path";
|
|
7922
7923
|
var cliTypeScriptInquiry = class {
|
|
7923
7924
|
constructor(main2) {
|
|
7924
7925
|
this.main = main2;
|
|
@@ -7929,7 +7930,7 @@ var cliTypeScriptInquiry = class {
|
|
|
7929
7930
|
}
|
|
7930
7931
|
async inquiry() {
|
|
7931
7932
|
const x = extractPathConfig(this.main.config);
|
|
7932
|
-
if (x.cli.useTypeScript && !existsSync10(
|
|
7933
|
+
if (x.cli.useTypeScript && !existsSync10(resolve9("tsconfig.json"))) {
|
|
7933
7934
|
if (await askYesNo(
|
|
7934
7935
|
`
|
|
7935
7936
|
ADD 'tsconfig.json' with required settings?
|
|
@@ -8018,11 +8019,11 @@ async function makeMenu(title, content, defaultOpt) {
|
|
|
8018
8019
|
}
|
|
8019
8020
|
|
|
8020
8021
|
// src/utils/inquiry/cli_menu_generate.ts
|
|
8021
|
-
import { dirname as dirname11, join as join14, resolve as
|
|
8022
|
+
import { dirname as dirname11, join as join14, resolve as resolve11 } from "node:path";
|
|
8022
8023
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
8023
8024
|
|
|
8024
8025
|
// src/utils/inquiry/cli_sample_style1.ts
|
|
8025
|
-
import { dirname as dirname10, join as join13, relative as relative4, resolve as
|
|
8026
|
+
import { dirname as dirname10, join as join13, relative as relative4, resolve as resolve10 } from "node:path";
|
|
8026
8027
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
8027
8028
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
8028
8029
|
async function cli_sample_style1(main2) {
|
|
@@ -8030,18 +8031,18 @@ async function cli_sample_style1(main2) {
|
|
|
8030
8031
|
const sampleroot = dirname10(join13(cli.srcDir, cli.baseCodePath));
|
|
8031
8032
|
const sample = {
|
|
8032
8033
|
frmDashboard: {
|
|
8033
|
-
html:
|
|
8034
|
-
scss:
|
|
8035
|
-
code:
|
|
8034
|
+
html: resolve10(join13(sampleroot, "frmDashboard.uc.html")),
|
|
8035
|
+
scss: resolve10(join13(sampleroot, "frmDashboard.uc.scss")),
|
|
8036
|
+
code: resolve10(join13(sampleroot, "frmDashboard.uc.ts"))
|
|
8036
8037
|
},
|
|
8037
8038
|
tptDashboard: {
|
|
8038
|
-
html:
|
|
8039
|
-
scss:
|
|
8040
|
-
code:
|
|
8039
|
+
html: resolve10(join13(sampleroot, "tptDashboard.tpt.html")),
|
|
8040
|
+
scss: resolve10(join13(sampleroot, "tptDashboard.tpt.scss")),
|
|
8041
|
+
code: resolve10(join13(sampleroot, "tptDashboard.tpt.ts"))
|
|
8041
8042
|
}
|
|
8042
8043
|
};
|
|
8043
|
-
const relHtmlPath = relative4(
|
|
8044
|
-
const designerRoot = ucUtil.changeExtension(
|
|
8044
|
+
const relHtmlPath = relative4(resolve10(cli.srcDir), sample.frmDashboard.html);
|
|
8045
|
+
const designerRoot = ucUtil.changeExtension(resolve10(join13(cli.srcDir, cli.designerDir, relHtmlPath)), ".html", ".designer.js");
|
|
8045
8046
|
const templateRoot = "templates/sample1";
|
|
8046
8047
|
await writeFileSafely(
|
|
8047
8048
|
sample.frmDashboard.html,
|
|
@@ -8120,7 +8121,7 @@ async function cli_menu_generate(main2, back_menu_callback = async () => {
|
|
|
8120
8121
|
case "t":
|
|
8121
8122
|
const cli = main2.config.cli;
|
|
8122
8123
|
await writeFileSafely(
|
|
8123
|
-
|
|
8124
|
+
resolve11("tsconfig.json"),
|
|
8124
8125
|
_runTemplate5("templates/typescript/json.tsconfig", {
|
|
8125
8126
|
outDir: main2.config.cli.outDir,
|
|
8126
8127
|
srcDir: main2.config.cli.srcDir,
|
|
@@ -8132,7 +8133,7 @@ async function cli_menu_generate(main2, back_menu_callback = async () => {
|
|
|
8132
8133
|
break;
|
|
8133
8134
|
case "v":
|
|
8134
8135
|
await writeFileSafely(
|
|
8135
|
-
|
|
8136
|
+
resolve11(".vscode/settings.json"),
|
|
8136
8137
|
_runTemplate5("templates/.vscode/json.settings", {}),
|
|
8137
8138
|
main2.cliOptions
|
|
8138
8139
|
);
|