orc-scripts 1.2.0-dev.1 → 1.3.0-dev.2
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/babel-whitelist.json +1 -8
- package/src/config/babelrc.js +2 -9
- package/src/config/eslintrc.js +1 -1
- package/src/config/jest.config.js +1 -1
- package/src/config/unexpected-form.js +5 -19
- package/src/config/unexpected-form.test.js +6 -21
- package/src/config/unexpected-module.js +3 -11
- package/src/config/unexpected-module.test.js +13 -59
- package/src/config/unexpected-styles.js +3 -6
- package/src/config/unexpected.js +4 -21
- package/src/config/unexpected.test.js +2 -6
- package/src/config/webpack.config.js +2 -2
- package/src/scripts/build/cli.js +3 -9
- package/src/scripts/prep.js +1 -5
- package/src/utils.js +3 -9
- package/src/utils.test.js +4 -29
package/package.json
CHANGED
package/src/config/babelrc.js
CHANGED
|
@@ -4,11 +4,7 @@ const isTest = process.env.NODE_ENV === "test" || process.env.BABEL_ENV === "tes
|
|
|
4
4
|
const isWebpack = parseEnv("BUILD_WEBPACK", false);
|
|
5
5
|
const isReact = parseEnv("BUILD_REACT", isWebpack);
|
|
6
6
|
|
|
7
|
-
const envTargets = isTest
|
|
8
|
-
? "current node, last 2 chrome version"
|
|
9
|
-
: isReact
|
|
10
|
-
? "defaults, IE 11"
|
|
11
|
-
: "node 10";
|
|
7
|
+
const envTargets = isTest ? "current node, last 2 chrome version" : isReact ? "defaults, IE 11" : "node 10";
|
|
12
8
|
|
|
13
9
|
console.log("Using targets", envTargets);
|
|
14
10
|
|
|
@@ -35,10 +31,7 @@ module.exports = {
|
|
|
35
31
|
isTest || isReact ? require.resolve("@loadable/babel-plugin") : null,
|
|
36
32
|
isTest || isReact ? require.resolve("@babel/plugin-transform-react-jsx") : null,
|
|
37
33
|
isTest || isReact
|
|
38
|
-
? [
|
|
39
|
-
require.resolve("babel-plugin-react-intl-auto"),
|
|
40
|
-
{ removePrefix: "src", filebase: true },
|
|
41
|
-
]
|
|
34
|
+
? [require.resolve("babel-plugin-react-intl-auto"), { removePrefix: "src", filebase: true }]
|
|
42
35
|
: null,
|
|
43
36
|
require.resolve("@babel/plugin-transform-computed-properties"),
|
|
44
37
|
].filter(x => !!x),
|
package/src/config/eslintrc.js
CHANGED
|
@@ -83,26 +83,18 @@ module.exports = {
|
|
|
83
83
|
return expect(subject, "to satisfy", pattern);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
expect.addAssertion("<object> to be a form combination field", function (
|
|
87
|
-
expect,
|
|
88
|
-
subject,
|
|
89
|
-
) {
|
|
86
|
+
expect.addAssertion("<object> to be a form combination field", function (expect, subject) {
|
|
90
87
|
if (subject.type !== "Combination") {
|
|
91
88
|
expect.fail();
|
|
92
89
|
}
|
|
93
90
|
const pattern = {
|
|
94
91
|
type: "Combination",
|
|
95
|
-
fields: expect
|
|
96
|
-
.it("to be an array")
|
|
97
|
-
.and("to have items satisfying", "to be a form field"),
|
|
92
|
+
fields: expect.it("to be an array").and("to have items satisfying", "to be a form field"),
|
|
98
93
|
};
|
|
99
94
|
if (subject.hasOwnProperty("proportions")) {
|
|
100
95
|
pattern.proportions = expect
|
|
101
96
|
.it("to be an array")
|
|
102
|
-
.and(
|
|
103
|
-
"to have items satisfying",
|
|
104
|
-
expect.it("to be a string").or("to be a number"),
|
|
105
|
-
)
|
|
97
|
+
.and("to have items satisfying", expect.it("to be a string").or("to be a number"))
|
|
106
98
|
.and("to be shorter than or same length as", subject.fields);
|
|
107
99
|
}
|
|
108
100
|
return expect(subject, "to satisfy", pattern);
|
|
@@ -148,19 +140,13 @@ module.exports = {
|
|
|
148
140
|
.it("to be an array")
|
|
149
141
|
.and(
|
|
150
142
|
"to have items satisfying",
|
|
151
|
-
expect
|
|
152
|
-
.it("to be a form field")
|
|
153
|
-
.or("to be a form combination field")
|
|
154
|
-
.or("to be a form list"),
|
|
143
|
+
expect.it("to be a form field").or("to be a form combination field").or("to be a form list"),
|
|
155
144
|
),
|
|
156
145
|
};
|
|
157
146
|
expect(subject, "to satisfy", pattern);
|
|
158
147
|
});
|
|
159
148
|
|
|
160
|
-
expect.addAssertion("<array-like> to be a form definition", function (
|
|
161
|
-
expect,
|
|
162
|
-
subject,
|
|
163
|
-
) {
|
|
149
|
+
expect.addAssertion("<array-like> to be a form definition", function (expect, subject) {
|
|
164
150
|
return expect(
|
|
165
151
|
subject,
|
|
166
152
|
"to have items satisfying",
|
|
@@ -3,18 +3,11 @@ expect.output.preferredWidth = 80;
|
|
|
3
3
|
describe("<array-like> to be a form definition", () => {
|
|
4
4
|
describe("<object> to be a form field", () => {
|
|
5
5
|
it("passes with a name only", () =>
|
|
6
|
-
expect(
|
|
7
|
-
() => expect({ name: "field1", type: "CheckboxInput" }, "to be a form field"),
|
|
8
|
-
"not to throw",
|
|
9
|
-
));
|
|
6
|
+
expect(() => expect({ name: "field1", type: "CheckboxInput" }, "to be a form field"), "not to throw"));
|
|
10
7
|
|
|
11
8
|
it("passes with a name and string label", () =>
|
|
12
9
|
expect(
|
|
13
|
-
() =>
|
|
14
|
-
expect(
|
|
15
|
-
{ name: "field1", type: "CheckboxInput", label: "A field" },
|
|
16
|
-
"to be a form field",
|
|
17
|
-
),
|
|
10
|
+
() => expect({ name: "field1", type: "CheckboxInput", label: "A field" }, "to be a form field"),
|
|
18
11
|
"not to throw",
|
|
19
12
|
));
|
|
20
13
|
|
|
@@ -56,8 +49,7 @@ describe("<array-like> to be a form definition", () => {
|
|
|
56
49
|
expect(
|
|
57
50
|
() => expect({ name: "field1", type: "InvalidType" }, "to be a form field"),
|
|
58
51
|
"to throw",
|
|
59
|
-
"expected { name: 'field1', type: 'InvalidType' } to be a form field\n"
|
|
60
|
-
" Invalid type 'InvalidType'",
|
|
52
|
+
"expected { name: 'field1', type: 'InvalidType' } to be a form field\n Invalid type 'InvalidType'",
|
|
61
53
|
));
|
|
62
54
|
|
|
63
55
|
describe("type 'Button'", () => {
|
|
@@ -625,10 +617,7 @@ describe("<array-like> to be a form definition", () => {
|
|
|
625
617
|
|
|
626
618
|
describe("type 'LineLabel'", () => {
|
|
627
619
|
it("passes with a name only", () =>
|
|
628
|
-
expect(
|
|
629
|
-
() => expect({ name: "field1", type: "LineLabel" }, "to be a form field"),
|
|
630
|
-
"not to throw",
|
|
631
|
-
));
|
|
620
|
+
expect(() => expect({ name: "field1", type: "LineLabel" }, "to be a form field"), "not to throw"));
|
|
632
621
|
});
|
|
633
622
|
|
|
634
623
|
describe("type 'NumberInput'", () => {
|
|
@@ -763,10 +752,7 @@ describe("<array-like> to be a form definition", () => {
|
|
|
763
752
|
|
|
764
753
|
describe("type 'ReadOnly'", () => {
|
|
765
754
|
it("passes with a name only", () =>
|
|
766
|
-
expect(
|
|
767
|
-
() => expect({ name: "field1", type: "ReadOnly" }, "to be a form field"),
|
|
768
|
-
"not to throw",
|
|
769
|
-
));
|
|
755
|
+
expect(() => expect({ name: "field1", type: "ReadOnly" }, "to be a form field"), "not to throw"));
|
|
770
756
|
});
|
|
771
757
|
|
|
772
758
|
describe("type 'Selector'", () => {
|
|
@@ -1670,8 +1656,7 @@ describe("<array-like> to be a form definition", () => {
|
|
|
1670
1656
|
|
|
1671
1657
|
it("fails if field array empty", () =>
|
|
1672
1658
|
expect(
|
|
1673
|
-
() =>
|
|
1674
|
-
expect({ type: "Combination", fields: [] }, "to be a form combination field"),
|
|
1659
|
+
() => expect({ type: "Combination", fields: [] }, "to be a form combination field"),
|
|
1675
1660
|
"to throw",
|
|
1676
1661
|
"expected { type: 'Combination', fields: [] } to be a form combination field\n" +
|
|
1677
1662
|
"\n" +
|
|
@@ -5,9 +5,7 @@ module.exports = {
|
|
|
5
5
|
.addAssertion("<object> to be a component", function (expect, subject) {
|
|
6
6
|
return expect(
|
|
7
7
|
subject,
|
|
8
|
-
expect
|
|
9
|
-
.it("to have property", "$$typeof", Symbol.for("react.memo"))
|
|
10
|
-
.or("to be a function"),
|
|
8
|
+
expect.it("to have property", "$$typeof", Symbol.for("react.memo")).or("to be a function"),
|
|
11
9
|
);
|
|
12
10
|
})
|
|
13
11
|
.addAssertion("<any> to be a component", function (expect) {
|
|
@@ -34,10 +32,7 @@ module.exports = {
|
|
|
34
32
|
pattern.label = expect.it("to be an object").and("to be a label");
|
|
35
33
|
pattern.dataPath = expect
|
|
36
34
|
.it("to be an array")
|
|
37
|
-
.and(
|
|
38
|
-
"to have items satisfying",
|
|
39
|
-
expect.it("to be a string").or("to be a number"),
|
|
40
|
-
);
|
|
35
|
+
.and("to have items satisfying", expect.it("to be a string").or("to be a number"));
|
|
41
36
|
if (subject.dataIdParam) {
|
|
42
37
|
pattern.dataIdParam = expect.it("to match", /^\w+$/);
|
|
43
38
|
}
|
|
@@ -57,10 +52,7 @@ module.exports = {
|
|
|
57
52
|
label: expect.it("to be an object").and("to be a label"),
|
|
58
53
|
dataPath: expect
|
|
59
54
|
.it("to be an array")
|
|
60
|
-
.and(
|
|
61
|
-
"to have items satisfying",
|
|
62
|
-
expect.it("to be a string").or("to be a number"),
|
|
63
|
-
),
|
|
55
|
+
.and("to have items satisfying", expect.it("to be a string").or("to be a number")),
|
|
64
56
|
};
|
|
65
57
|
if (subject.dataIdParam) {
|
|
66
58
|
pattern.dataIdParam = expect.it("to match", /^\w+$/);
|
|
@@ -16,22 +16,13 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
16
16
|
|
|
17
17
|
it("accepts class components", () => expect(ClassComponent, "to be a component"));
|
|
18
18
|
|
|
19
|
-
it("accepts memoized components", () =>
|
|
20
|
-
expect(React.memo(FakeComponent), "to be a component"));
|
|
19
|
+
it("accepts memoized components", () => expect(React.memo(FakeComponent), "to be a component"));
|
|
21
20
|
|
|
22
21
|
it("fails with undefined", () =>
|
|
23
|
-
expect(
|
|
24
|
-
() => expect(undefined, "to be a component"),
|
|
25
|
-
"to throw",
|
|
26
|
-
"expected undefined to be a component",
|
|
27
|
-
));
|
|
22
|
+
expect(() => expect(undefined, "to be a component"), "to throw", "expected undefined to be a component"));
|
|
28
23
|
|
|
29
24
|
it("fails with null", () =>
|
|
30
|
-
expect(
|
|
31
|
-
() => expect(null, "to be a component"),
|
|
32
|
-
"to throw",
|
|
33
|
-
"expected null to be a component",
|
|
34
|
-
));
|
|
25
|
+
expect(() => expect(null, "to be a component"), "to throw", "expected null to be a component"));
|
|
35
26
|
|
|
36
27
|
it("fails with string", () =>
|
|
37
28
|
expect(
|
|
@@ -43,10 +34,7 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
43
34
|
|
|
44
35
|
describe("<object> to be a subpage", () => {
|
|
45
36
|
it("handles a minimal subpage", () =>
|
|
46
|
-
expect(
|
|
47
|
-
() => expect({ component: FakeComponent }, "to be a subpage"),
|
|
48
|
-
"not to throw",
|
|
49
|
-
));
|
|
37
|
+
expect(() => expect({ component: FakeComponent }, "to be a subpage"), "not to throw"));
|
|
50
38
|
|
|
51
39
|
it("does not accept subpages with pages", () =>
|
|
52
40
|
expect(
|
|
@@ -132,21 +120,13 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
132
120
|
|
|
133
121
|
it("handles a subpage with toolbar", () =>
|
|
134
122
|
expect(
|
|
135
|
-
() =>
|
|
136
|
-
expect(
|
|
137
|
-
{ component: FakeComponent, toolStateSelector: fakeSelector },
|
|
138
|
-
"to be a subpage",
|
|
139
|
-
),
|
|
123
|
+
() => expect({ component: FakeComponent, toolStateSelector: fakeSelector }, "to be a subpage"),
|
|
140
124
|
"not to throw",
|
|
141
125
|
));
|
|
142
126
|
|
|
143
127
|
it("throws if toolbar state selector not function", () =>
|
|
144
128
|
expect(
|
|
145
|
-
() =>
|
|
146
|
-
expect(
|
|
147
|
-
{ component: FakeComponent, toolStateSelector: "fakeSelector" },
|
|
148
|
-
"to be a subpage",
|
|
149
|
-
),
|
|
129
|
+
() => expect({ component: FakeComponent, toolStateSelector: "fakeSelector" }, "to be a subpage"),
|
|
150
130
|
"to throw",
|
|
151
131
|
"expected { component: () => null, toolStateSelector: 'fakeSelector' }\n" +
|
|
152
132
|
"to be a subpage\n" +
|
|
@@ -159,21 +139,13 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
159
139
|
|
|
160
140
|
it("handles a subpage with toolbar functions", () =>
|
|
161
141
|
expect(
|
|
162
|
-
() =>
|
|
163
|
-
expect(
|
|
164
|
-
{ component: FakeComponent, toolFuncSelector: fakeSelector },
|
|
165
|
-
"to be a subpage",
|
|
166
|
-
),
|
|
142
|
+
() => expect({ component: FakeComponent, toolFuncSelector: fakeSelector }, "to be a subpage"),
|
|
167
143
|
"not to throw",
|
|
168
144
|
));
|
|
169
145
|
|
|
170
146
|
it("throws if toolbar function selector not function", () =>
|
|
171
147
|
expect(
|
|
172
|
-
() =>
|
|
173
|
-
expect(
|
|
174
|
-
{ component: FakeComponent, toolFuncSelector: "fakeSelector" },
|
|
175
|
-
"to be a subpage",
|
|
176
|
-
),
|
|
148
|
+
() => expect({ component: FakeComponent, toolFuncSelector: "fakeSelector" }, "to be a subpage"),
|
|
177
149
|
"to throw",
|
|
178
150
|
"expected { component: () => null, toolFuncSelector: 'fakeSelector' }\n" +
|
|
179
151
|
"to be a subpage\n" +
|
|
@@ -230,11 +202,7 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
230
202
|
));
|
|
231
203
|
|
|
232
204
|
it("fails when subject is an empty object", () =>
|
|
233
|
-
expect(
|
|
234
|
-
() => expect({}, "to be a subpage list"),
|
|
235
|
-
"to throw",
|
|
236
|
-
"expected {} to be a subpage list",
|
|
237
|
-
));
|
|
205
|
+
expect(() => expect({}, "to be a subpage list"), "to throw", "expected {} to be a subpage list"));
|
|
238
206
|
|
|
239
207
|
it("fails when subject contains something not a subpage", () =>
|
|
240
208
|
expect(
|
|
@@ -269,10 +237,7 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
269
237
|
|
|
270
238
|
describe("<object> to be a segment", () => {
|
|
271
239
|
it("passes with a string label and component", () =>
|
|
272
|
-
expect(
|
|
273
|
-
() => expect({ component: FakeComponent, label: "A label" }, "to be a segment"),
|
|
274
|
-
"not to throw",
|
|
275
|
-
));
|
|
240
|
+
expect(() => expect({ component: FakeComponent, label: "A label" }, "to be a segment"), "not to throw"));
|
|
276
241
|
|
|
277
242
|
it("passes with an object label, component and subpage list", () =>
|
|
278
243
|
expect(
|
|
@@ -672,11 +637,7 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
672
637
|
));
|
|
673
638
|
|
|
674
639
|
it("fails when subject is an empty object", () =>
|
|
675
|
-
expect(
|
|
676
|
-
() => expect({}, "to be a segment list"),
|
|
677
|
-
"to throw",
|
|
678
|
-
"expected {} to be a segment list",
|
|
679
|
-
));
|
|
640
|
+
expect(() => expect({}, "to be a segment list"), "to throw", "expected {} to be a segment list"));
|
|
680
641
|
|
|
681
642
|
it("fails when subject contains something not a segment", () =>
|
|
682
643
|
expect(
|
|
@@ -717,10 +678,7 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
717
678
|
|
|
718
679
|
describe("<object> to be a page", () => {
|
|
719
680
|
it("passes with a string label and component", () =>
|
|
720
|
-
expect(
|
|
721
|
-
() => expect({ component: FakeComponent, label: "A label" }, "to be a page"),
|
|
722
|
-
"not to throw",
|
|
723
|
-
));
|
|
681
|
+
expect(() => expect({ component: FakeComponent, label: "A label" }, "to be a page"), "not to throw"));
|
|
724
682
|
|
|
725
683
|
it("passes with a label, component and subpage list", () =>
|
|
726
684
|
expect(
|
|
@@ -1035,11 +993,7 @@ describe("Module structure plugin for Unexpected", () => {
|
|
|
1035
993
|
));
|
|
1036
994
|
|
|
1037
995
|
it("fails when subject is an empty object", () =>
|
|
1038
|
-
expect(
|
|
1039
|
-
() => expect({}, "to be a page list"),
|
|
1040
|
-
"to throw",
|
|
1041
|
-
"expected {} to be a page list",
|
|
1042
|
-
));
|
|
996
|
+
expect(() => expect({}, "to be a page list"), "to throw", "expected {} to be a page list"));
|
|
1043
997
|
|
|
1044
998
|
it("fails when subject contains something not a page", () =>
|
|
1045
999
|
expect(
|
|
@@ -20,12 +20,9 @@ module.exports = {
|
|
|
20
20
|
return declarations;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
expect.addAssertion(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return expect.shift(getStyleDeclarations(selector));
|
|
27
|
-
},
|
|
28
|
-
);
|
|
23
|
+
expect.addAssertion("<string> as a selector to have style rules <assertion?>", function (expect, selector) {
|
|
24
|
+
return expect.shift(getStyleDeclarations(selector));
|
|
25
|
+
});
|
|
29
26
|
|
|
30
27
|
expect.addAssertion(
|
|
31
28
|
"<DOMElement> to have style rules satisfying <assertion>",
|
package/src/config/unexpected.js
CHANGED
|
@@ -29,31 +29,17 @@ global.expect = unexpected
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
)
|
|
32
|
-
.addAssertion("<function> to be a reducer with initial state <object>", function (
|
|
33
|
-
expect,
|
|
34
|
-
subject,
|
|
35
|
-
initialState,
|
|
36
|
-
) {
|
|
32
|
+
.addAssertion("<function> to be a reducer with initial state <object>", function (expect, subject, initialState) {
|
|
37
33
|
expect.errorMode = "nested";
|
|
38
34
|
const oldState = Immutable.Map();
|
|
39
|
-
return expect(
|
|
40
|
-
subject,
|
|
41
|
-
"when called with",
|
|
42
|
-
[oldState, { type: "NOT_A_USEFUL_ACTION" }],
|
|
43
|
-
"to be",
|
|
44
|
-
oldState,
|
|
45
|
-
).and(
|
|
35
|
+
return expect(subject, "when called with", [oldState, { type: "NOT_A_USEFUL_ACTION" }], "to be", oldState).and(
|
|
46
36
|
"when called with",
|
|
47
37
|
[undefined, { type: "@@INIT" }],
|
|
48
38
|
"to equal",
|
|
49
39
|
Immutable.fromJS(initialState),
|
|
50
40
|
);
|
|
51
41
|
})
|
|
52
|
-
.addAssertion("<function> as a React component <assertion?>", function (
|
|
53
|
-
expect,
|
|
54
|
-
Subject,
|
|
55
|
-
assertions,
|
|
56
|
-
) {
|
|
42
|
+
.addAssertion("<function> as a React component <assertion?>", function (expect, Subject, assertions) {
|
|
57
43
|
expect.errorMode = "bubble";
|
|
58
44
|
try {
|
|
59
45
|
const element = React.createElement(Subject);
|
|
@@ -81,10 +67,7 @@ global.expect = unexpected
|
|
|
81
67
|
fieldName: expect
|
|
82
68
|
.it("to be a string")
|
|
83
69
|
.or("to be an array")
|
|
84
|
-
.and(
|
|
85
|
-
"to have items satisfying",
|
|
86
|
-
expect.it("to be a string").or("to be a number"),
|
|
87
|
-
),
|
|
70
|
+
.and("to have items satisfying", expect.it("to be a string").or("to be a number")),
|
|
88
71
|
};
|
|
89
72
|
if (subject.hasOwnProperty("width")) {
|
|
90
73
|
pattern.width = expect.it("to be a string").and("not to match", /[;:{[]/);
|
|
@@ -8,8 +8,7 @@ const TestComp = () => <div />;
|
|
|
8
8
|
// "<function> as a React component <assertion?>"
|
|
9
9
|
|
|
10
10
|
describe("<any> to be a label", () => {
|
|
11
|
-
it("passes if subject is a string", () =>
|
|
12
|
-
expect(() => expect("Label", "to be a label"), "not to throw"));
|
|
11
|
+
it("passes if subject is a string", () => expect(() => expect("Label", "to be a label"), "not to throw"));
|
|
13
12
|
|
|
14
13
|
it("passes if subject is a react-intl descriptor", () =>
|
|
15
14
|
expect(
|
|
@@ -52,10 +51,7 @@ describe("<any> to be a label", () => {
|
|
|
52
51
|
|
|
53
52
|
describe("<object> to be a column definition", () => {
|
|
54
53
|
it("passes with a select column", () =>
|
|
55
|
-
expect(
|
|
56
|
-
() => expect({ type: "select" }, "to be a column definition"),
|
|
57
|
-
"not to throw",
|
|
58
|
-
));
|
|
54
|
+
expect(() => expect({ type: "select" }, "to be a column definition"), "not to throw"));
|
|
59
55
|
|
|
60
56
|
it("fails if select column has other parameters", () =>
|
|
61
57
|
expect(
|
|
@@ -79,13 +79,13 @@ const config = {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
const locales = packageJson.locales;
|
|
82
|
-
const
|
|
82
|
+
const overtureApplication = packageJson.overtureApplication;
|
|
83
83
|
const dependencies = packageJson.dependencies;
|
|
84
84
|
|
|
85
85
|
config.plugins.push(
|
|
86
86
|
new webpack.DefinePlugin({
|
|
87
87
|
SUPPORTED_LOCALES: JSON.stringify(locales && locales.length ? locales : null),
|
|
88
|
-
|
|
88
|
+
OVERTURE_APPLICATION: JSON.stringify((overtureApplication && overtureApplication.name) || ""),
|
|
89
89
|
DEPENDENCIES: JSON.stringify(dependencies || {}),
|
|
90
90
|
}),
|
|
91
91
|
);
|
package/src/scripts/build/cli.js
CHANGED
|
@@ -12,12 +12,8 @@ const outDir = useSpecifiedOutDir ? [] : ["--out-dir", "dist"];
|
|
|
12
12
|
const copyFiles = args.includes("--no-copy-files") ? [] : ["--copy-files"];
|
|
13
13
|
|
|
14
14
|
const useBuiltinConfig =
|
|
15
|
-
!args.includes("--presets") &&
|
|
16
|
-
|
|
17
|
-
!hasPkgProp("babel");
|
|
18
|
-
const config = useBuiltinConfig
|
|
19
|
-
? ["--presets", here("../../config/babel-preset.js")]
|
|
20
|
-
: [];
|
|
15
|
+
!args.includes("--presets") && (!hasFile(".babelrc") || !hasFile("babel.config.js")) && !hasPkgProp("babel");
|
|
16
|
+
const config = useBuiltinConfig ? ["--presets", here("../../config/babel-preset.js")] : [];
|
|
21
17
|
|
|
22
18
|
const verbosity = args.includes("--quiet") ? [] : ["--verbose"];
|
|
23
19
|
|
|
@@ -29,9 +25,7 @@ const filteredArgs = args.filter(arg => !babelUnacceptedArgs.includes(arg));
|
|
|
29
25
|
|
|
30
26
|
const child = spawn(
|
|
31
27
|
resolveBin("@babel/cli", { executable: "babel" }),
|
|
32
|
-
[...outDir, ...copyFiles, ...ignore, ...verbosity, ...config, "src"].concat(
|
|
33
|
-
filteredArgs,
|
|
34
|
-
),
|
|
28
|
+
[...outDir, ...copyFiles, ...ignore, ...verbosity, ...config, "src"].concat(filteredArgs),
|
|
35
29
|
{ stdio: "inherit" },
|
|
36
30
|
);
|
|
37
31
|
|
package/src/scripts/prep.js
CHANGED
|
@@ -21,11 +21,7 @@ async function prep() {
|
|
|
21
21
|
if (process.env.NODE_ENV === "production") process.exit(0);
|
|
22
22
|
try {
|
|
23
23
|
const files = await readdir(staticDir);
|
|
24
|
-
await Promise.all(
|
|
25
|
-
files.map(file =>
|
|
26
|
-
copyFile(path.resolve(staticDir, file), path.resolve(distDir, file)),
|
|
27
|
-
),
|
|
28
|
-
);
|
|
24
|
+
await Promise.all(files.map(file => copyFile(path.resolve(staticDir, file), path.resolve(distDir, file))));
|
|
29
25
|
} catch (_) {}
|
|
30
26
|
}
|
|
31
27
|
|
package/src/utils.js
CHANGED
|
@@ -4,8 +4,7 @@ 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) =>
|
|
8
|
-
obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== undefined;
|
|
7
|
+
const hasOwn = (obj, key) => obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== undefined;
|
|
9
8
|
|
|
10
9
|
const hasPath = (obj, keys) => {
|
|
11
10
|
const [key, ...tail] = keys;
|
|
@@ -34,8 +33,7 @@ const hasFile = (...p) => fs.existsSync(fromRoot(...p));
|
|
|
34
33
|
|
|
35
34
|
const hasPkgProp = props => arrify(props).some(prop => has(pkg, prop));
|
|
36
35
|
|
|
37
|
-
const hasPkgSubProp = pkgProp => props =>
|
|
38
|
-
hasPkgProp(arrify(props).map(p => `${pkgProp}.${p}`));
|
|
36
|
+
const hasPkgSubProp = pkgProp => props => hasPkgProp(arrify(props).map(p => `${pkgProp}.${p}`));
|
|
39
37
|
|
|
40
38
|
const hasPeerDep = hasPkgSubProp("peerDependencies");
|
|
41
39
|
const hasDep = hasPkgSubProp("dependencies");
|
|
@@ -56,11 +54,7 @@ function parseEnv(name, def) {
|
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
function envIsSet(name) {
|
|
59
|
-
return (
|
|
60
|
-
process.env.hasOwnProperty(name) &&
|
|
61
|
-
process.env[name] &&
|
|
62
|
-
process.env[name] !== "undefined"
|
|
63
|
-
);
|
|
57
|
+
return process.env.hasOwnProperty(name) && process.env[name] && process.env[name] !== "undefined";
|
|
64
58
|
}
|
|
65
59
|
|
|
66
60
|
function resolveBin(modName, { executable = modName, cwd = process.cwd() } = {}) {
|
package/src/utils.test.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
const {
|
|
2
|
-
fromRoot,
|
|
3
|
-
hasFile,
|
|
4
|
-
hasPkgProp,
|
|
5
|
-
ifAnyDep,
|
|
6
|
-
parseEnv,
|
|
7
|
-
resolveBin,
|
|
8
|
-
} = require("./utils");
|
|
1
|
+
const { fromRoot, hasFile, hasPkgProp, ifAnyDep, parseEnv, resolveBin } = require("./utils");
|
|
9
2
|
const path = require("path");
|
|
10
3
|
|
|
11
4
|
describe("utils", () => {
|
|
@@ -36,22 +29,10 @@ describe("utils", () => {
|
|
|
36
29
|
it("exists", () => expect(hasPkgProp, "to be a function"));
|
|
37
30
|
|
|
38
31
|
it("returns true if local package.json has at least one of the given first-level keys", () =>
|
|
39
|
-
expect(
|
|
40
|
-
hasPkgProp,
|
|
41
|
-
"when called with",
|
|
42
|
-
[["no", "lint-staged", "dont-have"]],
|
|
43
|
-
"to equal",
|
|
44
|
-
true,
|
|
45
|
-
));
|
|
32
|
+
expect(hasPkgProp, "when called with", [["no", "lint-staged", "dont-have"]], "to equal", true));
|
|
46
33
|
|
|
47
34
|
it("returns false if local package.json does not have any of the given first-level keys", () =>
|
|
48
|
-
expect(
|
|
49
|
-
hasPkgProp,
|
|
50
|
-
"when called with",
|
|
51
|
-
[["no-such-key", "nuh-uh", "nope-not-here"]],
|
|
52
|
-
"to equal",
|
|
53
|
-
false,
|
|
54
|
-
));
|
|
35
|
+
expect(hasPkgProp, "when called with", [["no-such-key", "nuh-uh", "nope-not-here"]], "to equal", false));
|
|
55
36
|
});
|
|
56
37
|
|
|
57
38
|
describe("ifAnyDep", () => {
|
|
@@ -83,13 +64,7 @@ describe("utils", () => {
|
|
|
83
64
|
expect(parseEnv, "when called with", ["BABEL_ENV", "wrong"], "to equal", "test"));
|
|
84
65
|
|
|
85
66
|
it("returns default value if it does not exist", () =>
|
|
86
|
-
expect(
|
|
87
|
-
parseEnv,
|
|
88
|
-
"when called with",
|
|
89
|
-
["NO_SUCH_variable", "wrong"],
|
|
90
|
-
"to equal",
|
|
91
|
-
"wrong",
|
|
92
|
-
));
|
|
67
|
+
expect(parseEnv, "when called with", ["NO_SUCH_variable", "wrong"], "to equal", "wrong"));
|
|
93
68
|
});
|
|
94
69
|
|
|
95
70
|
describe("resolveBin", () => {
|