Skip to content

Commit

Permalink
chore: use esbuild to reduce the size of the action (#1334)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Aug 16, 2023
1 parent f21ebc4 commit dd47421
Show file tree
Hide file tree
Showing 2,469 changed files with 64,289 additions and 201,025 deletions.
20 changes: 20 additions & 0 deletions action-src/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node
/* eslint-disable node/no-unpublished-import */

import * as esbuild from 'esbuild';
import { fileURLToPath } from 'url';

const __dirname = fileURLToPath(new URL('.', import.meta.url));

async function buildAll() {
// Note: cjs is the only possible option at this moment.
await esbuild.build({
absWorkingDir: __dirname,
entryPoints: ['src/main_root.ts'],
bundle: true,
platform: 'node',
outfile: '../action/lib/main_root.js',
});
}

buildAll();
3 changes: 3 additions & 0 deletions action-src/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"ignoreWords": [
"EDITMSG",
"pollyjs"
],
"words": [
"outfile"
]
}
10 changes: 6 additions & 4 deletions action-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "yarn compile",
"compile": "tsc -p .",
"build": "node ./build.mjs",
"clean-build": "yarn clean && yarn build",
"clean": "shx rm -rf ../action/lib",
"clean": "shx rm -rf ../action/lib dist",
"eslint": "eslint 'action-source/**/*.ts'",
"prettier": "prettier -w \"**/*.{md,yaml,yml,json,ts}\"",
"prepublishOnly": "yarn build",
"smoke-test-push": "env-cmd -f ./fixtures/push.json node ./action/lib/main_root.js",
"smoke-test": "env-cmd -f ./fixtures/pull_request.json node ./action/lib/main_root.js",
"watch": "tsc -p . --watch",
"test": "jest"
},
"bin": {
"build": "./build.mjs"
},
"workspaces": {
"nohoist": [
"**"
Expand All @@ -28,6 +29,7 @@
"@octokit/rest": "^19.0.13",
"cspell": "^6.31.3",
"cspell-glob": "^6.31.3",
"esbuild": "^0.19.2",
"vscode-uri": "^3.0.7"
}
}
2 changes: 1 addition & 1 deletion action-src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"noUnusedParameters": true,
"noUnusedLocals": true,
"moduleResolution": "node",
"outDir": "../action/lib",
"outDir": "dist",
"rootDir": "./src"
},
"include": ["src/**/*"],
Expand Down
84 changes: 0 additions & 84 deletions action/lib/ActionParams.js

This file was deleted.

186 changes: 0 additions & 186 deletions action/lib/action.js

This file was deleted.

24 changes: 0 additions & 24 deletions action/lib/error.js

This file was deleted.

Loading

0 comments on commit dd47421

Please sign in to comment.