Skip to content

Commit 6c7afad

Browse files
committed
fix: Path improvements
1 parent 8681538 commit 6c7afad

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "default",
3-
"version": "0.12.0",
3+
"version": "0.12.1",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
"ajv": "^8.12.0",
2424
"ajv-formats": "^2.1.1",
2525
"semver": "^7.6.0",
26-
"codify-plugin-lib": "1.0.156",
26+
"codify-plugin-lib": "1.0.165",
2727
"codify-schemas": "1.0.63",
2828
"chalk": "^5.3.0",
2929
"debug": "^4.3.4",

src/resources/shell/path/path-resource.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ export class PathResource extends Resource<PathConfig> {
4343
declarationsOnly: { default: false, setting: true },
4444
},
4545
importAndDestroy:{
46-
refreshKeys: ['paths', 'declarationsOnly'],
47-
defaultRefreshValues: {
48-
paths: [],
49-
declarationsOnly: true,
46+
refreshMapper: (input) => {
47+
if (Object.keys(input).length === 0) {
48+
return { paths: [], declarationsOnly: true };
49+
}
50+
51+
return input;
5052
}
5153
},
5254
allowMultiple: {
@@ -56,7 +58,7 @@ export class PathResource extends Resource<PathConfig> {
5658
}
5759

5860
const currentPaths = new Set(current.paths)
59-
return desired.paths?.some((p) => currentPaths.has(p));
61+
return desired.paths?.some((p) => currentPaths.has(p)) ?? false;
6062
}
6163
}
6264
}
@@ -69,6 +71,9 @@ export class PathResource extends Resource<PathConfig> {
6971
}
7072

7173
override async refresh(parameters: Partial<PathConfig>, context: RefreshContext<PathConfig>): Promise<Partial<PathConfig> | null> {
74+
console.log(parameters)
75+
console.log(context);
76+
7277
// If declarations only, we only look into files to find potential paths
7378
if (parameters.declarationsOnly || context.isStateful) {
7479
const pathsResult = new Set<string>();
@@ -86,6 +91,8 @@ export class PathResource extends Resource<PathConfig> {
8691
}
8792

8893
if (parameters.paths) {
94+
console.log(`Path declarations ${path}`);
95+
console.log(pathDeclarations)
8996
pathDeclarations
9097
.map((d) => d.path)
9198
.forEach((d) => pathsResult.add(resolvePathWithVariables(untildify(d))));
@@ -96,6 +103,8 @@ export class PathResource extends Resource<PathConfig> {
96103
return null;
97104
}
98105

106+
console.log(pathsResult)
107+
99108
return {
100109
...parameters,
101110
paths: [...pathsResult],

0 commit comments

Comments
 (0)