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