@akanjs/devkit 0.9.60-canary.0 → 0.9.60-canary.11
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/README.md +1 -1
- package/cjs/src/dependencyScanner.js +14 -1
- package/cjs/src/executors.js +31 -10
- package/cjs/src/scanInfo.js +18 -15
- package/cjs/src/typeChecker.js +2 -1
- package/esm/src/dependencyScanner.js +14 -1
- package/esm/src/executors.js +31 -10
- package/esm/src/scanInfo.js +18 -15
- package/esm/src/typeChecker.js +2 -1
- package/package.json +3 -2
- package/src/dependencyScanner.d.ts +5 -1
- package/src/executors.d.ts +1 -0
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
이 패키지는 akanjs의 서브 라이브러리입니다. 더 자세한 내용은 [@akanjs/cli](https://www.npmjs.com/package/@akanjs/cli)와 [Akan.js Github](https://github.com/akan-team/akanjs)를 참고하세요.
|
|
@@ -31,6 +31,7 @@ __export(dependencyScanner_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(dependencyScanner_exports);
|
|
33
33
|
var fs = __toESM(require("fs"));
|
|
34
|
+
var import_ignore = __toESM(require("ignore"));
|
|
34
35
|
var path = __toESM(require("path"));
|
|
35
36
|
var ts = __toESM(require("typescript"));
|
|
36
37
|
class TypeScriptDependencyScanner {
|
|
@@ -39,10 +40,19 @@ class TypeScriptDependencyScanner {
|
|
|
39
40
|
directory;
|
|
40
41
|
tsconfig;
|
|
41
42
|
rootPackageJson;
|
|
42
|
-
|
|
43
|
+
ig;
|
|
44
|
+
workspaceRoot;
|
|
45
|
+
constructor(directory, {
|
|
46
|
+
workspaceRoot,
|
|
47
|
+
tsconfig,
|
|
48
|
+
rootPackageJson,
|
|
49
|
+
gitignorePatterns = []
|
|
50
|
+
}) {
|
|
43
51
|
this.directory = directory;
|
|
44
52
|
this.tsconfig = tsconfig;
|
|
45
53
|
this.rootPackageJson = rootPackageJson;
|
|
54
|
+
this.ig = (0, import_ignore.default)().add(gitignorePatterns);
|
|
55
|
+
this.workspaceRoot = workspaceRoot;
|
|
46
56
|
}
|
|
47
57
|
async getMonorepoDependencies(projectName) {
|
|
48
58
|
const npmSet = new Set(
|
|
@@ -104,6 +114,9 @@ class TypeScriptDependencyScanner {
|
|
|
104
114
|
const entries = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
105
115
|
for (const entry of entries) {
|
|
106
116
|
const fullPath = path.join(dir, entry.name);
|
|
117
|
+
const relativePath = path.relative(this.workspaceRoot, fullPath);
|
|
118
|
+
if (this.ig.ignores(relativePath))
|
|
119
|
+
continue;
|
|
107
120
|
if (entry.isDirectory()) {
|
|
108
121
|
if (!["node_modules", "dist", "build", ".git", ".next", "public", "ios", "android"].includes(entry.name))
|
|
109
122
|
await processDirectory(fullPath);
|
package/cjs/src/executors.js
CHANGED
|
@@ -325,6 +325,14 @@ class Executor {
|
|
|
325
325
|
this.writeJson("package.json", packageJson);
|
|
326
326
|
this.#packageJson = packageJson;
|
|
327
327
|
}
|
|
328
|
+
#gitignorePatterns = [];
|
|
329
|
+
getGitignorePatterns() {
|
|
330
|
+
if (this.#gitignorePatterns.length)
|
|
331
|
+
return this.#gitignorePatterns;
|
|
332
|
+
const gitignore = this.readFile(".gitignore");
|
|
333
|
+
this.#gitignorePatterns = gitignore.split("\n").map((line) => line.trim()).filter((line) => !!line && !line.startsWith("#"));
|
|
334
|
+
return this.#gitignorePatterns;
|
|
335
|
+
}
|
|
328
336
|
async #applyTemplateFile({
|
|
329
337
|
templatePath,
|
|
330
338
|
targetPath,
|
|
@@ -620,7 +628,12 @@ class SysExecutor extends Executor {
|
|
|
620
628
|
async getConfig({ refresh } = {}) {
|
|
621
629
|
if (this.#akanConfig && !refresh)
|
|
622
630
|
return this.#akanConfig;
|
|
623
|
-
|
|
631
|
+
const tsconfig = this.getTsConfig();
|
|
632
|
+
this.#akanConfig = this.type === "app" ? await (0, import_config.getAppConfig)(
|
|
633
|
+
this.cwdPath,
|
|
634
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
635
|
+
tsconfig
|
|
636
|
+
) : await (0, import_config.getLibConfig)(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name });
|
|
624
637
|
return this.#akanConfig;
|
|
625
638
|
}
|
|
626
639
|
async getModules() {
|
|
@@ -774,11 +787,11 @@ class SysExecutor extends Executor {
|
|
|
774
787
|
return modules.map((module2) => this.getLocalFile(`lib/${module2}/${module2}.constant.ts`));
|
|
775
788
|
}
|
|
776
789
|
async getConstantFilesWithLibs() {
|
|
777
|
-
const
|
|
790
|
+
const scanInfo = this.type === "app" ? await import_scanInfo.AppInfo.fromExecutor(this) : await import_scanInfo.LibInfo.fromExecutor(this);
|
|
778
791
|
const sysContantFiles = await this.getConstantFiles();
|
|
779
792
|
const sysScalarConstantFiles = await this.getScalarConstantFiles();
|
|
780
793
|
const libConstantFiles = await Promise.all(
|
|
781
|
-
|
|
794
|
+
scanInfo.getLibs().map(async (lib) => [
|
|
782
795
|
...await LibExecutor.from(this, lib).getConstantFiles(),
|
|
783
796
|
...await LibExecutor.from(this, lib).getScalarConstantFiles()
|
|
784
797
|
])
|
|
@@ -831,11 +844,11 @@ class AppExecutor extends SysExecutor {
|
|
|
831
844
|
async getConfig({ refresh } = {}) {
|
|
832
845
|
if (this.#akanConfig && !refresh)
|
|
833
846
|
return this.#akanConfig;
|
|
834
|
-
this.#akanConfig = await (0, import_config.getAppConfig)(
|
|
835
|
-
|
|
836
|
-
type: "app",
|
|
837
|
-
|
|
838
|
-
|
|
847
|
+
this.#akanConfig = await (0, import_config.getAppConfig)(
|
|
848
|
+
this.cwdPath,
|
|
849
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
850
|
+
this.getTsConfig()
|
|
851
|
+
);
|
|
839
852
|
return this.#akanConfig;
|
|
840
853
|
}
|
|
841
854
|
async syncAssets(libDeps) {
|
|
@@ -858,10 +871,18 @@ class AppExecutor extends SysExecutor {
|
|
|
858
871
|
]);
|
|
859
872
|
}
|
|
860
873
|
async increaseBuildNum() {
|
|
861
|
-
await (0, import_config.increaseBuildNum)(
|
|
874
|
+
await (0, import_config.increaseBuildNum)(
|
|
875
|
+
this.cwdPath,
|
|
876
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
877
|
+
this.getTsConfig()
|
|
878
|
+
);
|
|
862
879
|
}
|
|
863
880
|
async decreaseBuildNum() {
|
|
864
|
-
await (0, import_config.decreaseBuildNum)(
|
|
881
|
+
await (0, import_config.decreaseBuildNum)(
|
|
882
|
+
this.cwdPath,
|
|
883
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
884
|
+
this.getTsConfig()
|
|
885
|
+
);
|
|
865
886
|
}
|
|
866
887
|
}
|
|
867
888
|
class LibExecutor extends SysExecutor {
|
package/cjs/src/scanInfo.js
CHANGED
|
@@ -77,7 +77,13 @@ class ScanInfo {
|
|
|
77
77
|
const akanConfig = await exec.getConfig();
|
|
78
78
|
const tsconfig = exec.getTsConfig();
|
|
79
79
|
const rootPackageJson = exec.workspace.getPackageJson();
|
|
80
|
-
const
|
|
80
|
+
const gitignorePatterns = exec.workspace.getGitignorePatterns();
|
|
81
|
+
const scanner = new import_dependencyScanner.TypeScriptDependencyScanner(exec.cwdPath, {
|
|
82
|
+
workspaceRoot: exec.workspace.cwdPath,
|
|
83
|
+
tsconfig,
|
|
84
|
+
rootPackageJson,
|
|
85
|
+
gitignorePatterns
|
|
86
|
+
});
|
|
81
87
|
const { pkgDeps, libDeps, npmDeps } = await scanner.getMonorepoDependencies(exec.name);
|
|
82
88
|
const files = {
|
|
83
89
|
constant: { databases: [], scalars: [] },
|
|
@@ -181,15 +187,6 @@ class ScanInfo {
|
|
|
181
187
|
});
|
|
182
188
|
})
|
|
183
189
|
]);
|
|
184
|
-
const missingLibDeps = [];
|
|
185
|
-
libDeps.forEach((libName) => {
|
|
186
|
-
if (!akanConfig.libs.includes(libName))
|
|
187
|
-
missingLibDeps.push(libName);
|
|
188
|
-
});
|
|
189
|
-
if (missingLibDeps.length)
|
|
190
|
-
throw new Error(
|
|
191
|
-
`Missing libs: ${missingLibDeps.join(", ")}, add these dependencies in akan.config.ts as { libs: [...other deps, ${missingLibDeps.join(", ")}] }`
|
|
192
|
-
);
|
|
193
190
|
const scanResult = {
|
|
194
191
|
name: exec.name,
|
|
195
192
|
type: exec.type,
|
|
@@ -279,7 +276,7 @@ class AppInfo extends ScanInfo {
|
|
|
279
276
|
if (this.#sortedLibs)
|
|
280
277
|
return this.#sortedLibs;
|
|
281
278
|
const libIndices = LibInfo.getSortedLibIndices();
|
|
282
|
-
this.#sortedLibs = this.
|
|
279
|
+
this.#sortedLibs = this.getScanResult().libDeps.sort((libNameA, libNameB) => {
|
|
283
280
|
const indexA = libIndices.get(libNameA);
|
|
284
281
|
const indexB = libIndices.get(libNameB);
|
|
285
282
|
if (indexA === void 0 || indexB === void 0)
|
|
@@ -319,7 +316,7 @@ class LibInfo extends ScanInfo {
|
|
|
319
316
|
if (this.#sortedLibIndices)
|
|
320
317
|
return this.#sortedLibIndices;
|
|
321
318
|
this.#sortedLibIndices = new Map(
|
|
322
|
-
[...this.libInfos.entries()].sort(([_, libInfoA], [__, libInfoB]) => libInfoA.
|
|
319
|
+
[...this.libInfos.entries()].sort(([_, libInfoA], [__, libInfoB]) => libInfoA.getScanResult().libDeps.includes(libInfoB.name) ? 1 : -1).map(([libName], index) => [libName, index])
|
|
323
320
|
);
|
|
324
321
|
return this.#sortedLibIndices;
|
|
325
322
|
}
|
|
@@ -353,7 +350,7 @@ class LibInfo extends ScanInfo {
|
|
|
353
350
|
if (this.#sortedLibs)
|
|
354
351
|
return this.#sortedLibs;
|
|
355
352
|
const libs = LibInfo.getSortedLibIndices();
|
|
356
|
-
this.#sortedLibs = this.
|
|
353
|
+
this.#sortedLibs = this.scanResult.libDeps.sort((libNameA, libNameB) => {
|
|
357
354
|
const indexA = libs.get(libNameA);
|
|
358
355
|
const indexB = libs.get(libNameB);
|
|
359
356
|
if (indexA === void 0 || indexB === void 0)
|
|
@@ -366,7 +363,7 @@ class LibInfo extends ScanInfo {
|
|
|
366
363
|
return this.#getSortedLibs();
|
|
367
364
|
}
|
|
368
365
|
getLibInfo(libName) {
|
|
369
|
-
if (!this.getScanResult().
|
|
366
|
+
if (!this.getScanResult().libDeps.includes(libName))
|
|
370
367
|
return void 0;
|
|
371
368
|
const libSet = new Set(this.#getSortedLibs());
|
|
372
369
|
if (!libSet.has(libName))
|
|
@@ -391,7 +388,13 @@ class PkgInfo {
|
|
|
391
388
|
static async getScanResult(exec) {
|
|
392
389
|
const tsconfig = exec.getTsConfig();
|
|
393
390
|
const rootPackageJson = exec.workspace.getPackageJson();
|
|
394
|
-
const
|
|
391
|
+
const gitignorePatterns = exec.workspace.getGitignorePatterns();
|
|
392
|
+
const scanner = new import_dependencyScanner.TypeScriptDependencyScanner(exec.cwdPath, {
|
|
393
|
+
workspaceRoot: exec.workspace.cwdPath,
|
|
394
|
+
tsconfig,
|
|
395
|
+
rootPackageJson,
|
|
396
|
+
gitignorePatterns
|
|
397
|
+
});
|
|
395
398
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
396
399
|
const pkgPathSet = new Set(
|
|
397
400
|
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path2) => tsconfig.compilerOptions.paths?.[path2]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path2) => path2.replace("/*", ""))
|
package/cjs/src/typeChecker.js
CHANGED
|
@@ -74,7 +74,8 @@ ${errorMessages}`);
|
|
|
74
74
|
const diagnostics = [
|
|
75
75
|
...program.getSemanticDiagnostics(),
|
|
76
76
|
...program.getSyntacticDiagnostics(),
|
|
77
|
-
|
|
77
|
+
// Only check declaration diagnostics when declaration emit is enabled
|
|
78
|
+
...this.config.options.declaration ? program.getDeclarationDiagnostics() : []
|
|
78
79
|
];
|
|
79
80
|
const errors = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
|
|
80
81
|
const warnings = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Warning);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
|
+
import ignore from "ignore";
|
|
2
3
|
import * as path from "path";
|
|
3
4
|
import * as ts from "typescript";
|
|
4
5
|
class TypeScriptDependencyScanner {
|
|
@@ -7,10 +8,19 @@ class TypeScriptDependencyScanner {
|
|
|
7
8
|
directory;
|
|
8
9
|
tsconfig;
|
|
9
10
|
rootPackageJson;
|
|
10
|
-
|
|
11
|
+
ig;
|
|
12
|
+
workspaceRoot;
|
|
13
|
+
constructor(directory, {
|
|
14
|
+
workspaceRoot,
|
|
15
|
+
tsconfig,
|
|
16
|
+
rootPackageJson,
|
|
17
|
+
gitignorePatterns = []
|
|
18
|
+
}) {
|
|
11
19
|
this.directory = directory;
|
|
12
20
|
this.tsconfig = tsconfig;
|
|
13
21
|
this.rootPackageJson = rootPackageJson;
|
|
22
|
+
this.ig = ignore().add(gitignorePatterns);
|
|
23
|
+
this.workspaceRoot = workspaceRoot;
|
|
14
24
|
}
|
|
15
25
|
async getMonorepoDependencies(projectName) {
|
|
16
26
|
const npmSet = new Set(
|
|
@@ -72,6 +82,9 @@ class TypeScriptDependencyScanner {
|
|
|
72
82
|
const entries = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
73
83
|
for (const entry of entries) {
|
|
74
84
|
const fullPath = path.join(dir, entry.name);
|
|
85
|
+
const relativePath = path.relative(this.workspaceRoot, fullPath);
|
|
86
|
+
if (this.ig.ignores(relativePath))
|
|
87
|
+
continue;
|
|
75
88
|
if (entry.isDirectory()) {
|
|
76
89
|
if (!["node_modules", "dist", "build", ".git", ".next", "public", "ios", "android"].includes(entry.name))
|
|
77
90
|
await processDirectory(fullPath);
|
package/esm/src/executors.js
CHANGED
|
@@ -290,6 +290,14 @@ class Executor {
|
|
|
290
290
|
this.writeJson("package.json", packageJson);
|
|
291
291
|
this.#packageJson = packageJson;
|
|
292
292
|
}
|
|
293
|
+
#gitignorePatterns = [];
|
|
294
|
+
getGitignorePatterns() {
|
|
295
|
+
if (this.#gitignorePatterns.length)
|
|
296
|
+
return this.#gitignorePatterns;
|
|
297
|
+
const gitignore = this.readFile(".gitignore");
|
|
298
|
+
this.#gitignorePatterns = gitignore.split("\n").map((line) => line.trim()).filter((line) => !!line && !line.startsWith("#"));
|
|
299
|
+
return this.#gitignorePatterns;
|
|
300
|
+
}
|
|
293
301
|
async #applyTemplateFile({
|
|
294
302
|
templatePath,
|
|
295
303
|
targetPath,
|
|
@@ -585,7 +593,12 @@ class SysExecutor extends Executor {
|
|
|
585
593
|
async getConfig({ refresh } = {}) {
|
|
586
594
|
if (this.#akanConfig && !refresh)
|
|
587
595
|
return this.#akanConfig;
|
|
588
|
-
|
|
596
|
+
const tsconfig = this.getTsConfig();
|
|
597
|
+
this.#akanConfig = this.type === "app" ? await getAppConfig(
|
|
598
|
+
this.cwdPath,
|
|
599
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
600
|
+
tsconfig
|
|
601
|
+
) : await getLibConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name });
|
|
589
602
|
return this.#akanConfig;
|
|
590
603
|
}
|
|
591
604
|
async getModules() {
|
|
@@ -739,11 +752,11 @@ class SysExecutor extends Executor {
|
|
|
739
752
|
return modules.map((module) => this.getLocalFile(`lib/${module}/${module}.constant.ts`));
|
|
740
753
|
}
|
|
741
754
|
async getConstantFilesWithLibs() {
|
|
742
|
-
const
|
|
755
|
+
const scanInfo = this.type === "app" ? await AppInfo.fromExecutor(this) : await LibInfo.fromExecutor(this);
|
|
743
756
|
const sysContantFiles = await this.getConstantFiles();
|
|
744
757
|
const sysScalarConstantFiles = await this.getScalarConstantFiles();
|
|
745
758
|
const libConstantFiles = await Promise.all(
|
|
746
|
-
|
|
759
|
+
scanInfo.getLibs().map(async (lib) => [
|
|
747
760
|
...await LibExecutor.from(this, lib).getConstantFiles(),
|
|
748
761
|
...await LibExecutor.from(this, lib).getScalarConstantFiles()
|
|
749
762
|
])
|
|
@@ -796,11 +809,11 @@ class AppExecutor extends SysExecutor {
|
|
|
796
809
|
async getConfig({ refresh } = {}) {
|
|
797
810
|
if (this.#akanConfig && !refresh)
|
|
798
811
|
return this.#akanConfig;
|
|
799
|
-
this.#akanConfig = await getAppConfig(
|
|
800
|
-
|
|
801
|
-
type: "app",
|
|
802
|
-
|
|
803
|
-
|
|
812
|
+
this.#akanConfig = await getAppConfig(
|
|
813
|
+
this.cwdPath,
|
|
814
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
815
|
+
this.getTsConfig()
|
|
816
|
+
);
|
|
804
817
|
return this.#akanConfig;
|
|
805
818
|
}
|
|
806
819
|
async syncAssets(libDeps) {
|
|
@@ -823,10 +836,18 @@ class AppExecutor extends SysExecutor {
|
|
|
823
836
|
]);
|
|
824
837
|
}
|
|
825
838
|
async increaseBuildNum() {
|
|
826
|
-
await increaseBuildNum(
|
|
839
|
+
await increaseBuildNum(
|
|
840
|
+
this.cwdPath,
|
|
841
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
842
|
+
this.getTsConfig()
|
|
843
|
+
);
|
|
827
844
|
}
|
|
828
845
|
async decreaseBuildNum() {
|
|
829
|
-
await decreaseBuildNum(
|
|
846
|
+
await decreaseBuildNum(
|
|
847
|
+
this.cwdPath,
|
|
848
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
849
|
+
this.getTsConfig()
|
|
850
|
+
);
|
|
830
851
|
}
|
|
831
852
|
}
|
|
832
853
|
class LibExecutor extends SysExecutor {
|
package/esm/src/scanInfo.js
CHANGED
|
@@ -42,7 +42,13 @@ class ScanInfo {
|
|
|
42
42
|
const akanConfig = await exec.getConfig();
|
|
43
43
|
const tsconfig = exec.getTsConfig();
|
|
44
44
|
const rootPackageJson = exec.workspace.getPackageJson();
|
|
45
|
-
const
|
|
45
|
+
const gitignorePatterns = exec.workspace.getGitignorePatterns();
|
|
46
|
+
const scanner = new TypeScriptDependencyScanner(exec.cwdPath, {
|
|
47
|
+
workspaceRoot: exec.workspace.cwdPath,
|
|
48
|
+
tsconfig,
|
|
49
|
+
rootPackageJson,
|
|
50
|
+
gitignorePatterns
|
|
51
|
+
});
|
|
46
52
|
const { pkgDeps, libDeps, npmDeps } = await scanner.getMonorepoDependencies(exec.name);
|
|
47
53
|
const files = {
|
|
48
54
|
constant: { databases: [], scalars: [] },
|
|
@@ -146,15 +152,6 @@ class ScanInfo {
|
|
|
146
152
|
});
|
|
147
153
|
})
|
|
148
154
|
]);
|
|
149
|
-
const missingLibDeps = [];
|
|
150
|
-
libDeps.forEach((libName) => {
|
|
151
|
-
if (!akanConfig.libs.includes(libName))
|
|
152
|
-
missingLibDeps.push(libName);
|
|
153
|
-
});
|
|
154
|
-
if (missingLibDeps.length)
|
|
155
|
-
throw new Error(
|
|
156
|
-
`Missing libs: ${missingLibDeps.join(", ")}, add these dependencies in akan.config.ts as { libs: [...other deps, ${missingLibDeps.join(", ")}] }`
|
|
157
|
-
);
|
|
158
155
|
const scanResult = {
|
|
159
156
|
name: exec.name,
|
|
160
157
|
type: exec.type,
|
|
@@ -244,7 +241,7 @@ class AppInfo extends ScanInfo {
|
|
|
244
241
|
if (this.#sortedLibs)
|
|
245
242
|
return this.#sortedLibs;
|
|
246
243
|
const libIndices = LibInfo.getSortedLibIndices();
|
|
247
|
-
this.#sortedLibs = this.
|
|
244
|
+
this.#sortedLibs = this.getScanResult().libDeps.sort((libNameA, libNameB) => {
|
|
248
245
|
const indexA = libIndices.get(libNameA);
|
|
249
246
|
const indexB = libIndices.get(libNameB);
|
|
250
247
|
if (indexA === void 0 || indexB === void 0)
|
|
@@ -284,7 +281,7 @@ class LibInfo extends ScanInfo {
|
|
|
284
281
|
if (this.#sortedLibIndices)
|
|
285
282
|
return this.#sortedLibIndices;
|
|
286
283
|
this.#sortedLibIndices = new Map(
|
|
287
|
-
[...this.libInfos.entries()].sort(([_, libInfoA], [__, libInfoB]) => libInfoA.
|
|
284
|
+
[...this.libInfos.entries()].sort(([_, libInfoA], [__, libInfoB]) => libInfoA.getScanResult().libDeps.includes(libInfoB.name) ? 1 : -1).map(([libName], index) => [libName, index])
|
|
288
285
|
);
|
|
289
286
|
return this.#sortedLibIndices;
|
|
290
287
|
}
|
|
@@ -318,7 +315,7 @@ class LibInfo extends ScanInfo {
|
|
|
318
315
|
if (this.#sortedLibs)
|
|
319
316
|
return this.#sortedLibs;
|
|
320
317
|
const libs = LibInfo.getSortedLibIndices();
|
|
321
|
-
this.#sortedLibs = this.
|
|
318
|
+
this.#sortedLibs = this.scanResult.libDeps.sort((libNameA, libNameB) => {
|
|
322
319
|
const indexA = libs.get(libNameA);
|
|
323
320
|
const indexB = libs.get(libNameB);
|
|
324
321
|
if (indexA === void 0 || indexB === void 0)
|
|
@@ -331,7 +328,7 @@ class LibInfo extends ScanInfo {
|
|
|
331
328
|
return this.#getSortedLibs();
|
|
332
329
|
}
|
|
333
330
|
getLibInfo(libName) {
|
|
334
|
-
if (!this.getScanResult().
|
|
331
|
+
if (!this.getScanResult().libDeps.includes(libName))
|
|
335
332
|
return void 0;
|
|
336
333
|
const libSet = new Set(this.#getSortedLibs());
|
|
337
334
|
if (!libSet.has(libName))
|
|
@@ -356,7 +353,13 @@ class PkgInfo {
|
|
|
356
353
|
static async getScanResult(exec) {
|
|
357
354
|
const tsconfig = exec.getTsConfig();
|
|
358
355
|
const rootPackageJson = exec.workspace.getPackageJson();
|
|
359
|
-
const
|
|
356
|
+
const gitignorePatterns = exec.workspace.getGitignorePatterns();
|
|
357
|
+
const scanner = new TypeScriptDependencyScanner(exec.cwdPath, {
|
|
358
|
+
workspaceRoot: exec.workspace.cwdPath,
|
|
359
|
+
tsconfig,
|
|
360
|
+
rootPackageJson,
|
|
361
|
+
gitignorePatterns
|
|
362
|
+
});
|
|
360
363
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
361
364
|
const pkgPathSet = new Set(
|
|
362
365
|
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path2) => tsconfig.compilerOptions.paths?.[path2]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path2) => path2.replace("/*", ""))
|
package/esm/src/typeChecker.js
CHANGED
|
@@ -42,7 +42,8 @@ ${errorMessages}`);
|
|
|
42
42
|
const diagnostics = [
|
|
43
43
|
...program.getSemanticDiagnostics(),
|
|
44
44
|
...program.getSyntacticDiagnostics(),
|
|
45
|
-
|
|
45
|
+
// Only check declaration diagnostics when declaration emit is enabled
|
|
46
|
+
...this.config.options.declaration ? program.getDeclarationDiagnostics() : []
|
|
46
47
|
];
|
|
47
48
|
const errors = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
|
|
48
49
|
const warnings = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Warning);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "0.9.60-canary.
|
|
3
|
+
"version": "0.9.60-canary.11",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"esbuild-plugin-d.ts": "^1.3.1",
|
|
29
29
|
"eslint": "^9.19.0",
|
|
30
30
|
"form-data": "^4.0.1",
|
|
31
|
+
"ignore": "^7.0.5",
|
|
31
32
|
"ink": "^6.1.0",
|
|
32
33
|
"js-yaml": "^4.1.0",
|
|
33
34
|
"ora": "^3.4.0",
|
|
34
|
-
"react": "19.2.
|
|
35
|
+
"react": "19.2.1",
|
|
35
36
|
"reflect-metadata": "^0.2.2",
|
|
36
37
|
"tunnel-ssh": "^5.2.0",
|
|
37
38
|
"typescript": "5.8.3"
|
|
@@ -4,9 +4,13 @@ export declare class TypeScriptDependencyScanner {
|
|
|
4
4
|
private readonly directory;
|
|
5
5
|
private readonly tsconfig;
|
|
6
6
|
private readonly rootPackageJson;
|
|
7
|
-
|
|
7
|
+
private readonly ig;
|
|
8
|
+
private readonly workspaceRoot;
|
|
9
|
+
constructor(directory: string, { workspaceRoot, tsconfig, rootPackageJson, gitignorePatterns, }: {
|
|
10
|
+
workspaceRoot: string;
|
|
8
11
|
tsconfig: TsConfigJson;
|
|
9
12
|
rootPackageJson: PackageJson;
|
|
13
|
+
gitignorePatterns?: string[];
|
|
10
14
|
});
|
|
11
15
|
getMonorepoDependencies(projectName: string): Promise<{
|
|
12
16
|
pkgDeps: string[];
|
package/src/executors.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export declare class Executor {
|
|
|
69
69
|
refresh?: boolean;
|
|
70
70
|
}): PackageJson;
|
|
71
71
|
setPackageJson(packageJson: PackageJson): void;
|
|
72
|
+
getGitignorePatterns(): string[];
|
|
72
73
|
_applyTemplate({ basePath, template, scanInfo, dict, options, overwrite, }: {
|
|
73
74
|
basePath: string;
|
|
74
75
|
template: string;
|