Skip to content

Commit c2675a4

Browse files
authored
PR #65 - Add web build of NeuroPilot
Other functional changes: - Git extension dependency is now soft dependency - Desktop extension is also bundled - Docs options now give a dropdown menu from a list of docs to select.
2 parents f1322eb + 0b4faa0 commit c2675a4

46 files changed

Lines changed: 9795 additions & 3623 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/builds.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build extension
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- master
7+
paths-ignore:
8+
- ".github/"
9+
- ".vscode/"
10+
- ".husky/"
11+
- "playground/"
12+
- "docs/"
13+
- "tony/"
14+
pull_request:
15+
paths-ignore:
16+
- ".github/"
17+
- ".vscode/"
18+
- ".husky/"
19+
- "playground/"
20+
- "docs/"
21+
- "tony/"
22+
workflow_dispatch:
23+
inputs:
24+
prod:
25+
type: choice
26+
description: Whether to override to build in production mode. Use 0 for dev and 1 for prod.
27+
required: false
28+
default: "0"
29+
options: ["0", "1"]
30+
31+
jobs:
32+
build:
33+
name: Build extension
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout source repository
37+
uses: actions/checkout@v4
38+
with:
39+
ref: ${{ github.sha }}
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v4.4.0
43+
with:
44+
node-version: 22.x.x
45+
cache: 'npm'
46+
cache-dependency-path: './package-lock.json'
47+
48+
- name: Cache node_modules
49+
uses: actions/cache@v4
50+
with:
51+
path: node_modules/
52+
key: neuropilot-build
53+
54+
- name: Install dependencies
55+
run: npm install
56+
57+
- name: Package extension
58+
env:
59+
NODE_ENV: ${{ inputs.prod || '0' }}
60+
run: npx @vscode/vsce package --allow-star-activation
61+
62+
- name: Upload builds
63+
uses: actions/upload-artifact@v4
64+
with:
65+
path: neuropilot-*.vsix
66+
name: NeuroPilot (Non-Production) Build ${{ github.sha }}

