switch back to rollup

This commit is contained in:
silverwind 2020-08-16 22:45:41 +02:00
parent 4f701b6e1d
commit 79666bfed4
Signed by: silverwind
GPG Key ID: 2E62B41C93869443
4 changed files with 78 additions and 23 deletions

@ -4,8 +4,7 @@ test:
yarn -s run jest --color
bundle:
yarn -s run ncc build updates.js -q -m -o . -e cacache -e socks-proxy-agent -e ssri -e stripJsonComments -e encoding -e depd -e debug --no-source-map-register
@mv index.js updates
yarn -s run rollup --silent --compact -c rollup.config.js
publish:
git push -u --tags origin master

@ -26,9 +26,11 @@
"updates"
],
"devDependencies": {
"@rollup/plugin-commonjs": "15.0.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "9.0.0",
"@vercel/ncc": "0.23.0",
"ansi-regex": "5.0.0",
"colorette": "1.2.1",
"del": "5.1.0",
"eslint": "7.6.0",
"eslint-config-silverwind": "18.0.2",
@ -42,6 +44,9 @@
"rc": "1.2.8",
"registry-auth-token": "4.2.0",
"restana": "4.7.2",
"rollup": "2.26.3",
"rollup-plugin-hashbang": "2.2.2",
"rollup-plugin-terser": "7.0.0",
"semver": "7.3.2",
"tempy": "0.6.0",
"text-table": "0.2.0",

46
rollup.config.js Normal file

@ -0,0 +1,46 @@
const {unlinkSync} = require("fs");
const {writeSync} = require("tempy");
const {name} = require("./package.json");
const nullTemp = writeSync("export default null;", {extension: "mjs"});
const nullRouted = new Set([
"cacache",
"ssri",
"stripJsonComments",
"encoding",
]);
module.exports = {
input: `${name}.js`,
output: {
file: name,
name,
format: "cjs",
exports: "auto",
},
plugins: [
require("rollup-plugin-hashbang")(),
require("@rollup/plugin-json")({
indent: "",
preferConst: true,
}),
require("@rollup/plugin-node-resolve").default({
customResolveOptions: {
packageFilter: pkg => {
if (nullRouted.has(pkg.name)) return {main: nullTemp, type: "module"};
return pkg;
},
}
}),
require("@rollup/plugin-commonjs")({
sourceMap: false,
}),
require("rollup-plugin-terser").terser({
output: {comments: false},
}),
],
};
process.on("exit", () => {
unlinkSync(nullTemp);
});

@ -1,20 +1,19 @@
#!/usr/bin/env node
import ansiRegex from "ansi-regex";
import dns from "dns";
import fetch from "make-fetch-happen";
import minimist from "minimist";
import rat from "registry-auth-token";
import rc from "rc";
import ru from "registry-auth-token/registry-url";
import semver from "semver";
import textTable from "text-table";
import {cwd as cwdFn, stdout, argv, env, exit} from "process";
import {fromUrl} from "hosted-git-info";
import {join, dirname} from "path";
import {lstatSync, readFileSync, truncateSync, writeFileSync, accessSync} from "fs";
import {platform} from "os";
import {options, red, green, gray} from "colorette";
import {version} from "./package.json";
const ansiRegex = require("ansi-regex");
const dns = require("dns");
const fetch = require("make-fetch-happen");
const minimist = require("minimist");
const rat = require("registry-auth-token");
const rc = require("rc");
const ru = require("registry-auth-token/registry-url");
const semver = require("semver");
const textTable = require("text-table");
const {cwd: cwdFn, stdout, argv, env, exit} = require("process");
const {fromUrl} = require("hosted-git-info");
const {join, dirname} = require("path");
const {lstatSync, readFileSync, truncateSync, writeFileSync, accessSync} = require("fs");
const {platform} = require("os");
const {version} = require("./package.json");
env.NODE_ENV = "production";
@ -116,10 +115,16 @@ const args = minimist(argv.slice(2), {
},
});
if (args["no-color"]) {
options.enabled = false;
} else if (args.color) {
options.enabled = true;
const colorDisabled = args["no-color"] || "NO_COLOR" in process.env || process.env.TERM === "dumb";
const colorEnabled = args.color || "FORCE_COLOR" in process.env;
let red, green, gray;
if (!colorDisabled || colorEnabled) {
red = str => `\x1b[31m${str}\x1b[0m`;
green = str => `\x1b[32m${str}\x1b[0m`;
gray = str => `\x1b[90m${str}\x1b[0m`;
} else {
red = green = gray = str => str;
}
if (args.help) {