-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mina Smart
committed
Nov 30, 2017
1 parent
ba9aeea
commit 78e63a7
Showing
3 changed files
with
104 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,47 @@ | ||
import fetch from 'node-fetch'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import multiEntry from 'rollup-plugin-multi-entry'; | ||
import builtins from 'rollup-plugin-node-builtins'; | ||
import globals from 'rollup-plugin-node-globals'; | ||
import babel from 'rollup-plugin-babel'; | ||
import json from 'rollup-plugin-json'; | ||
import remap from 'rollup-plugin-remap'; | ||
import graphqlCompiler from 'rollup-plugin-graphql-js-client-compiler'; | ||
import eslintTestGenerator from './scripts/rollup-plugin-eslint-test-generator'; | ||
import baseConfig from './rollup-tests-common.config'; | ||
|
||
const {livereloadPort} = require('./package.json'); | ||
|
||
const reloadUri = `http://localhost:${livereloadPort}/changed?files=tests.js,index.html`; | ||
|
||
export default { | ||
entry: ['test/setup.js', 'test/**/*-test.js'], | ||
plugins: [ | ||
graphqlCompiler({ | ||
schema: './schema.json' | ||
}), | ||
multiEntry({ | ||
exports: false | ||
}), | ||
remap({ | ||
originalPath: './test/isomorphic-fetch-mock.js', | ||
targetPath: './test/fetch-mock-browser.js' | ||
}), | ||
globals(), | ||
builtins(), | ||
json({ | ||
exclude: './schema.json' | ||
}), | ||
eslintTestGenerator({ | ||
paths: [ | ||
'src', | ||
'test' | ||
baseConfig.plugins.push( | ||
remap({ | ||
originalPath: './test/isomorphic-fetch-mock.js', | ||
targetPath: './test/fetch-mock-browser.js' | ||
}), | ||
globals(), | ||
builtins(), | ||
nodeResolve({ | ||
jsnext: true, | ||
main: true, | ||
preferBuiltins: false | ||
}), | ||
babel({ | ||
babelrc: false, | ||
presets: [ | ||
[ | ||
`${process.cwd()}/node_modules/babel-preset-shopify/web`, { | ||
modules: false | ||
} | ||
] | ||
}), | ||
nodeResolve({ | ||
jsnext: true, | ||
main: true, | ||
preferBuiltins: false | ||
}), | ||
commonjs({ | ||
include: 'node_modules/**' | ||
}), | ||
babel({ | ||
babelrc: false, | ||
presets: [ | ||
[ | ||
`${process.cwd()}/node_modules/babel-preset-shopify/web`, { | ||
modules: false | ||
} | ||
] | ||
] | ||
}), | ||
{ | ||
onwrite() { | ||
fetch(reloadUri); | ||
} | ||
] | ||
}), | ||
{ | ||
onwrite() { | ||
fetch(reloadUri); | ||
} | ||
], | ||
targets: [{ | ||
format: 'iife', | ||
dest: '.tmp/test/tests.js' | ||
}], | ||
sourceMap: true | ||
}; | ||
} | ||
); | ||
|
||
baseConfig.targets = [{ | ||
format: 'iife', | ||
dest: '.tmp/test/tests.js' | ||
}]; | ||
|
||
export default baseConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,45 @@ | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import multiEntry from 'rollup-plugin-multi-entry'; | ||
import babel from 'rollup-plugin-babel'; | ||
import json from 'rollup-plugin-json'; | ||
import remap from 'rollup-plugin-remap'; | ||
import graphqlCompiler from 'rollup-plugin-graphql-js-client-compiler'; | ||
import eslintTestGenerator from './scripts/rollup-plugin-eslint-test-generator'; | ||
import baseConfig from './rollup-tests-common.config'; | ||
|
||
export default { | ||
entry: ['test/setup.js', 'test/**/*-test.js'], | ||
plugins: [ | ||
graphqlCompiler({ | ||
schema: './schema.json' | ||
}), | ||
multiEntry({ | ||
exports: false | ||
}), | ||
remap({ | ||
originalPath: './test/isomorphic-fetch-mock.js', | ||
targetPath: './test/fetch-mock-node.js' | ||
}), | ||
json({ | ||
exclude: './schema.json' | ||
}), | ||
eslintTestGenerator({ | ||
paths: [ | ||
'src', | ||
'test' | ||
baseConfig.plugins.push( | ||
remap({ | ||
originalPath: './test/isomorphic-fetch-mock.js', | ||
targetPath: './test/fetch-mock-node.js' | ||
}), | ||
nodeResolve({ | ||
jsnext: true, | ||
main: true, | ||
preferBuiltins: true | ||
}), | ||
babel({ | ||
babelrc: false, | ||
presets: [ | ||
[ | ||
`${process.cwd()}/node_modules/babel-preset-shopify/node`, { | ||
modules: false | ||
} | ||
] | ||
}), | ||
nodeResolve({ | ||
jsnext: true, | ||
main: true, | ||
preferBuiltins: true | ||
}), | ||
commonjs({ | ||
include: 'node_modules/**' | ||
}), | ||
babel({ | ||
babelrc: false, | ||
presets: [ | ||
[ | ||
`${process.cwd()}/node_modules/babel-preset-shopify/node`, { | ||
modules: false | ||
} | ||
] | ||
] | ||
}) | ||
], | ||
targets: [{ | ||
format: 'cjs', | ||
dest: '.tmp/test/node-tests.js' | ||
}], | ||
external: [ | ||
'assert', | ||
'url', | ||
'http', | ||
'https', | ||
'zlib', | ||
'stream', | ||
'buffer', | ||
'util', | ||
'string_decoder' | ||
], | ||
sourceMap: true | ||
}; | ||
] | ||
}) | ||
); | ||
|
||
baseConfig.targets = [{ | ||
format: 'cjs', | ||
dest: '.tmp/test/node-tests.js' | ||
}]; | ||
|
||
baseConfig.external = [ | ||
'assert', | ||
'url', | ||
'http', | ||
'https', | ||
'zlib', | ||
'stream', | ||
'buffer', | ||
'util', | ||
'string_decoder' | ||
]; | ||
|
||
export default baseConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import graphqlCompiler from 'rollup-plugin-graphql-js-client-compiler'; | ||
import json from 'rollup-plugin-json'; | ||
import multiEntry from 'rollup-plugin-multi-entry'; | ||
import eslintTestGenerator from './scripts/rollup-plugin-eslint-test-generator'; | ||
|
||
export default { | ||
entry: ['test/setup.js', 'test/**/*-test.js'], | ||
plugins: [ | ||
graphqlCompiler({ | ||
schema: './schema.json' | ||
}), | ||
multiEntry({ | ||
exports: false | ||
}), | ||
json({ | ||
exclude: './schema.json' | ||
}), | ||
eslintTestGenerator({ | ||
paths: [ | ||
'src', | ||
'test' | ||
] | ||
}), | ||
commonjs({ | ||
include: 'node_modules/**' | ||
}) | ||
], | ||
sourceMap: true | ||
}; |