.github/workflows/docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
pull_request:
99
paths:
1010
- docs/**
11-
1211
workflow_dispatch:
12+
workflow_call:
1313

1414
permissions:
1515
contents: read
@@ -23,7 +23,7 @@ concurrency:
2323
jobs:
2424
check:
2525
name: Check docs site
26-
if: ${{ github.event_name == 'pull_request' }}
26+
if: ${{ github.event_name != 'workflow_dispatch' }}
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout repository
@@ -53,7 +53,7 @@ jobs:
5353
run: cd docs && npm run check
5454
build:
5555
name: Build docs site
56-
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
56+
if: ${{ github.event_name != 'pull_request' }}
5757
runs-on: ubuntu-latest
5858
steps:
5959
- name: Checkout repository
@@ -84,7 +84,7 @@ jobs:
8484
run: |
8585
cd docs
8686
npm install
87-
87+
8888
- name: Build site
8989
working-directory: ${{ github.workspace }}/docs
9090
run: PUBLIC_VERSION=$(npm show ./ version) npm run build

.github/workflows/publish.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,24 @@ jobs:
3434
with:
3535
node-version: 'latest'
3636

37-
- name: Bump docs version
38-
if: ${{ inputs.update_docs }}
39-
run: |
40-
cd docs
41-
npm version --no-git-tag-version ${{ inputs.version }}
42-
git add package.json package-lock.json
43-
44-
- name: Build
45-
run: |
46-
npm install
47-
npm run compile
37+
- name: Install deps
38+
run: npm install
4839

4940
- name: Configure Git
5041
run: |
5142
git config --global user.name "GitHub Actions"
5243
git config --global user.email "actions@github.com"
5344
45+
- name: Bump docs version
46+
if: ${{ inputs.update_docs }}
47+
working-directory: ${{ github.workspace }}/docs
48+
run: |
49+
npm version --no-git-tag-version ${{ inputs.version }}
50+
git add package.json package-lock.json
51+
5452
- name: Publish extension
53+
env:
54+
NODE_ENV: 1
5555
run: npx @vscode/vsce publish ${{inputs.version}} -p ${{secrets.MARKETPLACE_TOKEN}} --allow-star-activation --no-git-tag-version
5656

5757
- name: Commit and push version change
@@ -60,3 +60,8 @@ jobs:
6060
git commit -am "$new_version"
6161
git tag -a "v$new_version" -m "$new_version"
6262
git push --follow-tags https://VSC-NeuroPilot:${{secrets.GITHUB_TOKEN}}:@github.com/VSC-NeuroPilot/neuropilot
63+
64+
- name: Rebuild docs site
65+
if: ${{ inputs.update_docs }}
66+
uses: ./.github/workflows/docs.yml
67+

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
npm run types
12
npx eslint
23
cd docs && npm run check

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"recommendations": ["astro-build.astro-vscode"],
2+
"recommendations": ["astro-build.astro-vscode", "connor4312.esbuild-problem-matchers"],
33
"unwantedRecommendations": []
44
}

.vscode/launch.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"version": "0.2.0",
77
"configurations": [
88
{
9-
"name": "Run Extension",
9+
"name": "Run Desktop Extension",
1010
"type": "extensionHost",
1111
"request": "launch",
1212
"runtimeExecutable": "${execPath}",
@@ -16,13 +16,30 @@
1616
// "--disable-extensions"
1717
],
1818
"outFiles": [
19-
"${workspaceFolder}/out/**/*.js"
19+
"${workspaceFolder}/out/**/*.js",
20+
"!${workspaceFolder}/out/web/**"
2021
],
21-
"preLaunchTask": "npm: watch"
22+
"preLaunchTask": "watch:desktop"
2223
},
2324
{
24-
"command": "./docs/node_modules/.bin/astro dev",
25+
"name": "Run Web Extension",
26+
"type": "extensionHost",
27+
"request": "launch",
28+
"debugWebWorkerHost": true,
29+
"args": [
30+
"--extensionDevelopmentPath=${workspaceFolder}",
31+
"${workspaceFolder}/playground",
32+
"--extensionDevelopmentKind=web"
33+
],
34+
"outFiles": [
35+
"${workspaceFolder}/out/web/**/*.js"
36+
],
37+
"preLaunchTask": "watch:web"
38+
},
39+
{
40+
"command": "./node_modules/.bin/astro dev",
2541
"name": "Docs development server (Astro)",
42+
"cwd": "${workspaceFolder}/docs",
2643
"request": "launch",
2744
"type": "node-terminal"
2845
}

.vscode/tasks.json

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"tasks": [
66
{
77
"type": "npm",
8-
"script": "watch",
8+
"script": "watch:desktop",
99
"problemMatcher": "$tsc-watch",
1010
"isBackground": true,
1111
"presentation": {
@@ -16,6 +16,82 @@
1616
"isDefault": true
1717
}
1818
},
19+
{
20+
"label": "watch:desktop",
21+
"dependsOn": [
22+
"npm: watch:desktop:tsc",
23+
"npm: watch:desktop:esbuild"
24+
],
25+
"presentation": {
26+
"reveal": "never"
27+
},
28+
"group": {
29+
"kind": "build",
30+
"isDefault": true
31+
}
32+
},
33+
{
34+
"type": "npm",
35+
"script": "watch:desktop:esbuild",
36+
"group": "build",
37+
"problemMatcher": "$esbuild-watch",
38+
"isBackground": true,
39+
"label": "npm: watch:desktop:esbuild",
40+
"presentation": {
41+
"group": "watch",
42+
"reveal": "never"
43+
}
44+
},
45+
{
46+
"type": "npm",
47+
"script": "watch:desktop:tsc",
48+
"group": "build",
49+
"problemMatcher": "$tsc-watch",
50+
"isBackground": true,
51+
"label": "npm: watch:desktop:tsc",
52+
"presentation": {
53+
"group": "watch",
54+
"reveal": "never"
55+
}
56+
},
57+
{
58+
"label": "watch:web",
59+
"dependsOn": [
60+
"npm: watch:web:tsc",
61+
"npm: watch:web:esbuild"
62+
],
63+
"presentation": {
64+
"reveal": "never"
65+
},
66+
"group": {
67+
"kind": "build",
68+
"isDefault": true
69+
}
70+
},
71+
{
72+
"type": "npm",
73+
"script": "watch:web:esbuild",
74+
"group": "build",
75+
"problemMatcher": "$esbuild-watch",
76+
"isBackground": true,
77+
"label": "npm: watch:web:esbuild",
78+
"presentation": {
79+
"group": "watch",
80+
"reveal": "never"
81+
}
82+
},
83+
{
84+
"type": "npm",
85+
"script": "watch:web:tsc",
86+
"group": "build",
87+
"problemMatcher": "$tsc-watch",
88+
"isBackground": true,
89+
"label": "npm: watch:web:tsc",
90+
"presentation": {
91+
"group": "watch",
92+
"reveal": "never"
93+
}
94+
},
1995
{
2096
"label": "Publish extension",
2197
"type": "shell",
@@ -29,7 +105,11 @@
29105
"description": "Bump which version?",
30106
"type": "pickString",
31107
"default": "patch",
32-
"options": [ "patch", "minor", "major" ]
108+
"options": [
109+
"patch",
110+
"minor",
111+
"major"
112+
]
33113
}
34114
]
35115
}

.vscodeignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ playground/**
33
.gitignore
44
eslint.config.mjs
55
tsconfig.json
6+
tsconfig.web.json
67
src/
8+
node_modules/
79
*.vsix
810

11+
# Project files
12+
project-files/
13+
14+
# Build files
15+
esbuild.{m,c,}js
16+
esbuild-configs/
17+
918
# Krita
1019
*.kra
1120
*.*~

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,19 @@ Please refer to the docs site above.
7373

7474
This extension uses the [TypeScript/JavaScript SDK](https://github.com/AriesAlex/typescript-neuro-game-sdk) by [AriesAlex](https://github.com/AriesAlex).
7575

76-
Documentation by @KTrain5169.
76+
Documentation by [@KTrain5169](https://github.com/KTrain5169).
7777

7878
Extension icon by Xaendril.
7979

8080
### Neuro's cursor
8181

8282
Assuming the [Edit Active Document](vscode://settings/neuropilot.permission.editActiveDocument) permission isn't set to `Off`, Neuro gains her own cursor, indicated by the pink cursor in text documents. This cursor will only appear in files she has access to (which is affected by the `Allow Unsafe Paths` and `Include`/`Exclude` Patterns settings.) and you can also move the cursor yourself using the aforementioned `Move Neuro's Cursor Here` command. This allows her to work on the same file as the programmer but without having to rely on the normal cursor, which solves some problems relating to their respective actions.
8383

84-
If you enable the [Cursor Follows Neuro](vscode://settings/neuropilot.cursorFollowsNeuro) setting, the normal cursor will automatically be moved to Neuro's cursor if she moves it.
84+
Neuro's cursor will be indicated with a cursor decoration inside the text editor itself, but you can also identify the line it's on by looking to the side and looking for this icon:
85+
86+
![NeuroPilot v1 icon (pink)](assets/heart.png)
87+
88+
If you enable the [Cursor Follows Neuro](vscode://settings/neuropilot.cursorFollowsNeuro) setting, the normal cursor will automatically be moved to Neuro's cursor if she moves it. This replicates the behaviour exhibited in earlier versions of the extension.
8589

8690
### "Why is there a file named rce.ts in it??? Is there an intentional RCE inside this extension???" <!-- had to add this just in case -->
8791

@@ -101,3 +105,5 @@ The short answer is no, there isn't an intentional Remote Code Execution vulnera
101105

102106
If you have an idea or want to contribute a feature, please first [create an issue](https://github.com/VSC-NeuroPilot/neuropilot/issues) or send a message to `@Pasu4` in the project's [post on the Neuro Discord](https://discord.com/channels/574720535888396288/1350968830230396938).
103107
If you make a pull request that contributes code, please run `npm run lint src` and resolve any errors that did not get auto-fixed, preferrably before each commit.
108+
109+
Please also refer to our [contributor docs](https://vsc-neuropilot.github.io/neuropilot/contributors).

0 commit comments

Comments
 (0)