Skip to content

Commit

Permalink
more explained error code for name-less umd bundle (#3393)
Browse files Browse the repository at this point in the history
* more explained error code for name-less umd bundle

* Align error code with IIFE warning

* Fix missing auth token issue. I guess we need to rethink how we post these messages as of course it makes sense CircleCI does not expose the token for different repo PRs for security reasons. Babel is using an AWS Lambda here, maybe something like that.

Co-authored-by: Lukas Taegert-Atkinson <lukas.taegert-atkinson@tngtech.com>
  • Loading branch information
rail44 and lukastaegert committed Mar 6, 2020
1 parent 3f1052b commit a792bb1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 36 deletions.
62 changes: 31 additions & 31 deletions LICENSE.md
Expand Up @@ -31,7 +31,7 @@ MIT, ISC
## acorn
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Repository: git+https://github.com/acornjs/acorn.git
Repository: https://github.com/acornjs/acorn.git

> Copyright (C) 2012-2018 by various contributors (see AUTHORS)
>
Expand All @@ -58,7 +58,7 @@ Repository: git+https://github.com/acornjs/acorn.git
## acorn-export-ns-from
License: MIT
By: Adrian Heine
Repository: git+https://github.com/acornjs/acorn-export-ns-from.git
Repository: https://github.com/acornjs/acorn-export-ns-from

> Copyright (C) 2017-2018 by Adrian Heine
>
Expand All @@ -85,7 +85,7 @@ Repository: git+https://github.com/acornjs/acorn-export-ns-from.git
## acorn-import-meta
License: MIT
By: Adrian Heine
Repository: git+https://github.com/adrianheine/acorn-import-meta.git
Repository: https://github.com/adrianheine/acorn-import-meta

> Copyright (C) 2017-2018 by Adrian Heine
>
Expand All @@ -112,7 +112,7 @@ Repository: git+https://github.com/adrianheine/acorn-import-meta.git
## acorn-walk
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Repository: git+https://github.com/acornjs/acorn.git
Repository: https://github.com/acornjs/acorn.git

> Copyright (C) 2012-2018 by various contributors (see AUTHORS)
>
Expand All @@ -139,7 +139,7 @@ Repository: git+https://github.com/acornjs/acorn.git
## anymatch
License: ISC
By: Elan Shanker
Repository: git+https://github.com/micromatch/anymatch.git
Repository: https://github.com/micromatch/anymatch

> The ISC License
>
Expand All @@ -162,14 +162,14 @@ Repository: git+https://github.com/micromatch/anymatch.git
## binary-extensions
License: MIT
By: Sindre Sorhus
Repository: git+https://github.com/sindresorhus/binary-extensions.git
Repository: sindresorhus/binary-extensions

---------------------------------------

## braces
License: MIT
By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm
Repository: git+https://github.com/micromatch/braces.git
Repository: micromatch/braces

> The MIT License (MIT)
>
Expand Down Expand Up @@ -227,7 +227,7 @@ Repository: git+https://github.com/paulmillr/chokidar.git
## colorette
License: MIT
By: Jorge Bucaran
Repository: git+https://github.com/jorgebucaran/colorette.git
Repository: jorgebucaran/colorette

> Copyright © Jorge Bucaran <<https://jorgebucaran.com>>
>
Expand All @@ -242,14 +242,14 @@ Repository: git+https://github.com/jorgebucaran/colorette.git
## date-time
License: MIT
By: Sindre Sorhus
Repository: git+https://github.com/sindresorhus/date-time.git
Repository: sindresorhus/date-time

---------------------------------------

## fill-range
License: MIT
By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling
Repository: git+https://github.com/jonschlinkert/fill-range.git
Repository: jonschlinkert/fill-range

> The MIT License (MIT)
>
Expand Down Expand Up @@ -278,7 +278,7 @@ Repository: git+https://github.com/jonschlinkert/fill-range.git
## glob-parent
License: ISC
By: Gulp Team, Elan Shanker, Blaine Bublitz
Repository: git+https://github.com/gulpjs/glob-parent.git
Repository: gulpjs/glob-parent

> The ISC License
>
Expand All @@ -301,13 +301,13 @@ Repository: git+https://github.com/gulpjs/glob-parent.git
## hash.js
License: MIT
By: Fedor Indutny
Repository: git+ssh://git@github.com/indutny/hash.js.git
Repository: git@github.com:indutny/hash.js

---------------------------------------

## inherits
License: ISC
Repository: git://github.com/isaacs/inherits.git
Repository: git://github.com/isaacs/inherits

> The ISC License
>
Expand All @@ -330,14 +330,14 @@ Repository: git://github.com/isaacs/inherits.git
## is-binary-path
License: MIT
By: Sindre Sorhus
Repository: git+https://github.com/sindresorhus/is-binary-path.git
Repository: sindresorhus/is-binary-path

---------------------------------------

## is-extglob
License: MIT
By: Jon Schlinkert
Repository: git+https://github.com/jonschlinkert/is-extglob.git
Repository: jonschlinkert/is-extglob

> The MIT License (MIT)
>
Expand Down Expand Up @@ -366,7 +366,7 @@ Repository: git+https://github.com/jonschlinkert/is-extglob.git
## is-glob
License: MIT
By: Jon Schlinkert, Brian Woodward, Daniel Perez
Repository: git+https://github.com/micromatch/is-glob.git
Repository: micromatch/is-glob

> The MIT License (MIT)
>
Expand Down Expand Up @@ -395,7 +395,7 @@ Repository: git+https://github.com/micromatch/is-glob.git
## is-number
License: MIT
By: Jon Schlinkert, Olsten Larck, Rouven Weßling
Repository: git+https://github.com/jonschlinkert/is-number.git
Repository: jonschlinkert/is-number

> The MIT License (MIT)
>
Expand Down Expand Up @@ -431,14 +431,14 @@ Repository: git+https://github.com/Rich-Harris/is-reference.git
## locate-character
License: MIT
By: Rich Harris
Repository: git+https://github.com/Rich-Harris/locate-character.git
Repository: Rich-Harris/locate-character

---------------------------------------

## magic-string
License: MIT
By: Rich Harris
Repository: git+https://github.com/rich-harris/magic-string.git
Repository: https://github.com/rich-harris/magic-string

> Copyright 2018 Rich Harris
>
Expand All @@ -453,7 +453,7 @@ Repository: git+https://github.com/rich-harris/magic-string.git
## micromatch
License: MIT
By: Jon Schlinkert, Amila Welihinda, Bogdan Chadkin, Brian Woodward, Devon Govett, Elan Shanker, Fabrício Matté, Martin Kolárik, Olsten Larck, Paul Miller, Tom Byrer, Tyler Akins, Peter Bright
Repository: git+https://github.com/micromatch/micromatch.git
Repository: micromatch/micromatch

> The MIT License (MIT)
>
Expand Down Expand Up @@ -481,7 +481,7 @@ Repository: git+https://github.com/micromatch/micromatch.git

## minimalistic-assert
License: ISC
Repository: git+https://github.com/calvinmetcalf/minimalistic-assert.git
Repository: https://github.com/calvinmetcalf/minimalistic-assert.git

> Copyright 2015 Calvin Metcalf
>
Expand Down Expand Up @@ -528,7 +528,7 @@ Repository: git://github.com/substack/minimist.git
## normalize-path
License: MIT
By: Jon Schlinkert, Blaine Bublitz
Repository: git+https://github.com/jonschlinkert/normalize-path.git
Repository: jonschlinkert/normalize-path

> The MIT License (MIT)
>
Expand Down Expand Up @@ -557,14 +557,14 @@ Repository: git+https://github.com/jonschlinkert/normalize-path.git
## parse-ms
License: MIT
By: Sindre Sorhus
Repository: git+https://github.com/sindresorhus/parse-ms.git
Repository: sindresorhus/parse-ms

---------------------------------------

## picomatch
License: MIT
By: Jon Schlinkert
Repository: git+https://github.com/micromatch/picomatch.git
Repository: micromatch/picomatch

> The MIT License (MIT)
>
Expand Down Expand Up @@ -593,14 +593,14 @@ Repository: git+https://github.com/micromatch/picomatch.git
## pretty-bytes
License: MIT
By: Sindre Sorhus
Repository: git+https://github.com/sindresorhus/pretty-bytes.git
Repository: sindresorhus/pretty-bytes

---------------------------------------

## pretty-ms
License: MIT
By: Sindre Sorhus
Repository: git+https://github.com/sindresorhus/pretty-ms.git
Repository: sindresorhus/pretty-ms

---------------------------------------

Expand Down Expand Up @@ -643,14 +643,14 @@ Repository: git://github.com/kamicane/require-relative.git
## rollup-pluginutils
License: MIT
By: Rich Harris
Repository: git+https://github.com/rollup/rollup-pluginutils.git
Repository: rollup/rollup-pluginutils

---------------------------------------

## signal-exit
License: ISC
By: Ben Coe
Repository: git+https://github.com/tapjs/signal-exit.git
Repository: https://github.com/tapjs/signal-exit.git

> The ISC License
>
Expand All @@ -674,7 +674,7 @@ Repository: git+https://github.com/tapjs/signal-exit.git
## sourcemap-codec
License: MIT
By: Rich Harris
Repository: git+https://github.com/Rich-Harris/sourcemap-codec.git
Repository: https://github.com/Rich-Harris/sourcemap-codec

> The MIT License
>
Expand Down Expand Up @@ -703,14 +703,14 @@ Repository: git+https://github.com/Rich-Harris/sourcemap-codec.git
## time-zone
License: MIT
By: Sindre Sorhus
Repository: git+https://github.com/sindresorhus/time-zone.git
Repository: sindresorhus/time-zone

---------------------------------------

## to-regex-range
License: MIT
By: Jon Schlinkert, Rouven Weßling
Repository: git+https://github.com/micromatch/to-regex-range.git
Repository: micromatch/to-regex-range

> The MIT License (MIT)
>
Expand Down
3 changes: 2 additions & 1 deletion scripts/post-comment.js
Expand Up @@ -5,7 +5,8 @@ const fetch = require('node-fetch');

const authToken = process.env.GH_AUTH_TOKEN;
if (!authToken) {
throw new Error('Could not find auth token.');
console.log('Could not find auth token.');
process.exit(0);
}

const prNumber = path.basename(
Expand Down
5 changes: 3 additions & 2 deletions src/finalisers/umd.ts
Expand Up @@ -44,8 +44,9 @@ export default function umd(

if (hasExports && !options.name) {
return error({
code: 'INVALID_OPTION',
message: 'You must supply "output.name" for UMD bundles.'
code: 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT',
message:
'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.'
});
}

Expand Down
5 changes: 3 additions & 2 deletions test/function/samples/error-missing-umd-name/_config.js
Expand Up @@ -2,7 +2,8 @@ module.exports = {
description: 'throws an error if no name is provided for a UMD bundle',
options: { output: { format: 'umd' } },
generateError: {
code: 'INVALID_OPTION',
message: 'You must supply "output.name" for UMD bundles.'
code: 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT',
message:
'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.'
}
};

0 comments on commit a792bb1

Please sign in to comment.