uc-dev 1.0.0-beta.5 → 1.0.2

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.
Files changed (2) hide show
  1. package/out/cli.js +60 -56
  2. 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 resolve2 } from "node:path";
727
+ import { dirname as dirname2, resolve as resolve3 } 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 } from "node:path";
1097
+ import path2, { join as join2, normalize as normalize2, resolve as resolve2 } 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,12 @@ 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
- let fpath = prow.projectPath;
1212
- let resolvPath = path2.resolve(fpath, relPath);
1211
+ let fpath = resolve2(prow.projectPath, prow.rootPath);
1212
+ let resolvPath = normalize2(path2.join(fpath, relPath));
1213
+ if (!fs2.existsSync(resolvPath)) {
1214
+ console.warn("ImportMap path not found:", resolvPath);
1215
+ continue;
1216
+ }
1213
1217
  if (!fs2.existsSync(resolvPath)) {
1214
1218
  console.warn("ImportMap path not found:", resolvPath);
1215
1219
  continue;
@@ -1382,10 +1386,10 @@ function ask(question, def) {
1382
1386
  output: process.stdout
1383
1387
  });
1384
1388
  const hint = def ? ` (${def})` : "";
1385
- return new Promise((resolve12) => {
1389
+ return new Promise((resolve13) => {
1386
1390
  rl.question(`${question}${hint}: `, (ans) => {
1387
1391
  rl.close();
1388
- resolve12(ans.trim() || def || "");
1392
+ resolve13(ans.trim() || def || "");
1389
1393
  });
1390
1394
  });
1391
1395
  }
@@ -1397,7 +1401,7 @@ async function askYesNo(question, def = true, autoYes = false) {
1397
1401
  return ans.startsWith("y");
1398
1402
  }
1399
1403
  function runTemplate(tptPath, importmeta, row) {
1400
- const tpath = resolve2(dirname2(fileURLToPath4(importmeta)), tptPath);
1404
+ const tpath = resolve3(dirname2(fileURLToPath4(importmeta)), tptPath);
1401
1405
  let tptContent = readFileSync(tpath, "utf8");
1402
1406
  const tmaker = new TemplateMaker();
1403
1407
  const callback = tmaker.compileTemplate(tptContent);
@@ -1444,22 +1448,22 @@ var cliDependancyChecker = class {
1444
1448
  return _deps;
1445
1449
  }
1446
1450
  detectPackageManager() {
1447
- if (existsSync4("pnpm-lock.yaml")) return "pnpm add -D";
1448
- if (existsSync4("yarn.lock")) return "yarn add -D";
1449
- return "npm install -D";
1451
+ if (existsSync4("pnpm-lock.yaml")) return "pnpm add ";
1452
+ if (existsSync4("yarn.lock")) return "yarn add ";
1453
+ return "npm install ";
1450
1454
  }
1451
1455
  installPackages(pkgs) {
1452
1456
  const [pm, ...baseArgs] = this.detectPackageManager().split(" ");
1453
1457
  const args2 = [...baseArgs, ...pkgs];
1454
1458
  console.log("Installing:", pkgs.join(", "));
1455
1459
  console.log(">", pm, args2.join(" "));
1456
- return new Promise((resolve12, reject) => {
1460
+ return new Promise((resolve13, reject) => {
1457
1461
  const child = spawn(pm, args2, {
1458
1462
  stdio: "inherit",
1459
1463
  shell: true
1460
1464
  });
1461
1465
  child.on("close", (code) => {
1462
- if (code === 0) resolve12();
1466
+ if (code === 0) resolve13();
1463
1467
  else reject(new Error(`Install failed with code ${code}`));
1464
1468
  });
1465
1469
  child.on("error", reject);
@@ -1512,7 +1516,7 @@ function getProjectDir(startPath) {
1512
1516
 
1513
1517
  // src/utils/inquiry/cliUcconfigInquiry.ts
1514
1518
  import { existsSync as existsSync6, readFileSync as readFileSync2 } from "node:fs";
1515
- import { dirname as dirname3, join as join3, resolve as resolve3 } from "node:path";
1519
+ import { dirname as dirname3, join as join3, resolve as resolve4 } from "node:path";
1516
1520
  import { fileURLToPath as fileURLToPath5 } from "node:url";
1517
1521
  var cliUcconfigInquiry = class {
1518
1522
  constructor(main2) {
@@ -1598,7 +1602,7 @@ var cliUcconfigInquiry = class {
1598
1602
  };
1599
1603
  try {
1600
1604
  await writeFileSafely(
1601
- resolve3("ucconfig.js"),
1605
+ resolve4("ucconfig.js"),
1602
1606
  _runTemplate("templates/js.ucconfig", JSON.parse(JSON.stringify(cfg))),
1603
1607
  this.main.cliOptions
1604
1608
  );
@@ -1804,16 +1808,16 @@ function splitCSSById(cssContent, rtrn) {
1804
1808
 
1805
1809
  // src/lib/processes/BuildDesigner.ts
1806
1810
  import { existsSync as existsSync9, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
1807
- import { join as join6, normalize as normalize5, relative as relative2, resolve as resolve6 } from "path";
1811
+ import { join as join6, normalize as normalize5, relative as relative2, resolve as resolve7 } from "path";
1808
1812
  import { fileURLToPath as fileURLToPath8 } from "url";
1809
1813
 
1810
1814
  // src/lib/processes/commonGeneratorX.ts
1811
1815
  import { existsSync as existsSync8, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
1812
- import { dirname as dirname5, join as join5, normalize as normalize4, resolve as resolve5 } from "path";
1816
+ import { dirname as dirname5, join as join5, normalize as normalize4, resolve as resolve6 } from "path";
1813
1817
 
1814
1818
  // src/lib/processes/ResourceBuildEngine.ts
1815
1819
  import { existsSync as existsSync7, readFileSync as readFileSync3 } from "fs";
1816
- import { dirname as dirname4, extname, join as join4, normalize as normalize3, resolve as resolve4, sep } from "path";
1820
+ import { dirname as dirname4, extname, join as join4, normalize as normalize3, resolve as resolve5, sep } from "path";
1817
1821
  import { fileURLToPath as fileURLToPath6 } from "url";
1818
1822
  var SCSS_IMPORT_RE = /@(use|import)\s+(?:url\()?["']([^"')]+)["']\)?\s*;/gi;
1819
1823
  var CSS_URL_RE = /url\(\s*["']?([^"')]+)["']?\s*\)/gi;
@@ -1918,7 +1922,7 @@ var ResourceBuildEngine = class {
1918
1922
  if (_path.startsWith("file:///")) _path = fileURLToPath6(_path);
1919
1923
  const absPath = (
1920
1924
  /*GetProject(path)*/
1921
- resolve4(_path)
1925
+ resolve5(_path)
1922
1926
  );
1923
1927
  const blueprint = new UserResource();
1924
1928
  Object.assign(blueprint, _blueprint);
@@ -1979,7 +1983,7 @@ var ResourceBuildEngine = class {
1979
1983
  css = stripCssComments(css);
1980
1984
  css = ucUtil.devEsc(css);
1981
1985
  css = css.replace(INSIDE_ATTR_RE, (_m, _q, rel, rest) => {
1982
- const targetAbs = resolve4(dirname4(absPath), rel);
1986
+ const targetAbs = resolve5(dirname4(absPath), rel);
1983
1987
  const key = this.build(targetAbs);
1984
1988
  return key ? `[inside="${key}"]${rest}` : _m;
1985
1989
  });
@@ -2056,7 +2060,7 @@ var ResourceBuildEngine = class {
2056
2060
  this.resourceMap.set(rel, res);
2057
2061
  return ResourceKeyBridge.makeKey(guid);
2058
2062
  }
2059
- const abs = resolve4(dirname4(importerPath), rel);
2063
+ const abs = resolve5(dirname4(importerPath), rel);
2060
2064
  if (!existsSync7(abs)) return rel;
2061
2065
  return this.build(abs, _blueprint);
2062
2066
  }
@@ -2180,7 +2184,7 @@ var commonGeneratorX = class _commonGeneratorX {
2180
2184
  declareClassPath: BuildingProcess.configHandler.MAIN_CONFIG.projectName == "uc-runtime" ? "uc-runtime/src/core-main" : "uc-runtime/core-main"
2181
2185
  };
2182
2186
  const srcDec = x.srcDec;
2183
- let resSrcFile = resolve5(proj.projectPath, x.srcDec.dirPath, x.cli.ResourceStorageFile);
2187
+ let resSrcFile = resolve6(proj.projectPath, x.srcDec.dirPath, x.cli.ResourceStorageFile);
2184
2188
  rowForRes.projectList.forEach((s) => {
2185
2189
  const resFullpath = s.resourceRelativePath;
2186
2190
  s.resourceRelativePath = JSON.stringify(resFullpath);
@@ -7391,7 +7395,7 @@ var BuildDesigner = class {
7391
7395
  const srcPathof = _row.src.allPathOf[pref.srcDec];
7392
7396
  const outPathof = _row.src.allPathOf[pref.outDec];
7393
7397
  let onSelect_xName = BuildingProcess.Event.onSelect_xName;
7394
- let projectPath = resolve6();
7398
+ let projectPath = resolve7();
7395
7399
  let htmlcode = this.common0(_row);
7396
7400
  if (htmlcode == void 0) return void 0;
7397
7401
  htmlcode = ucUtil.devEsc(htmlcode);
@@ -7502,7 +7506,7 @@ var BuildDesigner = class {
7502
7506
  }
7503
7507
  };
7504
7508
  nc(_path, fromFilePath) {
7505
- let fpath = join6(resolve6(), _path);
7509
+ let fpath = join6(resolve7(), _path);
7506
7510
  return correctpath(ucUtil.resolveSubNode(relativeFilePath(fromFilePath, fpath)));
7507
7511
  }
7508
7512
  };
@@ -7789,7 +7793,7 @@ var cliMenuSource = class {
7789
7793
  };
7790
7794
 
7791
7795
  // src/utils/inquiry/cliElectronInquiry.ts
7792
- import { dirname as dirname6, join as join9, resolve as resolve7 } from "node:path";
7796
+ import { dirname as dirname6, join as join9, resolve as resolve8 } from "node:path";
7793
7797
  import { fileURLToPath as fileURLToPath9 } from "node:url";
7794
7798
  var cliElectronInquiry = class {
7795
7799
  constructor(main2) {
@@ -7798,13 +7802,13 @@ var cliElectronInquiry = class {
7798
7802
  async generate(hasAddedSampleForm = false) {
7799
7803
  const cfg = this.main.config;
7800
7804
  const cli = cfg.cli;
7801
- const mainFilePath = resolve7(join9(cli.srcDir, cli.mainProcessFilePath));
7802
- const preloadFilePath = resolve7(join9(cli.srcDir, cli.preloadScriptFilePath));
7803
- const baseHtmlPath = resolve7(cli.baseHtmlPath);
7804
- const baseCodePath = resolve7(join9(cli.srcDir, cli.baseCodePath));
7805
- const baseCodeOutPath = resolve7(join9(cli.outDir, cli.baseCodePath));
7806
- const ResourceStorageFile = resolve7(join9(cli.srcDir, cli.ResourceStorageFile));
7807
- const baseCssPath = resolve7(cli.baseCssPath);
7805
+ const mainFilePath = resolve8(join9(cli.srcDir, cli.mainProcessFilePath));
7806
+ const preloadFilePath = resolve8(join9(cli.srcDir, cli.preloadScriptFilePath));
7807
+ const baseHtmlPath = resolve8(cli.baseHtmlPath);
7808
+ const baseCodePath = resolve8(join9(cli.srcDir, cli.baseCodePath));
7809
+ const baseCodeOutPath = resolve8(join9(cli.outDir, cli.baseCodePath));
7810
+ const ResourceStorageFile = resolve8(join9(cli.srcDir, cli.ResourceStorageFile));
7811
+ const baseCssPath = resolve8(cli.baseCssPath);
7808
7812
  writeFileSafely(
7809
7813
  mainFilePath,
7810
7814
  _runTemplate2("templates/electron/ts.main", {
@@ -7865,14 +7869,14 @@ function _runTemplate2(rel, options) {
7865
7869
  }
7866
7870
 
7867
7871
  // src/utils/inquiry/cliNewStartInquiry.ts
7868
- import { dirname as dirname7, join as join10, resolve as resolve8 } from "node:path";
7872
+ import { dirname as dirname7, join as join10, resolve as resolve9 } from "node:path";
7869
7873
  import { fileURLToPath as fileURLToPath10 } from "node:url";
7870
7874
  var cliNewStartInquiry = class {
7871
7875
  constructor(main2) {
7872
7876
  this.main = main2;
7873
7877
  }
7874
7878
  async inquiry() {
7875
- const cfg = await ImportUserConfig(resolve8("ucconfig.js"));
7879
+ const cfg = await ImportUserConfig(resolve9("ucconfig.js"));
7876
7880
  if (await askYesNo(`
7877
7881
  +-----------------------------+
7878
7882
  | EMPTY PROJECT |
@@ -7888,12 +7892,12 @@ ADD BLANK FORM?
7888
7892
  let ddirdpath = await ask(`WHERE TO GENERATE?
7889
7893
  INSIDE ('${renderDirPath}' DIRECTORY)
7890
7894
  >`, "");
7891
- __dpath = join10(resolve8(renderDirPath), ddirdpath);
7895
+ __dpath = join10(resolve9(renderDirPath), ddirdpath);
7892
7896
  } else {
7893
7897
  let dirPath = await ask(`WHERE TO GENERATE?
7894
7898
  INSIDE ('${srcdec.dirPath}' DIRECTORY)
7895
7899
  >`, "");
7896
- __dpath = join10(resolve8(srcdec.dirPath), dirPath);
7900
+ __dpath = join10(resolve9(srcdec.dirPath), dirPath);
7897
7901
  }
7898
7902
  writeFileSafely(
7899
7903
  join10(__dpath, "form1.uc.html"),
@@ -7914,7 +7918,7 @@ function _runTemplate3(rel, options) {
7914
7918
 
7915
7919
  // src/utils/inquiry/cliTypeScriptInquiry.ts
7916
7920
  import { existsSync as existsSync10 } from "node:fs";
7917
- import { dirname as dirname8, join as join11, resolve as resolve9 } from "node:path";
7921
+ import { dirname as dirname8, join as join11, resolve as resolve10 } from "node:path";
7918
7922
  var cliTypeScriptInquiry = class {
7919
7923
  constructor(main2) {
7920
7924
  this.main = main2;
@@ -7925,7 +7929,7 @@ var cliTypeScriptInquiry = class {
7925
7929
  }
7926
7930
  async inquiry() {
7927
7931
  const x = extractPathConfig(this.main.config);
7928
- if (x.cli.useTypeScript && !existsSync10(resolve9("tsconfig.json"))) {
7932
+ if (x.cli.useTypeScript && !existsSync10(resolve10("tsconfig.json"))) {
7929
7933
  if (await askYesNo(
7930
7934
  `
7931
7935
  ADD 'tsconfig.json' with required settings?
@@ -8014,11 +8018,11 @@ async function makeMenu(title, content, defaultOpt) {
8014
8018
  }
8015
8019
 
8016
8020
  // src/utils/inquiry/cli_menu_generate.ts
8017
- import { dirname as dirname11, join as join14, resolve as resolve11 } from "node:path";
8021
+ import { dirname as dirname11, join as join14, resolve as resolve12 } from "node:path";
8018
8022
  import { fileURLToPath as fileURLToPath12 } from "node:url";
8019
8023
 
8020
8024
  // src/utils/inquiry/cli_sample_style1.ts
8021
- import { dirname as dirname10, join as join13, relative as relative4, resolve as resolve10 } from "node:path";
8025
+ import { dirname as dirname10, join as join13, relative as relative4, resolve as resolve11 } from "node:path";
8022
8026
  import { fileURLToPath as fileURLToPath11 } from "node:url";
8023
8027
  import { readFileSync as readFileSync6 } from "node:fs";
8024
8028
  async function cli_sample_style1(main2) {
@@ -8026,18 +8030,18 @@ async function cli_sample_style1(main2) {
8026
8030
  const sampleroot = dirname10(join13(cli.srcDir, cli.baseCodePath));
8027
8031
  const sample = {
8028
8032
  frmDashboard: {
8029
- html: resolve10(join13(sampleroot, "frmDashboard.uc.html")),
8030
- scss: resolve10(join13(sampleroot, "frmDashboard.uc.scss")),
8031
- code: resolve10(join13(sampleroot, "frmDashboard.uc.ts"))
8033
+ html: resolve11(join13(sampleroot, "frmDashboard.uc.html")),
8034
+ scss: resolve11(join13(sampleroot, "frmDashboard.uc.scss")),
8035
+ code: resolve11(join13(sampleroot, "frmDashboard.uc.ts"))
8032
8036
  },
8033
8037
  tptDashboard: {
8034
- html: resolve10(join13(sampleroot, "tptDashboard.tpt.html")),
8035
- scss: resolve10(join13(sampleroot, "tptDashboard.tpt.scss")),
8036
- code: resolve10(join13(sampleroot, "tptDashboard.tpt.ts"))
8038
+ html: resolve11(join13(sampleroot, "tptDashboard.tpt.html")),
8039
+ scss: resolve11(join13(sampleroot, "tptDashboard.tpt.scss")),
8040
+ code: resolve11(join13(sampleroot, "tptDashboard.tpt.ts"))
8037
8041
  }
8038
8042
  };
8039
- const relHtmlPath = relative4(resolve10(cli.srcDir), sample.frmDashboard.html);
8040
- const designerRoot = ucUtil.changeExtension(resolve10(join13(cli.srcDir, cli.designerDir, relHtmlPath)), ".html", ".designer.js");
8043
+ const relHtmlPath = relative4(resolve11(cli.srcDir), sample.frmDashboard.html);
8044
+ const designerRoot = ucUtil.changeExtension(resolve11(join13(cli.srcDir, cli.designerDir, relHtmlPath)), ".html", ".designer.js");
8041
8045
  const templateRoot = "templates/sample1";
8042
8046
  await writeFileSafely(
8043
8047
  sample.frmDashboard.html,
@@ -8116,7 +8120,7 @@ async function cli_menu_generate(main2, back_menu_callback = async () => {
8116
8120
  case "t":
8117
8121
  const cli = main2.config.cli;
8118
8122
  await writeFileSafely(
8119
- resolve11("tsconfig.json"),
8123
+ resolve12("tsconfig.json"),
8120
8124
  _runTemplate5("templates/typescript/json.tsconfig", {
8121
8125
  outDir: main2.config.cli.outDir,
8122
8126
  srcDir: main2.config.cli.srcDir,
@@ -8128,7 +8132,7 @@ async function cli_menu_generate(main2, back_menu_callback = async () => {
8128
8132
  break;
8129
8133
  case "v":
8130
8134
  await writeFileSafely(
8131
- resolve11(".vscode/settings.json"),
8135
+ resolve12(".vscode/settings.json"),
8132
8136
  _runTemplate5("templates/.vscode/json.settings", {}),
8133
8137
  main2.cliOptions
8134
8138
  );
@@ -8331,7 +8335,7 @@ Sub Directory Path (inside source directory) : `, fdec.subDirPath ?? "");
8331
8335
  await this._cliTypeScriptInq.inquiry();
8332
8336
  }
8333
8337
  }
8334
- async checkBasicNeed() {
8338
+ async checkBasicNeed(inquiry = true) {
8335
8339
  this.projectDir = getProjectDir(process.cwd());
8336
8340
  if (this.projectDir == null) {
8337
8341
  throw Error("NO PROJECT FOUND");
@@ -8339,11 +8343,11 @@ Sub Directory Path (inside source directory) : `, fdec.subDirPath ?? "");
8339
8343
  this.dependancyChecker = new cliDependancyChecker(this);
8340
8344
  await this.updateDependancies();
8341
8345
  const depNeed = ["uc-runtime"];
8342
- if (!this.dependentProjects.includes("typescript"))
8343
- this.config.cli.useTypeScript = await cliTypeScriptInquiry.AskIsTypescript(true);
8344
- if (this.config.cli.useTypeScript)
8345
- depNeed.push("typescript", "@types/node");
8346
- await this.dependancyChecker.ensureDependencies(depNeed);
8346
+ if (inquiry) {
8347
+ if (this.config.cli.useTypeScript)
8348
+ depNeed.push("typescript", "@types/node");
8349
+ await this.dependancyChecker.ensureDependencies(depNeed);
8350
+ }
8347
8351
  }
8348
8352
  updateDependancies() {
8349
8353
  if (this.projectDir != void 0) {
@@ -8391,7 +8395,7 @@ switch (cmd) {
8391
8395
  break;
8392
8396
  case "setup":
8393
8397
  if (!ignreq)
8394
- await main.checkBasicNeed();
8398
+ await main.checkBasicNeed(false);
8395
8399
  await cli_menu_MainMenu(main);
8396
8400
  break;
8397
8401
  case "--help":
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "designer-build",
14
14
  "electron-tools"
15
15
  ],
16
- "version": "1.0.0-beta.5",
16
+ "version": "1.0.2",
17
17
  "description": "Electron CLI project builder for uc-runtime apps",
18
18
  "license": "ISC",
19
19
  "author": "AP",