Skip to content

Commit

Permalink
build out more versions with correct dependency maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Mina Smart committed Nov 30, 2017
1 parent 7af8d80 commit cb9df0a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ types.js
optimized-types.js

# Build artifacts
index.js
index.es.js
dev.js
dev.es.js
index.*
dev.*

# Decrypted secrets
secrets.json
Expand Down
44 changes: 24 additions & 20 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
/* eslint-env node */
import {readFileSync} from 'fs';
import babel from 'rollup-plugin-babel';
import nodeResolve from 'rollup-plugin-node-resolve';
import remap from 'rollup-plugin-remap';

const plugins = [babel()];
const targets = [];
const plugins = [
remap({
originalPath: './types',
targetPath: './optimized-types'
}),
nodeResolve({
jsnext: true,
main: true
}),
babel()
];

// eslint-disable-next-line no-process-env
if (process.env.BUILD_MODE === 'production') {
plugins.push(remap({
originalPath: './src/graphl-client',
targetPath: './src/graphl-client-dev'
}));

targets.push(
{dest: 'index.js', format: 'cjs'},
{dest: 'index.es.js', format: 'es'}
);
} else {
targets.push(
{dest: 'dev.js', format: 'cjs'},
{dest: 'dev.es.js', format: 'es'}
);
}
const targets = [
{format: 'cjs', suffix: ''},
{format: 'amd', suffix: '.amd'},
{format: 'es', suffix: '.es'},
{format: 'umd', suffix: '.umd'}
].map((config) => {
return {
dest: `index${config.suffix}.js`,
format: config.format
};
});

const banner = `/*
${readFileSync('./LICENSE.md')}
${readFileSync('./LICENSE.txt')}
*/`;

export default {
Expand Down
1 change: 1 addition & 0 deletions src/graphql-client-dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from 'graphql-js-client/dev.es';
1 change: 1 addition & 0 deletions src/graphql-client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from 'graphql-js-client';

0 comments on commit cb9df0a

Please sign in to comment.