create-aomex 0.0.14 → 0.0.16
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/index.js
CHANGED
|
@@ -1171,15 +1171,15 @@ var require_route = __commonJS({
|
|
|
1171
1171
|
};
|
|
1172
1172
|
}
|
|
1173
1173
|
function wrapConversion(toModel, graph) {
|
|
1174
|
-
const
|
|
1174
|
+
const path3 = [graph[toModel].parent, toModel];
|
|
1175
1175
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
1176
1176
|
let cur = graph[toModel].parent;
|
|
1177
1177
|
while (graph[cur].parent) {
|
|
1178
|
-
|
|
1178
|
+
path3.unshift(graph[cur].parent);
|
|
1179
1179
|
fn = link2(conversions[graph[cur].parent][cur], fn);
|
|
1180
1180
|
cur = graph[cur].parent;
|
|
1181
1181
|
}
|
|
1182
|
-
fn.conversion =
|
|
1182
|
+
fn.conversion = path3;
|
|
1183
1183
|
return fn;
|
|
1184
1184
|
}
|
|
1185
1185
|
module.exports = function(fromModel) {
|
|
@@ -6084,10 +6084,18 @@ var require_brace_expansion = __commonJS({
|
|
|
6084
6084
|
});
|
|
6085
6085
|
|
|
6086
6086
|
// src/index.ts
|
|
6087
|
-
import
|
|
6087
|
+
import path2 from "node:path/posix";
|
|
6088
6088
|
import yargsParser from "yargs-parser";
|
|
6089
6089
|
import { existsSync } from "node:fs";
|
|
6090
|
-
import {
|
|
6090
|
+
import {
|
|
6091
|
+
cp,
|
|
6092
|
+
mkdir,
|
|
6093
|
+
readdir as readdir2,
|
|
6094
|
+
readFile,
|
|
6095
|
+
rm,
|
|
6096
|
+
stat,
|
|
6097
|
+
writeFile as writeFile2
|
|
6098
|
+
} from "node:fs/promises";
|
|
6091
6099
|
|
|
6092
6100
|
// node_modules/.pnpm/@aomex+core@3.2.0_@types+node@20.14.12_typescript@5.5.4/node_modules/@aomex/core/dist/index.js
|
|
6093
6101
|
var import_openapi_types = __toESM(require_dist(), 1);
|
|
@@ -16572,12 +16580,12 @@ var PathBase = class {
|
|
|
16572
16580
|
/**
|
|
16573
16581
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
16574
16582
|
*/
|
|
16575
|
-
resolve(
|
|
16576
|
-
if (!
|
|
16583
|
+
resolve(path3) {
|
|
16584
|
+
if (!path3) {
|
|
16577
16585
|
return this;
|
|
16578
16586
|
}
|
|
16579
|
-
const rootPath = this.getRootString(
|
|
16580
|
-
const dir =
|
|
16587
|
+
const rootPath = this.getRootString(path3);
|
|
16588
|
+
const dir = path3.substring(rootPath.length);
|
|
16581
16589
|
const dirParts = dir.split(this.splitSep);
|
|
16582
16590
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
16583
16591
|
return result;
|
|
@@ -17329,8 +17337,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
17329
17337
|
/**
|
|
17330
17338
|
* @internal
|
|
17331
17339
|
*/
|
|
17332
|
-
getRootString(
|
|
17333
|
-
return win32.parse(
|
|
17340
|
+
getRootString(path3) {
|
|
17341
|
+
return win32.parse(path3).root;
|
|
17334
17342
|
}
|
|
17335
17343
|
/**
|
|
17336
17344
|
* @internal
|
|
@@ -17376,8 +17384,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
17376
17384
|
/**
|
|
17377
17385
|
* @internal
|
|
17378
17386
|
*/
|
|
17379
|
-
getRootString(
|
|
17380
|
-
return
|
|
17387
|
+
getRootString(path3) {
|
|
17388
|
+
return path3.startsWith("/") ? "/" : "";
|
|
17381
17389
|
}
|
|
17382
17390
|
/**
|
|
17383
17391
|
* @internal
|
|
@@ -17466,11 +17474,11 @@ var PathScurryBase = class {
|
|
|
17466
17474
|
/**
|
|
17467
17475
|
* Get the depth of a provided path, string, or the cwd
|
|
17468
17476
|
*/
|
|
17469
|
-
depth(
|
|
17470
|
-
if (typeof
|
|
17471
|
-
|
|
17477
|
+
depth(path3 = this.cwd) {
|
|
17478
|
+
if (typeof path3 === "string") {
|
|
17479
|
+
path3 = this.cwd.resolve(path3);
|
|
17472
17480
|
}
|
|
17473
|
-
return
|
|
17481
|
+
return path3.depth();
|
|
17474
17482
|
}
|
|
17475
17483
|
/**
|
|
17476
17484
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -17957,9 +17965,9 @@ var PathScurryBase = class {
|
|
|
17957
17965
|
process8();
|
|
17958
17966
|
return results;
|
|
17959
17967
|
}
|
|
17960
|
-
chdir(
|
|
17968
|
+
chdir(path3 = this.cwd) {
|
|
17961
17969
|
const oldCwd = this.cwd;
|
|
17962
|
-
this.cwd = typeof
|
|
17970
|
+
this.cwd = typeof path3 === "string" ? this.cwd.resolve(path3) : path3;
|
|
17963
17971
|
this.cwd[setAsCwd](oldCwd);
|
|
17964
17972
|
}
|
|
17965
17973
|
};
|
|
@@ -18315,8 +18323,8 @@ var MatchRecord = class {
|
|
|
18315
18323
|
}
|
|
18316
18324
|
// match, absolute, ifdir
|
|
18317
18325
|
entries() {
|
|
18318
|
-
return [...this.store.entries()].map(([
|
|
18319
|
-
|
|
18326
|
+
return [...this.store.entries()].map(([path3, n]) => [
|
|
18327
|
+
path3,
|
|
18320
18328
|
!!(n & 2),
|
|
18321
18329
|
!!(n & 1)
|
|
18322
18330
|
]);
|
|
@@ -18521,9 +18529,9 @@ var GlobUtil = class {
|
|
|
18521
18529
|
signal;
|
|
18522
18530
|
maxDepth;
|
|
18523
18531
|
includeChildMatches;
|
|
18524
|
-
constructor(patterns,
|
|
18532
|
+
constructor(patterns, path3, opts) {
|
|
18525
18533
|
this.patterns = patterns;
|
|
18526
|
-
this.path =
|
|
18534
|
+
this.path = path3;
|
|
18527
18535
|
this.opts = opts;
|
|
18528
18536
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
18529
18537
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -18542,11 +18550,11 @@ var GlobUtil = class {
|
|
|
18542
18550
|
});
|
|
18543
18551
|
}
|
|
18544
18552
|
}
|
|
18545
|
-
#ignored(
|
|
18546
|
-
return this.seen.has(
|
|
18553
|
+
#ignored(path3) {
|
|
18554
|
+
return this.seen.has(path3) || !!this.#ignore?.ignored?.(path3);
|
|
18547
18555
|
}
|
|
18548
|
-
#childrenIgnored(
|
|
18549
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
18556
|
+
#childrenIgnored(path3) {
|
|
18557
|
+
return !!this.#ignore?.childrenIgnored?.(path3);
|
|
18550
18558
|
}
|
|
18551
18559
|
// backpressure mechanism
|
|
18552
18560
|
pause() {
|
|
@@ -18761,8 +18769,8 @@ var GlobUtil = class {
|
|
|
18761
18769
|
};
|
|
18762
18770
|
var GlobWalker = class extends GlobUtil {
|
|
18763
18771
|
matches = /* @__PURE__ */ new Set();
|
|
18764
|
-
constructor(patterns,
|
|
18765
|
-
super(patterns,
|
|
18772
|
+
constructor(patterns, path3, opts) {
|
|
18773
|
+
super(patterns, path3, opts);
|
|
18766
18774
|
}
|
|
18767
18775
|
matchEmit(e) {
|
|
18768
18776
|
this.matches.add(e);
|
|
@@ -18799,8 +18807,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
18799
18807
|
};
|
|
18800
18808
|
var GlobStream = class extends GlobUtil {
|
|
18801
18809
|
results;
|
|
18802
|
-
constructor(patterns,
|
|
18803
|
-
super(patterns,
|
|
18810
|
+
constructor(patterns, path3, opts) {
|
|
18811
|
+
super(patterns, path3, opts);
|
|
18804
18812
|
this.results = new Minipass({
|
|
18805
18813
|
signal: this.signal,
|
|
18806
18814
|
objectMode: true
|
|
@@ -19376,29 +19384,14 @@ var Terminal = class {
|
|
|
19376
19384
|
var terminal2 = new Terminal();
|
|
19377
19385
|
|
|
19378
19386
|
// src/index.ts
|
|
19379
|
-
import { styleText as styleText2 } from "node:util";
|
|
19380
19387
|
import { execSync, spawn } from "node:child_process";
|
|
19381
|
-
|
|
19382
|
-
// src/replace-variables.ts
|
|
19383
|
-
import { readFile, writeFile as writeFile2 } from "node:fs/promises";
|
|
19384
|
-
import path2 from "node:path";
|
|
19385
|
-
var replaceVariables = async (filename, variables) => {
|
|
19386
|
-
const packageJSONFile = path2.resolve(filename);
|
|
19387
|
-
let packageContent = await readFile(packageJSONFile, "utf8");
|
|
19388
|
-
Object.entries(variables).forEach(([key, value]) => {
|
|
19389
|
-
packageContent = packageContent.replaceAll(`{{${key}}}`, value);
|
|
19390
|
-
});
|
|
19391
|
-
await writeFile2(packageJSONFile, packageContent);
|
|
19392
|
-
};
|
|
19393
|
-
|
|
19394
|
-
// src/index.ts
|
|
19395
19388
|
import kebabCase from "lodash.kebabcase";
|
|
19396
19389
|
var argv = yargsParser(process.argv.slice(2));
|
|
19397
|
-
var templateDir =
|
|
19390
|
+
var templateDir = path2.join(import.meta.dirname, "..", "templates");
|
|
19398
19391
|
var projectName = kebabCase(argv["project"] || "my-aomex-project");
|
|
19399
|
-
var targetDir =
|
|
19392
|
+
var targetDir = path2.resolve(projectName);
|
|
19400
19393
|
if (existsSync(targetDir)) {
|
|
19401
|
-
|
|
19394
|
+
terminal2.printError(`\u76EE\u5F55 "${targetDir}" \u5DF2\u5B58\u5728\uFF01`);
|
|
19402
19395
|
process.exit(1);
|
|
19403
19396
|
}
|
|
19404
19397
|
var nodeVersion = process.versions.node;
|
|
@@ -19433,7 +19426,7 @@ var { error: error2 } = await terminal2.runTasks([
|
|
|
19433
19426
|
await rm(targetDir, { recursive: true, force: true });
|
|
19434
19427
|
}
|
|
19435
19428
|
await mkdir(targetDir, { recursive: true });
|
|
19436
|
-
process.chdir(
|
|
19429
|
+
process.chdir(path2.resolve(projectName));
|
|
19437
19430
|
}
|
|
19438
19431
|
},
|
|
19439
19432
|
{
|
|
@@ -19448,15 +19441,23 @@ var { error: error2 } = await terminal2.runTasks([
|
|
|
19448
19441
|
await cp(templateDir, targetDir, { recursive: true });
|
|
19449
19442
|
const files = await readdir2(targetDir, { recursive: true });
|
|
19450
19443
|
for (const file of files) {
|
|
19451
|
-
const isFile = (await stat(
|
|
19444
|
+
const isFile = (await stat(path2.join(targetDir, file))).isFile();
|
|
19452
19445
|
if (!isFile) continue;
|
|
19453
|
-
|
|
19446
|
+
const fileAbsolutePath = path2.resolve(file);
|
|
19447
|
+
let fileContent = await readFile(fileAbsolutePath, "utf8");
|
|
19448
|
+
Object.entries(variables).forEach(([key, value]) => {
|
|
19449
|
+
fileContent = fileContent.replaceAll(`{{${key}}}`, value);
|
|
19450
|
+
});
|
|
19451
|
+
await writeFile2(fileAbsolutePath, fileContent);
|
|
19454
19452
|
}
|
|
19455
19453
|
await sleep();
|
|
19456
19454
|
}
|
|
19457
19455
|
},
|
|
19458
19456
|
{
|
|
19459
19457
|
title: "git\u521D\u59CB\u5316",
|
|
19458
|
+
skip: async () => {
|
|
19459
|
+
return !/\d\.\d/.test(execSync("git -v", { encoding: "utf8" }));
|
|
19460
|
+
},
|
|
19460
19461
|
task: async () => {
|
|
19461
19462
|
await runShell("git init");
|
|
19462
19463
|
await sleep();
|
|
@@ -19524,12 +19525,12 @@ var { error: error2 } = await terminal2.runTasks([
|
|
|
19524
19525
|
const devSuffix = packageManager === "npm" ? "--save-dev" : "-D";
|
|
19525
19526
|
for (let i = 0; i < packages.length; ++i) {
|
|
19526
19527
|
const { pkgs, dev, label } = packages[i];
|
|
19527
|
-
task.
|
|
19528
|
+
task.suffix = terminal2.style("gray", label);
|
|
19528
19529
|
await runShell(
|
|
19529
19530
|
`${packageManager} ${action} ${pkgs.join(" ")} ${dev ? devSuffix : ""}`
|
|
19530
19531
|
);
|
|
19531
19532
|
}
|
|
19532
|
-
task.
|
|
19533
|
+
task.suffix = "";
|
|
19533
19534
|
}
|
|
19534
19535
|
},
|
|
19535
19536
|
{
|
|
@@ -19542,7 +19543,7 @@ var { error: error2 } = await terminal2.runTasks([
|
|
|
19542
19543
|
]);
|
|
19543
19544
|
if (error2) process.exit(1);
|
|
19544
19545
|
console.log(
|
|
19545
|
-
"\n\u9879\u76EE\u521B\u5EFA\u6210\u529F\uFF1A" +
|
|
19546
|
+
"\n\u9879\u76EE\u521B\u5EFA\u6210\u529F\uFF1A" + terminal2.style(["blue", "underline"], process.cwd()) + "\n\u542F\u52A8\u9879\u76EE\u53EF\u6267\u884C\u5982\u4E0B\u6307\u4EE4\uFF1A\n\n" + terminal2.style("green", `cd ${projectName} && ${packageManager} start`) + "\n"
|
|
19546
19547
|
);
|
|
19547
19548
|
/*! Bundled license information:
|
|
19548
19549
|
|