diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a27566b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: "Release version" + required: true + type: string + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup NodeJS + uses: actions/setup-node@v3 + + - name: Configure Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Generate Changelog and GH Release + run: | + npx changelogen@latest --release --push -r ${{ inputs.version }} + npx changelogen@latest gh release --token ${{ secrets.GITHUB_TOKEN }} + + - name: Release VS Code Package + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + run: | + npx @vscode/vsce@latest publish diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b88ea4..aebfff5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,25 @@ All notable changes to the "vue3-vscode-snippets" extension will be documented in this file. +## v0.4.0 + +[compare changes](https://github.com/ExEr7um/vue3-vscode-snippets/compare/v0.3.1...v0.4.0) + + +### 🚀 Enhancements + + - Update `defineEmits` to Vue 3.3 syntax ([#43](https://github.com/ExEr7um/vue3-vscode-snippets/pull/43)) + - Add `Vitest` snippets ([#44](https://github.com/ExEr7um/vue3-vscode-snippets/pull/44)) + - Add Vue 3.3 snippets ([#45](https://github.com/ExEr7um/vue3-vscode-snippets/pull/45)) + +### 🏡 Chore + + - New release flow ([#46](https://github.com/ExEr7um/vue3-vscode-snippets/pull/46)) + +### ❤️ Contributors + +- Vasily Kuzin ([@ExEr7um](http://github.com/ExEr7um)) + ## `v0.3.1` ### Fixed diff --git a/README.md b/README.md index d16aace..ff2e2f0 100644 --- a/README.md +++ b/README.md @@ -59,25 +59,27 @@ These snippets were made to speed up Vue 3 development. With it you can write bo ### Script -| Snippet | Purpose | -| ------------------------ | ------------------------------------------- | -| `vref` | Vue `ref` | -| `vreactive` | Vue `reactive` | -| `vcomputed` | Vue `computed` | -| `vwatch` | Watcher | -| `vwatcheffect` | Watch Effect | -| `vonmounted` | onMounted hook | -| `vonbeforemount` | onBeforeMount hook | -| `vonbeforeupdate` | onBeforeUpdate hook | -| `vonupdated` | onUpdated hook | -| `vonerrorcaptured` | onErrorCaptured hook | -| `vonunmounted` | onUnmounted hook | -| `vonbeforeunmount` | onBeforeUnmount hook | -| `vdefineprops` | Define props | -| `vdefineemits` | Define emits | -| `vdefineemits-nopayload` | Define emits with no payload | -| `vsingleemit` | Single emit for defineEmits | -| `vsingleemit-nopayload` | Single emit for defineEmits with no payload | +| Snippet | Purpose | +| ------------------ | --------------------------- | +| `vref` | Vue `ref` | +| `vreactive` | Vue `reactive` | +| `vcomputed` | Vue `computed` | +| `vwatch` | Watcher | +| `vwatcheffect` | Watch Effect | +| `vonmounted` | onMounted hook | +| `vonbeforemount` | onBeforeMount hook | +| `vonbeforeupdate` | onBeforeUpdate hook | +| `vonupdated` | onUpdated hook | +| `vonerrorcaptured` | onErrorCaptured hook | +| `vonunmounted` | onUnmounted hook | +| `vonbeforeunmount` | onBeforeUnmount hook | +| `vdefineprops` | Define props | +| `vdefineemits` | Define emits | +| `vsingleemit` | Single emit for defineEmits | +| `vdefineslots` | Define slots | +| `vsingleslot` | Single slot for defineSlots | +| `vdefineoptions` | Define Options | +| `vdefinemodel` | Define Model | ### CSS @@ -153,6 +155,43 @@ These snippets were made to speed up Vue 3 development. With it you can write bo | `hcontrols-text` | Histoire controls - Text | | `hcontrols-textarea` | Histoire controls - Textarea | +### Vitest + +| Snippet | Purpose | +| ------------------------- | ------------------------------ | +| `viconfig` | Vitest config for Vue 3 | +| `viconfig-nuxt` | Vitest config for Nuxt 3 | +| `videscribe` | Vitest Describe | +| `videscribe-concurrent` | Vitest Describe - Concurrent | +| `viit` | Vitest It | +| `viit-concurrent` | Vitest It - Concurrent | +| `viit-async` | Vitest It - Async | +| `viit-async-concurrent` | Vitest It - Async Concurrent | +| `viit-todo` | Vitest It - Todo | +| `vitest` | Vitest Test | +| `vitest-concurrent` | Vitest Test - Concurrent | +| `vitest-async` | Vitest Test - Async | +| `vitest-async-concurrent` | Vitest Test - Async Concurrent | +| `vitest-todo` | Vitest Test - Todo | +| `visnapshot` | Vitest Match Snapshot | +| `visnapshot-inline` | Vitest Match Snapshot - Inline | + +### Vitest Vue + +| Snippet | Purpose | +| ------------- | ------------------------ | +| `vimount` | Vue Test Utils `mount` | +| `vicomponent` | Vue Test Utils Component | + +### Vitest Nuxt + +| Snippet | Purpose | +| -------------------- | ------------------------------ | +| `vimount-suspended` | nuxt-vitest `mountSuspended` | +| `vimocknuxtimport` | nuxt-vitest `mockNuxtImport` | +| `vimockcomponent` | nuxt-vitest `mockComponent` | +| `viregisterendpoint` | nuxt-vitest `registerEndpoint` | + ## Contributing This is an open source project open to anyone. Contributors are welcome on [GitHub](https://github.com/exer7um/vue3-vscode-snippets). diff --git a/changelog.config.json b/changelog.config.json new file mode 100644 index 0000000..d1a1dbf --- /dev/null +++ b/changelog.config.json @@ -0,0 +1,5 @@ +{ + "templates": { + "commitMessage": "release: `v{{newVersion}}`" + } +} diff --git a/package.json b/package.json index 45301c8..dcb15d3 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Vue 3 VS Code Snippets", "description": "Vue 3 snippets for VS Code", "icon": "images/vue-logo.png", - "version": "0.3.1", + "version": "0.4.0", "publisher": "exer7um", "repository": { "type": "git", @@ -118,7 +118,31 @@ { "language": "typescript", "path": "./snippets/histoire/histoire-script.code-snippets" + }, + { + "language": "javascript", + "path": "./snippets/vitest/vitest.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/vitest/vitest.code-snippets" + }, + { + "language": "javascript", + "path": "./snippets/vitest/vue.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/vitest/vue.code-snippets" + }, + { + "language": "javascript", + "path": "./snippets/vitest/nuxt.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/vitest/nuxt.code-snippets" } ] } -} +} \ No newline at end of file diff --git a/snippets/vitest/nuxt.code-snippets b/snippets/vitest/nuxt.code-snippets new file mode 100644 index 0000000..b3f26a4 --- /dev/null +++ b/snippets/vitest/nuxt.code-snippets @@ -0,0 +1,49 @@ +{ + "Vitest Config - Nuxt 3": { + "prefix": "viconfig-nuxt", + "body": [ + "import { defineVitestConfig } from 'nuxt-vitest/config'", + "", + "export default defineVitestConfig({", + "\ttest: {", + "\t\tenvironment: 'nuxt'", + "\t}", + "})" + ], + "description": "Vitest config for Nuxt 3" + }, + "Vitest Nuxt Mount Suspended": { + "prefix": "vimount-suspended", + "body": [ + "const wrapper = await mountSuspended(${0})", + ], + "description": "nuxt-vitest mountSuspended" + }, + "Vitest Nuxt Mock Import": { + "prefix": "vimocknuxtimport", + "body": [ + "mockNuxtImport('${1:functionName}', () => {", + "\treturn () => {", + "\t\treturn { ${0} }", + "\t}", + "})" + ], + "description": "nuxt-vitest mockNuxtImport" + }, + "Vitest Nuxt Mock Component": { + "prefix": "vimockcomponent", + "body": [ + "mockComponent('${0}')", + ], + "description": "nuxt-vitest mockComponent" + }, + "Vitest Nuxt Register Endpoint": { + "prefix": "viregisterendpoint", + "body": [ + "registerEndpoint('/${1:endpoint}/', () => {", + "\t{0}", + "})" + ], + "description": "nuxt-vitest registerEndpoint" + }, +} diff --git a/snippets/vitest/vitest.code-snippets b/snippets/vitest/vitest.code-snippets new file mode 100644 index 0000000..ce6944c --- /dev/null +++ b/snippets/vitest/vitest.code-snippets @@ -0,0 +1,131 @@ +{ + "Vitest Config - Vue 3": { + "prefix": "viconfig", + "body": [ + "import { defineConfig } from 'vitest/config'", + "", + "export default defineConfig({", + "\t${0}", + "})" + ], + "description": "Vitest config for Vue 3" + }, + "Vitest Describe": { + "prefix": "videscribe", + "body": [ + "describe('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Describe" + }, + "Vitest Describe - Concurrent": { + "prefix": "videscribe-concurrent", + "body": [ + "describe.concurrent('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Describe Concurrent" + }, + "Vitest It": { + "prefix": "viit", + "body": [ + "it('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest It" + }, + "Vitest It - Concurrent": { + "prefix": "viit-concurrent", + "body": [ + "it.concurrent('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest It Concurrent" + }, + "Vitest It - Async": { + "prefix": "viit-async", + "body": [ + "it('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest It Async" + }, + "Vitest It - Async Concurrent": { + "prefix": "viit-async-concurrent", + "body": [ + "it.concurrent('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest It Async Concurrent" + }, + "Vitest It - Todo": { + "prefix": "viit-todo", + "body": [ + "it.todo('${1:name}')" + ], + "description": "Vitest It Todo" + }, + "Vitest Test": { + "prefix": "vitest", + "body": [ + "test('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test" + }, + "Vitest Test - Concurrent": { + "prefix": "vitest-concurrent", + "body": [ + "test.concurrent('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test Concurrent" + }, + "Vitest Test - Async": { + "prefix": "vitest-async", + "body": [ + "test('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test Async" + }, + "Vitest Test - Async Concurrent": { + "prefix": "vitest-async-concurrent", + "body": [ + "test.concurrent('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test Async Concurrent" + }, + "Vitest Test - Todo": { + "prefix": "vitest-todo", + "body": [ + "test.todo('${1:name}')" + ], + "description": "Vitest Test Todo" + }, + "Vitest Match Snapshot": { + "prefix": "visnapshot", + "body": [ + "expect(${0}).toMatchSnapshot()" + ], + "description": "Vitest Match Snapshot" + }, + "Vitest Match Snapshot - Inline": { + "prefix": "visnapshot-inline", + "body": [ + "expect(${0}).toMatchInlineSnapshot()" + ], + "description": "Vitest Match Inline Snapshot" + }, +} diff --git a/snippets/vitest/vue.code-snippets b/snippets/vitest/vue.code-snippets new file mode 100644 index 0000000..ea6ec08 --- /dev/null +++ b/snippets/vitest/vue.code-snippets @@ -0,0 +1,22 @@ +{ + "Vitest Vue Mount": { + "prefix": "vimount", + "body": [ + "const wrapper = mount(${0})", + ], + "description": "Vue Test Utils Mount" + }, + "Vitest Test Component": { + "prefix": "vicomponent", + "body": [ + "{", + "\ttemplate: '${0}'", + "\t\tdata() {", + "\t\t\treturn {", + "\t\t${2:variable}", + "\t}", + "}" + ], + "description": "Vue Test Utils Component" + } +} diff --git a/snippets/vue/vue-script.code-snippets b/snippets/vue/vue-script.code-snippets index cb5fb62..f9e6325 100644 --- a/snippets/vue/vue-script.code-snippets +++ b/snippets/vue/vue-script.code-snippets @@ -111,32 +111,48 @@ "prefix": "vdefineemits", "body": [ "defineEmits<{", - "\t(e: '${1:eventName}', ${2:payloadName}: ${3:payloadType}): void", + "\t${1:eventName}: [${0}]", "}>()" ], "description": "Vue defineEmits" }, - "Vue Define Emits - No Payload": { - "prefix": "vdefineemits-nopayload", + "Vue Single Emit": { + "prefix": "vsingleemit", "body": [ - "defineEmits<{", - "\t(e: '${1:eventName}'): void", + "${1:eventName}: [${0}]", + ], + "description": "Vue single emit for defineEmits" + }, + "Vue Define Slots": { + "prefix": "vdefineslots", + "body": [ + "defineSlots<{", + "\tdefault: (props: { ${0} }) => any", "}>()" ], - "description": "Vue defineEmits with no payload" + "description": "Vue defineSlots" }, - "Vue Single Emit": { - "prefix": "vsingleemit", + "Vue Single Slot": { + "prefix": "vsingleslot", "body": [ - "(e: '${1:eventName}', ${2:payloadName}: ${3:payloadType}): void", + "\t${1:slotName}: (props: { ${0} }) => any", ], - "description": "Vue single emit for defineEmits" + "description": "Vue single slot for defineSlots" + }, + "Vue Define Options": { + "prefix": "vdefineoptions", + "body": [ + "defineOptions({", + "\t${0}", + "})" + ], + "description": "Vue defineOptions" }, - "Vue Single Emit - No Payload": { - "prefix": "vsingleemit-nopayload", + "Vue Define Model": { + "prefix": "vdefinemodel", "body": [ - "(e: '${1:eventName}'): void", + "const modelValue = defineModel()", ], - "description": "Vue single emit for defineEmits with no payload" + "description": "Vue defineModel" }, -} \ No newline at end of file +}