Skip to content

Commit 8b2cbdb

Browse files
authored
fix: derive CompileSummary from BuilderResult (#20)
Signed-off-by: dankeboy36 <dankeboy36@gmail.com>
1 parent 55044a7 commit 8b2cbdb

40 files changed

Lines changed: 13883 additions & 20340 deletions

.eslintrc.json

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
name: Build
1+
name: CI
2+
permissions:
3+
contents: read
4+
pull-requests: write
5+
26
on:
37
push:
48
branches:
@@ -9,64 +13,79 @@ on:
913
- main
1014

1115
jobs:
12-
build:
13-
name: test (${{ matrix.os }}, node-${{ matrix.node }}
16+
test:
17+
name: Test (${{ matrix.os }}, node-${{ matrix.node }})
1418
strategy:
1519
fail-fast: false
1620
matrix:
1721
os: [windows-latest, ubuntu-latest, macos-latest]
18-
node: [18.x]
22+
node: [22.14.0]
1923
runs-on: ${{ matrix.os }}
2024
steps:
2125
- name: Checkout
22-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2327
with:
2428
token: ${{ secrets.GITHUB_TOKEN }}
29+
2530
- name: Use Node.js
26-
uses: actions/setup-node@v3
31+
uses: actions/setup-node@v4
2732
with:
28-
node-version: ${{ matrix.config.node }}
33+
node-version: ${{ matrix.node }}
34+
2935
- name: Install Dependencies
3036
run: npm ci
31-
- name: Check API Docs
32-
run: npm run doc && git diff --exit-code
37+
3338
- name: Check Format
3439
run: npm run format && git diff --exit-code
40+
41+
- name: Check API Docs
42+
run: npm run doc && git diff --exit-code
43+
3544
- name: Lint
3645
run: npm run lint
46+
3747
- name: Test
38-
uses: coactions/setup-xvfb@v1
39-
with:
40-
run: npm test
48+
run: ${{ matrix.os == 'ubuntu-latest' && 'xvfb-run' || '' }} npm test
4149
env:
4250
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4351

4452
release:
4553
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
4654
runs-on: ubuntu-latest
47-
needs: [build]
55+
needs: [test]
4856
steps:
4957
- name: Checkout
50-
uses: actions/checkout@v3
58+
uses: actions/checkout@v4
5159
with:
5260
persist-credentials: false
61+
5362
- name: Use Node.js
54-
uses: actions/setup-node@v1
63+
uses: actions/setup-node@v4
5564
with:
56-
node-version: 18.x
65+
node-version: 22.14.0
66+
5767
- name: Install Dependencies
5868
run: npm ci
69+
5970
- name: Build
6071
run: npm run build
72+
6173
- name: Generate Typings
6274
run: npm run typings
75+
76+
- name: Load secrets from 1Password
77+
id: load_secrets
78+
uses: 1password/load-secrets-action@v3
79+
env:
80+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
81+
GITHUB_TOKEN: op://cicd_dankeboy36/GITHUB_TOKEN/credential
82+
NPM_TOKEN: op://cicd_dankeboy36/NPM_TOKEN/credential
83+
6384
- name: Release
6485
id: release
6586
run: npm run release
6687
env:
67-
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
68-
VSCE_PAT: ${{ secrets.VSCE_PAT }}
69-
OVSX_PAT: ${{ secrets.OVSX_PAT }}
70-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
88+
GITHUB_TOKEN: ${{ steps.load_secrets.outputs.GITHUB_TOKEN }}
89+
NPM_TOKEN: ${{ steps.load_secrets.outputs.NPM_TOKEN }}
7190
outputs:
7291
release_version: ${{ steps.release.outputs.release_version }}

.github/workflows/pr-title.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: PR Title
2+
permissions:
3+
contents: read
4+
pull-requests: write
25

36
on:
47
pull_request_target:
@@ -12,6 +15,6 @@ jobs:
1215
validate:
1316
runs-on: ubuntu-latest
1417
steps:
15-
- uses: amannn/action-semantic-pull-request@v3.1.0
18+
- uses: amannn/action-semantic-pull-request@d2ab30dcffc66150340abb5b947d518a3c3ce9cb # v3.1.0
1619
env:
1720
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.prettierrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,13 @@
1111
"typescript.tsdk": "./node_modules/typescript/lib",
1212
"editor.codeActionsOnSave": {
1313
"source.fixAll.eslint": "explicit"
14-
}
14+
},
15+
"[javascript][javascriptreact][json][typescript][typescriptreact][css]": {
16+
"editor.defaultFormatter": "esbenp.prettier-vscode",
17+
"editor.formatOnPaste": true,
18+
"editor.formatOnSave": true
19+
},
20+
"eslint.format.enable": true,
21+
"js/ts.implicitProjectConfig.checkJs": true,
22+
"js/ts.implicitProjectConfig.module": "NodeNext"
1523
}

.vscodeignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ src/**
77
.gitignore
88
.prettierignore
99
CHANGELOG.md
10-
webpack.config.js
1110
**/tsconfig.json
1211
**/.eslintrc.json
1312
**/*.map
1413
**/*.ts
15-
release.config.js
14+
*.config.*
1615
.nyc_output/**
1716
docs/**

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ If you want to use the Arduino APIs, you have to do the followings:
2727
1. Consume the `ArduinoContext` extension API in your VS Code extension:
2828

2929
```ts
30-
import * as vscode from 'vscode';
31-
import type { ArduinoContext } from 'vscode-arduino-api';
30+
import * as vscode from 'vscode'
31+
import type { ArduinoContext } from 'vscode-arduino-api'
3232
3333
export function activate(context: vscode.ExtensionContext) {
3434
const context: ArduinoContext = vscode.extensions.getExtension(
3535
'dankeboy36.vscode-arduino-api'
36-
)?.exports;
36+
)?.exports
3737
if (!context) {
3838
// Failed to load the Arduino API.
39-
return;
39+
return
4040
}
4141
4242
// Use the Arduino API in your VS Code extension.
@@ -47,19 +47,19 @@ If you want to use the Arduino APIs, you have to do the followings:
4747
vscode.commands.registerCommand('myExtension.showSketchPath', () => {
4848
vscode.window.showInformationMessage(
4949
`Sketch path: ${context.sketchPath}`
50-
);
50+
)
5151
})
52-
);
52+
)
5353
5454
// Listen on state change.
5555
// Register a listener to show the FQBN of the currently selected board as an information message.
5656
context.onDidChangeSketch((event) => {
5757
if (event.changedProperties.includes('board')) {
5858
vscode.window.showInformationMessage(
5959
`FQBN: ${event.object.board?.fqbn}`
60-
);
60+
)
6161
}
62-
});
62+
})
6363
}
6464
```
6565

docs/.nojekyll

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/README.md

Lines changed: 9 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# vscode-arduino-api
2-
3-
## Table of contents
1+
**vscode-arduino-api**
42

5-
### Classes
3+
---
64

7-
- [Disposable](classes/Disposable.md)
5+
# vscode-arduino-api
86

9-
### Interfaces
7+
## Interfaces
108

119
- [ArduinoContext](interfaces/ArduinoContext.md)
1210
- [ArduinoState](interfaces/ArduinoState.md)
@@ -16,125 +14,16 @@
1614
- [CompileSummary](interfaces/CompileSummary.md)
1715
- [ConfigOption](interfaces/ConfigOption.md)
1816
- [ConfigValue](interfaces/ConfigValue.md)
17+
- [Disposable](interfaces/Disposable.md)
1918
- [Event](interfaces/Event.md)
2019
- [Port](interfaces/Port.md)
2120
- [Programmer](interfaces/Programmer.md)
2221
- [SketchFolder](interfaces/SketchFolder.md)
2322
- [SketchFoldersChangeEvent](interfaces/SketchFoldersChangeEvent.md)
2423

25-
### Type Aliases
26-
27-
- [BoardIdentifier](README.md#boardidentifier)
28-
- [BuildProperties](README.md#buildproperties)
29-
- [Tool](README.md#tool)
30-
- [Version](README.md#version)
31-
32-
### Variables
33-
34-
- [ConfigOption](README.md#configoption)
35-
- [ConfigValue](README.md#configvalue)
36-
- [Port](README.md#port)
37-
- [Programmer](README.md#programmer)
38-
3924
## Type Aliases
4025

41-
### BoardIdentifier
42-
43-
Ƭ **BoardIdentifier**: `Nullable`\<`ApiBoard`, `"fqbn"`\>
44-
45-
Lightweight information to identify a board:
46-
47-
- The board's `name` is to provide a fallback for the UI. Preferably do not use this property for any sophisticated logic and board comparison. It must never participate in the board's identification.
48-
- The FQBN might contain boards config options if selected from the discovered ports (see [arduino/arduino-ide#1588](https://github.com/arduino/arduino-ide/issues/1588)).
49-
50-
---
51-
52-
### BuildProperties
53-
54-
Ƭ **BuildProperties**: `Readonly`\<`Record`\<`string`, `string`\>\>
55-
56-
Build properties used for compiling. The board-specific properties are retrieved from `board.txt` and `platform.txt`. For example, if the `board.txt` contains the `build.tarch=xtensa` entry for the `esp32:esp32:esp32` board, the record includes the `"build.tarch": "xtensa"` property.
57-
58-
---
59-
60-
### Tool
61-
62-
Ƭ **Tool**: `Readonly`\<`Pick`\<`ToolsDependencies`, `"name"` \| `"version"` \| `"packager"`\>\>
63-
64-
Required Tool dependencies of a board. See [`ToolsDependencies`](https://arduino.github.io/arduino-cli/latest/rpc/commands/#cc.arduino.cli.commands.v1.ToolsDependencies) for the CLI API.
65-
66-
---
67-
68-
### Version
69-
70-
Ƭ **Version**: `string`
71-
72-
Supposed to be a [SemVer](https://semver.org/) as a `string` but it's not enforced by Arduino. You might need to coerce the SemVer string.
73-
74-
## Variables
75-
76-
### ConfigOption
77-
78-
**ConfigOption**: `Object`
79-
80-
#### Type declaration
81-
82-
| Name | Type |
83-
| :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
84-
| `create` | (`base?`: \{ `option?`: `string` ; `optionLabel?`: `string` ; `values?`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }[] }) => [`ConfigOption`](interfaces/ConfigOption.md) |
85-
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`ConfigOption`](interfaces/ConfigOption.md) |
86-
| `encode` | (`message`: [`ConfigOption`](interfaces/ConfigOption.md), `writer?`: `Writer`) => `Writer` |
87-
| `fromJSON` | (`object`: `any`) => [`ConfigOption`](interfaces/ConfigOption.md) |
88-
| `fromPartial` | (`object`: \{ `option?`: `string` ; `optionLabel?`: `string` ; `values?`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }[] }) => [`ConfigOption`](interfaces/ConfigOption.md) |
89-
| `toJSON` | (`message`: [`ConfigOption`](interfaces/ConfigOption.md)) => `unknown` |
90-
91-
---
92-
93-
### ConfigValue
94-
95-
**ConfigValue**: `Object`
96-
97-
#### Type declaration
98-
99-
| Name | Type |
100-
| :------------ | :----------------------------------------------------------------------------------------------------------------------------------- |
101-
| `create` | (`base?`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }) => [`ConfigValue`](interfaces/ConfigValue.md) |
102-
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`ConfigValue`](interfaces/ConfigValue.md) |
103-
| `encode` | (`message`: [`ConfigValue`](interfaces/ConfigValue.md), `writer?`: `Writer`) => `Writer` |
104-
| `fromJSON` | (`object`: `any`) => [`ConfigValue`](interfaces/ConfigValue.md) |
105-
| `fromPartial` | (`object`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }) => [`ConfigValue`](interfaces/ConfigValue.md) |
106-
| `toJSON` | (`message`: [`ConfigValue`](interfaces/ConfigValue.md)) => `unknown` |
107-
108-
---
109-
110-
### Port
111-
112-
**Port**: `Object`
113-
114-
#### Type declaration
115-
116-
| Name | Type |
117-
| :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
118-
| `create` | (`base?`: \{ `address?`: `string` ; `hardwareId?`: `string` ; `label?`: `string` ; `properties?`: {} ; `protocol?`: `string` ; `protocolLabel?`: `string` }) => [`Port`](interfaces/Port.md) |
119-
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`Port`](interfaces/Port.md) |
120-
| `encode` | (`message`: [`Port`](interfaces/Port.md), `writer?`: `Writer`) => `Writer` |
121-
| `fromJSON` | (`object`: `any`) => [`Port`](interfaces/Port.md) |
122-
| `fromPartial` | (`object`: \{ `address?`: `string` ; `hardwareId?`: `string` ; `label?`: `string` ; `properties?`: {} ; `protocol?`: `string` ; `protocolLabel?`: `string` }) => [`Port`](interfaces/Port.md) |
123-
| `toJSON` | (`message`: [`Port`](interfaces/Port.md)) => `unknown` |
124-
125-
---
126-
127-
### Programmer
128-
129-
**Programmer**: `Object`
130-
131-
#### Type declaration
132-
133-
| Name | Type |
134-
| :------------ | :----------------------------------------------------------------------------------------------------------------------- |
135-
| `create` | (`base?`: \{ `id?`: `string` ; `name?`: `string` ; `platform?`: `string` }) => [`Programmer`](interfaces/Programmer.md) |
136-
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`Programmer`](interfaces/Programmer.md) |
137-
| `encode` | (`message`: [`Programmer`](interfaces/Programmer.md), `writer?`: `Writer`) => `Writer` |
138-
| `fromJSON` | (`object`: `any`) => [`Programmer`](interfaces/Programmer.md) |
139-
| `fromPartial` | (`object`: \{ `id?`: `string` ; `name?`: `string` ; `platform?`: `string` }) => [`Programmer`](interfaces/Programmer.md) |
140-
| `toJSON` | (`message`: [`Programmer`](interfaces/Programmer.md)) => `unknown` |
26+
- [BoardIdentifier](type-aliases/BoardIdentifier.md)
27+
- [BuildProperties](type-aliases/BuildProperties.md)
28+
- [Tool](type-aliases/Tool.md)
29+
- [Version](type-aliases/Version.md)

0 commit comments

Comments
 (0)