Skip to content

Commit 2180617

Browse files
feat: Implement GitHub Actions for extension publishing and update the @conectate/components/ct-lit snippet definition.
1 parent 91f2f64 commit 2180617

5 files changed

Lines changed: 86 additions & 32 deletions

File tree

.github/workflows/publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Extension
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
workflow_dispatch: # Allows manual triggering from the GitHub Actions tab
8+
9+
jobs:
10+
publish:
11+
name: Build, Publish and Release
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write # Needed to create a GitHub Release
15+
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v3
22+
with:
23+
version: 8
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
cache: "pnpm"
29+
30+
- name: Install Dependencies
31+
run: pnpm install
32+
33+
- name: Package Extension
34+
run: pnpm exec vsce package -o lit-snippets.vsix
35+
36+
- name: Publish to Visual Studio Marketplace
37+
run: pnpm exec vsce publish --packagePath lit-snippets.vsix
38+
env:
39+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
40+
41+
- name: Publish to Open VSX
42+
run: pnpx -y ovsx publish lit-snippets.vsix
43+
env:
44+
OVSX_PAT: ${{ secrets.OVSX_PAT }}
45+
46+
- name: Create GitHub Release
47+
uses: softprops/action-gh-release@v2
48+
with:
49+
files: lit-snippets.vsix
50+
generate_release_notes: true

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.vscode/test.code-snippets
22
node_modules
33
.history
4-
*.vsix
4+
*.vsix
5+
.DS_Store

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ Lit snippets for Visual Studio Code.
2020

2121
### Element and Its Property Snippets
2222

23-
| Trigger | Snippet |
24-
| ------------- | ------------------------------------------------------------ |
25-
| litbase | Create LitElement subclasss |
26-
| littemplate | Create LitElement subclasss with styles and render fn |
27-
| litprop | Generate property |
28-
| litquery | Generate @query property |
29-
| litqueryall | Generate @queryall property |
30-
| litrender | Generate render function with lit-html |
31-
| litstyles | Generate `styles` static property |
32-
| ctlittemplate | Create @conectate/ct-lit subclasss with styles and render fn |
23+
| Trigger | Snippet |
24+
| ------------- | ----------------------------------------------------------------------- |
25+
| litbase | Create LitElement subclasss |
26+
| littemplate | Create LitElement subclasss with styles and render fn |
27+
| litprop | Generate property |
28+
| litquery | Generate @query property |
29+
| litqueryall | Generate @queryall property |
30+
| litrender | Generate render function with lit-html |
31+
| litstyles | Generate `styles` static property |
32+
| ctlittemplate | Create @conectate/components/ct-lit subclasss with styles and render fn |
3333

3434
### Event Related Snippets
3535

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lit-snippets",
3-
"version": "1.0.4",
3+
"version": "2.0.0",
44
"displayName": "Lit Snippets",
55
"description": "Lit Snippets for VS Code",
66
"categories": [
@@ -62,6 +62,7 @@
6262
},
6363
"scripts": {
6464
"pack": "vsce package",
65+
"build": "vsce package -o lit-snippets-v$npm_package_version.vsix",
6566
"dist": "vsce publish"
6667
}
6768
}

src/typescript.json

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,35 @@
4242
],
4343
"description": "New LitElement subclass with lit-html"
4444
},
45-
46-
"Create @conectate/ct-lit Component": {
45+
"Create @conectate/components/ct-lit Component": {
4746
"prefix": "ctlittemplate",
4847
"body": [
49-
"import { CtLit, html, css, customElement, property, state } from \"@conectate/ct-lit\";",
50-
"",
51-
"@customElement(\"${TM_FILENAME_BASE}\")",
52-
"export class ${TM_FILENAME_BASE/([a-z]*)(-)?/${1:/capitalize}/g} extends CtLit {",
53-
"\tstatic styles = [",
54-
"\t\tcss`",
55-
"\t\t\t:host {",
56-
"\t\t\t\tdisplay: block;",
57-
"\t\t\t}",
58-
"\t\t`",
59-
"\t];",
60-
"",
61-
"\trender() {",
62-
"\t\treturn html`${0}`;",
63-
"\t}",
64-
"}",
48+
"import { LitElement, html, css, customElement, property, state } from \"@conectate/components/ct-lit\";",
49+
"",
50+
"@customElement(\"${TM_FILENAME_BASE}\")",
51+
"export class ${TM_FILENAME_BASE/([a-z]*)(-)?/${1:/capitalize}/g} extends LitElement {",
52+
"\tstatic styles = [",
53+
"\t\tcss`",
54+
"\t\t\t:host {",
55+
"\t\t\t\tdisplay: block;",
56+
"\t\t\t}",
57+
"\t\t`",
58+
"\t];",
59+
"",
60+
"@property({ type: String }) public text = \"\";",
61+
"@state() private _private = \"\";",
62+
"",
63+
"\trender() {",
64+
"\t\treturn html`${0}`;",
65+
"\t}",
66+
"}",
6567
"",
6668
"declare global {",
6769
"\tinterface HTMLElementTagNameMap {",
6870
"\t\t\"${TM_FILENAME_BASE}\": ${TM_FILENAME_BASE/([a-z]*)(-)?/${1:/capitalize}/g};",
6971
"\t}",
7072
"}"
71-
],
73+
],
7274
"description": "New CtLit subclass"
7375
},
7476
"Generate LitElement Property": {
@@ -119,4 +121,4 @@
119121
],
120122
"description": "Generate attributeChangedCallback(): Invoked when component attribute changes."
121123
}
122-
}
124+
}

0 commit comments

Comments
 (0)