Skip to content

Commit 2c7aa78

Browse files
author
Mina Smart
committed
Actually build for environments, and make logging cleaner
1 parent 78e63a7 commit 2c7aa78

9 files changed

+324
-296
lines changed

.babelrc

-21
This file was deleted.

circle.yml

-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ test:
1717
- mkdir -p $CIRCLE_TEST_REPORTS/junit
1818
override:
1919
- yarn test
20-
- yarn run test:with-optimized-types

package.json

+5-9
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88
"scripts": {
99
"prepublish": "yarn run build",
1010
"build": "rollup -c",
11-
"start": "yarn run clean && yarn run setup-paths && concurrently 'yarn run test:web-deps' 'yarn run test:livereload-server' 'yarn run test:watch' 'http-server -p 4200 .tmp/test' 'yarn run print-start-message'",
11+
"start": "yarn run clean && yarn run setup-paths && concurrently --names DEPS,LIVERELOAD,ROLLUP,HTTP,NOTIFIER 'yarn run test:web-deps' 'yarn run test:livereload-server' 'yarn run test:watch' 'http-server -p 4200 .tmp/test' 'yarn run print-start-message'",
1212
"clean": "rimraf .tmp index.*",
1313
"doc:build": "jsdoc2md src/*.js > docs/API_REFERENCE.md",
1414
"setup-paths": "mkdir -p .tmp/test",
1515
"test": "yarn run clean && yarn run setup-paths && yarn run test:node-deps && yarn run mocha",
16-
"test:with-optimized-types": "yarn run clean && yarn run setup-paths && yarn run test:node-deps-optimized && yarn run mocha",
1716
"test:watch": "rollup -w -c rollup-browser-tests.config.js",
1817
"test:web-deps": "cp test/index.html node_modules/mocha/mocha.* node_modules/jquery/dist/jquery.slim.min.js .tmp/test/ && cp node_modules/expect.js/index.js .tmp/test/expect.js",
19-
"test:node-deps": "rollup -c rollup-node-tests.config.js",
20-
"test:node-deps-optimized": "cross-env BABEL_ENV='node' node -- scripts/test-build-node.js --with-optimized-types .tmp/test/node-tests.js",
2118
"test:livereload-server": "node scripts/livereload.js",
19+
"test:node-deps": "rollup -c rollup-node-tests.config.js",
2220
"mocha": "mocha -u tdd $(yarn run mocha:reporter-args 2>&1 >/dev/null) .tmp/test/node-tests.js",
2321
"mocha:reporter-args": "test -n \"${CI}\" && >&2 echo --reporter xunit --reporter-options output=$CIRCLE_TEST_REPORTS/junit/mocha-$(date +%s).xml || true",
2422
"lint": "eslint --max-warnings 0 -c .eslintrc.json $(yarn run lint:reporter-args 2>&1 >/dev/null) src/ test/",
@@ -31,12 +29,10 @@
3129
"dependencies": {},
3230
"devDependencies": {
3331
"babel": "6.23.0",
34-
"babel-cli": "6.26.0",
3532
"babel-core": "6.26.0",
36-
"babel-preset-es2015-rollup": "3.0.0",
37-
"babel-preset-shopify": "15.0.1",
33+
"babel-plugin-external-helpers": "6.22.0",
34+
"babel-preset-env": "1.6.0",
3835
"concurrently": "3.5.0",
39-
"cross-env": "5.0.5",
4036
"eslint": "3.8.1",
4137
"eslint-plugin-shopify": "14.0.0",
4238
"eslint-test-generator": "1.0.5",
@@ -57,7 +53,7 @@
5753
"rollup": "0.47.6",
5854
"rollup-plugin-babel": "3.0.2",
5955
"rollup-plugin-commonjs": "8.1.0",
60-
"rollup-plugin-graphql-js-client-compiler": "0.1.0",
56+
"rollup-plugin-graphql-js-client-compiler": "0.1.1",
6157
"rollup-plugin-json": "2.3.0",
6258
"rollup-plugin-multi-entry": "2.0.1",
6359
"rollup-plugin-node-builtins": "2.1.2",

rollup-browser-tests.config.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fetch from 'node-fetch';
2+
import graphqlCompiler from 'rollup-plugin-graphql-js-client-compiler';
23
import nodeResolve from 'rollup-plugin-node-resolve';
34
import builtins from 'rollup-plugin-node-builtins';
45
import globals from 'rollup-plugin-node-globals';
@@ -10,6 +11,11 @@ const {livereloadPort} = require('./package.json');
1011

1112
const reloadUri = `http://localhost:${livereloadPort}/changed?files=tests.js,index.html`;
1213

14+
baseConfig.plugins.unshift(
15+
graphqlCompiler({
16+
schema: './schema.json'
17+
})
18+
);
1319
baseConfig.plugins.push(
1420
remap({
1521
originalPath: './test/isomorphic-fetch-mock.js',
@@ -25,11 +31,15 @@ baseConfig.plugins.push(
2531
babel({
2632
babelrc: false,
2733
presets: [
28-
[
29-
`${process.cwd()}/node_modules/babel-preset-shopify/web`, {
30-
modules: false
31-
}
32-
]
34+
[`${process.cwd()}/node_modules/babel-preset-env/lib/index`, {
35+
targets: {
36+
browsers: ['last 2 versions']
37+
},
38+
modules: false
39+
}]
40+
],
41+
plugins: [
42+
`${process.cwd()}/node_modules/babel-plugin-external-helpers/lib/index`
3343
]
3444
}),
3545
{

rollup-node-tests.config.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
import graphqlCompiler from 'rollup-plugin-graphql-js-client-compiler';
12
import nodeResolve from 'rollup-plugin-node-resolve';
23
import babel from 'rollup-plugin-babel';
34
import remap from 'rollup-plugin-remap';
45
import baseConfig from './rollup-tests-common.config';
56

7+
baseConfig.plugins.unshift(
8+
graphqlCompiler({
9+
schema: './schema.json',
10+
optimize: true,
11+
profileDocuments: ['src/graphql/**/*.graphql']
12+
})
13+
);
614
baseConfig.plugins.push(
715
remap({
816
originalPath: './test/isomorphic-fetch-mock.js',
@@ -16,11 +24,12 @@ baseConfig.plugins.push(
1624
babel({
1725
babelrc: false,
1826
presets: [
19-
[
20-
`${process.cwd()}/node_modules/babel-preset-shopify/node`, {
21-
modules: false
22-
}
23-
]
27+
[`${process.cwd()}/node_modules/babel-preset-env/lib/index`, {
28+
targets: {
29+
node: '8.1.2'
30+
},
31+
modules: false
32+
}]
2433
]
2534
})
2635
);

rollup-tests-common.config.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import commonjs from 'rollup-plugin-commonjs';
2-
import graphqlCompiler from 'rollup-plugin-graphql-js-client-compiler';
32
import json from 'rollup-plugin-json';
43
import multiEntry from 'rollup-plugin-multi-entry';
54
import eslintTestGenerator from './scripts/rollup-plugin-eslint-test-generator';
65

76
export default {
87
entry: ['test/setup.js', 'test/**/*-test.js'],
98
plugins: [
10-
graphqlCompiler({
11-
schema: './schema.json'
12-
}),
139
multiEntry({
1410
exports: false
1511
}),

rollup.config.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,22 @@ const plugins = [
1919
jsnext: true,
2020
main: true
2121
}),
22-
babel(),
23-
sizes({
24-
details: true
25-
})
22+
babel({
23+
babelrc: false,
24+
presets: [
25+
[`${process.cwd()}/node_modules/babel-preset-env/lib/index`, {
26+
targets: {
27+
browsers: ['last 2 versions'],
28+
node: '8.1.2'
29+
},
30+
modules: false
31+
}]
32+
],
33+
plugins: [
34+
`${process.cwd()}/node_modules/babel-plugin-external-helpers/lib/index`
35+
]
36+
}),
37+
sizes()
2638
];
2739

2840
const targets = [

test/setup.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
setup(() => {
2+
if (typeof mocha !== 'undefined') {
3+
mocha.setup({
4+
globals: ['LiveReload']
5+
});
6+
}
7+
});

0 commit comments

Comments
 (0)