Skip to content

Commit 07f1e5a

Browse files
Merge pull request #18 from forcedotcom/cristi/bundling
feat(W-17767554): bundling
2 parents a66a694 + dd44cdf commit 07f1e5a

File tree

12 files changed

+2106
-1013
lines changed

12 files changed

+2106
-1013
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
- run: npm --version
3232
- run: node --version
3333
- run: npm run compile
34-
- run: npx vsce package --follow-symlinks
34+
- run: npm run bundle:extension
35+
- run: npx vsce package
3536
- name: Stage Artifacts
3637
run: |
3738
mkdir extensions

.vscodeignore

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,47 @@
1-
.vscode/**
2-
.vscode-test/**
3-
src/**
4-
.gitignore
5-
.yarnrc
6-
vsc-extension-quickstart.md
7-
**/tsconfig.json
8-
**/.eslintrc.json
1+
# Salesforce
2+
.sfdx/**
3+
.sf/**
4+
5+
# Ignore TypeScript and build-related files
96
**/*.map
107
**/*.ts
8+
tsconfig.tsbuildinfo
9+
tsconfig.json
10+
src/**
11+
sha/**
12+
13+
# development files
1114
.github/**
12-
.sfdx/**
13-
.sf/**
14-
.prettierignore
15+
esbuild.config.js
16+
scripts/**
17+
.yarnrc
1518
.nvmrc
16-
coverage/**
19+
node_modules
20+
lib/**
21+
22+
# Ignore documentation and extra files
23+
CONTRIBUTING/**
24+
SECURITY.md
25+
SHA256.md
26+
changelog.md
27+
vsc-extension-quickstart.md
28+
29+
# ESLint, Prettier, Husky, and Commit Hooks (not needed for runtime)
30+
.eslintignore
31+
.husky/**
32+
.prettierignore
33+
.prettierrc
34+
.eslintrc.json
35+
.editorconfig
36+
.vscode/**
37+
38+
# Ignore tests and linting files
1739
jest.config.js
40+
jest.setup.js
41+
__tests__/**
1842
test/**
19-
contributing/
43+
coverage/**
2044

45+
# Ignore CVS files
46+
.git/
47+
.gitignore

esbuild.config.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2025, salesforce.com, inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
const { build } = require('esbuild');
8+
const esbuildPluginPino = require('esbuild-plugin-pino');
9+
const fs = require('fs');
10+
11+
const copyFiles = (src, dest) => {
12+
const stats = fs.statSync(src);
13+
try {
14+
if (stats.isDirectory()) {
15+
fs.cpSync(src, dest, { recursive: true });
16+
} else {
17+
fs.cpSync(src, dest);
18+
}
19+
console.log(`Copied from ${src} to ${dest}`);
20+
} catch (error) {
21+
console.error('An error occurred:', error);
22+
}
23+
};
24+
25+
// copy core-bundle/lib/transformStream.js to dist if core-bundle is included
26+
const srcPathTransformStream = './node_modules/@salesforce/core-bundle/lib/transformStream.js';
27+
const destPathTransformStream = './dist/transformStream.js';
28+
29+
(async () => {
30+
await build({
31+
bundle: true,
32+
entryPoints: ['./src/extension.ts'],
33+
external: ['vscode'],
34+
format: 'cjs',
35+
keepNames: true,
36+
loader: { '.node': 'file' },
37+
logOverride: {
38+
'unsupported-dynamic-import': 'error'
39+
},
40+
minify: true,
41+
outdir: 'dist',
42+
platform: 'node',
43+
plugins: [esbuildPluginPino({ transports: ['pino-pretty'] })],
44+
supported: { 'dynamic-import': false }
45+
});
46+
})()
47+
.then(() => {
48+
copyFiles(srcPathTransformStream, destPathTransformStream);
49+
})
50+
.catch(() => process.exit(1));

0 commit comments

Comments
 (0)