diff --git a/.github/release.yml b/.github/release.yml deleted file mode 100644 index 59a7a23..0000000 --- a/.github/release.yml +++ /dev/null @@ -1,14 +0,0 @@ -changelog: - categories: - - title: Features - labels: - - Feature - - title: Fixed - labels: - - Bug - - title: Documentation - labels: - - Documentation - - title: Other - labels: - - "*" diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 0000000..dbd1da5 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,15 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: Release version + required: true + type: string + +jobs: + changelog: + uses: ExEr7um/workflows/.github/workflows/changelog.yml@v0.7.0 + with: + version: ${{ inputs.version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..50a2f0d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,10 @@ +name: CI + +on: + pull_request: + branches: + - main + +jobs: + lint: + uses: ExEr7um/workflows/.github/workflows/frontend-lint.yml@v0.7.0 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..044dbd6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,12 @@ +name: Publish to VSCode Marketplace + +on: + workflow_run: + workflows: [Release] + types: [completed] + +jobs: + publish: + uses: ExEr7um/workflows/.github/workflows/publish-vscode.yml@v0.7.0 + secrets: + VSCE_PAT: ${{ secrets.VSCE_PAT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index a27566b..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,39 +0,0 @@ -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/.github/workflows/semantic-pr-title.yml b/.github/workflows/semantic-pr-title.yml new file mode 100644 index 0000000..692f123 --- /dev/null +++ b/.github/workflows/semantic-pr-title.yml @@ -0,0 +1,14 @@ +name: Семантический заголовок PR + +on: + pull_request: + branches: + - main + types: + - opened + - edited + - synchronize + +jobs: + semantic-pr-title: + uses: ExEr7um/workflows/.github/workflows/semantic-pr-title.yml@v0.7.0 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..f2d66f6 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +bun run lint-staged diff --git a/.prettierignore b/.prettierignore index 9ca1f56..32e6d82 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,12 @@ -*.code-snippets \ No newline at end of file +*.code-snippets +bun.lockb +bunfig.toml +CHANGELOG.md +LICENSE + +# From .gitignore +.env +*.log* +.eslintcache +*.DS_Store +node_modules diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e191b5..6652829 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,17 +1,11 @@ -// A launch configuration that launches the extension inside a new window -// Use IntelliSense to learn about possible attributes. -// Hover to view descriptions of existing attributes. -// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "0.2.0", - "configurations": [ - { - "name": "Extension", - "type": "extensionHost", - "request": "launch", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ] - } - ] -} \ No newline at end of file + "configurations": [ + { + "args": ["--extensionDevelopmentPath=${workspaceFolder}"], + "name": "Extension", + "request": "launch", + "type": "extensionHost" + } + ], + "version": "0.2.0" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 78374a0..86b5799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,38 @@ All notable changes to the "vue3-vscode-snippets" extension will be documented in this file. +## v0.7.0 + +[compare changes](https://github.com/ExEr7um/vue3-vscode-snippets/compare/v0.6.0...v0.7.0) + +### 🚀 Enhancements + +- **Vitest:** Add function to Vitest `todo` snippets ([#66](https://github.com/ExEr7um/vue3-vscode-snippets/pull/66)) +- **Vitest:** Add base Vitest snippets ([#67](https://github.com/ExEr7um/vue3-vscode-snippets/pull/67)) + +### 🩹 Fixes + +- **Vitest:** ⚠️ Remove config snippets ([dd5410c](https://github.com/ExEr7um/vue3-vscode-snippets/commit/dd5410c)) + +### 🏡 Chore + +- Setup Prettier ([71525f2](https://github.com/ExEr7um/vue3-vscode-snippets/commit/71525f2)) +- Setup ESLint ([4ac649a](https://github.com/ExEr7um/vue3-vscode-snippets/commit/4ac649a)) +- Remove unused `release.yml` file ([33fe21f](https://github.com/ExEr7um/vue3-vscode-snippets/commit/33fe21f)) +- Migrate to `ExEr7um/workflows` for CI ([#65](https://github.com/ExEr7um/vue3-vscode-snippets/pull/65)) +- Add `scopeMap` to Changelogen config ([4587bff](https://github.com/ExEr7um/vue3-vscode-snippets/commit/4587bff)) +- Setup pre-commit hooks ([b8d5d39](https://github.com/ExEr7um/vue3-vscode-snippets/commit/b8d5d39)) +- Setup CI ([#68](https://github.com/ExEr7um/vue3-vscode-snippets/pull/68)) +- Setup semantic PR title check ([#69](https://github.com/ExEr7um/vue3-vscode-snippets/pull/69)) + +#### ⚠️ Breaking Changes + +- **Vitest:** ⚠️ Remove config snippets ([dd5410c](https://github.com/ExEr7um/vue3-vscode-snippets/commit/dd5410c)) + +### ❤️ Contributors + +- Vasily Kuzin ([@ExEr7um](http://github.com/ExEr7um)) + ## v0.6.0 [compare changes](https://github.com/ExEr7um/vue3-vscode-snippets/compare/v0.5.1...v0.6.0) diff --git a/README.md b/README.md index 28a7794..41a3fe8 100644 --- a/README.md +++ b/README.md @@ -164,24 +164,25 @@ These snippets were made to speed up Vue 3 development. With it you can write bo ### 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 | +| Snippet | Purpose | +| ------------------------- | --------------------------------------- | +| `vibase` | Base for Vitest file | +| `vibase-vue` | Base for Vitest file for Vue component | +| `vibase-nuxt` | Base for Vitest file for Nuxt component | +| `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 diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..2bc69d3 Binary files /dev/null and b/bun.lockb differ diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..b6874be --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,2 @@ +[install] +exact = true diff --git a/changelog.config.json b/changelog.config.json index d1a1dbf..ad6fc00 100644 --- a/changelog.config.json +++ b/changelog.config.json @@ -1,4 +1,11 @@ { + "scopeMap": { + "histoire": "Histoire", + "nuxt": "Nuxt", + "pinia": "Pinia", + "vitest": "Vitest", + "vue": "Vue" + }, "templates": { "commitMessage": "release: `v{{newVersion}}`" } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..19b9018 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,3 @@ +import exer7umConfig from "@exer7um/eslint-config" + +export default exer7umConfig diff --git a/package.json b/package.json index 61ad8f4..368ed2b 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,24 @@ { "name": "vue-3-vscode-snippets", "displayName": "Vue 3 VS Code Snippets", + "version": "0.7.0", "description": "Vue 3 snippets for VS Code", - "icon": "images/vue-logo.png", - "version": "0.6.0", - "publisher": "exer7um", + "categories": [ + "Snippets" + ], + "keywords": [ + "Vue", + "Vue 3", + "Nuxt", + "Nuxt 3", + "Pinia", + "Vue Snippets", + "Vue 3 snippets", + "Nuxt snippets", + "Nuxt 3 snippets", + "Pinia snippets", + "Composition API" + ], "repository": { "type": "git", "url": "https://github.com/ExEr7um/vue3-vscode-snippets.git" @@ -31,25 +45,15 @@ "url": "https://github.com/pixel-fabian" } ], - "engines": { - "vscode": "^1.69.0" + "publisher": "exer7um", + "type": "module", + "scripts": { + "eslint": "eslint . --max-warnings=0", + "eslint:fix": "eslint . --max-warnings=0 --fix", + "postinstall": "husky", + "prettier": "prettier --check --ignore-unknown --no-error-on-unmatched-pattern *", + "prettier:write": "prettier --write --ignore-unknown --no-error-on-unmatched-pattern *" }, - "keywords": [ - "Vue", - "Vue 3", - "Nuxt", - "Nuxt 3", - "Pinia", - "Vue Snippets", - "Vue 3 snippets", - "Nuxt snippets", - "Nuxt 3 snippets", - "Pinia snippets", - "Composition API" - ], - "categories": [ - "Snippets" - ], "contributes": { "snippets": [ { @@ -149,5 +153,20 @@ "path": "./snippets/vitest/nuxt.code-snippets" } ] - } -} \ No newline at end of file + }, + "lint-staged": { + "*.{vue,js,jsx,cjs,mjs,ts,json}": "eslint --cache --fix", + "*": "prettier --write --ignore-unknown" + }, + "prettier": "@exer7um/prettier-config", + "devDependencies": { + "@exer7um/eslint-config": "1.1.1", + "@exer7um/prettier-config": "0.4.2", + "husky": "9.0.11", + "lint-staged": "15.2.2" + }, + "engines": { + "vscode": "^1.69.0" + }, + "icon": "images/vue-logo.png" +} diff --git a/snippets/vitest/nuxt.code-snippets b/snippets/vitest/nuxt.code-snippets index b3f26a4..a386740 100644 --- a/snippets/vitest/nuxt.code-snippets +++ b/snippets/vitest/nuxt.code-snippets @@ -1,17 +1,4 @@ { - "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": [ @@ -46,4 +33,27 @@ ], "description": "nuxt-vitest registerEndpoint" }, + "Vitest Nuxt Base": { + "prefix": "vibase-nuxt", + "body": [ + "// @vitest-environment nuxt", + "import type { VueWrapper } from '@vue/test-utils'", + "import { mountSuspended } from '@nuxt/test-utils/runtime'", + "import { afterEach, beforeEach, describe, expect } from 'vitest'", + "import ${TM_FILENAME/\\..*//} from '~/components/${TM_FILENAME/\\..*//}.vue'", + "", + "describe('${TM_FILENAME/\\..*//}', () => {", + "\tlet wrapper: VueWrapper", + "\t", + "\tbeforeEach(async () => {", + "\t\twrapper = await mountSuspended(${TM_FILENAME/\\..*//})", + "\t})", + "\t", + "\tafterEach(() => {", + "\t\twrapper.unmount()", + "\t})", + "})" + ], + "description": "Base for Vitest file for Vue component" + } } diff --git a/snippets/vitest/vitest.code-snippets b/snippets/vitest/vitest.code-snippets index 8275677..b029970 100644 --- a/snippets/vitest/vitest.code-snippets +++ b/snippets/vitest/vitest.code-snippets @@ -1,15 +1,4 @@ { - "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": [ @@ -67,7 +56,7 @@ "Vitest It - Todo": { "prefix": "viit-todo", "body": [ - "it.todo('${1:name}')" + "it.todo('${1:name}', () => {})" ], "description": "Vitest It Todo" }, @@ -110,7 +99,7 @@ "Vitest Test - Todo": { "prefix": "vitest-todo", "body": [ - "test.todo('${1:name}')" + "test.todo('${1:name}', () => {})" ], "description": "Vitest Test Todo" }, @@ -128,4 +117,16 @@ ], "description": "Vitest Match Inline Snapshot" }, + "Vitest Base": { + "prefix": "vibase", + "body": [ + "// @vitest-environment node", + "import { describe, expect } from 'vitest'", + "", + "describe('${TM_FILENAME/\\..*//}', () => {", + "\t${0}", + "})" + ], + "description": "Base for Vitest file" + }, } diff --git a/snippets/vitest/vue.code-snippets b/snippets/vitest/vue.code-snippets index ea6ec08..71e1a57 100644 --- a/snippets/vitest/vue.code-snippets +++ b/snippets/vitest/vue.code-snippets @@ -18,5 +18,27 @@ "}" ], "description": "Vue Test Utils Component" + }, + "Vitest Vue Base": { + "prefix": "vibase-vue", + "body": [ + "import type { VueWrapper } from '@vue/test-utils'", + "import { mount } from '@vue/test-utils'", + "import { afterEach, beforeEach, describe, expect } from 'vitest'", + "import ${TM_FILENAME/\\..*//} from '~/components/${TM_FILENAME/\\..*//}.vue'", + "", + "describe('${TM_FILENAME/\\..*//}', () => {", + "\tlet wrapper: VueWrapper", + "\t", + "\tbeforeEach(() => {", + "\t\twrapper = mount(${TM_FILENAME/\\..*//})", + "\t})", + "\t", + "\tafterEach(() => {", + "\t\twrapper.unmount()", + "\t})", + "})" + ], + "description": "Base for Vitest file for Vue component" } }