summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Federico Brigante <me@fregante.com> 2022-10-10 15:38:46 +0700
committerGravatar Federico Brigante <me@fregante.com> 2022-10-10 15:38:46 +0700
commit3450a96bd3bd25eb7728c360fca57d8679732105 (patch)
tree6e8a452b2c4c7dddc33c43d3d4d8b59ad847893d
parentb681c734a35948991bda26760708ef57f85c902a (diff)
downloadrefined-github-esbuild-2.tar.gz
refined-github-esbuild-2.tar.zst
refined-github-esbuild-2.zip
-rw-r--r--build/esbuild.ts17
-rw-r--r--package.json1
-rw-r--r--tsconfig.json6
3 files changed, 18 insertions, 6 deletions
diff --git a/build/esbuild.ts b/build/esbuild.ts
index af2bea42..8ad14e07 100644
--- a/build/esbuild.ts
+++ b/build/esbuild.ts
@@ -1,8 +1,9 @@
import {createRequire} from 'node:module';
import esbuild from 'esbuild';
+import {copy} from 'esbuild-plugin-copy';
-import {getFeatures, getFeaturesMeta} from './readme-parser.js';
+import {getImportedFeatures, getFeaturesMeta} from './readme-parser.js';
const {resolve: resolvePackage} = createRequire(import.meta.url);
@@ -11,7 +12,7 @@ const readmeLoader: esbuild.Plugin = {
setup(build) {
build.onLoad({filter: /readme\.md$/}, () => ({
contents: `
- export const featureList = ${JSON.stringify(getFeatures())};
+ export const importedFeatures = ${JSON.stringify(getImportedFeatures())};
export const featuresMeta = ${JSON.stringify(getFeaturesMeta())};
`,
loader: 'js',
@@ -27,15 +28,21 @@ void esbuild.build({
'source/refined-github.ts',
],
bundle: true,
+ logLevel: 'info',
watch: process.argv[2] === '--watch',
- outdir: 'distribution/build',
+ outdir: 'distribution',
external: ['chrome:*'],
- plugins: [readmeLoader],
+ plugins: [readmeLoader, copy({
+ assets: [{
+ from: ['source/*.+(html|json|png)'],
+ to: 'ignored-but-needed🤷‍♂️',
+ }],
+ })],
});
void esbuild.build({
entryPoints: [
resolvePackage('webextension-polyfill'),
],
- outdir: 'distribution/build',
+ outdir: 'distribution',
});
diff --git a/package.json b/package.json
index 18e1d7c4..bbf010f7 100644
--- a/package.json
+++ b/package.json
@@ -97,6 +97,7 @@
"dot-json": "^1.2.2",
"esbuild": "^0.15.10",
"esbuild-loader": "^2.20.0",
+ "esbuild-plugin-copy": "^1.3.0",
"eslint-config-xo-react": "^0.27.0",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
diff --git a/tsconfig.json b/tsconfig.json
index a7ac5f2d..63d28a2a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,7 @@
{
"extends": "@sindresorhus/tsconfig",
"compilerOptions": {
+ "baseUrl": ".",
"target": "es2021",
"module": "es2022",
"moduleResolution": "Node",
@@ -8,7 +9,10 @@
"declaration": false,
"esModuleInterop": true,
"noUncheckedIndexedAccess": false,
- "noPropertyAccessFromIndexSignature": false
+ "noPropertyAccessFromIndexSignature": false,
+ "paths": {
+ "react": ["node_modules/dom-chef/index.js"]
+ }
},
"include": [
"source",