Skip to content

Commit

Permalink
feat: improve build performance (#2359)
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Jun 12, 2024
1 parent 2421bf8 commit eeb4f0e
Show file tree
Hide file tree
Showing 66 changed files with 450 additions and 7,315 deletions.
40 changes: 14 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,36 @@ name: Build + Test
on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
node-version: [16.x]
build:
runs-on: [ubuntu-latest]

name: ${{ matrix.os }} (Node.js ${{ matrix.node-version }})
name: Build Material Icon Theme

steps:
- name: Checkout 🛎
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }} ⚙
uses: actions/setup-node@v3
- name: Setup Platform 🛠
uses: oven-sh/setup-bun@v1
with:
node-version: ${{ matrix.node-version }}
bun-version: latest

- name: Run display server 🖥
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
shell: bash
if: ${{ success() && matrix.os == 'ubuntu-latest' }}
- name: Install dependencies 📦
run: bun install --frozen-lockfile

- name: Install node_modules 📦
run: npm ci

- name: Cache node_modules 💾
uses: actions/cache@v3
- name: Cache dependencies 💾
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: ~/.bun/install/cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Test + Build 🚀
run: |
npm test
npm run vscode:prepublish
env:
DISPLAY: ':99.0'
bun test
bun run vscode:prepublish
15 changes: 7 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ jobs:
with:
fetch-depth: 0

- name: Setup Node.js ⚙️
uses: actions/setup-node@v3
- name: Setup Platform 🛠
uses: oven-sh/setup-bun@v1
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
bun-version: latest

- name: Install node_modules 📦
- name: Install dependencies 📦
run: |
npm ci
npm install --global @vscode/vsce
bun install --frozen-lockfile
bun add -g npm
- name: Update version ↗
run: |
Expand All @@ -52,7 +51,7 @@ jobs:
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV
- name: Build ⚒️
run: vsce package
run: bunx @vscode/vsce package

- name: Push tags 📌
run: git push
Expand Down
7 changes: 6 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"recommendations": ["biomejs.biome", "jock.svg", "editorconfig.editorconfig"]
"recommendations": [
"biomejs.biome",
"jock.svg",
"editorconfig.editorconfig",
"oven.bun-vscode"
]
}
24 changes: 5 additions & 19 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension",
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"smartStep": true,
"preLaunchTask": "npm: build"
"outFiles": ["${workspaceFolder}/dist/**/*.cjs"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Run Web Extension in VS Code",
Expand All @@ -24,20 +22,8 @@
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web"
],
"outFiles": ["${workspaceFolder}/dist/web/**/*.js"],
"preLaunchTask": "npm: watch-web"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/spec/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "npm: pretest"
"outFiles": ["${workspaceFolder}/dist/web/**/*.cjs"],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"out": true
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
Expand Down
26 changes: 5 additions & 21 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"type": "bun",
"script": "bun run ./scripts/build-with-esbuild.ts",
"problemMatcher": [],
"label": "bun: build",
"detail": "bun run ./scripts/build-with-esbuild.ts - package.json",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "lint",
"problemMatcher": ["$eslint-stylish"]
},
{
"type": "npm",
"script": "watch-web",
"group": "build",
"isBackground": true,
"problemMatcher": ["$ts-webpack-watch", "$tslint-webpack-watch"]
}
]
}
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,11 @@ This project offers translations into different languages. If you notice an erro

This icon extension consists not only of icons but also brings some code. This is necessary to simplify various things and enable multiple functionalities. If you want to change something here, the following steps are to be considered:

1. Install [Node.js](https://nodejs.org/en/) on your machine
2. Install node dependencies with `npm install`
1. Install [Bun](https://bun.sh/docs/installation) on your machine
2. Install dependencies with `bun install`
3. Open project with VS Code
4. Install required [VS Code extensions](.vscode/extensions.json)
5. Press `F5` or run `Launch Extension` in the debug window
6. Run tests with `Launch Tests`
6. Run tests with `bun test`

You will find more information about the official extension API in the [extension guides of VS Code](https://code.visualstudio.com/api/extension-guides/file-icon-theme).
62 changes: 0 additions & 62 deletions build/web-extension.webpack.config.js

This file was deleted.

39 changes: 0 additions & 39 deletions build/webpack.config.js

This file was deleted.

Binary file added bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[test]
# Load these modules before running tests.
preload = ["./src/tests/mocks"]
Binary file modified images/fileIcons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/folderIcons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eeb4f0e

Please sign in to comment.