Skip to content

Commit 7c45bbe

Browse files
committed
fix: using getInputsFromScripts on config.app
1 parent 30dff7b commit 7c45bbe

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/knip/src/plugins/aws-cdk/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ const isEnabled: IsPluginEnabled = ({ dependencies }) => hasDependency(dependenc
1414

1515
const config: string[] = ["cdk.json"];
1616

17-
const resolveConfig: ResolveConfig<AwsCdkConfig> = async config => {
17+
const resolveConfig: ResolveConfig<AwsCdkConfig> = async (config, options) => {
1818
if (!config) return [];
1919

20-
const app = config.app.split(" ")[0];
20+
const app = options.getInputsFromScripts(config.app, { knownBinsOnly: true });
2121
const watch = config.watch?.include ?? [];
2222
const context = Object.keys(config.context ?? {}).map(key => key.split("/")[0]) ?? [];
23-
return compact([app, ...watch, ...context]).map(id => toDependency(id));
23+
return compact([...app, ...watch, ...context]).map(id => (typeof id === 'string' ? toDependency(id) : id));
2424
};
2525

2626
const production: string[] = [

packages/knip/test/plugins/aws-cdk.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ test('Find dependencies with the aws-cdk plugin', async () => {
1919

2020
assert.deepEqual(counters, {
2121
...baseCounters,
22+
binaries: 1,
2223
dependencies: 0,
23-
devDependencies: 1,
24+
devDependencies: 2,
2425
unlisted: 1,
2526
processed: 3,
2627
total: 3,

0 commit comments

Comments
 (0)