Skip to content

Commit bb4cca2

Browse files
committed
workflow and refactor
1 parent b0bd5e9 commit bb4cca2

File tree

5 files changed

+118
-3
lines changed

5 files changed

+118
-3
lines changed

.github/workflows/build.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: "Build"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**/*.md'
9+
- '**/*.gitignore'
10+
- '**/*.gitattributes'
11+
pull_request:
12+
branches:
13+
- main
14+
paths-ignore:
15+
- '**/*.md'
16+
- '**/*.gitignore'
17+
- '**/*.gitattributes'
18+
workflow_dispatch:
19+
branches:
20+
- main
21+
paths-ignore:
22+
- '**/*.md'
23+
- '**/*.gitignore'
24+
- '**/*.gitattributes'
25+
26+
jobs:
27+
build:
28+
name: Build
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: write
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '20.x' # Updated Node.js version
40+
41+
- name: Install dependencies
42+
run: npm install
43+
44+
- name: Install vsce
45+
run: npm install -g @vscode/vsce
46+
47+
- name: Install cross-env
48+
run: npm install -g cross-env
49+
50+
- name: Package
51+
run: vsce package
52+
53+
- name: Extract Package Version
54+
id: package_version
55+
uses: Saionaro/[email protected]
56+
57+
- name: Publish
58+
if: ${{ github.event_name == 'push' }}
59+
run: npm run deploy
60+
env:
61+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
62+
63+
- name: Upload artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: ${{ github.event.repository.name }}.vsix
67+
path: |
68+
**/*.vsix
69+
70+
- name: 🏷️ Tag and Release
71+
id: tag_release
72+
uses: softprops/[email protected]
73+
with:
74+
tag_name: ${{ steps.package_version.outputs.version }}
75+
generate_release_notes: true
76+
files: |
77+
**/*.vsix

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MIT License
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
{
2+
"author": {
3+
"name": "Tim Heuer"
4+
},
5+
"publisher": "timheuer",
6+
"license": "MIT",
7+
"qna": "https://github.com/timheuer/jsondbg/issues",
28
"name": "jsondbg",
39
"displayName": "JSON Debug Visualizer",
410
"description": "Debug variable visualizer for JSON",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/timheuer/jsondbg.git"
14+
},
515
"icon": "resources/icon.png",
616
"version": "0.0.1",
717
"engines": {
@@ -34,7 +44,8 @@
3444
"watch": "tsc -watch -p ./",
3545
"pretest": "npm run compile && npm run lint",
3646
"lint": "eslint src",
37-
"test": "vscode-test"
47+
"test": "vscode-test",
48+
"deploy": "vsce publish"
3849
},
3950
"devDependencies": {
4051
"@types/vscode": "^1.97.0",
File renamed without changes.

src/jsonViewer.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,18 @@ export function registerViewJsonCommand(context: vscode.ExtensionContext): void
4646
// Create and show the JSON viewer
4747
createJsonViewer(jsonObj, context.extensionUri);
4848
} catch (error) {
49-
vscode.window.showErrorMessage('Failed to parse JSON: ' + error.message);
49+
let errorMessage = 'Failed to parse JSON';
50+
if (error instanceof Error) {
51+
errorMessage += ': ' + error.message;
52+
}
53+
vscode.window.showErrorMessage(errorMessage);
5054
}
5155
} catch (error) {
52-
vscode.window.showErrorMessage('Error processing variable: ' + error.message);
56+
let errorMessage = 'Error processing variable';
57+
if (error instanceof Error) {
58+
errorMessage += ': ' + error.message;
59+
}
60+
vscode.window.showErrorMessage(errorMessage);
5361
}
5462
});
5563

0 commit comments

Comments
 (0)