From fb8c27b676e30ab4c8abd5db28a14c1a6c55fd56 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 5 Jul 2022 06:23:49 +0200 Subject: [PATCH 01/15] [v3.0] New hashing algorithm that "fixes (nearly) everything" (#4543) * Initial new hashing idea * Simplify external import path generation 197 broken tests left * Use correct file names in chunk info 197 broken tests left * Implement first draft for hashing algorithm 189 broken tests left * Remove active deprecations this.emitAsset this.emitChunk this.getAssetFileName this.getChunkFileName import.meta.ROLLUP_ASSET_URL_ import.meta.ROLLUP_CHUNK_URL_ * Reduce render parameters * Always scan all chunks for hashes * Fix asset emission and remaining tests * Reintroduce augmentChunkHash and get OutputChunk by converting RenderedChunk * Provide chunk graph in renderChunk * Handle hash collisions * Remove deprecated hacky asset emission * Allow to configure hash sizes per file * Update documentation * Extend tests * Minor improvements * Improve documentation about hashing * Replace hash in sourcemap file * Provide ChunkInfo in banner/footer/intro/outro * Extract hashing logic * Clean up hashing logic * Add ExternalChunk wrapper * Store inputBase on Chunk * Store snippets on Chunk * Align chunk interfaces * Reduce this. property access * Move dynamicImportFunction warning to options normalization * Restructure rendering logic * Do not run on Node 10 * Update documentation * Try to fix Windows tests * Improve coverage * Remove graph background colors 3.0.0-0 --- .../_expected/amd/entry-main-5940aabc-amd.js | 4 ++++ .../_expected/cjs/entry-main-9cf3a232-cjs.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js index bed6a1ef6b4..b863b98285e 100644 --- a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js +++ b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js @@ -1,6 +1,10 @@ define(['require'], (function (require) { 'use strict'; console.log('main'); +<<<<<<<< HEAD:test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js new Promise(function (resolve, reject) { require(['./chunk-deb-87ce45a9-amd'], resolve, reject); }).then(console.log); +======== + new Promise(function (resolve, reject) { require(['./chunk-deb-faae56f2-amd'], resolve, reject); }).then(console.log); +>>>>>>>> 3030e2f11 ([v3.0] New hashing algorithm that "fixes (nearly) everything" (#4543)):test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-aaf15a0c-amd.js })); diff --git a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js index e28e6fa0c72..ec32df29945 100644 --- a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js +++ b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js @@ -1,4 +1,8 @@ 'use strict'; console.log('main'); +<<<<<<<< HEAD:test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js Promise.resolve().then(function () { return require('./chunk-deb-69905607-cjs.js'); }).then(console.log); +======== +Promise.resolve().then(function () { return require('./chunk-deb-2221fa83-cjs.js'); }).then(console.log); +>>>>>>>> 3030e2f11 ([v3.0] New hashing algorithm that "fixes (nearly) everything" (#4543)):test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-69b6552e-cjs.js From 95b2c3316d0cd9282f195c8490ea538257c65fe1 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 22 Jul 2022 06:08:24 +0200 Subject: [PATCH 02/15] Set up browser build --- LICENSE.md | 49 ------- browser/LICENSE.md | 187 +++++++++++++++++++++++++ browser/package.json | 37 +++++ build-plugins/clean-before-write.ts | 16 +++ build-plugins/generate-license-file.ts | 16 ++- package.json | 15 +- rollup.config.ts | 41 +++++- test/browser/index.js | 2 +- 8 files changed, 292 insertions(+), 71 deletions(-) create mode 100644 browser/LICENSE.md create mode 100644 browser/package.json create mode 100644 build-plugins/clean-before-write.ts diff --git a/LICENSE.md b/LICENSE.md index 98e89d8a276..f3e20d39822 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -292,35 +292,6 @@ Repository: gulpjs/glob-parent --------------------------------------- -## hash.js -License: MIT -By: Fedor Indutny -Repository: git@github.com:indutny/hash.js - ---------------------------------------- - -## inherits -License: ISC -Repository: git://github.com/isaacs/inherits - -> The ISC License -> -> Copyright (c) Isaac Z. Schlueter -> -> Permission to use, copy, modify, and/or distribute this software for any -> purpose with or without fee is hereby granted, provided that the above -> copyright notice and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -> PERFORMANCE OF THIS SOFTWARE. - ---------------------------------------- - ## is-binary-path License: MIT By: Sindre Sorhus @@ -454,26 +425,6 @@ Repository: https://github.com/rich-harris/magic-string --------------------------------------- -## minimalistic-assert -License: ISC -Repository: https://github.com/calvinmetcalf/minimalistic-assert.git - -> Copyright 2015 Calvin Metcalf -> -> Permission to use, copy, modify, and/or distribute this software for any purpose -> with or without fee is hereby granted, provided that the above copyright notice -> and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -> OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -> PERFORMANCE OF THIS SOFTWARE. - ---------------------------------------- - ## normalize-path License: MIT By: Jon Schlinkert, Blaine Bublitz diff --git a/browser/LICENSE.md b/browser/LICENSE.md new file mode 100644 index 00000000000..8d9cc1268eb --- /dev/null +++ b/browser/LICENSE.md @@ -0,0 +1,187 @@ +# Rollup core license +Rollup is released under the MIT license: + +The MIT License (MIT) + +Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Licenses of bundled dependencies +The published Rollup artifact additionally contains code with the following licenses: +MIT, ISC + +# Bundled dependencies: +## @rollup/pluginutils +License: MIT +By: Rich Harris +Repository: rollup/plugins + +--------------------------------------- + +## acorn +License: MIT +By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine +Repository: https://github.com/acornjs/acorn.git + +> MIT License +> +> Copyright (C) 2012-2022 by various contributors (see AUTHORS) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## acorn-walk +License: MIT +By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine +Repository: https://github.com/acornjs/acorn.git + +> MIT License +> +> Copyright (C) 2012-2020 by various contributors (see AUTHORS) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## hash.js +License: MIT +By: Fedor Indutny +Repository: git@github.com:indutny/hash.js + +--------------------------------------- + +## inherits +License: ISC +Repository: git://github.com/isaacs/inherits + +> The ISC License +> +> Copyright (c) Isaac Z. Schlueter +> +> Permission to use, copy, modify, and/or distribute this software for any +> purpose with or without fee is hereby granted, provided that the above +> copyright notice and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +> PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + +## is-reference +License: MIT +By: Rich Harris +Repository: git+https://github.com/Rich-Harris/is-reference.git + +--------------------------------------- + +## locate-character +License: MIT +By: Rich Harris +Repository: Rich-Harris/locate-character + +--------------------------------------- + +## magic-string +License: MIT +By: Rich Harris +Repository: https://github.com/rich-harris/magic-string + +> Copyright 2018 Rich Harris +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## minimalistic-assert +License: ISC +Repository: https://github.com/calvinmetcalf/minimalistic-assert.git + +> Copyright 2015 Calvin Metcalf +> +> Permission to use, copy, modify, and/or distribute this software for any purpose +> with or without fee is hereby granted, provided that the above copyright notice +> and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +> OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +> PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + +## sourcemap-codec +License: MIT +By: Rich Harris +Repository: https://github.com/Rich-Harris/sourcemap-codec + +> The MIT License +> +> Copyright (c) 2015 Rich Harris +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. diff --git a/browser/package.json b/browser/package.json new file mode 100644 index 00000000000..3a9a304a37f --- /dev/null +++ b/browser/package.json @@ -0,0 +1,37 @@ +{ + "name": "@rollup/browser", + "version": "3.0.0-2", + "description": "Next-generation ES module bundler browser build", + "main": "dist/rollup.browser.js", + "module": "dist/es/rollup.browser.js", + "types": "dist/rollup.browser.d.ts", + "repository": "rollup/rollup", + "keywords": [ + "modules", + "bundler", + "bundling", + "es6", + "optimizer", + "browser" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/rollup/rollup/issues" + }, + "homepage": "https://rollupjs.org/", + "files": [ + "dist/**/*.js", + "dist/*.d.ts", + "dist/bin/rollup", + "dist/es/package.json", + "dist/rollup.browser.js.map" + ], + "exports": { + ".": { + "types": "./dist/rollup.d.ts", + "require": "./dist/rollup.browser.js", + "import": "./dist/es/rollup.browser.js" + }, + "./dist/*": "./dist/*" + } +} diff --git a/build-plugins/clean-before-write.ts b/build-plugins/clean-before-write.ts new file mode 100644 index 00000000000..fc9109e7119 --- /dev/null +++ b/build-plugins/clean-before-write.ts @@ -0,0 +1,16 @@ +import { remove } from 'fs-extra'; +import type { Plugin } from 'rollup'; + +export default function cleanBeforeWrite(dir: string): Plugin { + let removePromise: Promise | null = null; + return { + generateBundle(_options, _bundle, isWrite) { + if (isWrite) { + // Only remove before first write, but make all writes wait on the removal + removePromise ||= remove(dir); + return removePromise; + } + }, + name: 'clean-before-write' + }; +} diff --git a/build-plugins/generate-license-file.ts b/build-plugins/generate-license-file.ts index 1ebc97d873a..341f2c87ee7 100644 --- a/build-plugins/generate-license-file.ts +++ b/build-plugins/generate-license-file.ts @@ -1,11 +1,16 @@ import { promises as fs } from 'fs'; +import { join } from 'path'; import type { PluginImpl } from 'rollup'; import license, { type Dependency, type Person } from 'rollup-plugin-license'; -async function generateLicenseFile(dependencies: readonly Dependency[]): Promise { +async function generateLicenseFile( + dir: string, + dependencies: readonly Dependency[] +): Promise { const coreLicense = await fs.readFile('LICENSE-CORE.md', 'utf8'); const licenses = new Set(); const dependencyLicenseTexts = Array.from(dependencies) + .filter(({ name }) => name !== '@rollup/browser') .sort(({ name: nameA }, { name: nameB }) => (nameA! > nameB! ? 1 : -1)) .map(({ name, license, licenseText, author, maintainers, contributors, repository }) => { let text = `## ${name}\n`; @@ -52,9 +57,10 @@ async function generateLicenseFile(dependencies: readonly Dependency[]): Promise `${Array.from(licenses).join(', ')}\n\n` + `# Bundled dependencies:\n` + dependencyLicenseTexts; - const existingLicenseText = await fs.readFile('LICENSE.md', 'utf8'); + const licenseFile = join(dir, 'LICENSE.md'); + const existingLicenseText = await fs.readFile(licenseFile, 'utf8'); if (existingLicenseText !== licenseText) { - await fs.writeFile('LICENSE.md', licenseText); + await fs.writeFile(licenseFile, licenseText); console.warn('LICENSE.md updated. You should commit the updated file.'); } } @@ -64,7 +70,7 @@ interface LicenseHandler { writeLicense: PluginImpl; } -export default function getLicenseHandler(): LicenseHandler { +export default function getLicenseHandler(dir: string): LicenseHandler { const licenses = new Map(); return { collectLicenses() { @@ -80,7 +86,7 @@ export default function getLicenseHandler(): LicenseHandler { return { name: 'write-license', writeBundle() { - return generateLicenseFile(Array.from(licenses.values())); + return generateLicenseFile(dir, Array.from(licenses.values())); } }; } diff --git a/package.json b/package.json index 22876ae4445..a5231677365 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,14 @@ "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", - "typings": "dist/rollup.d.ts", + "types": "dist/rollup.d.ts", "bin": { "rollup": "dist/bin/rollup" }, "scripts": { - "build": "shx rm -rf dist && node scripts/update-git-commit.js && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", - "build:cjs": "shx rm -rf dist && rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", - "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup && cp -r dist browser/", + "build": "node scripts/update-git-commit.js && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", "ci:lint": "npm run lint:nofix", "ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all", "ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only", @@ -131,11 +131,8 @@ "exports": { ".": { "types": "./dist/rollup.d.ts", - "node": { - "require": "./dist/rollup.js", - "import": "./dist/es/rollup.js" - }, - "default": "./dist/es/rollup.browser.js" + "require": "./dist/rollup.js", + "import": "./dist/es/rollup.js" }, "./loadConfigFile": "./dist/loadConfigFile.js", "./dist/loadConfigFile": "./dist/loadConfigFile.js", diff --git a/rollup.config.ts b/rollup.config.ts index 01783d5ca12..9e1845c01eb 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,6 +1,7 @@ import { promises as fs } from 'fs'; import { resolve } from 'path'; import { env } from 'process'; +import { fileURLToPath } from 'url'; import alias from '@rollup/plugin-alias'; import commonjs from '@rollup/plugin-commonjs'; import json from '@rollup/plugin-json'; @@ -10,6 +11,7 @@ import type { Plugin, RollupOptions, WarningHandlerWithDefault } from 'rollup'; import { string } from 'rollup-plugin-string'; import { terser } from 'rollup-plugin-terser'; import addCliEntry from './build-plugins/add-cli-entry'; +import cleanBeforeWrite from './build-plugins/clean-before-write'; import conditionalFsEventsImport from './build-plugins/conditional-fsevents-import'; import emitModulePackageFile from './build-plugins/emit-module-package-file'; import esmDynamicImport from './build-plugins/esm-dynamic-import'; @@ -17,6 +19,13 @@ import getLicenseHandler from './build-plugins/generate-license-file'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; import { version } from './package.json'; +// TODO Lukas do not encode any enforced order between cjs and esm build, instead use a shared plugin and write the license on closeBundle +// TODO Lukas inline script to update the commit +// TODO Lukas inline chmod via fs.chmod +// TODO Lukas copy types programmatically for both normal and browser build +// TODO Lukas adapt "files" property +// TODO Lukas script that cds into browser dir, updates version and runs publish with same flags as main publish +// TODO Lukas adapt REPL artefact async function getBanner(): Promise { let commitHash: string; @@ -75,14 +84,17 @@ const nodePlugins: Plugin[] = [ ignoreTryCatch: false, include: 'node_modules/**' }), - typescript() + typescript(), + cleanBeforeWrite('dist') ]; export default async function ( command: Record ): Promise { const banner = await getBanner(); - const { collectLicenses, writeLicense } = getLicenseHandler(); + const { collectLicenses, writeLicense } = getLicenseHandler( + fileURLToPath(new URL('.', import.meta.url)) + ); const commonJSBuild: RollupOptions = { // 'fsevents' is a dependency of 'chokidar' that cannot be bundled as it contains binary code @@ -130,15 +142,29 @@ export default async function ( minifyInternalExports: false, sourcemap: false }, - plugins: [...nodePlugins, emitModulePackageFile(), collectLicenses()] + plugins: [...nodePlugins, emitModulePackageFile(), collectLicenses(), writeLicense()] }; + const { collectLicenses: collectLicensesBrowser, writeLicense: writeLicenseBrowser } = + getLicenseHandler(fileURLToPath(new URL('browser', import.meta.url))); + const browserBuilds: RollupOptions = { input: 'src/browser-entry.ts', onwarn, output: [ - { banner, file: 'dist/rollup.browser.js', format: 'umd', name: 'rollup', sourcemap: true }, - { banner, file: 'dist/es/rollup.browser.js', format: 'es' } + { + banner, + file: 'browser/dist/rollup.browser.js', + format: 'umd', + name: 'rollup', + sourcemap: true + }, + { + banner, + file: 'browser/dist/es/rollup.browser.js', + format: 'es', + plugins: [emitModulePackageFile()] + } ], plugins: [ replaceBrowserModules(), @@ -148,8 +174,9 @@ export default async function ( commonjs(), typescript(), terser({ module: true, output: { comments: 'some' } }), - collectLicenses(), - writeLicense() + collectLicensesBrowser(), + writeLicenseBrowser(), + cleanBeforeWrite('browser/dist') ], strictDeprecations: true, treeshake diff --git a/test/browser/index.js b/test/browser/index.js index f3aa646a980..d9359152e89 100644 --- a/test/browser/index.js +++ b/test/browser/index.js @@ -5,7 +5,7 @@ global.performance = require('perf_hooks').performance; const { basename, resolve } = require('path'); const fixturify = require('fixturify'); -const { rollup } = require('../../dist/rollup.browser.js'); +const { rollup } = require('../../browser/dist/rollup.browser.js'); const { assertFilesAreEqual, runTestSuiteWithSamples, compareError } = require('../utils.js'); runTestSuiteWithSamples('browser', resolve(__dirname, 'samples'), (dir, config) => { From 5b858511120a90246d9c7adb49f5c85bd86f62bb Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 22 Jul 2022 06:50:57 +0200 Subject: [PATCH 03/15] Generate commithash inline --- build-plugins/generate-license-file.ts | 11 ++++---- build-plugins/get-banner.ts | 30 ++++++++++++++++++++++ package.json | 2 +- rollup.config.ts | 35 +++----------------------- scripts/update-git-commit.js | 13 ---------- 5 files changed, 40 insertions(+), 51 deletions(-) create mode 100644 build-plugins/get-banner.ts delete mode 100644 scripts/update-git-commit.js diff --git a/build-plugins/generate-license-file.ts b/build-plugins/generate-license-file.ts index 341f2c87ee7..ecc514d2aa2 100644 --- a/build-plugins/generate-license-file.ts +++ b/build-plugins/generate-license-file.ts @@ -72,14 +72,13 @@ interface LicenseHandler { export default function getLicenseHandler(dir: string): LicenseHandler { const licenses = new Map(); + function addLicenses(dependencies: readonly Dependency[]) { + for (const dependency of dependencies) { + licenses.set(dependency.name!, dependency); + } + } return { collectLicenses() { - function addLicenses(dependencies: readonly Dependency[]) { - for (const dependency of dependencies) { - licenses.set(dependency.name!, dependency); - } - } - return license({ thirdParty: addLicenses }); }, writeLicense() { diff --git a/build-plugins/get-banner.ts b/build-plugins/get-banner.ts new file mode 100644 index 00000000000..a406f75a3cb --- /dev/null +++ b/build-plugins/get-banner.ts @@ -0,0 +1,30 @@ +import { exec } from 'child_process'; +import { env } from 'process'; +import { promisify } from 'util'; +import { version } from '../package.json'; + +const execPromise = promisify(exec); + +function generateBanner(commitHash: string): string { + const date = new Date( + env.SOURCE_DATE_EPOCH ? 1000 * +env.SOURCE_DATE_EPOCH : Date.now() + ).toUTCString(); + + return `/* + @license + Rollup.js v${version} + ${date} - commit ${commitHash} + + https://github.com/rollup/rollup + + Released under the MIT License. +*/`; +} + +let getBannerPromise: Promise | null = null; + +export default async function getBanner(): Promise { + return (getBannerPromise ||= execPromise('git rev-parse HEAD').then(({ stdout }) => + generateBanner(stdout.trim()) + )); +} diff --git a/package.json b/package.json index a5231677365..8b72b2be8d9 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "rollup": "dist/bin/rollup" }, "scripts": { - "build": "node scripts/update-git-commit.js && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "build": "rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", "build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", "ci:lint": "npm run lint:nofix", diff --git a/rollup.config.ts b/rollup.config.ts index 9e1845c01eb..e2c66f15148 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,6 +1,4 @@ -import { promises as fs } from 'fs'; import { resolve } from 'path'; -import { env } from 'process'; import { fileURLToPath } from 'url'; import alias from '@rollup/plugin-alias'; import commonjs from '@rollup/plugin-commonjs'; @@ -16,39 +14,15 @@ import conditionalFsEventsImport from './build-plugins/conditional-fsevents-impo import emitModulePackageFile from './build-plugins/emit-module-package-file'; import esmDynamicImport from './build-plugins/esm-dynamic-import'; import getLicenseHandler from './build-plugins/generate-license-file'; +import getBanner from './build-plugins/get-banner'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; -import { version } from './package.json'; -// TODO Lukas do not encode any enforced order between cjs and esm build, instead use a shared plugin and write the license on closeBundle // TODO Lukas inline script to update the commit // TODO Lukas inline chmod via fs.chmod // TODO Lukas copy types programmatically for both normal and browser build // TODO Lukas adapt "files" property // TODO Lukas script that cds into browser dir, updates version and runs publish with same flags as main publish // TODO Lukas adapt REPL artefact -async function getBanner(): Promise { - let commitHash: string; - - try { - commitHash = await fs.readFile('.commithash', 'utf8'); - } catch { - commitHash = 'unknown'; - } - - const date = new Date( - env.SOURCE_DATE_EPOCH ? 1000 * +env.SOURCE_DATE_EPOCH : Date.now() - ).toUTCString(); - - return `/* - @license - Rollup.js v${version} - ${date} - commit ${commitHash} - - https://github.com/rollup/rollup - - Released under the MIT License. -*/`; -} const onwarn: WarningHandlerWithDefault = warning => { // eslint-disable-next-line no-console @@ -91,7 +65,6 @@ const nodePlugins: Plugin[] = [ export default async function ( command: Record ): Promise { - const banner = await getBanner(); const { collectLicenses, writeLicense } = getLicenseHandler( fileURLToPath(new URL('.', import.meta.url)) ); @@ -105,7 +78,7 @@ export default async function ( }, onwarn, output: { - banner, + banner: getBanner, chunkFileNames: 'shared/[name].js', dir: 'dist', entryFileNames: '[name]', @@ -153,14 +126,14 @@ export default async function ( onwarn, output: [ { - banner, + banner: getBanner, file: 'browser/dist/rollup.browser.js', format: 'umd', name: 'rollup', sourcemap: true }, { - banner, + banner: getBanner, file: 'browser/dist/es/rollup.browser.js', format: 'es', plugins: [emitModulePackageFile()] diff --git a/scripts/update-git-commit.js b/scripts/update-git-commit.js deleted file mode 100644 index 06a200e5cb6..00000000000 --- a/scripts/update-git-commit.js +++ /dev/null @@ -1,13 +0,0 @@ -import { execSync } from 'child_process'; -import { writeFileSync } from 'fs'; -import { dirname, join } from 'path'; -import { fileURLToPath } from 'url'; - -let revision; -try { - revision = execSync('git rev-parse HEAD').toString().trim(); -} catch (e) { - console.warn('Could not determine git commit when building Rollup.'); - revision = '(could not be determined)'; -} -writeFileSync(join(dirname(fileURLToPath(import.meta.url)), '../.commithash'), revision); From 8374509f045fdd2a5c5419f28e6baf5c49221f6a Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 22 Jul 2022 07:05:49 +0200 Subject: [PATCH 04/15] Remove execa --- package-lock.json | 1 - package.json | 1 - scripts/perf-init.js | 54 ++++++++++++++++++++++++-------------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index ab456df2db1..9ed66caff96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,6 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.2.1", - "execa": "^6.1.0", "fixturify": "^2.1.1", "fs-extra": "^10.1.0", "get-package-type": "^0.1.0", diff --git a/package.json b/package.json index 8b72b2be8d9..d1371062f95 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,6 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.2.1", - "execa": "^6.1.0", "fixturify": "^2.1.1", "fs-extra": "^10.1.0", "get-package-type": "^0.1.0", diff --git a/scripts/perf-init.js b/scripts/perf-init.js index 9f719110c00..351104739c9 100644 --- a/scripts/perf-init.js +++ b/scripts/perf-init.js @@ -1,10 +1,27 @@ /* eslint-disable no-console */ +import { spawn } from 'child_process'; import { fileURLToPath } from 'url'; -import { execa } from 'execa'; import fs from 'fs-extra'; import { findConfigFileName } from './find-config.js'; +const spawnPromise = (command, args) => { + return new Promise((resolve, reject) => { + const childProcess = spawn(command, args); + + childProcess.stdout.pipe(process.stdout); + childProcess.stderr.pipe(process.stderr); + + childProcess.on('close', code => { + if (code) { + reject(new Error(`"${[command, ...args].join(' ')}" exited with code ${code}.`)); + } else { + resolve(); + } + }); + }); +}; + const TARGET_DIR = fileURLToPath(new URL('../perf', import.meta.url).href); const VALID_REPO = /^([^/\s#]+\/[^/\s#]+)(#([^/\s#]+))?$/; const repoWithBranch = process.argv[2]; @@ -22,28 +39,15 @@ fs.removeSync(TARGET_DIR); const [, repo, , branch] = VALID_REPO.exec(repoWithBranch); -setupNewRepo(repo, branch).catch(error => { - console.error(error.message); - process.exit(1); -}); - -function execWithOutput(command, args) { - const call = execa(command, args); - call.stderr.pipe(process.stderr); - return call; -} - -async function setupNewRepo(repo, branch) { - const gitArgs = ['clone', '--depth', 1, '--progress']; - if (branch) { - console.error(`Cloning branch "${branch}" of "${repo}"...`); - gitArgs.push('--branch', branch); - } else { - console.error(`Cloning "${repo}"...`); - } - gitArgs.push(`https://github.com/${repo}.git`, TARGET_DIR); - await execWithOutput('git', gitArgs); - await findConfigFileName(TARGET_DIR); - process.chdir(TARGET_DIR); - await execWithOutput('npm', ['install']); +const gitArgs = ['clone', '--depth', 1, '--progress']; +if (branch) { + console.error(`Cloning branch "${branch}" of "${repo}"...`); + gitArgs.push('--branch', branch); +} else { + console.error(`Cloning "${repo}"...`); } +gitArgs.push(`https://github.com/${repo}.git`, TARGET_DIR); +await spawnPromise('git', gitArgs); +await findConfigFileName(TARGET_DIR); +process.chdir(TARGET_DIR); +await spawnPromise('npm', ['install']); From 66bff36318f59c68bc36b5e2bfed9458a3ee03f2 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 22 Jul 2022 07:17:21 +0200 Subject: [PATCH 05/15] Chmod executable from rollup config --- build-plugins/add-cli-entry.ts | 11 +++++++++-- package.json | 6 +++--- rollup.config.ts | 2 -- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build-plugins/add-cli-entry.ts b/build-plugins/add-cli-entry.ts index eb32e55acd5..fbc16150c6d 100644 --- a/build-plugins/add-cli-entry.ts +++ b/build-plugins/add-cli-entry.ts @@ -1,11 +1,15 @@ +import { chmod } from 'fs/promises'; +import { resolve } from 'path'; import MagicString from 'magic-string'; import type { Plugin } from 'rollup'; +const CLI_CHUNK = 'bin/rollup'; + export default function addCliEntry(): Plugin { return { buildStart() { this.emitFile({ - fileName: 'bin/rollup', + fileName: CLI_CHUNK, id: 'cli/cli.ts', preserveSignature: false, type: 'chunk' @@ -13,12 +17,15 @@ export default function addCliEntry(): Plugin { }, name: 'add-cli-entry', renderChunk(code, chunkInfo) { - if (chunkInfo.fileName === 'bin/rollup') { + if (chunkInfo.fileName === CLI_CHUNK) { const magicString = new MagicString(code); magicString.prepend('#!/usr/bin/env node\n\n'); return { code: magicString.toString(), map: magicString.generateMap({ hires: true }) }; } return null; + }, + writeBundle({ dir }) { + return chmod(resolve(dir!, CLI_CHUNK), '755'); } }; } diff --git a/package.json b/package.json index d1371062f95..afb20628623 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "rollup": "dist/bin/rollup" }, "scripts": { - "build": "rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", - "build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", - "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "build": "rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts", + "build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts", + "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts", "ci:lint": "npm run lint:nofix", "ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all", "ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only", diff --git a/rollup.config.ts b/rollup.config.ts index e2c66f15148..20ead5a930f 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -17,8 +17,6 @@ import getLicenseHandler from './build-plugins/generate-license-file'; import getBanner from './build-plugins/get-banner'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; -// TODO Lukas inline script to update the commit -// TODO Lukas inline chmod via fs.chmod // TODO Lukas copy types programmatically for both normal and browser build // TODO Lukas adapt "files" property // TODO Lukas script that cds into browser dir, updates version and runs publish with same flags as main publish From 36be14c6104336a7b140ca366e098bbc8d09b0fb Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 22 Jul 2022 14:27:03 +0200 Subject: [PATCH 06/15] Adjust pkg.files --- browser/package.json | 1 - package.json | 3 +-- rollup.config.ts | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/browser/package.json b/browser/package.json index 3a9a304a37f..05d311fc74c 100644 --- a/browser/package.json +++ b/browser/package.json @@ -22,7 +22,6 @@ "files": [ "dist/**/*.js", "dist/*.d.ts", - "dist/bin/rollup", "dist/es/package.json", "dist/rollup.browser.js.map" ], diff --git a/package.json b/package.json index afb20628623..a55bf734a4a 100644 --- a/package.json +++ b/package.json @@ -120,8 +120,7 @@ "dist/**/*.js", "dist/*.d.ts", "dist/bin/rollup", - "dist/es/package.json", - "dist/rollup.browser.js.map" + "dist/es/package.json" ], "engines": { "node": ">=14.0.0", diff --git a/rollup.config.ts b/rollup.config.ts index 20ead5a930f..42522d059ab 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -17,9 +17,9 @@ import getLicenseHandler from './build-plugins/generate-license-file'; import getBanner from './build-plugins/get-banner'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; -// TODO Lukas copy types programmatically for both normal and browser build -// TODO Lukas adapt "files" property +// TODO Lukas copy types programmatically for both normal and browser build by emitting them // TODO Lukas script that cds into browser dir, updates version and runs publish with same flags as main publish +// TODO Lukas adapt "files" property // TODO Lukas adapt REPL artefact const onwarn: WarningHandlerWithDefault = warning => { From 0668a7a6371d084c70f9c199ee9589c0215e0ad3 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 22 Jul 2022 14:50:26 +0200 Subject: [PATCH 07/15] Copy types into build --- build-plugins/copy-types.ts | 18 ++++++++++++++++++ package.json | 6 +++--- rollup.config.ts | 7 ++++--- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 build-plugins/copy-types.ts diff --git a/build-plugins/copy-types.ts b/build-plugins/copy-types.ts new file mode 100644 index 00000000000..b2956e2218f --- /dev/null +++ b/build-plugins/copy-types.ts @@ -0,0 +1,18 @@ +import { resolve } from 'path'; +import { readFile } from 'fs-extra'; +import type { Plugin } from 'rollup'; + +export default function copyTypes(fileName: string): Plugin { + return { + async generateBundle(_options, _bundle, isWrite) { + if (isWrite) { + this.emitFile({ + fileName, + source: await readFile(resolve('src/rollup/types.d.ts'), 'utf8'), + type: 'asset' + }); + } + }, + name: 'copy-types' + }; +} diff --git a/package.json b/package.json index a55bf734a4a..02fbb7cf48f 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "rollup": "dist/bin/rollup" }, "scripts": { - "build": "rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts", - "build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts", - "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts", + "build": "rollup --config rollup.config.ts --configPlugin typescript", + "build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest", + "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript", "ci:lint": "npm run lint:nofix", "ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all", "ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only", diff --git a/rollup.config.ts b/rollup.config.ts index 42522d059ab..e5938e1a8b4 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -11,17 +11,16 @@ import { terser } from 'rollup-plugin-terser'; import addCliEntry from './build-plugins/add-cli-entry'; import cleanBeforeWrite from './build-plugins/clean-before-write'; import conditionalFsEventsImport from './build-plugins/conditional-fsevents-import'; +import copyTypes from './build-plugins/copy-types'; import emitModulePackageFile from './build-plugins/emit-module-package-file'; import esmDynamicImport from './build-plugins/esm-dynamic-import'; import getLicenseHandler from './build-plugins/generate-license-file'; import getBanner from './build-plugins/get-banner'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; -// TODO Lukas copy types programmatically for both normal and browser build by emitting them // TODO Lukas script that cds into browser dir, updates version and runs publish with same flags as main publish // TODO Lukas adapt "files" property // TODO Lukas adapt REPL artefact - const onwarn: WarningHandlerWithDefault = warning => { // eslint-disable-next-line no-console console.error( @@ -93,7 +92,8 @@ export default async function ( ...nodePlugins, addCliEntry(), esmDynamicImport(), - !command.configTest && collectLicenses() + !command.configTest && collectLicenses(), + !command.configTest && copyTypes('rollup.d.ts') ], strictDeprecations: true, treeshake @@ -128,6 +128,7 @@ export default async function ( file: 'browser/dist/rollup.browser.js', format: 'umd', name: 'rollup', + plugins: [copyTypes('rollup.browser.d.ts')], sourcemap: true }, { From b440de3b9d9dc2045e2d58222abf10885126e5d7 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 25 Jul 2022 06:53:21 +0200 Subject: [PATCH 08/15] Work on release script --- .github/workflows/tests.yml | 2 +- package-lock.json | 1039 ++++++++++++++++++++++++++++++++--- package.json | 7 +- scripts/check-release.js | 9 + scripts/colors.js | 8 + scripts/find-config.js | 4 +- scripts/helpers.js | 45 ++ scripts/perf-init.js | 34 +- scripts/perf.js | 24 +- scripts/release.js | 55 ++ scripts/test-package.js | 2 +- scripts/update-snapshots.js | 6 +- 12 files changed, 1117 insertions(+), 118 deletions(-) create mode 100755 scripts/check-release.js create mode 100644 scripts/colors.js create mode 100644 scripts/helpers.js create mode 100644 scripts/release.js diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8dcc7430c55..b185827e0a0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: - name: Lint run: npm run ci:lint - name: Vulnerabilities - run: npm run security + run: npm audit - name: Run all tests run: npm run ci:test env: diff --git a/package-lock.json b/package-lock.json index 9ed66caff96..737387cb69b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,10 @@ "name": "rollup", "version": "3.0.0-2", "license": "MIT", + "dependencies": { + "inquirer": "^9.0.2", + "semver": "^7.3.7" + }, "bin": { "rollup": "dist/bin/rollup" }, @@ -1530,6 +1534,25 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -1539,6 +1562,16 @@ "node": ">=8" } }, + "node_modules/bl": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", + "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1643,6 +1676,29 @@ "sourcemap-codec": "^1.4.8" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -1737,6 +1793,11 @@ "node": ">=4" } }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -1785,6 +1846,17 @@ "node": ">=8" } }, + "node_modules/cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cli-truncate": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", @@ -1801,6 +1873,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-width": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.0.0.tgz", + "integrity": "sha512-ZksGS2xpa/bYkNzN3BAw1wEjsLV/ZKOf/CCrJ/QOBsxx6fOARIkwTutxp1XIOIohi6HKmOFjMoK/XaqDVUpEEw==", + "engines": { + "node": ">= 12" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -1841,6 +1921,14 @@ "node": ">=8" } }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -1991,6 +2079,14 @@ "node": ">=8" } }, + "node_modules/defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha512-s82itHOnYrN0Ib8r+z7laQz3sdE+4FP3d9Q7VLO7U+KRT+CR0GsWuyHxzdAY82I7cXv0G/twrqomTJLOssO5HA==", + "dependencies": { + "clone": "^1.0.2" + } + }, "node_modules/define-properties": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", @@ -2043,8 +2139,7 @@ "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" }, "node_modules/electron-to-chromium": { "version": "1.4.184", @@ -2055,8 +2150,7 @@ "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" }, "node_modules/ensure-posix-path": { "version": "1.1.1", @@ -2627,6 +2721,19 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2676,6 +2783,43 @@ "reusify": "^1.0.4" } }, + "node_modules/figures": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/figures/-/figures-4.0.1.tgz", + "integrity": "sha512-rElJwkA/xS04Vfg+CaZodpso7VqBknOYbzi6I76hI4X80RUjkSxO2oAyPmGbuXUppywjqndOrQDl817hDnI++w==", + "dependencies": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/figures/node_modules/is-unicode-supported": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz", + "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -3223,6 +3367,36 @@ "url": "https://github.com/sponsors/typicode" } }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", @@ -3279,8 +3453,171 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/inquirer": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.0.2.tgz", + "integrity": "sha512-AqmDHmz3bIe573OiM4svTZzajBzff1xpuzYAimW8gjzW5ncuPllWB8t/GKl+NSuKRJaKyIF2bU2RCx8H1dwqyQ==", + "dependencies": { + "ansi-escapes": "^5.0.0", + "chalk": "^5.0.1", + "cli-cursor": "^4.0.0", + "cli-width": "^4.0.0", + "external-editor": "^3.0.3", + "figures": "^4.0.1", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^6.1.2", + "run-async": "^2.4.0", + "rxjs": "^7.5.6", + "string-width": "^5.1.2", + "strip-ansi": "^7.0.1", + "through": "^2.3.6", + "wrap-ansi": "^8.0.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/inquirer/node_modules/ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "dependencies": { + "type-fest": "^1.0.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/ansi-styles": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.1.0.tgz", + "integrity": "sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/chalk": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", + "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/inquirer/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/strip-ansi": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", + "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/wrap-ansi": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.0.1.tgz", + "integrity": "sha512-QFF+ufAqhoYHvoHdajT/Po7KoXVBPXS2bgjIam5isfWJPfIOnQZ50JtUiVvCv/sjgacf3yRrt2ZKUZ/V4itN4g==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } }, "node_modules/internal-slot": { "version": "1.0.3", @@ -3429,6 +3766,17 @@ "node": ">=0.10.0" } }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -4043,8 +4391,7 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "node_modules/lodash.flattendeep": { "version": "4.4.0", @@ -4259,7 +4606,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -4622,6 +4968,11 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "node_modules/nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -5033,36 +5384,179 @@ "wrappy": "1" } }, - "node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/ora": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/ora/-/ora-6.1.2.tgz", + "integrity": "sha512-EJQ3NiP5Xo94wJXIzAyOtSb0QEIAUu7m8t6UZ9krbz0vAJqr92JpcK/lEXg91q6B9pEGqrykkd2EQplnifDSBw==", + "dependencies": { + "bl": "^5.0.0", + "chalk": "^5.0.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.6.1", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.1.0", + "log-symbols": "^5.1.0", + "strip-ansi": "^7.0.1", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", + "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ora/node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/is-unicode-supported": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz", + "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "dependencies": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/ora/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/strip-ansi": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", + "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", "dependencies": { - "mimic-fn": "^4.0.0" + "ansi-regex": "^6.0.1" }, "engines": { "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", "engines": { - "node": ">= 0.8.0" + "node": ">=0.10.0" } }, "node_modules/p-limit": { @@ -5431,6 +5925,19 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -5775,6 +6282,14 @@ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "dev": true }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -5799,10 +6314,9 @@ } }, "node_modules/rxjs": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz", - "integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==", - "dev": true, + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz", + "integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==", "dependencies": { "tslib": "^2.1.0" } @@ -5813,11 +6327,15 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "node_modules/semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -5924,8 +6442,7 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "node_modules/slash": { "version": "3.0.0", @@ -6080,6 +6597,33 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/string-argv": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", @@ -6093,7 +6637,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -6110,7 +6653,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, "engines": { "node": ">=12" }, @@ -6122,7 +6664,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", - "dev": true, "dependencies": { "ansi-regex": "^6.0.1" }, @@ -6283,8 +6824,7 @@ "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, "node_modules/time-zone": { "version": "2.0.0", @@ -6298,6 +6838,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -6355,8 +6906,7 @@ "node_modules/tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "dev": true + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -6524,6 +7074,11 @@ "punycode": "^2.1.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -6554,6 +7109,14 @@ "node": "8.* || >= 10.*" } }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dependencies": { + "defaults": "^1.0.3" + } + }, "node_modules/weak-napi": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/weak-napi/-/weak-napi-2.0.2.tgz", @@ -6727,8 +7290,7 @@ "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yaml": { "version": "2.1.1", @@ -7955,12 +8517,27 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bl": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", + "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", + "requires": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -8037,6 +8614,15 @@ } } }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -8100,6 +8686,11 @@ "supports-color": "^5.3.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -8131,6 +8722,11 @@ "restore-cursor": "^3.1.0" } }, + "cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==" + }, "cli-truncate": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", @@ -8141,6 +8737,11 @@ "string-width": "^5.0.0" } }, + "cli-width": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.0.0.tgz", + "integrity": "sha512-ZksGS2xpa/bYkNzN3BAw1wEjsLV/ZKOf/CCrJ/QOBsxx6fOARIkwTutxp1XIOIohi6HKmOFjMoK/XaqDVUpEEw==" + }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -8177,6 +8778,11 @@ } } }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==" + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -8293,6 +8899,14 @@ "strip-bom": "^4.0.0" } }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha512-s82itHOnYrN0Ib8r+z7laQz3sdE+4FP3d9Q7VLO7U+KRT+CR0GsWuyHxzdAY82I7cXv0G/twrqomTJLOssO5HA==", + "requires": { + "clone": "^1.0.2" + } + }, "define-properties": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", @@ -8330,8 +8944,7 @@ "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" }, "electron-to-chromium": { "version": "1.4.184", @@ -8342,8 +8955,7 @@ "emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" }, "ensure-posix-path": { "version": "1.1.1", @@ -8781,6 +9393,16 @@ "strip-final-newline": "^3.0.0" } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -8827,6 +9449,27 @@ "reusify": "^1.0.4" } }, + "figures": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/figures/-/figures-4.0.1.tgz", + "integrity": "sha512-rElJwkA/xS04Vfg+CaZodpso7VqBknOYbzi6I76hI4X80RUjkSxO2oAyPmGbuXUppywjqndOrQDl817hDnI++w==", + "requires": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==" + }, + "is-unicode-supported": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz", + "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ==" + } + } + }, "file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -9213,6 +9856,19 @@ "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", "dev": true }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, "ignore": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", @@ -9254,8 +9910,107 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "inquirer": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.0.2.tgz", + "integrity": "sha512-AqmDHmz3bIe573OiM4svTZzajBzff1xpuzYAimW8gjzW5ncuPllWB8t/GKl+NSuKRJaKyIF2bU2RCx8H1dwqyQ==", + "requires": { + "ansi-escapes": "^5.0.0", + "chalk": "^5.0.1", + "cli-cursor": "^4.0.0", + "cli-width": "^4.0.0", + "external-editor": "^3.0.3", + "figures": "^4.0.1", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^6.1.2", + "run-async": "^2.4.0", + "rxjs": "^7.5.6", + "string-width": "^5.1.2", + "strip-ansi": "^7.0.1", + "through": "^2.3.6", + "wrap-ansi": "^8.0.1" + }, + "dependencies": { + "ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "requires": { + "type-fest": "^1.0.2" + } + }, + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==" + }, + "ansi-styles": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.1.0.tgz", + "integrity": "sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==" + }, + "chalk": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", + "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==" + }, + "cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "requires": { + "restore-cursor": "^4.0.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "strip-ansi": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", + "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==" + }, + "wrap-ansi": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.0.1.tgz", + "integrity": "sha512-QFF+ufAqhoYHvoHdajT/Po7KoXVBPXS2bgjIam5isfWJPfIOnQZ50JtUiVvCv/sjgacf3yRrt2ZKUZ/V4itN4g==", + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } }, "internal-slot": { "version": "1.0.3", @@ -9356,6 +10111,11 @@ "is-extglob": "^2.1.1" } }, + "is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==" + }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -9810,8 +10570,7 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash.flattendeep": { "version": "4.4.0", @@ -9973,7 +10732,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "requires": { "yallist": "^4.0.0" } @@ -10234,6 +10992,11 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -10568,6 +11331,91 @@ "word-wrap": "^1.2.3" } }, + "ora": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/ora/-/ora-6.1.2.tgz", + "integrity": "sha512-EJQ3NiP5Xo94wJXIzAyOtSb0QEIAUu7m8t6UZ9krbz0vAJqr92JpcK/lEXg91q6B9pEGqrykkd2EQplnifDSBw==", + "requires": { + "bl": "^5.0.0", + "chalk": "^5.0.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.6.1", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.1.0", + "log-symbols": "^5.1.0", + "strip-ansi": "^7.0.1", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==" + }, + "chalk": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", + "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==" + }, + "cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "requires": { + "restore-cursor": "^4.0.0" + } + }, + "is-unicode-supported": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz", + "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ==" + }, + "log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "requires": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "strip-ansi": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", + "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==" + }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -10808,6 +11656,16 @@ "safe-buffer": "^5.1.0" } }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, "readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -11068,6 +11926,11 @@ } } }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -11078,10 +11941,9 @@ } }, "rxjs": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz", - "integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==", - "dev": true, + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz", + "integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==", "requires": { "tslib": "^2.1.0" } @@ -11092,11 +11954,15 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, "requires": { "lru-cache": "^6.0.0" } @@ -11176,8 +12042,7 @@ "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "slash": { "version": "3.0.0", @@ -11312,6 +12177,21 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } + } + }, "string-argv": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", @@ -11322,7 +12202,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, "requires": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -11332,14 +12211,12 @@ "ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==" }, "strip-ansi": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", - "dev": true, "requires": { "ansi-regex": "^6.0.1" } @@ -11456,8 +12333,7 @@ "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, "time-zone": { "version": "2.0.0", @@ -11465,6 +12341,14 @@ "integrity": "sha512-2cp/YLRm7ly33CzvySyXqo/QEOu4KMn6fCof0gpqosWY3PEJUJJhXP/Cb2wXFUuCzWWJYEmPvdHNzjLlfXC49A==", "dev": true }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -11512,8 +12396,7 @@ "tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "dev": true + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "tsutils": { "version": "3.21.0", @@ -11627,6 +12510,11 @@ "punycode": "^2.1.0" } }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -11651,6 +12539,14 @@ "minimatch": "^3.0.4" } }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "requires": { + "defaults": "^1.0.3" + } + }, "weak-napi": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/weak-napi/-/weak-napi-2.0.2.tgz", @@ -11789,8 +12685,7 @@ "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "yaml": { "version": "2.1.1", diff --git a/package.json b/package.json index 02fbb7cf48f..c072293e8e2 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,7 @@ "perf:init": "node scripts/perf-init.js", "postpublish": "git push && git push --tags", "prepare": "husky install && npm run build", - "prepublishOnly": "git pull --ff-only && npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all", - "security": "npm audit", + "prepublishOnly": "scripts/check-release.js", "test": "npm run build && npm run test:all", "test:cjs": "npm run build:cjs && npm run test:only", "test:quick": "mocha -b test/test.js", @@ -135,5 +134,9 @@ "./loadConfigFile": "./dist/loadConfigFile.js", "./dist/loadConfigFile": "./dist/loadConfigFile.js", "./dist/*": "./dist/*" + }, + "dependencies": { + "inquirer": "^9.0.2", + "semver": "^7.3.7" } } diff --git a/scripts/check-release.js b/scripts/check-release.js new file mode 100755 index 00000000000..fb22e5d40ac --- /dev/null +++ b/scripts/check-release.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node + +import { env, exit } from 'node:process'; +import { red } from './colors.js'; + +if (env.ROLLUP_RELEASE !== 'releasing') { + console.error(red`Do not call "npm publish" directly but rather run "scripts/release.js".`); + exit(1); +} diff --git a/scripts/colors.js b/scripts/colors.js new file mode 100644 index 00000000000..6713d2ff96d --- /dev/null +++ b/scripts/colors.js @@ -0,0 +1,8 @@ +import { env } from 'node:process'; +import { createColors } from 'colorette'; + +// @see https://no-color.org +// @see https://www.npmjs.com/package/chalk +export const { bold, cyan, green, red } = createColors({ + useColor: env.FORCE_COLOR !== '0' && !env.NO_COLOR +}); diff --git a/scripts/find-config.js b/scripts/find-config.js index eba93586b43..023529ac115 100644 --- a/scripts/find-config.js +++ b/scripts/find-config.js @@ -1,5 +1,5 @@ -import { promises as fs } from 'fs'; -import { resolve } from 'path'; +import { promises as fs } from 'node:fs'; +import { resolve } from 'node:path'; export async function findConfigFileName(targetDir) { const filesInWorkingDir = new Set(await fs.readdir(targetDir)); diff --git a/scripts/helpers.js b/scripts/helpers.js new file mode 100644 index 00000000000..1990bb9c334 --- /dev/null +++ b/scripts/helpers.js @@ -0,0 +1,45 @@ +import { spawn } from 'node:child_process'; +import { bold, cyan, green } from './colors.js'; + +export function runWithEcho(command, args) { + return new Promise((resolve, reject) => { + const cmdString = formatCommand(command, args); + console.error(bold(`\n${cyan`Run>`} ${cmdString}`)); + + const childProcess = spawn(command, args); + + childProcess.stdout.pipe(process.stdout); + childProcess.stderr.pipe(process.stderr); + + childProcess.on('close', code => { + if (code) { + reject(new Error(`"${cmdString}" exited with code ${code}.`)); + } else { + console.error(bold(`\n${green`Finished>`} ${cmdString}\n`)); + resolve(); + } + }); + }); +} + +export function runAndGetStdout(command, args) { + return new Promise((resolve, reject) => { + const childProcess = spawn(command, args); + let stdout = ''; + + childProcess.stderr.pipe(process.stderr); + childProcess.stdout.on('data', data => (stdout += String(data))); + + childProcess.on('close', code => { + if (code) { + reject(new Error(`"${formatCommand(command, args)}" exited with code ${code}.`)); + } else { + resolve(stdout.trim()); + } + }); + }); +} + +function formatCommand(command, args) { + return [command, ...args].join(' '); +} diff --git a/scripts/perf-init.js b/scripts/perf-init.js index 351104739c9..22e930eb4c4 100644 --- a/scripts/perf-init.js +++ b/scripts/perf-init.js @@ -1,37 +1,21 @@ /* eslint-disable no-console */ -import { spawn } from 'child_process'; -import { fileURLToPath } from 'url'; +import { argv, chdir, exit } from 'node:process'; +import { fileURLToPath } from 'node:url'; import fs from 'fs-extra'; import { findConfigFileName } from './find-config.js'; - -const spawnPromise = (command, args) => { - return new Promise((resolve, reject) => { - const childProcess = spawn(command, args); - - childProcess.stdout.pipe(process.stdout); - childProcess.stderr.pipe(process.stderr); - - childProcess.on('close', code => { - if (code) { - reject(new Error(`"${[command, ...args].join(' ')}" exited with code ${code}.`)); - } else { - resolve(); - } - }); - }); -}; +import { runWithEcho } from './helpers.js'; const TARGET_DIR = fileURLToPath(new URL('../perf', import.meta.url).href); const VALID_REPO = /^([^/\s#]+\/[^/\s#]+)(#([^/\s#]+))?$/; -const repoWithBranch = process.argv[2]; +const repoWithBranch = argv[2]; -if (process.argv.length !== 3 || !VALID_REPO.test(repoWithBranch)) { +if (argv.length !== 3 || !VALID_REPO.test(repoWithBranch)) { console.error( 'You need to provide a GitHub repo in the form / or /#branch, e.g. ' + '"npm run perf:init rollup/rollup"' ); - process.exit(1); + exit(1); } console.error(`Cleaning up '${TARGET_DIR}'...`); @@ -47,7 +31,7 @@ if (branch) { console.error(`Cloning "${repo}"...`); } gitArgs.push(`https://github.com/${repo}.git`, TARGET_DIR); -await spawnPromise('git', gitArgs); +await runWithEcho('git', gitArgs); await findConfigFileName(TARGET_DIR); -process.chdir(TARGET_DIR); -await spawnPromise('npm', ['install']); +chdir(TARGET_DIR); +await runWithEcho('npm', ['install']); diff --git a/scripts/perf.js b/scripts/perf.js index 989588efbe0..fc6491235ae 100644 --- a/scripts/perf.js +++ b/scripts/perf.js @@ -1,9 +1,9 @@ /* eslint-disable import/no-unresolved */ /* global gc */ -import { readFileSync, writeFileSync } from 'fs'; -import { cwd } from 'process'; -import { fileURLToPath } from 'url'; +import { readFileSync, writeFileSync } from 'node:fs'; +import { argv, chdir, cwd, exit } from 'node:process'; +import { fileURLToPath } from 'node:url'; import { createColors } from 'colorette'; import prettyBytes from 'pretty-bytes'; import loadConfigFile from '../dist/loadConfigFile.js'; @@ -17,7 +17,7 @@ const { bold, underline, cyan, red, green } = createColors(); const MIN_ABSOLUTE_TIME_DEVIATION = 10; const RELATIVE_DEVIATION_FOR_COLORING = 5; -process.chdir(targetDir); +chdir(targetDir); const configFile = await findConfigFileName(targetDir); const configs = await loadConfigFile( configFile, @@ -26,10 +26,10 @@ const configs = await loadConfigFile( let numberOfRunsToAverage = 6; let numberOfDiscardedResults = 3; -if (process.argv.length >= 3) { - numberOfRunsToAverage = Number.parseInt(process.argv[2]); - if (process.argv.length >= 4) { - numberOfDiscardedResults = Number.parseInt(process.argv[3]); +if (argv.length >= 3) { + numberOfRunsToAverage = Number.parseInt(argv[2]); + if (argv.length >= 4) { + numberOfDiscardedResults = Number.parseInt(argv[3]); } } if (!(numberOfDiscardedResults >= 0) || !(numberOfDiscardedResults < numberOfRunsToAverage)) { @@ -38,7 +38,7 @@ if (!(numberOfDiscardedResults >= 0) || !(numberOfDiscardedResults < numberOfRun 'Usage: "npm run perf [ []]"\n' + 'where 0 <= < ' ); - process.exit(1); + exit(1); } console.info( bold( @@ -114,9 +114,9 @@ async function buildAndGetTimings(config) { config.output = config.output[0]; } gc(); - process.chdir(targetDir); + chdir(targetDir); const bundle = await rollup(config); - process.chdir(initialDir); + chdir(initialDir); await bundle.generate(config.output); return bundle.getTimings(); } @@ -169,7 +169,7 @@ function persistTimings(timings) { console.info(bold(`Saving performance information to new reference file ${cyan(perfFile)}.`)); } catch (e) { console.error(bold(`Could not persist performance information in ${cyan(perfFile)}.`)); - process.exit(1); + exit(1); } } diff --git a/scripts/release.js b/scripts/release.js new file mode 100644 index 00000000000..8c9fd2ca0e4 --- /dev/null +++ b/scripts/release.js @@ -0,0 +1,55 @@ +#!/usr/bin/env node + +// git pull --ff-only && npm ci && npm run lint:nofix && npm audit && npm run build:bootstrap && npm run test:all + +import fs from 'fs-extra'; +import inquirer from 'inquirer'; +import semverInc from 'semver/functions/inc.js'; +import semverPreRelease from 'semver/functions/prerelease.js'; +import { runAndGetStdout } from './helpers.js'; + +const MAIN_BRANCH = 'master'; +const MAIN_INCREMENTS = ['patch', 'minor']; +const BRANCH_INCREMENTS = ['premajor', 'preminor', 'prepatch']; +const PRE_RELEASE_INCREMENTS = ['prerelease']; + +// TODO Lukas enable +// await runWithEcho('git', ['pull', '--ff-only']); + +const [pkg, currentBranch] = await Promise.all([ + fs.readFile(new URL('../package.json', import.meta.url), 'utf8').then(JSON.parse), + runAndGetStdout('git', ['branch', '--show-current']) +]); +const { version } = pkg; +const isPreRelease = !!semverPreRelease(version); +const isMainBranch = currentBranch === MAIN_BRANCH; + +const availableIncrements = isMainBranch + ? MAIN_INCREMENTS + : isPreRelease + ? PRE_RELEASE_INCREMENTS + : BRANCH_INCREMENTS; + +const { newVersion } = await inquirer.prompt([ + { + choices: availableIncrements.map(increment => { + const value = semverInc(version, increment); + return { + name: `${increment} (${value})`, + short: increment, + value + }; + }), + message: `Select type of release (currently "${version}" on branch "${currentBranch}"):`, + name: 'newVersion', + type: 'list' + } +]); + +// TODO Lukas enable +// await Promise.all([runWithEcho('npm', ['ci']), runWithEcho('npm', ['audit'])]); +// await Promise.all([ +// runWithEcho('npm', ['run', 'lint:nofix']), +// runWithEcho('npm', ['run', 'build:bootstrap']) +// ]); +// await runWithEcho('npm', ['run', 'test:all']); diff --git a/scripts/test-package.js b/scripts/test-package.js index bc63ffaadc8..fbd98106389 100644 --- a/scripts/test-package.js +++ b/scripts/test-package.js @@ -1,4 +1,4 @@ -import { readFile } from 'fs/promises'; +import { readFile } from 'node:fs/promises'; const pkg = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')); const chokidarPkg = JSON.parse( diff --git a/scripts/update-snapshots.js b/scripts/update-snapshots.js index fda68a2b21c..936bd7d3bcd 100755 --- a/scripts/update-snapshots.js +++ b/scripts/update-snapshots.js @@ -1,8 +1,8 @@ #!/usr/bin/env node -import { readdirSync } from 'fs'; -import { dirname, join, resolve } from 'path'; -import { fileURLToPath } from 'url'; +import { readdirSync } from 'node:fs'; +import { dirname, join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; import fs from 'fs-extra'; const basePath = resolve(dirname(fileURLToPath(import.meta.url)), '../test'); From ac3e55fe8b794f1f5b5b5967c396d5db93067f2a Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 25 Jul 2022 14:57:50 +0200 Subject: [PATCH 09/15] Continue work on release script --- package.json | 3 +- scripts/check-release.js | 2 -- scripts/helpers.js | 6 ++-- scripts/release.js | 75 ++++++++++++++++++++++++++++++++++++++-- 4 files changed, 77 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index c072293e8e2..3a692bc054f 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,7 @@ "lint:markdown": "prettier --write \"**/*.md\"", "perf": "npm run build:cjs && node --expose-gc scripts/perf.js", "perf:init": "node scripts/perf-init.js", - "postpublish": "git push && git push --tags", - "prepare": "husky install && npm run build", + "prepare": "husky install && scripts/check-release.js || npm run build", "prepublishOnly": "scripts/check-release.js", "test": "npm run build && npm run test:all", "test:cjs": "npm run build:cjs && npm run test:only", diff --git a/scripts/check-release.js b/scripts/check-release.js index fb22e5d40ac..165633c6f1f 100755 --- a/scripts/check-release.js +++ b/scripts/check-release.js @@ -1,9 +1,7 @@ #!/usr/bin/env node import { env, exit } from 'node:process'; -import { red } from './colors.js'; if (env.ROLLUP_RELEASE !== 'releasing') { - console.error(red`Do not call "npm publish" directly but rather run "scripts/release.js".`); exit(1); } diff --git a/scripts/helpers.js b/scripts/helpers.js index 1990bb9c334..4d47b87dfe5 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -1,12 +1,12 @@ import { spawn } from 'node:child_process'; import { bold, cyan, green } from './colors.js'; -export function runWithEcho(command, args) { +export function runWithEcho(command, args, options) { return new Promise((resolve, reject) => { const cmdString = formatCommand(command, args); console.error(bold(`\n${cyan`Run>`} ${cmdString}`)); - const childProcess = spawn(command, args); + const childProcess = spawn(command, args, options); childProcess.stdout.pipe(process.stdout); childProcess.stderr.pipe(process.stderr); @@ -15,7 +15,7 @@ export function runWithEcho(command, args) { if (code) { reject(new Error(`"${cmdString}" exited with code ${code}.`)); } else { - console.error(bold(`\n${green`Finished>`} ${cmdString}\n`)); + console.error(bold(`${green`Finished>`} ${cmdString}\n`)); resolve(); } }); diff --git a/scripts/release.js b/scripts/release.js index 8c9fd2ca0e4..a1ce99799cc 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -2,22 +2,32 @@ // git pull --ff-only && npm ci && npm run lint:nofix && npm audit && npm run build:bootstrap && npm run test:all +import { fileURLToPath } from 'node:url'; +import { chdir, exit } from 'process'; import fs from 'fs-extra'; import inquirer from 'inquirer'; import semverInc from 'semver/functions/inc.js'; import semverPreRelease from 'semver/functions/prerelease.js'; -import { runAndGetStdout } from './helpers.js'; +import { runAndGetStdout, runWithEcho } from './helpers.js'; +// TODO Lukas extract functions to structure const MAIN_BRANCH = 'master'; const MAIN_INCREMENTS = ['patch', 'minor']; const BRANCH_INCREMENTS = ['premajor', 'preminor', 'prepatch']; const PRE_RELEASE_INCREMENTS = ['prerelease']; +// We execute everything from the main directory +chdir(fileURLToPath(new URL('..', import.meta.url))); + +const MAIN_PKG = 'package.json'; +const BROWSER_PKG = 'browser/package.json'; +const CHANGELOG = 'CHANGELOG.md'; + // TODO Lukas enable // await runWithEcho('git', ['pull', '--ff-only']); const [pkg, currentBranch] = await Promise.all([ - fs.readFile(new URL('../package.json', import.meta.url), 'utf8').then(JSON.parse), + readJson(MAIN_PKG), runAndGetStdout('git', ['branch', '--show-current']) ]); const { version } = pkg; @@ -46,6 +56,14 @@ const { newVersion } = await inquirer.prompt([ } ]); +// Find version in changelog +const changelog = await fs.readFile(CHANGELOG, 'utf8'); +const x = getFirstChangelogEnry(changelog); + +console.log(x); +exit(); + +// Install dependencies, build and run tests // TODO Lukas enable // await Promise.all([runWithEcho('npm', ['ci']), runWithEcho('npm', ['audit'])]); // await Promise.all([ @@ -53,3 +71,56 @@ const { newVersion } = await inquirer.prompt([ // runWithEcho('npm', ['run', 'build:bootstrap']) // ]); // await runWithEcho('npm', ['run', 'test:all']); + +// TODO Lukas enable +// const browserPkg = await readJson(BROWSER_PKG); +// await Promise.all([ +// fs.writeFile(MAIN_PKG, getPkgStringWithVersion(pkg, newVersion)), +// fs.writeFile(BROWSER_PKG, getPkgStringWithVersion(browserPkg, newVersion)) +// ]); + +// Commit changes +const gitTag = `v${newVersion}`; +// TODO Lukas enable +// await runWithEcho('git', ['add', MAIN_PKG, BROWSER_PKG]); +// await runWithEcho('git', ['commit', '-m', newVersion]); +// await runWithEcho('git', ['tag', gitTag]); + +// Release +const releaseEnv = { ...process.env, ROLLUP_RELEASE: 'releasing' }; +const releaseTag = isPreRelease ? ['--tag', 'beta'] : []; +await Promise.all([ + runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { + cwd: new URL('..', import.meta.url), + env: releaseEnv + }), + runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { + cwd: new URL('../browser', import.meta.url), + env: releaseEnv + }) +]); + +// Push changes +await Promise.all([ + runWithEcho('git', ['push', 'origin', 'HEAD']), + runWithEcho('git', ['push', 'origin', gitTag]) +]); + +async function readJson(file) { + const content = await fs.readFile(file, 'utf8'); + return JSON.parse(content); +} + +function getPkgStringWithVersion(pkg, version) { + return JSON.stringify({ ...pkg, version }, null, 2) + '\n'; +} + +function getFirstChangelogEnry(changelog) { + const match = changelog.match(/## (\d+\.\d+\.\d+)[\s\S]*?(?=\s## )/); + if (!match) { + throw new Error('Could not detect any changelog entry.'); + } + const [entry, version] = match; + const { index } = match; + return { entry, index, version }; +} From d144c4168aa14a3bf10b104616796be39f7f7665 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 26 Jul 2022 07:15:26 +0200 Subject: [PATCH 10/15] Continue work on release script --- scripts/release.js | 118 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 112 insertions(+), 6 deletions(-) diff --git a/scripts/release.js b/scripts/release.js index a1ce99799cc..090a82945ed 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -7,6 +7,7 @@ import { chdir, exit } from 'process'; import fs from 'fs-extra'; import inquirer from 'inquirer'; import semverInc from 'semver/functions/inc.js'; +import semverParse from 'semver/functions/parse.js'; import semverPreRelease from 'semver/functions/prerelease.js'; import { runAndGetStdout, runWithEcho } from './helpers.js'; @@ -57,10 +58,61 @@ const { newVersion } = await inquirer.prompt([ ]); // Find version in changelog + +// read log +// (*) text missing ? +// - create text +// - Ask to edit file +// - Confirm when done +// - Read log again +// print text +// confirm? +// read text again +// did not change? break +// Otherwise (*) const changelog = await fs.readFile(CHANGELOG, 'utf8'); -const x = getFirstChangelogEnry(changelog); +const { currentVersion, index, previousVersion, text } = getFirstChangelogEnry(changelog); +do { + if (currentVersion !== newVersion) { + const updatedLog = + changelog.slice(0, index) + + `## ${newVersion} + +_${new Date().toISOString().slice(0, 10)}_ + +### Features + +- Introduce \`maxParallelFileOps\` to limit both read and write operations, default to 20 and replaces \`maxParallelFileRead\` (#4570) + +### Bug Fixes + +- Avoid including variables referenced from return statements that are never reached (#4573) -console.log(x); +### Pull Requests + +- [#4570](https://github.com/rollup/rollup/pull/4570): Introduce maxParallelFileOps to limit parallel writes (@lukastaegert) +- [#4572](https://github.com/rollup/rollup/pull/4572): Document more ways to read package.json in ESM (@berniegp) +- [#4573](https://github.com/rollup/rollup/pull/4573): Do not include unused return expressions (@lukastaegert) +`; + } + const changelog = await fs.readFile(CHANGELOG, 'utf8'); + const { currentVersion, index, previousVersion, text } = getFirstChangelogEnry(changelog); + + // console.log(bold(cyan`New changelog entry:`)); + let entryText = ''; + if (currentVersion === newVersion) { + entryText = text; + const result = await inquirer.prompt([ + { + message: `Confirm changelog and release "${newVersion}"? (otherwise edit the changelog and select "n")`, + name: 'continue', + type: 'confirm' + } + ]); + console.log(result); + } + break; +} while (true); exit(); // Install dependencies, build and run tests @@ -116,11 +168,65 @@ function getPkgStringWithVersion(pkg, version) { } function getFirstChangelogEnry(changelog) { - const match = changelog.match(/## (\d+\.\d+\.\d+)[\s\S]*?(?=\s## )/); + const match = changelog.match( + /(?## (?\d+\.\d+\.\d+)[\s\S]*?)\n+## (?\d+\.\d+\.\d+)/ + ); if (!match) { throw new Error('Could not detect any changelog entry.'); } - const [entry, version] = match; - const { index } = match; - return { entry, index, version }; + const { + groups: { text, currentVersion, previousVersion }, + index + } = match; + return { currentVersion, index, previousVersion, text }; +} + +function getNewLogEntry(version, prs) { + if (prs.length === 0) { + throw new Error(`Release does not contain any PRs`); + } + const firstPr = prs[0].pr; + const date = new Date().toISOString().slice(0, 10); + const { minor, patch } = semverParse(version); + let sections = getDummyLogSection('Bug Fixes', firstPr); + if (patch === 0) { + sections = getDummyLogSection('Features', firstPr) + sections; + if (minor === 0) { + sections = getDummyLogSection('Breaking Changes', firstPr) + sections; + } + } + return `## ${version} + +_${date}_ + +${sections}### Pull Requests + +${prs.map( + ({ text, pr }) => + `- [#${pr}](https://github.com/rollup/rollup/pull/${pr}): ${text} (@lukastaegert)\n` +)}`; +} + +function getDummyLogSection(headline, pr) { + return `### ${headline} + +- (#${pr}) + +`; +} + +async function getIncludedPRs(previousVersion) { + const commits = await runAndGetStdout('git', [ + '--no-pager', + 'log', + `v${previousVersion}..HEAD`, + '--pretty=tformat:%s' + ]); + const getPrRegExp = /^([^(]+)\s\(#(\d+)\)$/gm; + const prs = []; + let match; + while ((match = getPrRegExp.exec(commits))) { + prs.push({ pr: match[2], text: match[1] }); + } + return prs; } From 5ad4c1fc75f448c4c0e61d6b0acb66ca725062a7 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Thu, 28 Jul 2022 15:24:34 +0200 Subject: [PATCH 11/15] Finish release script --- package-lock.json | 111 ++++++++++++++ package.json | 2 + scripts/release.js | 368 ++++++++++++++++++++++++++------------------- 3 files changed, 324 insertions(+), 157 deletions(-) mode change 100644 => 100755 scripts/release.js diff --git a/package-lock.json b/package-lock.json index 737387cb69b..efa85d88270 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "3.0.0-2", "license": "MIT", "dependencies": { + "github-api": "^3.4.0", "inquirer": "^9.0.2", "semver": "^7.3.7" }, @@ -1528,6 +1529,14 @@ "node": ">=8" } }, + "node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2950,6 +2959,25 @@ "integrity": "sha512-0sQoMh9s0BYsm+12Huy/rkKxVu4R1+r96YX5cG44rHV0pQ6iC3Q+mkoMFaGWObMFYQxCVT+ssG1ksneA2MI9KQ==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -3139,6 +3167,30 @@ "get-symbol-from-current-process-h": "^1.0.1" } }, + "node_modules/github-api": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/github-api/-/github-api-3.4.0.tgz", + "integrity": "sha512-2yYqYS6Uy4br1nw0D3VrlYWxtGTkUhIZrumBrcBwKdBOzMT8roAe8IvI6kjIOkxqxapKR5GkEsHtz3Du/voOpA==", + "dependencies": { + "axios": "^0.21.1", + "debug": "^2.2.0", + "js-base64": "^2.1.9", + "utf8": "^2.1.1" + } + }, + "node_modules/github-api/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/github-api/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -4132,6 +4184,11 @@ "node": ">=8" } }, + "node_modules/js-base64": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", + "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -7074,6 +7131,11 @@ "punycode": "^2.1.0" } }, + "node_modules/utf8": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", + "integrity": "sha512-QXo+O/QkLP/x1nyi54uQiG0XrODxdysuQvE5dtVqv7F5K2Qb6FsN+qbr6KhF5wQ20tfcV3VQp0/2x1e1MRSPWg==" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -8511,6 +8573,14 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, + "axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "requires": { + "follow-redirects": "^1.14.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -9572,6 +9642,11 @@ "integrity": "sha512-0sQoMh9s0BYsm+12Huy/rkKxVu4R1+r96YX5cG44rHV0pQ6iC3Q+mkoMFaGWObMFYQxCVT+ssG1ksneA2MI9KQ==", "dev": true }, + "follow-redirects": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" + }, "foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -9701,6 +9776,32 @@ "get-symbol-from-current-process-h": "^1.0.1" } }, + "github-api": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/github-api/-/github-api-3.4.0.tgz", + "integrity": "sha512-2yYqYS6Uy4br1nw0D3VrlYWxtGTkUhIZrumBrcBwKdBOzMT8roAe8IvI6kjIOkxqxapKR5GkEsHtz3Du/voOpA==", + "requires": { + "axios": "^0.21.1", + "debug": "^2.2.0", + "js-base64": "^2.1.9", + "utf8": "^2.1.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + } + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -10379,6 +10480,11 @@ } } }, + "js-base64": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", + "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -12510,6 +12616,11 @@ "punycode": "^2.1.0" } }, + "utf8": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", + "integrity": "sha512-QXo+O/QkLP/x1nyi54uQiG0XrODxdysuQvE5dtVqv7F5K2Qb6FsN+qbr6KhF5wQ20tfcV3VQp0/2x1e1MRSPWg==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 3a692bc054f..60abf839a11 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "perf:init": "node scripts/perf-init.js", "prepare": "husky install && scripts/check-release.js || npm run build", "prepublishOnly": "scripts/check-release.js", + "release": "node scripts/release.js", "test": "npm run build && npm run test:all", "test:cjs": "npm run build:cjs && npm run test:only", "test:quick": "mocha -b test/test.js", @@ -135,6 +136,7 @@ "./dist/*": "./dist/*" }, "dependencies": { + "github-api": "^3.4.0", "inquirer": "^9.0.2", "semver": "^7.3.7" } diff --git a/scripts/release.js b/scripts/release.js old mode 100644 new mode 100755 index 090a82945ed..b806269b830 --- a/scripts/release.js +++ b/scripts/release.js @@ -1,173 +1,120 @@ #!/usr/bin/env node -// git pull --ff-only && npm ci && npm run lint:nofix && npm audit && npm run build:bootstrap && npm run test:all - +import { readFile, writeFile } from 'fs/promises'; import { fileURLToPath } from 'node:url'; import { chdir, exit } from 'process'; -import fs from 'fs-extra'; +import GitHub from 'github-api'; import inquirer from 'inquirer'; import semverInc from 'semver/functions/inc.js'; import semverParse from 'semver/functions/parse.js'; import semverPreRelease from 'semver/functions/prerelease.js'; +import { cyan, red } from './colors.js'; import { runAndGetStdout, runWithEcho } from './helpers.js'; -// TODO Lukas extract functions to structure -const MAIN_BRANCH = 'master'; -const MAIN_INCREMENTS = ['patch', 'minor']; -const BRANCH_INCREMENTS = ['premajor', 'preminor', 'prepatch']; -const PRE_RELEASE_INCREMENTS = ['prerelease']; - // We execute everything from the main directory chdir(fileURLToPath(new URL('..', import.meta.url))); +const MAIN_BRANCH = 'master'; const MAIN_PKG = 'package.json'; const BROWSER_PKG = 'browser/package.json'; const CHANGELOG = 'CHANGELOG.md'; -// TODO Lukas enable -// await runWithEcho('git', ['pull', '--ff-only']); - -const [pkg, currentBranch] = await Promise.all([ +const [gh] = await Promise.all([getGithubApi(), runWithEcho('git', ['pull', '--ff-only'])]); +const [pkg, browserPkg, currentBranch, repo] = await Promise.all([ readJson(MAIN_PKG), - runAndGetStdout('git', ['branch', '--show-current']) + readJson(BROWSER_PKG), + runAndGetStdout('git', ['branch', '--show-current']), + gh.getRepo('rollup', 'rollup') ]); -const { version } = pkg; -const isPreRelease = !!semverPreRelease(version); const isMainBranch = currentBranch === MAIN_BRANCH; +const newVersion = await getNewVersion(pkg, isMainBranch); +if (isMainBranch) { + await addStubChangelogEntry(newVersion); +} +await installDependenciesBuildAndTest(); +const changelogEntry = isMainBranch ? await waitForChangelogUpdate(newVersion) : ''; +await updatePackages(pkg, browserPkg); +const gitTag = `v${newVersion}`; +await commitChanges(newVersion, gitTag); +await releasePackages(newVersion); +await pushChanges(gitTag); +if (changelogEntry) { + await createReleaseNotes(changelogEntry, gitTag); +} -const availableIncrements = isMainBranch - ? MAIN_INCREMENTS - : isPreRelease - ? PRE_RELEASE_INCREMENTS - : BRANCH_INCREMENTS; - -const { newVersion } = await inquirer.prompt([ - { - choices: availableIncrements.map(increment => { - const value = semverInc(version, increment); - return { - name: `${increment} (${value})`, - short: increment, - value - }; - }), - message: `Select type of release (currently "${version}" on branch "${currentBranch}"):`, - name: 'newVersion', - type: 'list' +async function getGithubApi() { + const GITHUB_TOKEN = '.github_token'; + try { + const token = (await readFile(GITHUB_TOKEN, 'utf8')).trim(); + return new GitHub({ token }); + } catch (err) { + if (err.code === 'ENOENT') { + console.error( + `Could not find GitHub token file. Please create "${GITHUB_TOKEN}" containing a token with the following permissions: +- public_repo` + ); + exit(1); + } else { + throw err; + } } -]); - -// Find version in changelog - -// read log -// (*) text missing ? -// - create text -// - Ask to edit file -// - Confirm when done -// - Read log again -// print text -// confirm? -// read text again -// did not change? break -// Otherwise (*) -const changelog = await fs.readFile(CHANGELOG, 'utf8'); -const { currentVersion, index, previousVersion, text } = getFirstChangelogEnry(changelog); -do { - if (currentVersion !== newVersion) { - const updatedLog = - changelog.slice(0, index) + - `## ${newVersion} - -_${new Date().toISOString().slice(0, 10)}_ - -### Features - -- Introduce \`maxParallelFileOps\` to limit both read and write operations, default to 20 and replaces \`maxParallelFileRead\` (#4570) - -### Bug Fixes +} -- Avoid including variables referenced from return statements that are never reached (#4573) +async function readJson(file) { + const content = await readFile(file, 'utf8'); + return JSON.parse(content); +} -### Pull Requests +async function getNewVersion(pkg, isMainBranch) { + const { version } = pkg; + const availableIncrements = isMainBranch + ? ['patch', 'minor'] + : semverPreRelease(version) + ? ['prerelease'] + : ['premajor', 'preminor', 'prepatch']; + + const { newVersion } = await inquirer.prompt([ + { + choices: availableIncrements.map(increment => { + const value = semverInc(version, increment); + return { + name: `${increment} (${value})`, + short: increment, + value + }; + }), + message: `Select type of release (currently "${version}" on branch "${currentBranch}"):`, + name: 'newVersion', + type: 'list' + } + ]); + return newVersion; +} -- [#4570](https://github.com/rollup/rollup/pull/4570): Introduce maxParallelFileOps to limit parallel writes (@lukastaegert) -- [#4572](https://github.com/rollup/rollup/pull/4572): Document more ways to read package.json in ESM (@berniegp) -- [#4573](https://github.com/rollup/rollup/pull/4573): Do not include unused return expressions (@lukastaegert) -`; - } - const changelog = await fs.readFile(CHANGELOG, 'utf8'); - const { currentVersion, index, previousVersion, text } = getFirstChangelogEnry(changelog); - - // console.log(bold(cyan`New changelog entry:`)); - let entryText = ''; - if (currentVersion === newVersion) { - entryText = text; - const result = await inquirer.prompt([ - { - message: `Confirm changelog and release "${newVersion}"? (otherwise edit the changelog and select "n")`, - name: 'continue', - type: 'confirm' - } - ]); - console.log(result); +async function addStubChangelogEntry(version) { + const changelog = await readFile(CHANGELOG, 'utf8'); + const { currentVersion, index } = getFirstChangelogEntry(changelog); + if (currentVersion === version) { + console.error( + `Changelog entry for version "${version}" already exists. Please remove the entry and commit the change before trying again.` + ); + exit(1); } - break; -} while (true); -exit(); - -// Install dependencies, build and run tests -// TODO Lukas enable -// await Promise.all([runWithEcho('npm', ['ci']), runWithEcho('npm', ['audit'])]); -// await Promise.all([ -// runWithEcho('npm', ['run', 'lint:nofix']), -// runWithEcho('npm', ['run', 'build:bootstrap']) -// ]); -// await runWithEcho('npm', ['run', 'test:all']); - -// TODO Lukas enable -// const browserPkg = await readJson(BROWSER_PKG); -// await Promise.all([ -// fs.writeFile(MAIN_PKG, getPkgStringWithVersion(pkg, newVersion)), -// fs.writeFile(BROWSER_PKG, getPkgStringWithVersion(browserPkg, newVersion)) -// ]); - -// Commit changes -const gitTag = `v${newVersion}`; -// TODO Lukas enable -// await runWithEcho('git', ['add', MAIN_PKG, BROWSER_PKG]); -// await runWithEcho('git', ['commit', '-m', newVersion]); -// await runWithEcho('git', ['tag', gitTag]); - -// Release -const releaseEnv = { ...process.env, ROLLUP_RELEASE: 'releasing' }; -const releaseTag = isPreRelease ? ['--tag', 'beta'] : []; -await Promise.all([ - runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { - cwd: new URL('..', import.meta.url), - env: releaseEnv - }), - runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { - cwd: new URL('../browser', import.meta.url), - env: releaseEnv - }) -]); -// Push changes -await Promise.all([ - runWithEcho('git', ['push', 'origin', 'HEAD']), - runWithEcho('git', ['push', 'origin', gitTag]) -]); - -async function readJson(file) { - const content = await fs.readFile(file, 'utf8'); - return JSON.parse(content); -} + const prs = await getIncludedPRs(currentVersion, gh); + await writeFile( + CHANGELOG, + changelog.slice(0, index) + getNewLogEntry(version, prs) + '\n\n' + changelog.slice(index) + ); -function getPkgStringWithVersion(pkg, version) { - return JSON.stringify({ ...pkg, version }, null, 2) + '\n'; + console.log( + cyan(`A stub for the release notes was added to the beginning of "${CHANGELOG}". +Please edit this file to add useful information about bug fixes, features and +breaking changes in the release while the tests are running.`) + ); } -function getFirstChangelogEnry(changelog) { +function getFirstChangelogEntry(changelog) { const match = changelog.match( /(?## (?\d+\.\d+\.\d+)[\s\S]*?)\n+## (?\d+\.\d+\.\d+)/ ); @@ -181,6 +128,29 @@ function getFirstChangelogEnry(changelog) { return { currentVersion, index, previousVersion, text }; } +async function getIncludedPRs(previousVersion, repo) { + const commits = await runAndGetStdout('git', [ + '--no-pager', + 'log', + `v${previousVersion}..HEAD`, + '--pretty=tformat:%s' + ]); + const getPrRegExp = /^([^(]+)\s\(#(\d+)\)$/gm; + const prs = []; + let match; + while ((match = getPrRegExp.exec(commits))) { + prs.push({ pr: match[2], text: match[1].split('\n')[0] }); + } + prs.sort((a, b) => (a.pr > b.pr ? 1 : -1)); + return Promise.all( + prs.map(async ({ pr, text }) => ({ + author: (await repo.getPullRequest(pr)).data.user.login, + pr, + text + })) + ); +} + function getNewLogEntry(version, prs) { if (prs.length === 0) { throw new Error(`Release does not contain any PRs`); @@ -201,32 +171,116 @@ _${date}_ ${sections}### Pull Requests -${prs.map( - ({ text, pr }) => - `- [#${pr}](https://github.com/rollup/rollup/pull/${pr}): ${text} (@lukastaegert)\n` -)}`; +${prs + .map( + ({ text, pr, author }) => + `- [#${pr}](https://github.com/rollup/rollup/pull/${pr}): ${text} (@${author})` + ) + .join('\n')}`; } function getDummyLogSection(headline, pr) { return `### ${headline} -- (#${pr}) +- [replace me] (#${pr}) `; } -async function getIncludedPRs(previousVersion) { - const commits = await runAndGetStdout('git', [ - '--no-pager', - 'log', - `v${previousVersion}..HEAD`, - '--pretty=tformat:%s' +async function installDependenciesBuildAndTest() { + await Promise.all([runWithEcho('npm', ['ci']), runWithEcho('npm', ['audit'])]); + await Promise.all([ + runWithEcho('npm', ['run', 'lint:nofix']), + runWithEcho('npm', ['run', 'build:bootstrap']) ]); - const getPrRegExp = /^([^(]+)\s\(#(\d+)\)$/gm; - const prs = []; - let match; - while ((match = getPrRegExp.exec(commits))) { - prs.push({ pr: match[2], text: match[1] }); + await runWithEcho('npm', ['run', 'test:all']); +} + +async function waitForChangelogUpdate(version) { + const { changelogUpdated } = await inquirer.prompt([ + { + message: `Please confirm that the changelog has been updated to continue`, + name: 'changelogUpdated', + type: 'confirm' + } + ]); + + if (!changelogUpdated) { + console.log(red`Aborting release.`); + exit(); + } + + let changelogEntry = ''; + while (true) { + await runWithEcho('npx', ['prettier', '--write', CHANGELOG]); + const changelog = await readFile(CHANGELOG, 'utf8'); + const { text: newEntry } = getFirstChangelogEntry(changelog); + if (newEntry !== changelogEntry) { + changelogEntry = newEntry; + console.log(cyan('You generated the following changelog entry:\n') + changelogEntry); + const { changelogConfirmed } = await inquirer.prompt([ + { + message: `Please edit the changelog again or confirm the changelog is acceptable to continue to release "${version}".`, + name: 'changelogConfirmed', + type: 'confirm' + } + ]); + if (!changelogConfirmed) { + console.log(red`Aborting release.`); + exit(); + } + continue; + } + break; } - return prs; + + console.log(cyan('No further changes, continuing release.')); + return changelogEntry; +} + +function updatePackages(pkg, browserPkg) { + return Promise.all([ + writeFile(MAIN_PKG, getPkgStringWithVersion(pkg, newVersion)), + writeFile(BROWSER_PKG, getPkgStringWithVersion(browserPkg, newVersion)) + ]); +} + +function getPkgStringWithVersion(pkg, version) { + return JSON.stringify({ ...pkg, version }, null, 2) + '\n'; +} + +async function commitChanges(newVersion, gitTag) { + await runWithEcho('git', ['add', MAIN_PKG, BROWSER_PKG]); + await runWithEcho('git', ['commit', '-m', newVersion]); + await runWithEcho('git', ['tag', gitTag]); +} + +function releasePackages(newVersion) { + const releaseEnv = { ...process.env, ROLLUP_RELEASE: 'releasing' }; + const releaseTag = semverPreRelease(newVersion) ? ['--tag', 'beta'] : []; + return Promise.all([ + runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { + cwd: new URL('..', import.meta.url), + env: releaseEnv + }), + runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { + cwd: new URL('../browser', import.meta.url), + env: releaseEnv + }) + ]); +} + +function pushChanges(gitTag) { + return Promise.all([ + runWithEcho('git', ['push', 'origin', 'HEAD']), + runWithEcho('git', ['push', 'origin', gitTag]) + ]); +} + +function createReleaseNotes(changelog, tag) { + return repo.createRelease({ + body: changelog, + name: tag, + tag_name: tag + }); } From a6a03133808d55575c700322fc5c08a16c717f8c Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 29 Jul 2022 06:28:49 +0200 Subject: [PATCH 12/15] Push correct REPL artefacts --- rollup.config.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index e5938e1a8b4..89dcfe0ab12 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -18,9 +18,6 @@ import getLicenseHandler from './build-plugins/generate-license-file'; import getBanner from './build-plugins/get-banner'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; -// TODO Lukas script that cds into browser dir, updates version and runs publish with same flags as main publish -// TODO Lukas adapt "files" property -// TODO Lukas adapt REPL artefact const onwarn: WarningHandlerWithDefault = warning => { // eslint-disable-next-line no-console console.error( From e998486a3a69f2fc7466fef234fdde7ef0bbd94d Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 29 Jul 2022 09:26:16 +0200 Subject: [PATCH 13/15] Add comments to released PRs and issues --- scripts/release.js | 87 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 19 deletions(-) diff --git a/scripts/release.js b/scripts/release.js index b806269b830..8590103f5c2 100755 --- a/scripts/release.js +++ b/scripts/release.js @@ -19,18 +19,27 @@ const MAIN_PKG = 'package.json'; const BROWSER_PKG = 'browser/package.json'; const CHANGELOG = 'CHANGELOG.md'; -const [gh] = await Promise.all([getGithubApi(), runWithEcho('git', ['pull', '--ff-only'])]); -const [pkg, browserPkg, currentBranch, repo] = await Promise.all([ +const [gh, currentBranch] = await Promise.all([ + getGithubApi(), + runAndGetStdout('git', ['branch', '--show-current']), + runWithEcho('git', ['pull', '--ff-only']) +]); +const [pkg, browserPkg, repo, issues, changelog] = await Promise.all([ readJson(MAIN_PKG), readJson(BROWSER_PKG), - runAndGetStdout('git', ['branch', '--show-current']), - gh.getRepo('rollup', 'rollup') + gh.getRepo('rollup', 'rollup'), + gh.getIssues('rollup', 'rollup'), + readFile(CHANGELOG, 'utf8') ]); const isMainBranch = currentBranch === MAIN_BRANCH; -const newVersion = await getNewVersion(pkg, isMainBranch); +const [newVersion, includedPRs] = await Promise.all([ + getNewVersion(pkg, isMainBranch), + getIncludedPRs(changelog, repo) +]); if (isMainBranch) { - await addStubChangelogEntry(newVersion); + await addStubChangelogEntry(newVersion, repo, includedPRs, changelog); } + await installDependenciesBuildAndTest(); const changelogEntry = isMainBranch ? await waitForChangelogUpdate(newVersion) : ''; await updatePackages(pkg, browserPkg); @@ -41,6 +50,7 @@ await pushChanges(gitTag); if (changelogEntry) { await createReleaseNotes(changelogEntry, gitTag); } +await postReleaseComments(includedPRs, issues, newVersion); async function getGithubApi() { const GITHUB_TOKEN = '.github_token'; @@ -91,8 +101,7 @@ async function getNewVersion(pkg, isMainBranch) { return newVersion; } -async function addStubChangelogEntry(version) { - const changelog = await readFile(CHANGELOG, 'utf8'); +async function addStubChangelogEntry(version, repo, changelog, includedPRs) { const { currentVersion, index } = getFirstChangelogEntry(changelog); if (currentVersion === version) { console.error( @@ -101,10 +110,12 @@ async function addStubChangelogEntry(version) { exit(1); } - const prs = await getIncludedPRs(currentVersion, gh); await writeFile( CHANGELOG, - changelog.slice(0, index) + getNewLogEntry(version, prs) + '\n\n' + changelog.slice(index) + changelog.slice(0, index) + + getNewLogEntry(version, includedPRs) + + '\n\n' + + changelog.slice(index) ); console.log( @@ -128,11 +139,12 @@ function getFirstChangelogEntry(changelog) { return { currentVersion, index, previousVersion, text }; } -async function getIncludedPRs(previousVersion, repo) { +async function getIncludedPRs(changelog, repo) { + const { currentVersion } = getFirstChangelogEntry(changelog); const commits = await runAndGetStdout('git', [ '--no-pager', 'log', - `v${previousVersion}..HEAD`, + `v${currentVersion}..HEAD`, '--pretty=tformat:%s' ]); const getPrRegExp = /^([^(]+)\s\(#(\d+)\)$/gm; @@ -143,11 +155,21 @@ async function getIncludedPRs(previousVersion, repo) { } prs.sort((a, b) => (a.pr > b.pr ? 1 : -1)); return Promise.all( - prs.map(async ({ pr, text }) => ({ - author: (await repo.getPullRequest(pr)).data.user.login, - pr, - text - })) + prs.map(async ({ pr, text }) => { + const { data } = await repo.getPullRequest(pr); + const bodyWithoutComments = data.body.replace(//g, ''); + const closedIssuesRegexp = /(fix(es|ed)?|(close|resolve)[sd]?) #(\d+)/g; + const closed = []; + while ((match = closedIssuesRegexp.exec(bodyWithoutComments))) { + closed.push(match[4]); + } + return { + author: data.user.login, + closed, + pr, + text + }; + }) ); } @@ -259,11 +281,11 @@ function releasePackages(newVersion) { const releaseEnv = { ...process.env, ROLLUP_RELEASE: 'releasing' }; const releaseTag = semverPreRelease(newVersion) ? ['--tag', 'beta'] : []; return Promise.all([ - runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { + runWithEcho('npm', ['publish', ...releaseTag], { cwd: new URL('..', import.meta.url), env: releaseEnv }), - runWithEcho('npm', ['publish', '--dry-run', ...releaseTag], { + runWithEcho('npm', ['publish', ...releaseTag], { cwd: new URL('../browser', import.meta.url), env: releaseEnv }) @@ -284,3 +306,30 @@ function createReleaseNotes(changelog, tag) { tag_name: tag }); } + +function postReleaseComments(includedPRs, issues, version) { + const isPreRelease = semverPreRelease(newVersion); + const installNote = isPreRelease + ? `Note that this is a pre-release, so to test it, you need to install Rollup via \`npm install rollup@${newVersion}\` or \`npm install rollup@beta\`. It will likely become part of a regular release later.` + : 'You can test it via `npm install rollup`.'; + return Promise.all( + includedPRs.map(({ pr, closed }) => + Promise.all([ + issues + .createIssueComment( + pr, + `This PR has been released as part of rollup@${version}. ${installNote}`, + ...closed.map(closedPr => + issues + .createIssueComment( + closedPr, + `This issue has been resolved via #${pr} as part of rollup@${version}. ${installNote}` + ) + .then(() => console.log(cyan(`Added fix comment to #${closedPr} via #${pr}.`))) + ) + ) + .then(() => console.log(cyan(`Added release comment to #${pr}.`))) + ]) + ) + ); +} From eff9e428f88aaa87d696a4f26de0e32468a33b03 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 29 Jul 2022 16:03:46 +0200 Subject: [PATCH 14/15] fixup! [v3.0] New hashing algorithm that "fixes (nearly) everything" (#4543) --- .../_expected/amd/entry-main-5940aabc-amd.js | 4 ---- .../_expected/cjs/entry-main-9cf3a232-cjs.js | 4 ---- 2 files changed, 8 deletions(-) diff --git a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js index b863b98285e..bed6a1ef6b4 100644 --- a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js +++ b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js @@ -1,10 +1,6 @@ define(['require'], (function (require) { 'use strict'; console.log('main'); -<<<<<<<< HEAD:test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-5940aabc-amd.js new Promise(function (resolve, reject) { require(['./chunk-deb-87ce45a9-amd'], resolve, reject); }).then(console.log); -======== - new Promise(function (resolve, reject) { require(['./chunk-deb-faae56f2-amd'], resolve, reject); }).then(console.log); ->>>>>>>> 3030e2f11 ([v3.0] New hashing algorithm that "fixes (nearly) everything" (#4543)):test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/amd/entry-main-aaf15a0c-amd.js })); diff --git a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js index ec32df29945..e28e6fa0c72 100644 --- a/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js +++ b/test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js @@ -1,8 +1,4 @@ 'use strict'; console.log('main'); -<<<<<<<< HEAD:test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-9cf3a232-cjs.js Promise.resolve().then(function () { return require('./chunk-deb-69905607-cjs.js'); }).then(console.log); -======== -Promise.resolve().then(function () { return require('./chunk-deb-2221fa83-cjs.js'); }).then(console.log); ->>>>>>>> 3030e2f11 ([v3.0] New hashing algorithm that "fixes (nearly) everything" (#4543)):test/chunking-form/samples/emit-file/filenames-function-patterns/_expected/cjs/entry-main-69b6552e-cjs.js From b541d9d4d99a03258c54decb99215a43021eda0a Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sat, 30 Jul 2022 07:07:04 +0200 Subject: [PATCH 15/15] Add Rollup-in-browser example --- docs/06-faqs.md | 90 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/docs/06-faqs.md b/docs/06-faqs.md index 99fc03e2768..0d6e4827a54 100755 --- a/docs/06-faqs.md +++ b/docs/06-faqs.md @@ -102,6 +102,96 @@ This is however a problem for polyfills, as those usually need to be executed fi Rollup is already used by many major JavaScript libraries, and can also be used to build the vast majority of applications. However if you want to use code-splitting or dynamic imports with older browsers, you will need an additional runtime to handle loading missing chunks. We recommend using the [SystemJS Production Build](https://github.com/systemjs/systemjs#browser-production) as it integrates nicely with Rollup's system format output and is capable of properly handling all the ES module live bindings and re-export edge cases. Alternatively, an AMD loader can be used as well. +#### How do I run Rollup itself in a browser + +While the regular Rollup build relies on some NodeJS features, there is also a browser build available that only uses browser APIs. You can install it via + +``` +npm install @rollup/browser +``` + +and in your script, import it via + +```js +import { rollup } from '@rollup/browser'; +``` + +Alternatively, you can import from a CDN, e.g. for the ESM build + +```js +import * as rollup from 'https://unpkg.com/@rollup/browser/dist/es/rollup.browser.js'; +``` + +and for the UMD build + +```html + +``` + +which will create a global variable `window.rollup`. As the browser build cannot access the file system, you need to provide plugins that resolve and load all modules you want to bundle. Here is a contrived example that does this: + +```js +const modules = { + 'main.js': "import foo from 'foo.js'; console.log(foo);", + 'foo.js': 'export default 42;' +}; + +rollup + .rollup({ + input: 'main.js', + plugins: [ + { + name: 'loader', + resolveId(source) { + if (modules.hasOwnProperty(source)) { + return source; + } + }, + load(id) { + if (modules.hasOwnProperty(id)) { + return modules[id]; + } + } + } + ] + }) + .then(bundle => bundle.generate({ format: 'es' })) + .then(({ output }) => console.log(output[0].code)); +``` + +This example only supports two imports, `"main.js"` and `"foo.js"`, and no relative imports. Here is another example that uses absolute URLs as entry points and supports relative imports. In that case, we are just re-bundling Rollup itself, but it could be used on any other URL that exposes an ES module: + +```js +rollup + .rollup({ + input: 'https://unpkg.com/rollup/dist/es/rollup.js', + plugins: [ + { + name: 'url-resolver', + resolveId(source, importer) { + if (source[0] !== '.') { + try { + new URL(source); + // If it is a valid URL, return it + return source; + } catch { + // Otherwise make it external + return { id: source, external: true }; + } + } + return new URL(source, importer).href; + }, + async load(id) { + const response = await fetch(id); + return response.text(); + } + } + ] + }) + .then(bundle => bundle.generate({ format: 'es' })) + .then(({ output }) => console.log(output)); +``` + #### Who made the Rollup logo? It's lovely. [Julian Lloyd](https://twitter.com/jlmakes)!