Skip to content

Commit

Permalink
Merge pull request #61 from mjeanroy/greenkeeper/rollup-0.48.2
Browse files Browse the repository at this point in the history
chore(package): update rollup to version 0.48.2
  • Loading branch information
mjeanroy authored Aug 21, 2017
2 parents 2e8d201 + 5ef69b5 commit d774af3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"gulp-jasmine": "2.4.2",
"gulp-util": "3.0.8",
"jasmine-core": "2.7.0",
"rollup": "0.47.6",
"rollup": "0.48.2",
"rollup-plugin-commonjs": "8.1.0",
"rollup-plugin-node-resolve": "3.0.0",
"run-sequence": "2.1.0",
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ module.exports = (options = {}) => {
* @return {void}
*/
options(opts) {
if (opts && opts.sourceMap) {
if (!opts) {
return;
}

// Rollup >= 0.48 replace `sourceMap` with `sourcemap`.
if (opts.sourceMap || opts.sourcemap) {
plugin.enableSourceMap();
}
},
Expand Down
12 changes: 12 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ describe('rollup-plugin-license', () => {
expect(LicensePlugin.prototype.enableSourceMap).toHaveBeenCalledWith();
});

it('should enable sourceMap if options.sourcemap (lowercase) is true', () => {
spyOn(LicensePlugin.prototype, 'enableSourceMap').and.callThrough();

const instance = plugin();
const result = instance.options({
sourcemap: true,
});

expect(result).not.toBeDefined();
expect(LicensePlugin.prototype.enableSourceMap).toHaveBeenCalledWith();
});

it('should not enable sourceMap if options.sourceMap is false', () => {
spyOn(LicensePlugin.prototype, 'enableSourceMap').and.callThrough();

Expand Down
31 changes: 21 additions & 10 deletions test/integration/it.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@ describe('Dependency', () => {
const thirdPartyOutput = path.join(tmpDir.name, 'dependencies.txt');

const rollupConfig = {
// Keep the `entry` option because of `rollup-plugin-commonjs`
entry: path.join(__dirname, 'bundle.js'),
dest: bundleOutput,
format: 'es',

input: path.join(__dirname, 'bundle.js'),

output: {
file: bundleOutput,
format: 'es',
},

plugins: [
nodeResolve(),
commonjs(),
Expand All @@ -66,7 +73,7 @@ describe('Dependency', () => {
};

rollup.rollup(rollupConfig)
.then((bundle) => bundle.write(rollupConfig))
.then((bundle) => bundle.write(rollupConfig.output))
.then(() => {
fs.readFile(thirdPartyOutput, 'utf8', (err, data) => {
if (err) {
Expand All @@ -86,21 +93,25 @@ describe('Dependency', () => {
const EOL = '\n';

const rollupConfig = {
// Keep the `entry` option because of `rollup-plugin-commonjs`
entry: path.join(__dirname, 'bundle.js'),
dest: bundleOutput,
format: 'es',

input: path.join(__dirname, 'bundle.js'),

output: {
file: bundleOutput,
format: 'es',
},

plugins: [
nodeResolve(),
commonjs(),

licensePlugin({
banner,
}),
licensePlugin({banner}),
],
};

rollup.rollup(rollupConfig)
.then((bundle) => bundle.write(rollupConfig))
.then((bundle) => bundle.write(rollupConfig.output))
.then(() => {
fs.readFile(bundleOutput, 'utf8', (err, data) => {
if (err) {
Expand Down

0 comments on commit d774af3

Please sign in to comment.