Skip to content

Commit d52c630

Browse files
fix: Added Open VSX build (#914) (#963)
Co-authored-by: Chris Johnston <chris@johnstoncode.com>
1 parent c453f9a commit d52c630

File tree

5 files changed

+574
-712
lines changed

5 files changed

+574
-712
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ jobs:
6868
GIT_AUTHOR_NAME: ${{ secrets.gitName }}
6969
GIT_COMMITTER_NAME: ${{ secrets.gitName }}
7070

71+
- name: Release Open VSX
72+
if: startsWith(matrix.os, 'ubuntu') && matrix.version == 'stable' && github.ref == 'refs/heads/master' && github.repository == 'JohnstonCode/svn-scm'
73+
run: |
74+
yarn add iconv-lite jschardet
75+
npx vsce package -o svn-scm-ovsx.vsix
76+
npx ovsx publish svn-scm-ovsx.vsix -p ${{ secrets.ovsxToken }}
77+
78+
- name: Upload Open VSX to release
79+
if: startsWith(matrix.os, 'ubuntu') && matrix.version == 'stable' && github.ref == 'refs/heads/master' && github.repository == 'JohnstonCode/svn-scm'
80+
uses: svenstaro/upload-release-action@v2
81+
with:
82+
repo_token: ${{ secrets.githubToken }}
83+
file: svn-scm-ovsx.vsix
84+
tag: ${{ github.ref }}
85+
7186
eslint:
7287
runs-on: ubuntu-latest
7388
if: "!contains(github.event.head_commit.message, 'skip ci')"
@@ -113,3 +128,14 @@ jobs:
113128
with:
114129
name: "svn-scm-${{ github.sha }}.vsix"
115130
path: "svn-scm.vsix"
131+
132+
- name: Package open-vsx extension
133+
run: |
134+
yarn add iconv-lite jschardet
135+
npx vsce package -o svn-scm-ovsx.vsix
136+
137+
- name: Upload open-vsx artifact
138+
uses: actions/upload-artifact@v1
139+
with:
140+
name: "svn-scm-ovsx-${{ github.sha }}.vsix"
141+
path: "svn-scm-ovsx.vsix"

.vscodeignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ vsc-extension-quickstart.md
2323
.dependabot/**
2424
images/docs/**
2525
bin
26-
node_modules
2726
webpack.config.js
2827

2928
out/**

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,7 @@
4949
"vscode:prepublish": "yarn run lint && yarn run build",
5050
"watch:css": "yarn run build:css -w"
5151
},
52-
"dependencies": {
53-
"chardet": "^1.2.1",
54-
"dayjs": "^1.8.32",
55-
"minimatch": "^3.0.4",
56-
"original-fs": "^1.0.0",
57-
"semver": "^7.2.1",
58-
"tmp": "0.2.1",
59-
"xml2js": "^0.4.19"
60-
},
52+
"dependencies": {},
6153
"devDependencies": {
6254
"@semantic-release/changelog": "^5.0.1",
6355
"@semantic-release/git": "^9.0.0",
@@ -70,24 +62,32 @@
7062
"@types/xml2js": "^0.4.4",
7163
"@typescript-eslint/eslint-plugin": "^3.8.0",
7264
"@typescript-eslint/parser": "^3.8.0",
65+
"chardet": "^1.2.1",
66+
"dayjs": "^1.8.32",
7367
"decache": "^4.6.0",
7468
"eslint": "^7.6.0",
7569
"eslint-config-prettier": "^6.11.0",
7670
"eslint-plugin-prettier": "^3.1.4",
7771
"glob": "^7.1.4",
7872
"iconv-lite-umd": "0.6.8",
7973
"milligram": "^1.4.1",
74+
"minimatch": "^3.0.4",
8075
"mocha": "^8.1.1",
8176
"node-sass": "^4.14.1",
77+
"original-fs": "^1.0.0",
78+
"ovsx": "^0.1.0-next.dacd2fd",
8279
"prettier": "^2.0.5",
8380
"prettylint": "^1.0.0",
8481
"semantic-release": "^17.1.1",
8582
"semantic-release-vsce": "^3.0.1",
83+
"semver": "^7.2.1",
84+
"tmp": "0.2.1",
8685
"ts-loader": "^8.0.2",
8786
"typescript": "^3.9.7",
8887
"vscode-test": "^1.4.0",
8988
"webpack": "^4.44.1",
90-
"webpack-cli": "^3.3.12"
89+
"webpack-cli": "^3.3.12",
90+
"xml2js": "^0.4.19"
9191
},
9292
"config": {
9393
"commitizen": {

src/vscodeModules.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,29 @@ function getNodeModule<T>(moduleName: string, showError = true): T | undefined {
1111
typeof __webpack_require__ === "function"
1212
? __non_webpack_require__
1313
: require;
14-
try {
15-
return r(`${env.appRoot}/node_modules.asar/${moduleName}`);
16-
} catch (err) {
17-
// Not in ASAR.
18-
}
19-
try {
20-
return r(`${env.appRoot}/node_modules/${moduleName}`);
21-
} catch (err) {
22-
if (showError) {
23-
window.showErrorMessage(`Missing dependency: ${moduleName}`);
14+
15+
const paths = [
16+
`${env.appRoot}/node_modules.asar/${moduleName}`,
17+
`${env.appRoot}/node_modules/${moduleName}`,
18+
moduleName
19+
];
20+
21+
for (const p of paths) {
22+
try {
23+
return r(p);
24+
} catch (err) {
25+
// Not in path.
2426
}
2527
}
28+
29+
if (showError) {
30+
window.showErrorMessage(`Missing dependency: ${moduleName}`);
31+
}
32+
2633
return undefined;
2734
}
2835

29-
export const keytar = getNodeModule("keytar") as typeof import("keytar");
36+
export const keytar = getNodeModule("keytar", false) as typeof import("keytar");
3037

3138
let iconv_lite = getNodeModule(
3239
"iconv-lite-umd",

0 commit comments

Comments
 (0)