From 1cece1c485b9d04ef91b639c67eee1aef19dfa3a Mon Sep 17 00:00:00 2001 From: Satoshi Amemiya Date: Fri, 6 Mar 2020 18:20:52 +0900 Subject: [PATCH] more explained error code for name-less umd bundle (#3393) * 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 --- LICENSE.md | 62 +++++++++---------- scripts/post-comment.js | 3 +- src/finalisers/umd.ts | 5 +- .../samples/error-missing-umd-name/_config.js | 5 +- 4 files changed, 39 insertions(+), 36 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 5a154b950cc..8df2facb746 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -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) > @@ -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 > @@ -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 > @@ -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) > @@ -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 > @@ -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) > @@ -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 <> > @@ -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) > @@ -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 > @@ -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 > @@ -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) > @@ -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) > @@ -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) > @@ -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 > @@ -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) > @@ -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 > @@ -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) > @@ -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) > @@ -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 --------------------------------------- @@ -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 > @@ -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 > @@ -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) > diff --git a/scripts/post-comment.js b/scripts/post-comment.js index 30b5defcb7f..2e29de90ae0 100755 --- a/scripts/post-comment.js +++ b/scripts/post-comment.js @@ -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( diff --git a/src/finalisers/umd.ts b/src/finalisers/umd.ts index c919a479a1c..93c68a5ea27 100644 --- a/src/finalisers/umd.ts +++ b/src/finalisers/umd.ts @@ -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.' }); } diff --git a/test/function/samples/error-missing-umd-name/_config.js b/test/function/samples/error-missing-umd-name/_config.js index 04cf5eb68a7..3a722d59f6d 100644 --- a/test/function/samples/error-missing-umd-name/_config.js +++ b/test/function/samples/error-missing-umd-name/_config.js @@ -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.' } };