orc-scripts 4.0.0-dev.9 → 4.0.1
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/package.json +1 -1
- package/src/config/eslint.config.mjs +60 -41
- package/src/config/unexpected-form.js +38 -38
- package/src/config/unexpected.js +8 -8
- package/src/index.js +1 -1
- package/src/run-script.js +1 -1
- package/src/scripts/buildDep.js +3 -1
- package/src/scripts/prep.js +6 -2
- package/src/utils.js +7 -4
package/package.json
CHANGED
|
@@ -1,45 +1,64 @@
|
|
|
1
1
|
import globals from "globals";
|
|
2
|
+
import pluginJs from "@eslint/js";
|
|
2
3
|
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
|
|
3
|
-
import pluginReactHookConfig from "eslint-plugin-react-hooks"
|
|
4
|
+
import pluginReactHookConfig from "eslint-plugin-react-hooks";
|
|
4
5
|
|
|
5
6
|
export default [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
7
|
+
{ files: ["**/*.{js,mjs,cjs,jsx}"] },
|
|
8
|
+
{ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
|
|
9
|
+
{ files: ["**/*.js"], languageOptions: { sourceType: "module" } },
|
|
10
|
+
{ languageOptions: { globals: { ...globals.browser, ...globals.node, ...{ Intl: false } } } },
|
|
11
|
+
pluginJs.configs.recommended,
|
|
12
|
+
pluginReactConfig,
|
|
13
|
+
{
|
|
14
|
+
plugins: {
|
|
15
|
+
"react-hooks": pluginReactHookConfig,
|
|
16
|
+
},
|
|
17
|
+
rules: pluginReactHookConfig.configs.recommended.rules,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
files: ["**/*.test.js"],
|
|
21
|
+
languageOptions: { globals: { ...globals.jest } },
|
|
22
|
+
rules: {
|
|
23
|
+
"react/jsx-key": "off",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
files: ["**/*.js"],
|
|
28
|
+
rules: {
|
|
29
|
+
"no-unused-vars": [
|
|
30
|
+
"error",
|
|
31
|
+
{
|
|
32
|
+
vars: "all",
|
|
33
|
+
args: "none",
|
|
34
|
+
caughtErrors: "all",
|
|
35
|
+
ignoreRestSiblings: false,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
settings: {
|
|
42
|
+
react: {
|
|
43
|
+
version: "detect",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
languageOptions: {
|
|
47
|
+
globals: {
|
|
48
|
+
SUPPORTED_LOCALES: false,
|
|
49
|
+
OVERTURE_APPLICATION: false,
|
|
50
|
+
DEPENDENCIES: false,
|
|
51
|
+
BUILD_ID: false,
|
|
52
|
+
BUILD_NUMBER: false,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
rules: {
|
|
56
|
+
"jsx-a11y/href-no-hash": "off",
|
|
57
|
+
"react/prop-types": "off",
|
|
58
|
+
"react/no-children-prop": "off",
|
|
59
|
+
"react/display-name": "off",
|
|
60
|
+
"no-mixed-spaces-and-tabs": "off",
|
|
61
|
+
"no-case-declarations": "off",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
];
|
|
@@ -91,7 +91,7 @@ module.exports = {
|
|
|
91
91
|
type: "Combination",
|
|
92
92
|
fields: expect.it("to be an array").and("to have items satisfying", "to be a form field"),
|
|
93
93
|
};
|
|
94
|
-
if (
|
|
94
|
+
if (Object.prototype.hasOwnProperty.call(subject, "proportions")) {
|
|
95
95
|
pattern.proportions = expect
|
|
96
96
|
.it("to be an array")
|
|
97
97
|
.and("to have items satisfying", expect.it("to be a string").or("to be a number"))
|
|
@@ -109,17 +109,17 @@ module.exports = {
|
|
|
109
109
|
name: expect.it("to be a string"),
|
|
110
110
|
rowField: expect.it("to be a form field").or("to be a form combination field"),
|
|
111
111
|
};
|
|
112
|
-
if (
|
|
112
|
+
if (Object.prototype.hasOwnProperty.call(subject, "rowCount")) {
|
|
113
113
|
pattern.rowCount = expect.it("to be a number");
|
|
114
114
|
}
|
|
115
|
-
if (
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(subject, "add")) {
|
|
116
116
|
if (subject.rowCount) {
|
|
117
117
|
expect.errorMode = "nested";
|
|
118
118
|
return expect.fail("Form list with row count cannot have 'add' label");
|
|
119
119
|
}
|
|
120
120
|
pattern.add = expect.it("to be a label");
|
|
121
121
|
}
|
|
122
|
-
if (
|
|
122
|
+
if (Object.prototype.hasOwnProperty.call(subject, "staticValues")) {
|
|
123
123
|
if (!subject.rowCount) {
|
|
124
124
|
expect.errorMode = "nested";
|
|
125
125
|
return expect.fail("Form list without row count cannot have static values");
|
|
@@ -173,135 +173,135 @@ module.exports = {
|
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
const addLabelProp = (expect, subject, pattern) => {
|
|
176
|
-
if (
|
|
176
|
+
if (Object.prototype.hasOwnProperty.call(subject, "label")) {
|
|
177
177
|
pattern.label = expect.it("to be a label");
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
|
|
181
181
|
const addMultipleProp = (expect, subject, pattern) => {
|
|
182
|
-
if (
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(subject, "multiple")) {
|
|
183
183
|
pattern.multiple = expect.it("to be a boolean");
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
const addButtonProps = (expect, subject, pattern, small) => {
|
|
188
|
-
if (
|
|
188
|
+
if (Object.prototype.hasOwnProperty.call(subject, "primary")) {
|
|
189
189
|
pattern.primary = expect.it("to be a boolean");
|
|
190
190
|
}
|
|
191
|
-
if (
|
|
191
|
+
if (Object.prototype.hasOwnProperty.call(subject, "active")) {
|
|
192
192
|
pattern.active = expect.it("to be a boolean");
|
|
193
193
|
}
|
|
194
194
|
if (small) {
|
|
195
195
|
pattern.altText = expect.it("to be a label");
|
|
196
196
|
pattern.icon = expect.it("to be a string");
|
|
197
197
|
} else {
|
|
198
|
-
if (
|
|
198
|
+
if (Object.prototype.hasOwnProperty.call(subject, "buttonText")) {
|
|
199
199
|
pattern.buttonText = expect.it("to be a label");
|
|
200
200
|
}
|
|
201
|
-
if (
|
|
201
|
+
if (Object.prototype.hasOwnProperty.call(subject, "icon")) {
|
|
202
202
|
pattern.icon = expect.it("to be a string");
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
if (
|
|
205
|
+
if (Object.prototype.hasOwnProperty.call(subject, "autofocus")) {
|
|
206
206
|
pattern.autofocus = expect.it("to be a boolean");
|
|
207
207
|
}
|
|
208
|
-
if (
|
|
208
|
+
if (Object.prototype.hasOwnProperty.call(subject, "disabled")) {
|
|
209
209
|
pattern.disabled = expect.it("to be a boolean");
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
212
|
|
|
213
213
|
const addInputProps = (expect, subject, pattern, textual = true) => {
|
|
214
|
-
if (textual &&
|
|
214
|
+
if (textual && Object.prototype.hasOwnProperty.call(subject, "autocomplete")) {
|
|
215
215
|
pattern.autocomplete = expect.it("to be a string");
|
|
216
216
|
}
|
|
217
|
-
if (
|
|
217
|
+
if (Object.prototype.hasOwnProperty.call(subject, "autofocus")) {
|
|
218
218
|
pattern.autofocus = expect.it("to be a boolean");
|
|
219
219
|
}
|
|
220
|
-
if (
|
|
220
|
+
if (Object.prototype.hasOwnProperty.call(subject, "disabled")) {
|
|
221
221
|
pattern.disabled = expect.it("to be a boolean");
|
|
222
222
|
}
|
|
223
|
-
if (textual &&
|
|
223
|
+
if (textual && Object.prototype.hasOwnProperty.call(subject, "readOnly")) {
|
|
224
224
|
pattern.readOnly = expect.it("to be a boolean");
|
|
225
225
|
}
|
|
226
|
-
if (
|
|
226
|
+
if (Object.prototype.hasOwnProperty.call(subject, "required")) {
|
|
227
227
|
pattern.required = expect.it("to be a label");
|
|
228
228
|
}
|
|
229
|
-
if (
|
|
229
|
+
if (Object.prototype.hasOwnProperty.call(subject, "tabindex")) {
|
|
230
230
|
pattern.tabindex = expect.it("to be a number");
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
const addTextInputProps = (expect, subject, pattern) => {
|
|
235
|
-
if (
|
|
235
|
+
if (Object.prototype.hasOwnProperty.call(subject, "maxlength")) {
|
|
236
236
|
pattern.maxlength = expect.it("to be a number").and("to be greater than", 0);
|
|
237
237
|
}
|
|
238
|
-
if (
|
|
238
|
+
if (Object.prototype.hasOwnProperty.call(subject, "minlength")) {
|
|
239
239
|
pattern.minlength = expect.it("to be a number").and("to be greater than", 0);
|
|
240
240
|
}
|
|
241
|
-
if (
|
|
241
|
+
if (Object.prototype.hasOwnProperty.call(subject, "pattern")) {
|
|
242
242
|
pattern.pattern = expect.it("to be a regular expression");
|
|
243
243
|
}
|
|
244
|
-
if (
|
|
244
|
+
if (Object.prototype.hasOwnProperty.call(subject, "placeholder")) {
|
|
245
245
|
pattern.placeholder = expect.it("to be a label");
|
|
246
246
|
}
|
|
247
|
-
if (
|
|
247
|
+
if (Object.prototype.hasOwnProperty.call(subject, "size")) {
|
|
248
248
|
pattern.size = expect.it("to be a number").and("to be greater than", 0);
|
|
249
249
|
}
|
|
250
|
-
if (
|
|
250
|
+
if (Object.prototype.hasOwnProperty.call(subject, "spellcheck")) {
|
|
251
251
|
pattern.spellcheck = expect.it("to be a boolean").or("to be", "");
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
254
|
|
|
255
255
|
const addNumberInputProps = (expect, subject, pattern) => {
|
|
256
|
-
if (
|
|
256
|
+
if (Object.prototype.hasOwnProperty.call(subject, "max")) {
|
|
257
257
|
pattern.max = expect.it("to be a number");
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
259
|
+
if (Object.prototype.hasOwnProperty.call(subject, "min")) {
|
|
260
260
|
pattern.min = expect.it("to be a number");
|
|
261
261
|
}
|
|
262
|
-
if (
|
|
262
|
+
if (Object.prototype.hasOwnProperty.call(subject, "step")) {
|
|
263
263
|
pattern.step = expect.it("to be a number");
|
|
264
264
|
}
|
|
265
|
-
if (
|
|
265
|
+
if (Object.prototype.hasOwnProperty.call(subject, "placeholder")) {
|
|
266
266
|
pattern.placeholder = expect.it("to be a label");
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
269
|
|
|
270
270
|
const addDateInputProps = (expect, subject, pattern) => {
|
|
271
|
-
if (
|
|
271
|
+
if (Object.prototype.hasOwnProperty.call(subject, "max")) {
|
|
272
272
|
pattern.max = expect.it("to be a string").and("to match", /^\d{4}-\d{2}-\d{2}$/);
|
|
273
273
|
}
|
|
274
|
-
if (
|
|
274
|
+
if (Object.prototype.hasOwnProperty.call(subject, "min")) {
|
|
275
275
|
pattern.min = expect.it("to be a string").and("to match", /^\d{4}-\d{2}-\d{2}$/);
|
|
276
276
|
}
|
|
277
|
-
if (
|
|
277
|
+
if (Object.prototype.hasOwnProperty.call(subject, "step")) {
|
|
278
278
|
pattern.step = expect.it("to be a number");
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
281
|
|
|
282
282
|
const addTimeInputProps = (expect, subject, pattern) => {
|
|
283
|
-
if (
|
|
283
|
+
if (Object.prototype.hasOwnProperty.call(subject, "max")) {
|
|
284
284
|
pattern.max = expect.it("to be a string").and("to match", /^\d{2}:\d{2}(?::\d{2})?$/);
|
|
285
285
|
}
|
|
286
|
-
if (
|
|
286
|
+
if (Object.prototype.hasOwnProperty.call(subject, "min")) {
|
|
287
287
|
pattern.min = expect.it("to be a string").and("to match", /^\d{2}:\d{2}(?::\d{2})?$/);
|
|
288
288
|
}
|
|
289
|
-
if (
|
|
289
|
+
if (Object.prototype.hasOwnProperty.call(subject, "step")) {
|
|
290
290
|
pattern.step = expect.it("to be a number").or("to be", "any");
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
293
|
|
|
294
294
|
const addSwitchInputProps = (expect, subject, pattern) => {
|
|
295
|
-
if (
|
|
295
|
+
if (Object.prototype.hasOwnProperty.call(subject, "onCaption")) {
|
|
296
296
|
pattern.onCaption = expect.it("to be a label");
|
|
297
297
|
}
|
|
298
|
-
if (
|
|
298
|
+
if (Object.prototype.hasOwnProperty.call(subject, "offCaption")) {
|
|
299
299
|
pattern.offCaption = expect.it("to be a label");
|
|
300
300
|
}
|
|
301
|
-
if (
|
|
301
|
+
if (Object.prototype.hasOwnProperty.call(subject, "onColor")) {
|
|
302
302
|
pattern.onColor = expect.it("to be a string");
|
|
303
303
|
}
|
|
304
|
-
if (
|
|
304
|
+
if (Object.prototype.hasOwnProperty.call(subject, "offColor")) {
|
|
305
305
|
pattern.offColor = expect.it("to be a string");
|
|
306
306
|
}
|
|
307
307
|
};
|
package/src/config/unexpected.js
CHANGED
|
@@ -69,10 +69,10 @@ global.expect = unexpected
|
|
|
69
69
|
.or("to be an array")
|
|
70
70
|
.and("to have items satisfying", expect.it("to be a string").or("to be a number")),
|
|
71
71
|
};
|
|
72
|
-
if (
|
|
72
|
+
if (Object.prototype.hasOwnProperty.call(subject, "width")) {
|
|
73
73
|
pattern.width = expect.it("to be a string").and("not to match", /[;:{[]/);
|
|
74
74
|
}
|
|
75
|
-
if (
|
|
75
|
+
if (Object.prototype.hasOwnProperty.call(subject, "type")) {
|
|
76
76
|
pattern.type = expect
|
|
77
77
|
.it("to be", "number")
|
|
78
78
|
.or("to be", "date")
|
|
@@ -87,26 +87,26 @@ global.expect = unexpected
|
|
|
87
87
|
.or("to be an array")
|
|
88
88
|
.and("to have items satisfying", "to be a string");
|
|
89
89
|
}
|
|
90
|
-
if (subject.type === "switch" &&
|
|
90
|
+
if (subject.type === "switch" && Object.prototype.hasOwnProperty.call(subject, "switch")) {
|
|
91
91
|
pattern.switch = expect.it("to be an object");
|
|
92
92
|
}
|
|
93
93
|
if (subject.type === "custom") {
|
|
94
94
|
pattern.component = expect.it("to be a function");
|
|
95
|
-
if (
|
|
95
|
+
if (Object.prototype.hasOwnProperty.call(subject, "funcs")) {
|
|
96
96
|
pattern.funcs = expect.it("to have values satisfying", "to be a function");
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
100
|
+
if (Object.prototype.hasOwnProperty.call(subject, "transform")) {
|
|
101
101
|
pattern.transform = expect.it("to be a function");
|
|
102
102
|
}
|
|
103
|
-
if (
|
|
103
|
+
if (Object.prototype.hasOwnProperty.call(subject, "label")) {
|
|
104
104
|
pattern.label = expect.it("to be a label");
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
106
|
+
if (Object.prototype.hasOwnProperty.call(subject, "sort")) {
|
|
107
107
|
pattern.sort = expect.it("to be a function");
|
|
108
108
|
}
|
|
109
|
-
if (
|
|
109
|
+
if (Object.prototype.hasOwnProperty.call(subject, "defaultValue")) {
|
|
110
110
|
pattern.defaultValue = expect.it("to be defined");
|
|
111
111
|
}
|
|
112
112
|
return expect(subject, "to exhaustively satisfy", pattern);
|
package/src/index.js
CHANGED
package/src/run-script.js
CHANGED
package/src/scripts/buildDep.js
CHANGED
package/src/scripts/prep.js
CHANGED
|
@@ -20,7 +20,9 @@ async function prep() {
|
|
|
20
20
|
copyFile(contentDir, path.resolve(distDir, "content")),
|
|
21
21
|
copyFile(mockDir, path.resolve(distDir, "__mocks__")),
|
|
22
22
|
]);
|
|
23
|
-
} catch
|
|
23
|
+
} catch {
|
|
24
|
+
// don't do anything
|
|
25
|
+
}
|
|
24
26
|
|
|
25
27
|
if (process.env.NODE_ENV === "production") {
|
|
26
28
|
// production build will not copy the static files
|
|
@@ -28,7 +30,9 @@ async function prep() {
|
|
|
28
30
|
try {
|
|
29
31
|
const files = await readdir(staticDir);
|
|
30
32
|
await Promise.all(files.map(file => copyFile(path.resolve(staticDir, file), path.resolve(distDir, file))));
|
|
31
|
-
} catch
|
|
33
|
+
} catch {
|
|
34
|
+
// don't do anything
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
if (existsSync(projectSpecificPrep)) {
|
package/src/utils.js
CHANGED
|
@@ -4,7 +4,8 @@ const arrify = require("arrify");
|
|
|
4
4
|
const which = require("which");
|
|
5
5
|
const readPkgUp = require("read-pkg-up");
|
|
6
6
|
|
|
7
|
-
const hasOwn = (obj, key) =>
|
|
7
|
+
const hasOwn = (obj, key) =>
|
|
8
|
+
Object.prototype.hasOwnProperty.call(obj, key) && obj[key] !== null && obj[key] !== undefined;
|
|
8
9
|
|
|
9
10
|
const hasPath = (obj, keys) => {
|
|
10
11
|
const [key, ...tail] = keys;
|
|
@@ -46,7 +47,7 @@ function parseEnv(name, def) {
|
|
|
46
47
|
if (envIsSet(name)) {
|
|
47
48
|
try {
|
|
48
49
|
return JSON.parse(process.env[name] || "<fail>");
|
|
49
|
-
} catch
|
|
50
|
+
} catch {
|
|
50
51
|
return process.env[name];
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -54,14 +55,16 @@ function parseEnv(name, def) {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
function envIsSet(name) {
|
|
57
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
Object.prototype.hasOwnProperty.call(process.env, name) && process.env[name] && process.env[name] !== "undefined"
|
|
60
|
+
);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
function resolveBin(modName, { executable = modName, cwd = process.cwd() } = {}) {
|
|
61
64
|
let pathFromWhich;
|
|
62
65
|
try {
|
|
63
66
|
pathFromWhich = fs.realpathSync(which.sync(executable));
|
|
64
|
-
} catch
|
|
67
|
+
} catch {
|
|
65
68
|
// ignore _error
|
|
66
69
|
}
|
|
67
70
|
try {
|