@platformos/platformos-check-node 0.0.6 → 0.0.8
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/configs/all.yml +2 -119
- package/configs/recommended.yml +2 -97
- package/dist/autofix.d.ts +3 -3
- package/dist/autofix.js +1 -1
- package/dist/backfill-docs/argument-collector.d.ts +2 -2
- package/dist/backfill-docs/index.js +7 -8
- package/dist/cli.js +8 -8
- package/dist/config/load-config-description.js +0 -1
- package/dist/config/load-third-party-checks.d.ts +1 -1
- package/dist/config/load-third-party-checks.js +7 -12
- package/dist/config/resolve/merge-fragments.js +0 -2
- package/dist/config/resolve/read-yaml.js +1 -7
- package/dist/config/types.d.ts +3 -5
- package/dist/index.d.ts +13 -9
- package/dist/index.js +31 -67
- package/dist/test/test-helpers.js +2 -36
- package/package.json +7 -9
package/configs/all.yml
CHANGED
|
@@ -3,91 +3,33 @@
|
|
|
3
3
|
# Do not modify manually. Your changes will be overwritten.
|
|
4
4
|
ignore:
|
|
5
5
|
- node_modules/**
|
|
6
|
-
AppBlockMissingSchema:
|
|
7
|
-
enabled: false
|
|
8
|
-
severity: 0
|
|
9
|
-
AppBlockValidTags:
|
|
10
|
-
enabled: false
|
|
11
|
-
severity: 0
|
|
12
|
-
AssetPreload:
|
|
13
|
-
enabled: true
|
|
14
|
-
severity: 1
|
|
15
|
-
AssetSizeAppBlockCSS:
|
|
16
|
-
enabled: false
|
|
17
|
-
severity: 0
|
|
18
|
-
thresholdInBytes: 100000
|
|
19
|
-
AssetSizeAppBlockJavaScript:
|
|
20
|
-
enabled: false
|
|
21
|
-
severity: 0
|
|
22
|
-
thresholdInBytes: 10000
|
|
23
|
-
AssetSizeCSS:
|
|
24
|
-
enabled: true
|
|
25
|
-
severity: 0
|
|
26
|
-
thresholdInBytes: 100000
|
|
27
|
-
AssetSizeJavaScript:
|
|
28
|
-
enabled: true
|
|
29
|
-
severity: 0
|
|
30
|
-
thresholdInBytes: 10000
|
|
31
|
-
BlockIdUsage:
|
|
32
|
-
enabled: true
|
|
33
|
-
severity: 1
|
|
34
|
-
CdnPreconnect:
|
|
35
|
-
enabled: true
|
|
36
|
-
severity: 0
|
|
37
|
-
ContentForHeaderModification:
|
|
38
|
-
enabled: true
|
|
39
|
-
severity: 0
|
|
40
|
-
DeprecateBgsizes:
|
|
41
|
-
enabled: true
|
|
42
|
-
severity: 1
|
|
43
|
-
DeprecateLazysizes:
|
|
44
|
-
enabled: true
|
|
45
|
-
severity: 1
|
|
46
6
|
DeprecatedFilter:
|
|
47
7
|
enabled: true
|
|
48
8
|
severity: 1
|
|
49
|
-
DeprecatedFontsOnSectionsAndBlocks:
|
|
50
|
-
enabled: true
|
|
51
|
-
severity: 1
|
|
52
|
-
DeprecatedFontsOnSettingsSchema:
|
|
53
|
-
enabled: true
|
|
54
|
-
severity: 1
|
|
55
9
|
DeprecatedTag:
|
|
56
10
|
enabled: true
|
|
57
11
|
severity: 1
|
|
58
|
-
|
|
12
|
+
DuplicateFunctionArguments:
|
|
59
13
|
enabled: true
|
|
60
14
|
severity: 1
|
|
61
15
|
DuplicateRenderPartialArguments:
|
|
62
16
|
enabled: true
|
|
63
17
|
severity: 1
|
|
64
|
-
EmptyBlockContent:
|
|
65
|
-
enabled: true
|
|
66
|
-
severity: 1
|
|
67
18
|
GraphQLCheck:
|
|
68
19
|
enabled: true
|
|
69
20
|
severity: 0
|
|
70
21
|
GraphQLVariablesCheck:
|
|
71
22
|
enabled: true
|
|
72
23
|
severity: 0
|
|
73
|
-
HardcodedRoutes:
|
|
74
|
-
enabled: true
|
|
75
|
-
severity: 1
|
|
76
24
|
ImgWidthAndHeight:
|
|
77
25
|
enabled: true
|
|
78
26
|
severity: 0
|
|
79
27
|
InvalidHashAssignTarget:
|
|
80
28
|
enabled: true
|
|
81
29
|
severity: 0
|
|
82
|
-
JSONMissingBlock:
|
|
83
|
-
enabled: true
|
|
84
|
-
severity: 0
|
|
85
30
|
JSONSyntaxError:
|
|
86
31
|
enabled: true
|
|
87
32
|
severity: 0
|
|
88
|
-
LiquidFreeSettings:
|
|
89
|
-
enabled: true
|
|
90
|
-
severity: 1
|
|
91
33
|
LiquidHTMLSyntaxError:
|
|
92
34
|
enabled: true
|
|
93
35
|
severity: 0
|
|
@@ -100,39 +42,16 @@ MetadataParamsCheck:
|
|
|
100
42
|
MissingAsset:
|
|
101
43
|
enabled: true
|
|
102
44
|
severity: 0
|
|
103
|
-
|
|
104
|
-
enabled: true
|
|
105
|
-
severity: 1
|
|
106
|
-
MissingTemplate:
|
|
45
|
+
MissingPartial:
|
|
107
46
|
enabled: true
|
|
108
47
|
severity: 0
|
|
109
48
|
ignoreMissing: []
|
|
110
49
|
OrphanedPartial:
|
|
111
50
|
enabled: true
|
|
112
51
|
severity: 1
|
|
113
|
-
PaginationSize:
|
|
114
|
-
enabled: true
|
|
115
|
-
severity: 1
|
|
116
|
-
minSize: 1
|
|
117
|
-
maxSize: 250
|
|
118
52
|
ParserBlockingScript:
|
|
119
53
|
enabled: true
|
|
120
54
|
severity: 0
|
|
121
|
-
RemoteAsset:
|
|
122
|
-
enabled: true
|
|
123
|
-
severity: 1
|
|
124
|
-
ReservedDocParamNames:
|
|
125
|
-
enabled: true
|
|
126
|
-
severity: 0
|
|
127
|
-
SchemaPresetsBlockOrder:
|
|
128
|
-
enabled: true
|
|
129
|
-
severity: 1
|
|
130
|
-
SchemaPresetsStaticBlocks:
|
|
131
|
-
enabled: true
|
|
132
|
-
severity: 0
|
|
133
|
-
StaticStylesheetAndJavascriptTags:
|
|
134
|
-
enabled: true
|
|
135
|
-
severity: 0
|
|
136
55
|
TranslationKeyExists:
|
|
137
56
|
enabled: true
|
|
138
57
|
severity: 0
|
|
@@ -145,21 +64,12 @@ UndefinedObject:
|
|
|
145
64
|
UniqueDocParamNames:
|
|
146
65
|
enabled: true
|
|
147
66
|
severity: 0
|
|
148
|
-
UniqueSettingId:
|
|
149
|
-
enabled: true
|
|
150
|
-
severity: 0
|
|
151
|
-
UniqueStaticBlockId:
|
|
152
|
-
enabled: true
|
|
153
|
-
severity: 0
|
|
154
67
|
UnknownFilter:
|
|
155
68
|
enabled: true
|
|
156
69
|
severity: 0
|
|
157
70
|
UnknownProperty:
|
|
158
71
|
enabled: true
|
|
159
72
|
severity: 0
|
|
160
|
-
UnrecognizedContentForArguments:
|
|
161
|
-
enabled: true
|
|
162
|
-
severity: 1
|
|
163
73
|
UnrecognizedRenderPartialArguments:
|
|
164
74
|
enabled: true
|
|
165
75
|
severity: 1
|
|
@@ -169,15 +79,6 @@ UnusedAssign:
|
|
|
169
79
|
UnusedDocParam:
|
|
170
80
|
enabled: true
|
|
171
81
|
severity: 1
|
|
172
|
-
ValidBlockTarget:
|
|
173
|
-
enabled: true
|
|
174
|
-
severity: 0
|
|
175
|
-
ValidContentForArgumentTypes:
|
|
176
|
-
enabled: true
|
|
177
|
-
severity: 1
|
|
178
|
-
ValidContentForArguments:
|
|
179
|
-
enabled: true
|
|
180
|
-
severity: 0
|
|
181
82
|
ValidDocParamTypes:
|
|
182
83
|
enabled: true
|
|
183
84
|
severity: 0
|
|
@@ -187,27 +88,9 @@ ValidHTMLTranslation:
|
|
|
187
88
|
ValidJSON:
|
|
188
89
|
enabled: true
|
|
189
90
|
severity: 0
|
|
190
|
-
ValidLocalBlocks:
|
|
191
|
-
enabled: true
|
|
192
|
-
severity: 0
|
|
193
91
|
ValidRenderPartialArgumentTypes:
|
|
194
92
|
enabled: true
|
|
195
93
|
severity: 1
|
|
196
|
-
ValidSchema:
|
|
197
|
-
enabled: true
|
|
198
|
-
severity: 0
|
|
199
|
-
ValidSchemaName:
|
|
200
|
-
enabled: true
|
|
201
|
-
severity: 0
|
|
202
|
-
ValidSettingsKey:
|
|
203
|
-
enabled: true
|
|
204
|
-
severity: 0
|
|
205
|
-
ValidStaticBlockType:
|
|
206
|
-
enabled: true
|
|
207
|
-
severity: 0
|
|
208
|
-
ValidVisibleIf:
|
|
209
|
-
enabled: true
|
|
210
|
-
severity: 0
|
|
211
94
|
VariableName:
|
|
212
95
|
enabled: true
|
|
213
96
|
severity: 1
|
package/configs/recommended.yml
CHANGED
|
@@ -3,69 +3,33 @@
|
|
|
3
3
|
# Do not modify manually. Your changes will be overwritten.
|
|
4
4
|
ignore:
|
|
5
5
|
- node_modules/**
|
|
6
|
-
AssetPreload:
|
|
7
|
-
enabled: true
|
|
8
|
-
severity: 1
|
|
9
|
-
BlockIdUsage:
|
|
10
|
-
enabled: true
|
|
11
|
-
severity: 1
|
|
12
|
-
CdnPreconnect:
|
|
13
|
-
enabled: true
|
|
14
|
-
severity: 0
|
|
15
|
-
ContentForHeaderModification:
|
|
16
|
-
enabled: true
|
|
17
|
-
severity: 0
|
|
18
|
-
DeprecateBgsizes:
|
|
19
|
-
enabled: true
|
|
20
|
-
severity: 1
|
|
21
|
-
DeprecateLazysizes:
|
|
22
|
-
enabled: true
|
|
23
|
-
severity: 1
|
|
24
6
|
DeprecatedFilter:
|
|
25
7
|
enabled: true
|
|
26
8
|
severity: 1
|
|
27
|
-
DeprecatedFontsOnSectionsAndBlocks:
|
|
28
|
-
enabled: true
|
|
29
|
-
severity: 1
|
|
30
|
-
DeprecatedFontsOnSettingsSchema:
|
|
31
|
-
enabled: true
|
|
32
|
-
severity: 1
|
|
33
9
|
DeprecatedTag:
|
|
34
10
|
enabled: true
|
|
35
11
|
severity: 1
|
|
36
|
-
|
|
12
|
+
DuplicateFunctionArguments:
|
|
37
13
|
enabled: true
|
|
38
14
|
severity: 1
|
|
39
15
|
DuplicateRenderPartialArguments:
|
|
40
16
|
enabled: true
|
|
41
17
|
severity: 1
|
|
42
|
-
EmptyBlockContent:
|
|
43
|
-
enabled: true
|
|
44
|
-
severity: 1
|
|
45
18
|
GraphQLCheck:
|
|
46
19
|
enabled: true
|
|
47
20
|
severity: 0
|
|
48
21
|
GraphQLVariablesCheck:
|
|
49
22
|
enabled: true
|
|
50
23
|
severity: 0
|
|
51
|
-
HardcodedRoutes:
|
|
52
|
-
enabled: true
|
|
53
|
-
severity: 1
|
|
54
24
|
ImgWidthAndHeight:
|
|
55
25
|
enabled: true
|
|
56
26
|
severity: 0
|
|
57
27
|
InvalidHashAssignTarget:
|
|
58
28
|
enabled: true
|
|
59
29
|
severity: 0
|
|
60
|
-
JSONMissingBlock:
|
|
61
|
-
enabled: true
|
|
62
|
-
severity: 0
|
|
63
30
|
JSONSyntaxError:
|
|
64
31
|
enabled: true
|
|
65
32
|
severity: 0
|
|
66
|
-
LiquidFreeSettings:
|
|
67
|
-
enabled: true
|
|
68
|
-
severity: 1
|
|
69
33
|
LiquidHTMLSyntaxError:
|
|
70
34
|
enabled: true
|
|
71
35
|
severity: 0
|
|
@@ -78,39 +42,16 @@ MetadataParamsCheck:
|
|
|
78
42
|
MissingAsset:
|
|
79
43
|
enabled: true
|
|
80
44
|
severity: 0
|
|
81
|
-
|
|
82
|
-
enabled: true
|
|
83
|
-
severity: 1
|
|
84
|
-
MissingTemplate:
|
|
45
|
+
MissingPartial:
|
|
85
46
|
enabled: true
|
|
86
47
|
severity: 0
|
|
87
48
|
ignoreMissing: []
|
|
88
49
|
OrphanedPartial:
|
|
89
50
|
enabled: true
|
|
90
51
|
severity: 1
|
|
91
|
-
PaginationSize:
|
|
92
|
-
enabled: true
|
|
93
|
-
severity: 1
|
|
94
|
-
minSize: 1
|
|
95
|
-
maxSize: 250
|
|
96
52
|
ParserBlockingScript:
|
|
97
53
|
enabled: true
|
|
98
54
|
severity: 0
|
|
99
|
-
RemoteAsset:
|
|
100
|
-
enabled: true
|
|
101
|
-
severity: 1
|
|
102
|
-
ReservedDocParamNames:
|
|
103
|
-
enabled: true
|
|
104
|
-
severity: 0
|
|
105
|
-
SchemaPresetsBlockOrder:
|
|
106
|
-
enabled: true
|
|
107
|
-
severity: 1
|
|
108
|
-
SchemaPresetsStaticBlocks:
|
|
109
|
-
enabled: true
|
|
110
|
-
severity: 0
|
|
111
|
-
StaticStylesheetAndJavascriptTags:
|
|
112
|
-
enabled: true
|
|
113
|
-
severity: 0
|
|
114
55
|
TranslationKeyExists:
|
|
115
56
|
enabled: true
|
|
116
57
|
severity: 0
|
|
@@ -123,21 +64,12 @@ UndefinedObject:
|
|
|
123
64
|
UniqueDocParamNames:
|
|
124
65
|
enabled: true
|
|
125
66
|
severity: 0
|
|
126
|
-
UniqueSettingId:
|
|
127
|
-
enabled: true
|
|
128
|
-
severity: 0
|
|
129
|
-
UniqueStaticBlockId:
|
|
130
|
-
enabled: true
|
|
131
|
-
severity: 0
|
|
132
67
|
UnknownFilter:
|
|
133
68
|
enabled: true
|
|
134
69
|
severity: 0
|
|
135
70
|
UnknownProperty:
|
|
136
71
|
enabled: true
|
|
137
72
|
severity: 0
|
|
138
|
-
UnrecognizedContentForArguments:
|
|
139
|
-
enabled: true
|
|
140
|
-
severity: 1
|
|
141
73
|
UnrecognizedRenderPartialArguments:
|
|
142
74
|
enabled: true
|
|
143
75
|
severity: 1
|
|
@@ -147,15 +79,6 @@ UnusedAssign:
|
|
|
147
79
|
UnusedDocParam:
|
|
148
80
|
enabled: true
|
|
149
81
|
severity: 1
|
|
150
|
-
ValidBlockTarget:
|
|
151
|
-
enabled: true
|
|
152
|
-
severity: 0
|
|
153
|
-
ValidContentForArgumentTypes:
|
|
154
|
-
enabled: true
|
|
155
|
-
severity: 1
|
|
156
|
-
ValidContentForArguments:
|
|
157
|
-
enabled: true
|
|
158
|
-
severity: 0
|
|
159
82
|
ValidDocParamTypes:
|
|
160
83
|
enabled: true
|
|
161
84
|
severity: 0
|
|
@@ -165,27 +88,9 @@ ValidHTMLTranslation:
|
|
|
165
88
|
ValidJSON:
|
|
166
89
|
enabled: true
|
|
167
90
|
severity: 0
|
|
168
|
-
ValidLocalBlocks:
|
|
169
|
-
enabled: true
|
|
170
|
-
severity: 0
|
|
171
91
|
ValidRenderPartialArgumentTypes:
|
|
172
92
|
enabled: true
|
|
173
93
|
severity: 1
|
|
174
|
-
ValidSchema:
|
|
175
|
-
enabled: true
|
|
176
|
-
severity: 0
|
|
177
|
-
ValidSchemaName:
|
|
178
|
-
enabled: true
|
|
179
|
-
severity: 0
|
|
180
|
-
ValidSettingsKey:
|
|
181
|
-
enabled: true
|
|
182
|
-
severity: 0
|
|
183
|
-
ValidStaticBlockType:
|
|
184
|
-
enabled: true
|
|
185
|
-
severity: 0
|
|
186
|
-
ValidVisibleIf:
|
|
187
|
-
enabled: true
|
|
188
|
-
severity: 0
|
|
189
94
|
VariableName:
|
|
190
95
|
enabled: true
|
|
191
96
|
severity: 1
|
package/dist/autofix.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Offense,
|
|
1
|
+
import { Offense, App, FixApplicator } from '@platformos/platformos-check-common';
|
|
2
2
|
export declare const saveToDiskFixApplicator: FixApplicator;
|
|
3
3
|
/**
|
|
4
|
-
* Apply and save to disk the safe fixes for a set of offenses on
|
|
4
|
+
* Apply and save to disk the safe fixes for a set of offenses on an app.
|
|
5
5
|
*/
|
|
6
|
-
export declare function autofix(sourceCodes:
|
|
6
|
+
export declare function autofix(sourceCodes: App, offenses: Offense[]): Promise<void>;
|
package/dist/autofix.js
CHANGED
|
@@ -10,7 +10,7 @@ const saveToDiskFixApplicator = async (sourceCode, fix) => {
|
|
|
10
10
|
};
|
|
11
11
|
exports.saveToDiskFixApplicator = saveToDiskFixApplicator;
|
|
12
12
|
/**
|
|
13
|
-
* Apply and save to disk the safe fixes for a set of offenses on
|
|
13
|
+
* Apply and save to disk the safe fixes for a set of offenses on an app.
|
|
14
14
|
*/
|
|
15
15
|
async function autofix(sourceCodes, offenses) {
|
|
16
16
|
await (0, platformos_check_common_1.autofix)(sourceCodes, offenses, exports.saveToDiskFixApplicator);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { App } from '@platformos/platformos-check-common';
|
|
2
2
|
import { PartialUsage } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Collect all partial usages from a theme by visiting function, render, and include tags.
|
|
5
5
|
*/
|
|
6
|
-
export declare function collectPartialUsages(theme:
|
|
6
|
+
export declare function collectPartialUsages(theme: App, verbose?: boolean, log?: (message: string) => void): Promise<Map<string, PartialUsage>>;
|
|
@@ -55,11 +55,10 @@ async function backfillDocs(options, log = console.log) {
|
|
|
55
55
|
errors: [],
|
|
56
56
|
};
|
|
57
57
|
log('Scanning for partial usages (function, render, include)...');
|
|
58
|
-
// Load theme configuration
|
|
59
58
|
const config = await (0, index_1.loadConfig)(undefined, rootPath);
|
|
60
|
-
const
|
|
61
|
-
// Collect all partial usages from the
|
|
62
|
-
const usageMap = await (0, argument_collector_1.collectPartialUsages)(
|
|
59
|
+
const app = await (0, index_1.getApp)(config);
|
|
60
|
+
// Collect all partial usages from the app
|
|
61
|
+
const usageMap = await (0, argument_collector_1.collectPartialUsages)(app, verbose, log);
|
|
63
62
|
const totalCalls = Array.from(usageMap.values()).reduce((sum, usage) => sum + Array.from(usage.arguments.values()).reduce((s, a) => s + a.usageCount, 0), 0);
|
|
64
63
|
log(`Found ${totalCalls} partial calls referencing ${usageMap.size} partials\n`);
|
|
65
64
|
if (usageMap.size === 0) {
|
|
@@ -210,7 +209,7 @@ async function runBackfillDocsCLI(args) {
|
|
|
210
209
|
}
|
|
211
210
|
function printHelp() {
|
|
212
211
|
console.log(`
|
|
213
|
-
Usage:
|
|
212
|
+
Usage: platformos-check backfill-docs [path] [options]
|
|
214
213
|
|
|
215
214
|
Scans a platformOS project for partial usages (function, render, include tags)
|
|
216
215
|
and backfills or updates {% doc %} tags in the corresponding partial files.
|
|
@@ -225,9 +224,9 @@ Options:
|
|
|
225
224
|
--help, -h Show this help message
|
|
226
225
|
|
|
227
226
|
Examples:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
platformos-check backfill-docs
|
|
228
|
+
platformos-check backfill-docs ./my-project --dry-run
|
|
229
|
+
platformos-check backfill-docs --verbose --required
|
|
231
230
|
`);
|
|
232
231
|
}
|
|
233
232
|
//# sourceMappingURL=index.js.map
|
package/dist/cli.js
CHANGED
|
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const index_1 = require("./index");
|
|
7
7
|
const backfill_docs_1 = require("./backfill-docs");
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
async function
|
|
9
|
+
async function runCheck(args) {
|
|
10
10
|
const root = node_path_1.default.resolve(args[0] || '.');
|
|
11
11
|
const configPath = args[1] ? node_path_1.default.resolve(args[1]) : undefined;
|
|
12
|
-
const {
|
|
12
|
+
const { app, config, offenses } = await (0, index_1.appCheckRun)(root, configPath, console.error.bind(console));
|
|
13
13
|
console.log(JSON.stringify(offenses, null, 2));
|
|
14
14
|
console.log(JSON.stringify(config, null, 2));
|
|
15
|
-
console.log(JSON.stringify(
|
|
15
|
+
console.log(JSON.stringify(app.map((x) => x.uri), null, 2));
|
|
16
16
|
}
|
|
17
17
|
function printUsage() {
|
|
18
18
|
console.log(`
|
|
19
|
-
Usage:
|
|
19
|
+
Usage: platformos-check [command] [options]
|
|
20
20
|
|
|
21
21
|
Commands:
|
|
22
|
-
<path> Run
|
|
22
|
+
<path> Run platformos checks on the specified path (default)
|
|
23
23
|
backfill-docs Backfill doc tags in partial files based on usage
|
|
24
24
|
|
|
25
|
-
Run '
|
|
25
|
+
Run 'platformos-check <command> --help' for more information on a command.
|
|
26
26
|
`);
|
|
27
27
|
}
|
|
28
28
|
async function main() {
|
|
@@ -40,8 +40,8 @@ async function main() {
|
|
|
40
40
|
await (0, backfill_docs_1.runBackfillDocsCLI)(args.slice(1));
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
// Default: run
|
|
44
|
-
await
|
|
43
|
+
// Default: run platformos check
|
|
44
|
+
await runCheck(args);
|
|
45
45
|
}
|
|
46
46
|
main();
|
|
47
47
|
//# sourceMappingURL=cli.js.map
|
|
@@ -33,7 +33,6 @@ async function loadConfigDescription(configDescription, root) {
|
|
|
33
33
|
const rootUri = vscode_uri_1.URI.file(root);
|
|
34
34
|
return {
|
|
35
35
|
settings: unaliasedSettings(configDescription.checkSettings, checks),
|
|
36
|
-
context: configDescription.context ?? 'theme',
|
|
37
36
|
checks,
|
|
38
37
|
ignore: configDescription.ignore,
|
|
39
38
|
rootUri: resolveRoot(rootUri, configDescription.root),
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.loadThirdPartyChecks = loadThirdPartyChecks;
|
|
7
4
|
exports.findThirdPartyChecks = findThirdPartyChecks;
|
|
8
|
-
const glob_1 =
|
|
9
|
-
const node_util_1 = require("node:util");
|
|
10
|
-
const asyncGlob = (0, node_util_1.promisify)(glob_1.default);
|
|
5
|
+
const glob_1 = require("glob");
|
|
11
6
|
function loadThirdPartyChecks(
|
|
12
7
|
/**
|
|
13
8
|
* An array of require()-able paths.
|
|
14
9
|
* @example
|
|
15
10
|
* [
|
|
16
|
-
* '@acme/
|
|
11
|
+
* '@acme/platformos-check-extension',
|
|
17
12
|
* '/absolute/path/to/checks.js',
|
|
18
13
|
* './lib/checks.js',
|
|
19
14
|
* ]
|
|
@@ -44,14 +39,14 @@ modulePaths = []) {
|
|
|
44
39
|
}
|
|
45
40
|
async function findThirdPartyChecks(nodeModuleRoot) {
|
|
46
41
|
const paths = [
|
|
47
|
-
globJoin(nodeModuleRoot.replace(/\\/g, '/'), '/node_modules/
|
|
48
|
-
globJoin(nodeModuleRoot.replace(/\\/g, '/'), '/node_modules/@*/
|
|
42
|
+
globJoin(nodeModuleRoot.replace(/\\/g, '/'), '/node_modules/platformos-check-*/'),
|
|
43
|
+
globJoin(nodeModuleRoot.replace(/\\/g, '/'), '/node_modules/@*/platformos-check-*/'),
|
|
49
44
|
];
|
|
50
|
-
const results = await Promise.all(paths.map((path) =>
|
|
45
|
+
const results = await Promise.all(paths.map((path) => (0, glob_1.glob)(path)));
|
|
51
46
|
return results
|
|
52
47
|
.flat()
|
|
53
|
-
.filter((x) => !/\@
|
|
54
|
-
!/
|
|
48
|
+
.filter((x) => !/\@platformos\/platformos-check-(node|common|browser|docs-updater)/.test(x) &&
|
|
49
|
+
!/platformos-check-vscode/.test(x));
|
|
55
50
|
}
|
|
56
51
|
function globJoin(...parts) {
|
|
57
52
|
return parts.flatMap((x) => x.replace(/\\/g, '/').replace(/\/+$/, '')).join('/');
|
|
@@ -25,8 +25,6 @@ function mergeFragments(baseConfigs, config) {
|
|
|
25
25
|
.map((b) => b.checkSettings)
|
|
26
26
|
.concat(config.checkSettings)
|
|
27
27
|
.reduce(mergeDeep),
|
|
28
|
-
// We use the last one defined, or default to 'theme'
|
|
29
|
-
context: selectLatest(baseConfigs.map((b) => b.context), config.context) ?? 'theme',
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
function selectLatest(base, curr) {
|
|
@@ -81,12 +81,6 @@ isRootConfig = false) {
|
|
|
81
81
|
else if (isRootConfig) {
|
|
82
82
|
config.extends = [resolveExtends(root, 'platformos-check:recommended')];
|
|
83
83
|
}
|
|
84
|
-
if (yamlFile.context) {
|
|
85
|
-
if (platformos_check_common_1.Modes.includes(yamlFile.context)) {
|
|
86
|
-
config.context = yamlFile.context;
|
|
87
|
-
}
|
|
88
|
-
delete yamlFile.context;
|
|
89
|
-
}
|
|
90
84
|
// legacy settings that screw up assumptions
|
|
91
85
|
if (yamlFile.include_categories)
|
|
92
86
|
delete yamlFile.include_categories;
|
|
@@ -143,7 +137,7 @@ pathLike) {
|
|
|
143
137
|
if (pathLike.startsWith('.')) {
|
|
144
138
|
return node_path_1.default.resolve(root, pathLike);
|
|
145
139
|
}
|
|
146
|
-
return (0, node_fs_1.realpathSync)(require.resolve(pathLike, { paths: getAncestorNodeModules(root) }));
|
|
140
|
+
return (0, node_fs_1.realpathSync)(require.resolve(/* webpackIgnore: true */ pathLike, { paths: getAncestorNodeModules(root) }));
|
|
147
141
|
}
|
|
148
142
|
/**
|
|
149
143
|
* Resolves the check settings. Will also camelCase the snake_case settings
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChecksSettings,
|
|
1
|
+
import { ChecksSettings, Severity } from '@platformos/platformos-check-common';
|
|
2
2
|
/**
|
|
3
3
|
* The pipeline goes like this:
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ import { ChecksSettings, Mode, Severity } from '@platformos/platformos-check-com
|
|
|
6
6
|
* -> ConfigFragment # an intermediate representation of the file
|
|
7
7
|
* -> ConfigFragment[] # the file and its extends
|
|
8
8
|
* -> ConfigDescription # the flattened config (no extends)
|
|
9
|
-
* -> Config # the
|
|
9
|
+
* -> Config # the platformos-check config
|
|
10
10
|
*
|
|
11
11
|
* Our goal is to support more than one config file format, so what we'll
|
|
12
12
|
* do is have one adapter per file format that outputs a ConfigFragment.
|
|
@@ -20,12 +20,10 @@ export interface ConfigFragment {
|
|
|
20
20
|
extends: string[];
|
|
21
21
|
require: string[];
|
|
22
22
|
checkSettings: ChecksSettings;
|
|
23
|
-
context?: Mode;
|
|
24
23
|
}
|
|
25
24
|
/** A ConfigDescription is a ConfigFragment that doesn't extend anything. */
|
|
26
|
-
export type ConfigDescription = Omit<ConfigFragment, 'extends'
|
|
25
|
+
export type ConfigDescription = Omit<ConfigFragment, 'extends'> & {
|
|
27
26
|
extends: [];
|
|
28
|
-
context: Mode;
|
|
29
27
|
};
|
|
30
28
|
export declare const ModernIdentifiers: readonly ["platformos-check:nothing", "platformos-check:recommended", "platformos-check:all"];
|
|
31
29
|
export type ModernIdentifier = (typeof ModernIdentifiers)[number];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, GraphQLSourceCode, JSONSourceCode, LiquidSourceCode, Offense,
|
|
1
|
+
import { Config, GraphQLSourceCode, JSONSourceCode, LiquidSourceCode, Offense, App, YAMLSourceCode } from '@platformos/platformos-check-common';
|
|
2
2
|
import { loadConfig as resolveConfig } from './config';
|
|
3
3
|
import { NodeFileSystem } from './NodeFileSystem';
|
|
4
4
|
export * from '@platformos/platformos-check-common';
|
|
@@ -6,18 +6,22 @@ export * from './config/types';
|
|
|
6
6
|
export { NodeFileSystem };
|
|
7
7
|
export { runBackfillDocsCLI } from './backfill-docs';
|
|
8
8
|
export declare const loadConfig: typeof resolveConfig;
|
|
9
|
-
export type
|
|
10
|
-
|
|
9
|
+
export type AppCheckRun = {
|
|
10
|
+
app: App;
|
|
11
11
|
config: Config;
|
|
12
12
|
offenses: Offense[];
|
|
13
13
|
};
|
|
14
|
-
export declare function toSourceCode(absolutePath: string): Promise<LiquidSourceCode | JSONSourceCode | GraphQLSourceCode | undefined>;
|
|
14
|
+
export declare function toSourceCode(absolutePath: string): Promise<LiquidSourceCode | JSONSourceCode | GraphQLSourceCode | YAMLSourceCode | undefined>;
|
|
15
15
|
export declare function check(root: string, configPath?: string): Promise<Offense[]>;
|
|
16
16
|
export declare function checkAndAutofix(root: string, configPath?: string): Promise<void>;
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
|
|
17
|
+
export declare function appCheckRun(root: string, configPath?: string, log?: (message: string) => void): Promise<AppCheckRun>;
|
|
18
|
+
export declare function getAppAndConfig(root: string, configPath?: string): Promise<{
|
|
19
|
+
app: App;
|
|
20
20
|
config: Config;
|
|
21
21
|
}>;
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
22
|
+
export declare function getApp(config: Config): Promise<App>;
|
|
23
|
+
export declare function getAppFilesPathPattern(rootUri: string): string;
|
|
24
|
+
/** @deprecated Use appCheckRun instead */
|
|
25
|
+
export declare const runCheck: typeof appCheckRun;
|
|
26
|
+
/** @deprecated Use appCheckRun instead */
|
|
27
|
+
export declare const themeCheckRun: typeof appCheckRun;
|
package/dist/index.js
CHANGED
|
@@ -17,28 +17,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.loadConfig = exports.runBackfillDocsCLI = exports.NodeFileSystem = void 0;
|
|
20
|
+
exports.themeCheckRun = exports.runCheck = exports.loadConfig = exports.runBackfillDocsCLI = exports.NodeFileSystem = void 0;
|
|
21
21
|
exports.toSourceCode = toSourceCode;
|
|
22
22
|
exports.check = check;
|
|
23
23
|
exports.checkAndAutofix = checkAndAutofix;
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
24
|
+
exports.appCheckRun = appCheckRun;
|
|
25
|
+
exports.getAppAndConfig = getAppAndConfig;
|
|
26
|
+
exports.getApp = getApp;
|
|
27
|
+
exports.getAppFilesPathPattern = getAppFilesPathPattern;
|
|
28
28
|
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
29
29
|
const platformos_check_docs_updater_1 = require("@platformos/platformos-check-docs-updater");
|
|
30
30
|
const liquid_html_parser_1 = require("@platformos/liquid-html-parser");
|
|
31
31
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
32
32
|
const node_path_1 = __importDefault(require("node:path"));
|
|
33
|
-
const node_util_1 = require("node:util");
|
|
34
33
|
const vscode_uri_1 = require("vscode-uri");
|
|
35
|
-
const
|
|
34
|
+
const glob_1 = require("glob");
|
|
36
35
|
const autofix_1 = require("./autofix");
|
|
37
36
|
const config_1 = require("./config");
|
|
38
37
|
const NodeFileSystem_1 = require("./NodeFileSystem");
|
|
39
38
|
Object.defineProperty(exports, "NodeFileSystem", { enumerable: true, get: function () { return NodeFileSystem_1.NodeFileSystem; } });
|
|
40
39
|
const node_url_1 = require("node:url");
|
|
41
|
-
const asyncGlob = (0, node_util_1.promisify)(glob);
|
|
42
40
|
__exportStar(require("@platformos/platformos-check-common"), exports);
|
|
43
41
|
__exportStar(require("./config/types"), exports);
|
|
44
42
|
var backfill_docs_1 = require("./backfill-docs");
|
|
@@ -58,50 +56,18 @@ async function toSourceCode(absolutePath) {
|
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
async function check(root, configPath) {
|
|
61
|
-
const run = await
|
|
59
|
+
const run = await appCheckRun(root, configPath);
|
|
62
60
|
return run.offenses;
|
|
63
61
|
}
|
|
64
62
|
async function checkAndAutofix(root, configPath) {
|
|
65
|
-
const {
|
|
66
|
-
await (0, autofix_1.autofix)(
|
|
63
|
+
const { app, offenses } = await appCheckRun(root, configPath);
|
|
64
|
+
await (0, autofix_1.autofix)(app, offenses);
|
|
67
65
|
}
|
|
68
|
-
async function
|
|
69
|
-
const {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// Ultimately, I want to be able to have type safety on the parsed content
|
|
74
|
-
// of the {% schema %} tags if the schema is known to be valid. This should make
|
|
75
|
-
// {% schema %} related theme checks much easier to write than having to write visitor
|
|
76
|
-
// code and doing null checks all over the place. `ThemeBlock.Schema` is much more specific
|
|
77
|
-
// than `any` ever could be.
|
|
78
|
-
//
|
|
79
|
-
// I also want to have the option of passing down the getSectionSchema &
|
|
80
|
-
// getBlockSchema functions as dependencies. This will enable me to cache the
|
|
81
|
-
// results in the language server and avoid redoing validation between runs if
|
|
82
|
-
// we know the schema of a file that didn't change is valid.
|
|
83
|
-
//
|
|
84
|
-
// The crux of my problem is that I want to be passing down the json validation set
|
|
85
|
-
// as dependencies and not a full blown language service. But the easiest way
|
|
86
|
-
// is to have a `isValidSchema` is to have the language service do the
|
|
87
|
-
// validation of the JSON schema... We're technically going to have two
|
|
88
|
-
// JSONValidator running in theme check (node). We already have two in the
|
|
89
|
-
// language server.
|
|
90
|
-
const validator = await platformos_check_common_1.JSONValidator.create(themeLiquidDocsManager, config);
|
|
91
|
-
const isValidSchema = validator?.isValid;
|
|
92
|
-
// We can assume that all files are loaded when running themeCheckRun
|
|
93
|
-
const schemas = theme.map((source) => (0, platformos_check_common_1.toSchema)(config.context, source.uri, source, isValidSchema));
|
|
94
|
-
// prettier-ignore
|
|
95
|
-
const blockSchemas = new Map(theme.filter(source => (0, platformos_check_common_1.isBlock)(source.uri)).map((source) => [
|
|
96
|
-
node_path_1.default.basename(source.uri, '.liquid'),
|
|
97
|
-
(0, platformos_check_common_1.memo)(async () => (0, platformos_check_common_1.toSchema)(config.context, source.uri, source, isValidSchema))
|
|
98
|
-
]));
|
|
99
|
-
// prettier-ignore
|
|
100
|
-
const sectionSchemas = new Map(theme.filter(source => (0, platformos_check_common_1.isSection)(source.uri)).map((source) => [
|
|
101
|
-
node_path_1.default.basename(source.uri, '.liquid'),
|
|
102
|
-
(0, platformos_check_common_1.memo)(async () => (0, platformos_check_common_1.toSchema)(config.context, source.uri, source, isValidSchema))
|
|
103
|
-
]));
|
|
104
|
-
const docDefinitions = new Map(theme.map((file) => [
|
|
66
|
+
async function appCheckRun(root, configPath, log = () => { }) {
|
|
67
|
+
const { app, config } = await getAppAndConfig(root, configPath);
|
|
68
|
+
const platformOSLiquidDocsManager = new platformos_check_docs_updater_1.PlatformOSLiquidDocsManager(log);
|
|
69
|
+
const validator = await platformos_check_common_1.JSONValidator.create(platformOSLiquidDocsManager, config);
|
|
70
|
+
const docDefinitions = new Map(app.map((file) => [
|
|
105
71
|
node_path_1.default.relative(vscode_uri_1.URI.file(root).toString(), file.uri),
|
|
106
72
|
(0, platformos_check_common_1.memo)(async () => {
|
|
107
73
|
const ast = file.ast;
|
|
@@ -114,47 +80,45 @@ async function themeCheckRun(root, configPath, log = () => { }) {
|
|
|
114
80
|
return (0, platformos_check_common_1.extractDocDefinition)(file.uri, ast);
|
|
115
81
|
}),
|
|
116
82
|
]));
|
|
117
|
-
const offenses = await (0, platformos_check_common_1.check)(
|
|
83
|
+
const offenses = await (0, platformos_check_common_1.check)(app, config, {
|
|
118
84
|
fs: NodeFileSystem_1.NodeFileSystem,
|
|
119
|
-
|
|
120
|
-
jsonValidationSet:
|
|
121
|
-
// This is kind of gross, but we want those things to be lazy and called by name so...
|
|
122
|
-
// In the language server, this is memo'ed in DocumentManager, but we don't have that kind
|
|
123
|
-
// of luxury in CLI-mode.
|
|
124
|
-
getSectionSchema: async (name) => sectionSchemas.get(name)?.(),
|
|
125
|
-
getBlockSchema: async (name) => blockSchemas.get(name)?.(),
|
|
126
|
-
getAppBlockSchema: async (name) => blockSchemas.get(name)?.(), // cheating... but TODO
|
|
85
|
+
platformosDocset: platformOSLiquidDocsManager,
|
|
86
|
+
jsonValidationSet: platformOSLiquidDocsManager,
|
|
127
87
|
getDocDefinition: async (relativePath) => docDefinitions.get(relativePath)?.(),
|
|
128
88
|
});
|
|
129
89
|
return {
|
|
130
|
-
|
|
90
|
+
app,
|
|
131
91
|
config,
|
|
132
92
|
offenses,
|
|
133
93
|
};
|
|
134
94
|
}
|
|
135
|
-
async function
|
|
95
|
+
async function getAppAndConfig(root, configPath) {
|
|
136
96
|
const config = await (0, exports.loadConfig)(configPath, root);
|
|
137
|
-
const
|
|
97
|
+
const app = await getApp(config);
|
|
138
98
|
return {
|
|
139
|
-
|
|
99
|
+
app,
|
|
140
100
|
config,
|
|
141
101
|
};
|
|
142
102
|
}
|
|
143
|
-
async function
|
|
103
|
+
async function getApp(config) {
|
|
144
104
|
// On windows machines - the separator provided by path.join is '\'
|
|
145
105
|
// however the glob function fails silently since '\' is used to escape glob charater
|
|
146
106
|
// as mentioned in the documentation of node-glob
|
|
147
107
|
// the path is normalised and '\' are replaced with '/' and then passed to the glob function
|
|
148
|
-
let normalizedGlob =
|
|
149
|
-
const paths = await
|
|
150
|
-
// Global ignored paths should not be part of the
|
|
108
|
+
let normalizedGlob = getAppFilesPathPattern(config.rootUri);
|
|
109
|
+
const paths = await (0, glob_1.glob)(normalizedGlob, { absolute: true }).then((result) =>
|
|
110
|
+
// Global ignored paths should not be part of the app
|
|
151
111
|
result.filter((filePath) => !(0, platformos_check_common_1.isIgnored)(filePath, config)));
|
|
152
112
|
const sourceCodes = await Promise.all(paths.map(toSourceCode));
|
|
153
113
|
return sourceCodes.filter((x) => x !== undefined);
|
|
154
114
|
}
|
|
155
|
-
function
|
|
115
|
+
function getAppFilesPathPattern(rootUri) {
|
|
156
116
|
return node_path_1.default
|
|
157
|
-
.normalize(node_path_1.default.join((0, node_url_1.fileURLToPath)(rootUri), '**/*.{liquid,json,graphql}'))
|
|
117
|
+
.normalize(node_path_1.default.join((0, node_url_1.fileURLToPath)(rootUri), '**/*.{liquid,json,graphql,yml,yaml}'))
|
|
158
118
|
.replace(/\\/g, '/');
|
|
159
119
|
}
|
|
120
|
+
/** @deprecated Use appCheckRun instead */
|
|
121
|
+
exports.runCheck = appCheckRun;
|
|
122
|
+
/** @deprecated Use appCheckRun instead */
|
|
123
|
+
exports.themeCheckRun = appCheckRun;
|
|
160
124
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -42,7 +9,6 @@ exports.removeTmpFolder = removeTmpFolder;
|
|
|
42
9
|
exports.createMockConfigFile = createMockConfigFile;
|
|
43
10
|
exports.createMockNodeModule = createMockNodeModule;
|
|
44
11
|
exports.makeTempWorkspace = makeTempWorkspace;
|
|
45
|
-
const mktemp = __importStar(require("mktemp"));
|
|
46
12
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
47
13
|
const node_os_1 = __importDefault(require("node:os"));
|
|
48
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -55,7 +21,7 @@ async function makeTmpFolder() {
|
|
|
55
21
|
async function removeTmpFolder(tempDir) {
|
|
56
22
|
return promises_1.default.rm(tempDir, { recursive: true, force: true });
|
|
57
23
|
}
|
|
58
|
-
async function createMockConfigFile(tempDir, contents = 'dummy content', relativePath = '.
|
|
24
|
+
async function createMockConfigFile(tempDir, contents = 'dummy content', relativePath = '.platformos-check.yml') {
|
|
59
25
|
const filePath = node_path_1.default.join(tempDir, relativePath);
|
|
60
26
|
await promises_1.default.writeFile(filePath, contents, 'utf8');
|
|
61
27
|
return filePath;
|
|
@@ -91,7 +57,7 @@ async function createMockNodeModule(tempDir, moduleName, moduleContent = exports
|
|
|
91
57
|
return nodeModuleRoot;
|
|
92
58
|
}
|
|
93
59
|
async function makeTempWorkspace(structure) {
|
|
94
|
-
const root = await
|
|
60
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(__dirname, '..', '.'));
|
|
95
61
|
if (!root)
|
|
96
62
|
throw new Error('Could not create temp dir for temp workspace');
|
|
97
63
|
await createFiles(structure, [root]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformos/platformos-check-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "platformOS",
|
|
@@ -33,13 +33,11 @@
|
|
|
33
33
|
"type-check": "tsc --noEmit"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@platformos/platformos-check-common": "0.0.
|
|
37
|
-
"@platformos/platformos-check-docs-updater": "0.0.
|
|
38
|
-
"glob": "^
|
|
39
|
-
"vscode-uri": "^3.0
|
|
40
|
-
"yaml": "^2.
|
|
36
|
+
"@platformos/platformos-check-common": "0.0.8",
|
|
37
|
+
"@platformos/platformos-check-docs-updater": "0.0.8",
|
|
38
|
+
"glob": "^13.0.0",
|
|
39
|
+
"vscode-uri": "^3.1.0",
|
|
40
|
+
"yaml": "^2.8.2"
|
|
41
41
|
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@types/glob": "^8.0.0"
|
|
44
|
-
}
|
|
42
|
+
"devDependencies": {}
|
|
45
43
|
}
|