remove rollup from webex and fix package.json root scripts

This commit is contained in:
Sebastian 2022-05-24 00:37:24 -03:00
parent c3ba7fb523
commit 16cc179edf
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
5 changed files with 723 additions and 849 deletions

View File

@ -2,10 +2,10 @@
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"compile": "pnpm run --filter '{packages}' compile",
"clean": "pnpm run --filter '{packages}' clean",
"pretty": "pnpm run --filter '{packages}' pretty",
"check": "pnpm run --filter '{packages}' --if-present test"
"compile": "pnpm run --filter '@gnu-taler/*' compile",
"clean": "pnpm run --filter '@gnu-taler/*' clean",
"pretty": "pnpm run --filter '@gnu-taler/*' pretty",
"check": "pnpm run --filter '@gnu-taler/*' --if-present test"
},
"devDependencies": {
"@babel/core": "7.13.16",

View File

@ -13,9 +13,7 @@
"test:coverage": "nyc pnpm test",
"compile": "tsc && ./build-fast-with-linaria.mjs",
"dev": "./dev.mjs",
"compile:test": "rollup -c rollup.config.test.js -m",
"pretty": "prettier --write src",
"watch": "tsc --watch & rollup -w -c",
"i18n:extract": "pogen extract",
"i18n:merge": "pogen merge",
"i18n:emit": "pogen emit",
@ -41,15 +39,7 @@
"@linaria/babel-preset": "3.0.0-beta.4",
"@linaria/core": "3.0.0-beta.4",
"@linaria/react": "3.0.0-beta.4",
"@linaria/rollup": "3.0.0-beta.4",
"@linaria/webpack-loader": "3.0.0-beta.4",
"@rollup/plugin-alias": "^3.1.2",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-image": "^2.1.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.1",
"@rollup/plugin-typescript": "^8.3.0",
"@testing-library/preact": "^2.0.1",
"@testing-library/preact-hooks": "^1.1.0",
"@types/chai": "^4.3.0",
@ -67,11 +57,6 @@
"preact-cli": "^3.3.5",
"preact-render-to-string": "^5.1.19",
"rimraf": "^3.0.2",
"rollup": "^2.67.2",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-ignore": "^1.0.10",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.5.5"
},
"nyc": {

View File

@ -1,121 +0,0 @@
// rollup.config.js
import linaria from '@linaria/rollup';
import alias from '@rollup/plugin-alias';
import commonjs from "@rollup/plugin-commonjs";
import image from '@rollup/plugin-image';
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import css from 'rollup-plugin-css-only';
import ignore from "rollup-plugin-ignore";
import typescript from '@rollup/plugin-typescript';
export const makePlugins = () => [
typescript({
outputToFilesystem: false,
}),
alias({
entries: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom', replacement: 'preact/compat' }
]
}),
ignore(["module", "os"]),
nodeResolve({
browser: true,
preferBuiltins: true,
}),
//terser(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
// "__filename": "'__webextension__'",
preventAssignment: true
}),
commonjs({
include: [/node_modules/, /dist/],
extensions: [".js"],
ignoreGlobal: true,
sourceMap: true,
}),
json(),
image(),
linaria({
babelOptions: {
babelrc: false,
configFile: './babel.config-linaria.json',
},
sourceMap: process.env.NODE_ENV !== 'production',
}),
];
const webExtensionWalletEntryPoint = {
input: "src/walletEntryPoint.tsx",
output: {
file: "dist/walletEntryPoint.js",
format: "iife",
exports: "none",
name: "webExtensionWalletEntry",
},
plugins: [
...makePlugins(),
css({
output: 'walletEntryPoint.css',
}),
],
};
const webExtensionPopupEntryPoint = {
input: "src/popupEntryPoint.tsx",
output: {
file: "dist/popupEntryPoint.js",
format: "iife",
exports: "none",
name: "webExtensionPopupEntry",
},
plugins: [
...makePlugins(),
css({
output: 'popupEntryPoint.css',
}),
],
};
const webExtensionBackgroundPageScript = {
input: "src/background.ts",
output: {
file: "dist/background.js",
format: "iife",
exports: "none",
name: "webExtensionBackgroundScript",
},
plugins: makePlugins(),
};
const webExtensionCryptoWorker = {
input: "src/browserWorkerEntry.ts",
output: {
file: "dist/browserWorkerEntry.js",
format: "iife",
exports: "none",
name: "webExtensionCryptoWorker",
},
plugins: makePlugins(),
};
export default [
webExtensionPopupEntryPoint,
webExtensionWalletEntryPoint,
webExtensionBackgroundPageScript,
webExtensionCryptoWorker,
];

View File

@ -1,47 +0,0 @@
// rollup.config.js
import fs from 'fs';
import path from 'path';
import css from 'rollup-plugin-css-only';
import { makePlugins } from "./rollup.config"
function fromDir(startPath, regex) {
if (!fs.existsSync(startPath)) {
return;
}
const files = fs.readdirSync(startPath);
const result = files.flatMap(file => {
const filename = path.join(startPath, file);
const stat = fs.lstatSync(filename);
if (stat.isDirectory()) {
return fromDir(filename, regex);
}
else if (regex.test(filename)) {
return filename
}
}).filter(x => !!x)
return result
}
const tests = fromDir('./src', /.test.ts$/)
// .filter(t => t === 'src/wallet/DepositPage.test.ts')
.map(test => ({
input: test,
output: {
file: test.replace(/^src/, 'dist').replace(/\.ts$/, '.js'),
format: "iife",
exports: "none",
name: test,
},
plugins: [
...makePlugins(),
css({
output: 'walletEntryPoint.css',
}),
],
}))
export default [
...tests,
];

File diff suppressed because it is too large Load Diff