Skip to content

Commit

Permalink
Extract esbuild into config files, remove nohoist settings
Browse files Browse the repository at this point in the history
  • Loading branch information
grantbacon-jaspersoft committed May 30, 2024
1 parent 52b3fce commit fb2d32c
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 9 deletions.
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/**"
]
},
"scripts": {
Expand Down
17 changes: 17 additions & 0 deletions packages/input-controls/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { build } = require("esbuild");

const isProd = process.env.NODE_ENV === 'production';

const sharedConfig = {
entryPoints: ["index.ts"],
bundle: true,
minify: isProd,
sourcemap: !isProd,
format: 'esm',
};

build({
...sharedConfig,
platform: 'node',
outfile: "dist/index.js",
});
4 changes: 2 additions & 2 deletions packages/input-controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "dist/index.js",
"scripts": {
"test": "jest",
"build": "esbuild index.ts --bundle --format=esm --outfile=dist/index.js",
"build-prod": "esbuild index.ts --bundle --format=esm --minify --sourcemap --outfile=dist/index.js",
"build": "node esbuild.js",
"build-prod": "NODE_ENV=production node esbuild.js",
"clean": "rm -rf ./dist"
},
"repository": "git@github.com:Jaspersoft/js-visualize-plugins.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/input-controls/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"strict": true,
"skipLibCheck": true,
"outDir": "dist",
"moduleResolution": "Node16",
"moduleResolution": "NodeNext",
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist"],
Expand Down
18 changes: 18 additions & 0 deletions packages/test-app/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { build } = require("esbuild");
const { dependencies } = require('./package.json');

const isProd = process.env.NODE_ENV === 'production';

const sharedConfig = {
entryPoints: ["src/entrypoint.tsx"],
bundle: true,
minify: isProd,
sourcemap: !isProd,
format: 'esm',
};

build({
...sharedConfig,
platform: 'node',
outfile: "dist/bundle.js",
});
5 changes: 3 additions & 2 deletions packages/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"license": "MIT",
"private": true,
"scripts": {
"start": "esbuild ./src/entrypoint.tsx --outfile=public/bundle.js --bundle --watch --sourcemap --servedir=public",
"build": "esbuild ./src/entrypoint.tsx --outfile=dist/bundle.js --bundle --minify",
"start": "esbuild ./src/entrypoint.tsx --outfile=public/bundle.js --bundle --watch --minify --sourcemap --servedir=public",
"build": "node esbuild.js",
"build-prod": "NODE_ENV=production node esbuild.js",
"clean": "rm -rf dist"
},
"devDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions packages/test-app/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var ICPlugin = require('input-controls-plugin');

var x = new ICPlugin({});

console.log(x);
2 changes: 1 addition & 1 deletion packages/test-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"strict": true,
"skipLibCheck": true,
"outDir": "dist",
"moduleResolution": "Node16",
"moduleResolution": "NodeNext",
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist"],
Expand Down

0 comments on commit fb2d32c

Please sign in to comment.