Skip to content

Commit 4d66e75

Browse files
Merge pull request #4 from mohankumarelec/wsl-issues
Fixed WSL Issues
2 parents effabea + a942f78 commit 4d66e75

35 files changed

+4664
-837
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ jobs:
1212
build:
1313
name: "Build VS Code Extension"
1414
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
platform:
19+
[
20+
"win32-arm64",
21+
"win32-x64",
22+
"linux-arm64",
23+
"linux-x64",
24+
"linux-armhf",
25+
"alpine-x64",
26+
"darwin-x64",
27+
"darwin-arm64",
28+
"alpine-arm64",
29+
]
30+
1531
steps:
1632
- name: Checkout repository
1733
uses: actions/checkout@v4
@@ -24,17 +40,17 @@ jobs:
2440
- name: Install dependencies
2541
run: npm install
2642

27-
- name: Install vsce tool
28-
run: npm install -g @vscode/vsce
29-
3043
- name: Checking Linting
3144
run: npm run lint
3245

46+
- name: Compile Extension
47+
run: npm run package -- --target ${{ matrix.platform }}
48+
3349
- name: Package extension
34-
run: vsce package --out "extension.vsix"
50+
run: npx vsce package --target ${{ matrix.platform }} --out "flexpilot-${{ matrix.platform }}.vsix"
3551

3652
- name: Upload extension vsix as artifact
3753
uses: actions/upload-artifact@v4
3854
with:
39-
name: "extension.vsix"
40-
path: "extension.vsix"
55+
name: "flexpilot-${{ matrix.platform }}.vsix"
56+
path: "flexpilot-${{ matrix.platform }}.vsix"

.github/workflows/release.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ jobs:
1212
name: "Release VS Code Extension"
1313
runs-on: ubuntu-latest
1414
environment: production
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
platform:
19+
[
20+
"win32-arm64",
21+
"win32-x64",
22+
"linux-arm64",
23+
"linux-x64",
24+
"linux-armhf",
25+
"alpine-x64",
26+
"darwin-x64",
27+
"darwin-arm64",
28+
"alpine-arm64",
29+
]
30+
1531
steps:
1632
- name: Checkout repository
1733
uses: actions/checkout@v4
@@ -58,27 +74,33 @@ jobs:
5874
- name: Install dependencies
5975
run: npm install
6076

61-
- name: Install vsce tool
62-
run: npm install -g @vscode/vsce
63-
6477
- name: Checking Linting
6578
run: npm run lint
6679

80+
- name: Compile Extension
81+
run: npm run package -- --target ${{ matrix.platform }}
82+
6783
- name: Package extension
68-
run: vsce package --out "extension.vsix"
84+
run: npx vsce package --target ${{ matrix.platform }} --out "flexpilot-${{ matrix.platform }}.vsix"
6985

7086
- name: Upload extension vsix as artifact
7187
uses: actions/upload-artifact@v4
7288
with:
73-
name: "extension.vsix"
74-
path: "extension.vsix"
89+
name: "flexpilot-${{ matrix.platform }}.vsix"
90+
path: "flexpilot-${{ matrix.platform }}.vsix"
7591

7692
- name: Upload Release Assets
7793
uses: softprops/action-gh-release@v2
7894
with:
79-
files: extension.vsix
95+
files: "flexpilot-${{ matrix.platform }}.vsix"
8096
env:
8197
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8298

8399
- name: Release to VS Code Marketplace
84-
run: vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
100+
uses: nick-fields/retry@v3
101+
with:
102+
timeout_minutes: 5
103+
max_attempts: 6
104+
retry_on: error
105+
retry_wait_seconds: 10
106+
command: npx vsce publish --packagePath "flexpilot-${{ matrix.platform }}.vsix" -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}

.husky/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
#!/bin/sh
12
npx lint-staged
3+
4+
if git diff --cached --name-only | grep -qE "^(package\.json|package-lock\.json)$"; then
5+
echo "Error: Changes to package.json or package-lock.json are not allowed."
6+
exit 1
7+
fi
8+
29
echo "Completed Pre Commit Hooks ..."

build/post-build.mjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Command, Option } from "commander";
2+
import * as fs from "fs";
3+
import * as path from "path";
4+
import extensionConfig from "../webpack.config.mjs";
5+
6+
const targetMapping = {
7+
"win32-x64": "node-napi.win32-x64-msvc.node",
8+
"win32-arm64": "node-napi.win32-arm64-msvc.node",
9+
"linux-x64": "node-napi.linux-x64-gnu.node",
10+
"linux-arm64": "node-napi.linux-arm64-gnu.node",
11+
"linux-armhf": "node-napi.linux-arm-gnueabihf.node",
12+
"alpine-x64": "node-napi.linux-x64-musl.node",
13+
"darwin-x64": "node-napi.darwin-x64.node",
14+
"darwin-arm64": "node-napi.darwin-arm64.node",
15+
"alpine-arm64": "node-napi.linux-arm64-musl.node",
16+
};
17+
18+
const args = new Command()
19+
.addOption(
20+
new Option("--target [platform]", "Specify the target VS Code platform")
21+
.choices(Object.keys(targetMapping))
22+
.makeOptionMandatory(),
23+
)
24+
.parse()
25+
.opts();
26+
27+
const outDir = extensionConfig[0].output.path;
28+
for (const file of fs.readdirSync(outDir)) {
29+
if (file === targetMapping[args.target]) {
30+
continue;
31+
} else if (file.startsWith("node-napi")) {
32+
console.log(`Deleting file: ${file}`);
33+
fs.unlinkSync(path.join(outDir, file));
34+
}
35+
}

eslint.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,24 @@ export default [
1010
pluginJs.configs.recommended,
1111
...tseslint.configs.recommended,
1212
eslintPluginPrettierRecommended,
13+
{
14+
ignores: ["node_modules/**", "build/**"],
15+
rules: {
16+
"no-restricted-imports": [
17+
"error",
18+
{
19+
paths: [
20+
{
21+
name: "fs",
22+
message: "Please use vscode.workspace.fs",
23+
},
24+
{
25+
name: "fs/promises",
26+
message: "Please use vscode.workspace.fs",
27+
},
28+
],
29+
},
30+
],
31+
},
32+
},
1333
];

0 commit comments

Comments
 (0)