creatium 0.1.13 → 0.1.15
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/main.cjs +19 -14
- package/dist/main.mjs +19 -14
- package/package.json +3 -3
package/dist/main.cjs
CHANGED
|
@@ -1469,18 +1469,18 @@ class Core {
|
|
|
1469
1469
|
async getCmds() {
|
|
1470
1470
|
const res = {};
|
|
1471
1471
|
const Klass = this.#getClass();
|
|
1472
|
-
|
|
1472
|
+
await Promise.all(Object.entries(this.config).map(async ([key, value]) => {
|
|
1473
1473
|
const {
|
|
1474
1474
|
type,
|
|
1475
1475
|
...props
|
|
1476
1476
|
} = value;
|
|
1477
|
-
if (!(type in Klass))
|
|
1477
|
+
if (!(type in Klass)) return;
|
|
1478
1478
|
const instance = new Klass[type](props);
|
|
1479
1479
|
if ("cmd" in instance) {
|
|
1480
1480
|
const cmd = await instance.cmd();
|
|
1481
1481
|
if (cmd) res[key] = cmd;
|
|
1482
1482
|
}
|
|
1483
|
-
}
|
|
1483
|
+
}));
|
|
1484
1484
|
return res;
|
|
1485
1485
|
}
|
|
1486
1486
|
async getPrompts(initialValues) {
|
|
@@ -1493,12 +1493,12 @@ class Core {
|
|
|
1493
1493
|
...cached,
|
|
1494
1494
|
values: cachedValues
|
|
1495
1495
|
} });
|
|
1496
|
-
|
|
1496
|
+
await Promise.all(Object.entries(this.config).map(async ([key, value]) => {
|
|
1497
1497
|
const {
|
|
1498
1498
|
type,
|
|
1499
1499
|
...props
|
|
1500
1500
|
} = value;
|
|
1501
|
-
if (!(type in Klass))
|
|
1501
|
+
if (!(type in Klass)) return;
|
|
1502
1502
|
const instance = new Klass[type](props);
|
|
1503
1503
|
instance._onCancel = this.onCancel;
|
|
1504
1504
|
instance.debugMode = this.debugMode;
|
|
@@ -1509,7 +1509,7 @@ class Core {
|
|
|
1509
1509
|
instance.afterPrompt = async (value2) => await cached?.set({ [key]: value2 });
|
|
1510
1510
|
if ("prompt" in instance)
|
|
1511
1511
|
res[key] = await instance.getPromptHooked.bind(instance);
|
|
1512
|
-
}
|
|
1512
|
+
}));
|
|
1513
1513
|
return res;
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
@@ -1657,7 +1657,7 @@ class CreatiumCore {
|
|
|
1657
1657
|
else if (typeof this.config.outro === "function" && this.#data)
|
|
1658
1658
|
await this.config.outro(this.#data);
|
|
1659
1659
|
else if (this.config.outro === void 0) {
|
|
1660
|
-
this.utils.prompt.outro("Successfully completed \u{1F308}");
|
|
1660
|
+
this.utils.prompt.outro(this.utils.style.color.greenBright("Successfully completed \u{1F308}"));
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
1663
|
/**
|
|
@@ -1777,10 +1777,10 @@ class CreatiumCore {
|
|
|
1777
1777
|
inputOpts
|
|
1778
1778
|
} = {}) {
|
|
1779
1779
|
if (!input) input = this.#cwd;
|
|
1780
|
-
console.
|
|
1780
|
+
if (this.debugMode) console.dir({ replacePlaceholdersData: {
|
|
1781
1781
|
params,
|
|
1782
1782
|
input
|
|
1783
|
-
} });
|
|
1783
|
+
} }, { depth: null });
|
|
1784
1784
|
if (!params) return;
|
|
1785
1785
|
const getContent = async (filePath) => {
|
|
1786
1786
|
try {
|
|
@@ -1790,21 +1790,26 @@ class CreatiumCore {
|
|
|
1790
1790
|
return void 0;
|
|
1791
1791
|
}
|
|
1792
1792
|
};
|
|
1793
|
-
const paths = await getPaths(
|
|
1793
|
+
const paths = await getPaths("**", {
|
|
1794
1794
|
filesOnly: true,
|
|
1795
|
+
cwd: input,
|
|
1796
|
+
absolute: true,
|
|
1795
1797
|
dot: true,
|
|
1796
1798
|
...inputOpts || {}
|
|
1797
1799
|
});
|
|
1798
|
-
console.debug({
|
|
1799
|
-
|
|
1800
|
+
console.debug({
|
|
1801
|
+
templatePaths: paths,
|
|
1802
|
+
input
|
|
1803
|
+
});
|
|
1804
|
+
await Promise.all(paths.map(async (path) => {
|
|
1800
1805
|
const content = await getContent(path);
|
|
1801
|
-
if (!content)
|
|
1806
|
+
if (!content) return;
|
|
1802
1807
|
const res = await replacePlaceholders({
|
|
1803
1808
|
content,
|
|
1804
1809
|
params
|
|
1805
1810
|
});
|
|
1806
1811
|
await writeFile(path, res, "utf-8");
|
|
1807
|
-
}
|
|
1812
|
+
}));
|
|
1808
1813
|
}
|
|
1809
1814
|
/**
|
|
1810
1815
|
* Return the input path of a template by name or path.
|
package/dist/main.mjs
CHANGED
|
@@ -1443,18 +1443,18 @@ class Core {
|
|
|
1443
1443
|
async getCmds() {
|
|
1444
1444
|
const res = {};
|
|
1445
1445
|
const Klass = this.#getClass();
|
|
1446
|
-
|
|
1446
|
+
await Promise.all(Object.entries(this.config).map(async ([key, value]) => {
|
|
1447
1447
|
const {
|
|
1448
1448
|
type,
|
|
1449
1449
|
...props
|
|
1450
1450
|
} = value;
|
|
1451
|
-
if (!(type in Klass))
|
|
1451
|
+
if (!(type in Klass)) return;
|
|
1452
1452
|
const instance = new Klass[type](props);
|
|
1453
1453
|
if ("cmd" in instance) {
|
|
1454
1454
|
const cmd = await instance.cmd();
|
|
1455
1455
|
if (cmd) res[key] = cmd;
|
|
1456
1456
|
}
|
|
1457
|
-
}
|
|
1457
|
+
}));
|
|
1458
1458
|
return res;
|
|
1459
1459
|
}
|
|
1460
1460
|
async getPrompts(initialValues) {
|
|
@@ -1467,12 +1467,12 @@ class Core {
|
|
|
1467
1467
|
...cached,
|
|
1468
1468
|
values: cachedValues
|
|
1469
1469
|
} });
|
|
1470
|
-
|
|
1470
|
+
await Promise.all(Object.entries(this.config).map(async ([key, value]) => {
|
|
1471
1471
|
const {
|
|
1472
1472
|
type,
|
|
1473
1473
|
...props
|
|
1474
1474
|
} = value;
|
|
1475
|
-
if (!(type in Klass))
|
|
1475
|
+
if (!(type in Klass)) return;
|
|
1476
1476
|
const instance = new Klass[type](props);
|
|
1477
1477
|
instance._onCancel = this.onCancel;
|
|
1478
1478
|
instance.debugMode = this.debugMode;
|
|
@@ -1483,7 +1483,7 @@ class Core {
|
|
|
1483
1483
|
instance.afterPrompt = async (value2) => await cached?.set({ [key]: value2 });
|
|
1484
1484
|
if ("prompt" in instance)
|
|
1485
1485
|
res[key] = await instance.getPromptHooked.bind(instance);
|
|
1486
|
-
}
|
|
1486
|
+
}));
|
|
1487
1487
|
return res;
|
|
1488
1488
|
}
|
|
1489
1489
|
}
|
|
@@ -1631,7 +1631,7 @@ class CreatiumCore {
|
|
|
1631
1631
|
else if (typeof this.config.outro === "function" && this.#data)
|
|
1632
1632
|
await this.config.outro(this.#data);
|
|
1633
1633
|
else if (this.config.outro === void 0) {
|
|
1634
|
-
this.utils.prompt.outro("Successfully completed \u{1F308}");
|
|
1634
|
+
this.utils.prompt.outro(this.utils.style.color.greenBright("Successfully completed \u{1F308}"));
|
|
1635
1635
|
}
|
|
1636
1636
|
}
|
|
1637
1637
|
/**
|
|
@@ -1751,10 +1751,10 @@ class CreatiumCore {
|
|
|
1751
1751
|
inputOpts
|
|
1752
1752
|
} = {}) {
|
|
1753
1753
|
if (!input) input = this.#cwd;
|
|
1754
|
-
console.
|
|
1754
|
+
if (this.debugMode) console.dir({ replacePlaceholdersData: {
|
|
1755
1755
|
params,
|
|
1756
1756
|
input
|
|
1757
|
-
} });
|
|
1757
|
+
} }, { depth: null });
|
|
1758
1758
|
if (!params) return;
|
|
1759
1759
|
const getContent = async (filePath) => {
|
|
1760
1760
|
try {
|
|
@@ -1764,21 +1764,26 @@ class CreatiumCore {
|
|
|
1764
1764
|
return void 0;
|
|
1765
1765
|
}
|
|
1766
1766
|
};
|
|
1767
|
-
const paths = await getPaths(
|
|
1767
|
+
const paths = await getPaths("**", {
|
|
1768
1768
|
filesOnly: true,
|
|
1769
|
+
cwd: input,
|
|
1770
|
+
absolute: true,
|
|
1769
1771
|
dot: true,
|
|
1770
1772
|
...inputOpts || {}
|
|
1771
1773
|
});
|
|
1772
|
-
console.debug({
|
|
1773
|
-
|
|
1774
|
+
console.debug({
|
|
1775
|
+
templatePaths: paths,
|
|
1776
|
+
input
|
|
1777
|
+
});
|
|
1778
|
+
await Promise.all(paths.map(async (path) => {
|
|
1774
1779
|
const content = await getContent(path);
|
|
1775
|
-
if (!content)
|
|
1780
|
+
if (!content) return;
|
|
1776
1781
|
const res = await replacePlaceholders({
|
|
1777
1782
|
content,
|
|
1778
1783
|
params
|
|
1779
1784
|
});
|
|
1780
1785
|
await writeFile(path, res, "utf-8");
|
|
1781
|
-
}
|
|
1786
|
+
}));
|
|
1782
1787
|
}
|
|
1783
1788
|
/**
|
|
1784
1789
|
* Return the input path of a template by name or path.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "creatium",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Build your create-bins quickly and easily",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bin",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/columnify": "1.5.4",
|
|
69
69
|
"@types/yargs": "17.0.33",
|
|
70
|
-
"@creatium/repo-config": "0.1.
|
|
70
|
+
"@creatium/repo-config": "0.1.15"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "unbuild",
|
|
78
78
|
"dev": "tsx examples/simple/bin.ts",
|
|
79
|
-
"example": "run()
|
|
79
|
+
"example": "run(){ tsx examples/\"${@:1}\"/bin.ts; }; run $@",
|
|
80
80
|
"size": "pnpm dlx @sizium/cli -i ./ --res info",
|
|
81
81
|
"test": "vitest run -r src --passWithNoTests"
|
|
82
82
|
}
|