@akanjs/cli 0.9.2 → 0.9.3
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/cjs/index.js +12 -9
- package/cjs/src/templates/workspaceRoot/package.json.template +1 -0
- package/cjs/src/templates/workspaceRoot/tsconfig.json.template +2 -5
- package/esm/index.js +12 -9
- package/esm/src/templates/workspaceRoot/package.json.template +1 -0
- package/esm/src/templates/workspaceRoot/tsconfig.json.template +2 -5
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -1784,6 +1784,7 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1784
1784
|
}
|
|
1785
1785
|
setTsPaths(type, name) {
|
|
1786
1786
|
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1787
|
+
rootTsConfig.compilerOptions.paths ??= {};
|
|
1787
1788
|
if (type === "lib" || type === "pkg")
|
|
1788
1789
|
rootTsConfig.compilerOptions.paths[`@${name}`] = [`${type}s/${name}/index.ts`];
|
|
1789
1790
|
rootTsConfig.compilerOptions.paths[`@${name}/*`] = [`${type}s/${name}/*`];
|
|
@@ -1796,9 +1797,11 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1796
1797
|
}
|
|
1797
1798
|
unsetTsPaths(type, name) {
|
|
1798
1799
|
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1799
|
-
const filteredKeys = Object.keys(rootTsConfig.compilerOptions.paths
|
|
1800
|
+
const filteredKeys = Object.keys(rootTsConfig.compilerOptions.paths ?? {}).filter(
|
|
1801
|
+
(key) => !key.startsWith(`@${name}`)
|
|
1802
|
+
);
|
|
1800
1803
|
rootTsConfig.compilerOptions.paths = Object.fromEntries(
|
|
1801
|
-
filteredKeys.map((key) => [key, rootTsConfig.compilerOptions.paths[key]])
|
|
1804
|
+
filteredKeys.map((key) => [key, rootTsConfig.compilerOptions.paths?.[key] ?? []])
|
|
1802
1805
|
);
|
|
1803
1806
|
if (rootTsConfig.references) {
|
|
1804
1807
|
rootTsConfig.references = rootTsConfig.references.filter(
|
|
@@ -1919,19 +1922,19 @@ var SysExecutor = class extends Executor {
|
|
|
1919
1922
|
const scanner = new TypeScriptDependencyScanner(this.cwdPath);
|
|
1920
1923
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
1921
1924
|
const pkgPathSet = new Set(
|
|
1922
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((path9) => tsconfig.compilerOptions.paths[path9]
|
|
1925
|
+
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path9) => tsconfig.compilerOptions.paths?.[path9]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path9) => path9.replace("/*", ""))
|
|
1923
1926
|
);
|
|
1924
1927
|
const libPathSet = new Set(
|
|
1925
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((path9) => tsconfig.compilerOptions.paths[path9]
|
|
1928
|
+
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path9) => tsconfig.compilerOptions.paths?.[path9]?.some((resolve) => resolve.startsWith("libs/"))).map((path9) => path9.replace("/*", ""))
|
|
1926
1929
|
);
|
|
1927
1930
|
const [npmDepSet, pkgPathDepSet, libPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet, libPathSet]);
|
|
1928
1931
|
const pkgDeps = [...pkgPathDepSet].map((path9) => {
|
|
1929
1932
|
const pathSplitLength = path9.split("/").length;
|
|
1930
|
-
return tsconfig.compilerOptions.paths[path9][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1933
|
+
return (tsconfig.compilerOptions.paths?.[path9]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1931
1934
|
});
|
|
1932
1935
|
const libDeps = [...libPathDepSet].map((path9) => {
|
|
1933
1936
|
const pathSplitLength = path9.split("/").length;
|
|
1934
|
-
return tsconfig.compilerOptions.paths[path9][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1937
|
+
return (tsconfig.compilerOptions.paths?.[path9]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1935
1938
|
}).filter((libName) => libName !== this.name);
|
|
1936
1939
|
if (!import_fs4.default.existsSync(`${this.cwdPath}/lib/__scalar`))
|
|
1937
1940
|
import_fs4.default.mkdirSync(`${this.cwdPath}/lib/__scalar`, { recursive: true });
|
|
@@ -2233,12 +2236,12 @@ var PkgExecutor = class _PkgExecutor extends Executor {
|
|
|
2233
2236
|
const scanner = new TypeScriptDependencyScanner(this.cwdPath);
|
|
2234
2237
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
2235
2238
|
const pkgPathSet = new Set(
|
|
2236
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((path9) => tsconfig.compilerOptions.paths[path9]
|
|
2239
|
+
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path9) => tsconfig.compilerOptions.paths?.[path9]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path9) => path9.replace("/*", ""))
|
|
2237
2240
|
);
|
|
2238
2241
|
const [npmDepSet, pkgPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet]);
|
|
2239
2242
|
const pkgDeps = [...pkgPathDepSet].map((path9) => {
|
|
2240
2243
|
const pathSplitLength = path9.split("/").length;
|
|
2241
|
-
return tsconfig.compilerOptions.paths[path9][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
2244
|
+
return (tsconfig.compilerOptions.paths?.[path9]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
2242
2245
|
}).filter((pkg) => pkg !== this.name);
|
|
2243
2246
|
const pkgScanResult = {
|
|
2244
2247
|
name: this.name,
|
|
@@ -3652,7 +3655,7 @@ var ApplicationRunner = class {
|
|
|
3652
3655
|
resolve: {
|
|
3653
3656
|
alias: {
|
|
3654
3657
|
...Object.fromEntries(
|
|
3655
|
-
Object.entries(tsconfig.compilerOptions.paths).map(([key, value]) => [
|
|
3658
|
+
Object.entries(tsconfig.compilerOptions.paths ?? {}).map(([key, value]) => [
|
|
3656
3659
|
key.replace("/*", ""),
|
|
3657
3660
|
`${app.workspace.workspaceRoot}/${value[0].replace("/*", "").replace("/index.ts", "")}`
|
|
3658
3661
|
])
|
|
@@ -13,17 +13,14 @@
|
|
|
13
13
|
"importHelpers": false,
|
|
14
14
|
"target": "es2022",
|
|
15
15
|
"module": "esnext",
|
|
16
|
-
"types": ["node", "
|
|
17
|
-
"lib": ["
|
|
16
|
+
"types": ["node", "vite/client", "jest"],
|
|
17
|
+
"lib": ["es2022", "dom", "webworker"],
|
|
18
18
|
"skipLibCheck": true,
|
|
19
19
|
"skipDefaultLibCheck": true,
|
|
20
20
|
"strictNullChecks": true,
|
|
21
21
|
"baseUrl": ".",
|
|
22
22
|
"jsx": "preserve",
|
|
23
23
|
"resolveJsonModule": true,
|
|
24
|
-
"paths": {
|
|
25
|
-
"@/*": ["*"]
|
|
26
|
-
}
|
|
27
24
|
},
|
|
28
25
|
"exclude": ["**/node_modules", "tmp", "**/ios", "**/android"]
|
|
29
26
|
}
|
package/esm/index.js
CHANGED
|
@@ -1771,6 +1771,7 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
setTsPaths(type, name) {
|
|
1773
1773
|
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1774
|
+
rootTsConfig.compilerOptions.paths ??= {};
|
|
1774
1775
|
if (type === "lib" || type === "pkg")
|
|
1775
1776
|
rootTsConfig.compilerOptions.paths[`@${name}`] = [`${type}s/${name}/index.ts`];
|
|
1776
1777
|
rootTsConfig.compilerOptions.paths[`@${name}/*`] = [`${type}s/${name}/*`];
|
|
@@ -1783,9 +1784,11 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1783
1784
|
}
|
|
1784
1785
|
unsetTsPaths(type, name) {
|
|
1785
1786
|
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1786
|
-
const filteredKeys = Object.keys(rootTsConfig.compilerOptions.paths
|
|
1787
|
+
const filteredKeys = Object.keys(rootTsConfig.compilerOptions.paths ?? {}).filter(
|
|
1788
|
+
(key) => !key.startsWith(`@${name}`)
|
|
1789
|
+
);
|
|
1787
1790
|
rootTsConfig.compilerOptions.paths = Object.fromEntries(
|
|
1788
|
-
filteredKeys.map((key) => [key, rootTsConfig.compilerOptions.paths[key]])
|
|
1791
|
+
filteredKeys.map((key) => [key, rootTsConfig.compilerOptions.paths?.[key] ?? []])
|
|
1789
1792
|
);
|
|
1790
1793
|
if (rootTsConfig.references) {
|
|
1791
1794
|
rootTsConfig.references = rootTsConfig.references.filter(
|
|
@@ -1906,19 +1909,19 @@ var SysExecutor = class extends Executor {
|
|
|
1906
1909
|
const scanner = new TypeScriptDependencyScanner(this.cwdPath);
|
|
1907
1910
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
1908
1911
|
const pkgPathSet = new Set(
|
|
1909
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((path9) => tsconfig.compilerOptions.paths[path9]
|
|
1912
|
+
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path9) => tsconfig.compilerOptions.paths?.[path9]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path9) => path9.replace("/*", ""))
|
|
1910
1913
|
);
|
|
1911
1914
|
const libPathSet = new Set(
|
|
1912
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((path9) => tsconfig.compilerOptions.paths[path9]
|
|
1915
|
+
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path9) => tsconfig.compilerOptions.paths?.[path9]?.some((resolve) => resolve.startsWith("libs/"))).map((path9) => path9.replace("/*", ""))
|
|
1913
1916
|
);
|
|
1914
1917
|
const [npmDepSet, pkgPathDepSet, libPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet, libPathSet]);
|
|
1915
1918
|
const pkgDeps = [...pkgPathDepSet].map((path9) => {
|
|
1916
1919
|
const pathSplitLength = path9.split("/").length;
|
|
1917
|
-
return tsconfig.compilerOptions.paths[path9][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1920
|
+
return (tsconfig.compilerOptions.paths?.[path9]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1918
1921
|
});
|
|
1919
1922
|
const libDeps = [...libPathDepSet].map((path9) => {
|
|
1920
1923
|
const pathSplitLength = path9.split("/").length;
|
|
1921
|
-
return tsconfig.compilerOptions.paths[path9][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1924
|
+
return (tsconfig.compilerOptions.paths?.[path9]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1922
1925
|
}).filter((libName) => libName !== this.name);
|
|
1923
1926
|
if (!fs8.existsSync(`${this.cwdPath}/lib/__scalar`))
|
|
1924
1927
|
fs8.mkdirSync(`${this.cwdPath}/lib/__scalar`, { recursive: true });
|
|
@@ -2220,12 +2223,12 @@ var PkgExecutor = class _PkgExecutor extends Executor {
|
|
|
2220
2223
|
const scanner = new TypeScriptDependencyScanner(this.cwdPath);
|
|
2221
2224
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
2222
2225
|
const pkgPathSet = new Set(
|
|
2223
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((path9) => tsconfig.compilerOptions.paths[path9]
|
|
2226
|
+
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path9) => tsconfig.compilerOptions.paths?.[path9]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path9) => path9.replace("/*", ""))
|
|
2224
2227
|
);
|
|
2225
2228
|
const [npmDepSet, pkgPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet]);
|
|
2226
2229
|
const pkgDeps = [...pkgPathDepSet].map((path9) => {
|
|
2227
2230
|
const pathSplitLength = path9.split("/").length;
|
|
2228
|
-
return tsconfig.compilerOptions.paths[path9][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
2231
|
+
return (tsconfig.compilerOptions.paths?.[path9]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
2229
2232
|
}).filter((pkg) => pkg !== this.name);
|
|
2230
2233
|
const pkgScanResult = {
|
|
2231
2234
|
name: this.name,
|
|
@@ -3644,7 +3647,7 @@ var ApplicationRunner = class {
|
|
|
3644
3647
|
resolve: {
|
|
3645
3648
|
alias: {
|
|
3646
3649
|
...Object.fromEntries(
|
|
3647
|
-
Object.entries(tsconfig.compilerOptions.paths).map(([key, value]) => [
|
|
3650
|
+
Object.entries(tsconfig.compilerOptions.paths ?? {}).map(([key, value]) => [
|
|
3648
3651
|
key.replace("/*", ""),
|
|
3649
3652
|
`${app.workspace.workspaceRoot}/${value[0].replace("/*", "").replace("/index.ts", "")}`
|
|
3650
3653
|
])
|
|
@@ -13,17 +13,14 @@
|
|
|
13
13
|
"importHelpers": false,
|
|
14
14
|
"target": "es2022",
|
|
15
15
|
"module": "esnext",
|
|
16
|
-
"types": ["node", "
|
|
17
|
-
"lib": ["
|
|
16
|
+
"types": ["node", "vite/client", "jest"],
|
|
17
|
+
"lib": ["es2022", "dom", "webworker"],
|
|
18
18
|
"skipLibCheck": true,
|
|
19
19
|
"skipDefaultLibCheck": true,
|
|
20
20
|
"strictNullChecks": true,
|
|
21
21
|
"baseUrl": ".",
|
|
22
22
|
"jsx": "preserve",
|
|
23
23
|
"resolveJsonModule": true,
|
|
24
|
-
"paths": {
|
|
25
|
-
"@/*": ["*"]
|
|
26
|
-
}
|
|
27
24
|
},
|
|
28
25
|
"exclude": ["**/node_modules", "tmp", "**/ios", "**/android"]
|
|
29
26
|
}
|