diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d530f1ad..934ded9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,58 +16,70 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - node: [18] + node: [20, 22] steps: - name: Checkout - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v4.2.2 - name: Setup Node.js ${{ matrix.node }} - uses: actions/setup-node@v3.5.0 + uses: actions/setup-node@v4.2.0 with: node-version: ${{ matrix.node }} - - uses: pnpm/action-setup@v2.2.2 + - uses: pnpm/action-setup@v4.1.0 with: - version: 7.x.x run_install: true - name: Test run: pnpm test:coverage - name: Upload code coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 lint: runs-on: ubuntu-latest name: Lint source code steps: - name: Checkout - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v4.2.2 - name: Setup Node.js - uses: actions/setup-node@v3.5.0 - - uses: pnpm/action-setup@v2.2.2 + uses: actions/setup-node@v4.2.0 + - uses: pnpm/action-setup@v4.1.0 with: - version: 7.x.x run_install: true - name: Lint run: pnpm lint + publish: + runs-on: ubuntu-latest + name: Publish test build to pkg.pr.new + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + - name: Setup Node.js + uses: actions/setup-node@v4.2.0 + - uses: pnpm/action-setup@v4.1.0 + with: + run_install: true + + - name: Build + run: pnpm build + - name: Publish + run: pnpx pkg-pr-new publish + test-examples: runs-on: ubuntu-latest name: Test build of example projects steps: - name: Checkout unplugin-fluent-vue - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v4.2.2 - name: Checkout examples - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v4.2.2 with: repository: fluent-vue/examples path: examples - name: Setup Node.js - uses: actions/setup-node@v3.5.0 - - uses: pnpm/action-setup@v2.2.2 - with: - version: 7.x.x - run_install: true + uses: actions/setup-node@v4.2.0 + - uses: pnpm/action-setup@v4.1.0 - name: Test - run: node scripts/build-examples.mjs + run: node scripts/build-examples.js diff --git a/.husky/pre-commit b/.husky/pre-commit index e0b5a3b9..cb2c84d5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - pnpm lint-staged - diff --git a/.release-it.json b/.release-it.json index 510aea89..17cbebeb 100644 --- a/.release-it.json +++ b/.release-it.json @@ -1,6 +1,6 @@ { "hooks": { - "before:init": ["pnpm lint", "pnpm test -- --run"], + "before:init": ["pnpm lint", "pnpm test --run"], "after:bump": "pnpm build" }, "github": { diff --git a/CHANGELOG.md b/CHANGELOG.md index dbb94ff6..9b09b222 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,79 @@ + + + + + + + + +## 1.4.0 (2025-02-24) + +#### :star: New Features +* [#107](https://github.com/fluent-vue/unplugin-fluent-vue/pull/107) Add an option to parse FTL during build ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + +## 1.3.2 (2024-11-13) + +#### :bug: Bug Fixes +* [#103](https://github.com/fluent-vue/unplugin-fluent-vue/pull/103) Add sourcemap support to SFCFluentPlugin ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + +## 1.3.1 (2024-09-12) + +#### :bug: Bug Fixes +* [#97](https://github.com/fluent-vue/unplugin-fluent-vue/pull/97) Make @nuxt/kit dependency optional ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + +## 1.3.0 (2024-04-05) + +#### :star: New Features +* [#84](https://github.com/fluent-vue/unplugin-fluent-vue/pull/84) Add Nuxt module ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + +## 1.2.0 (2024-03-05) + +#### :star: New Features +* [#55](https://github.com/fluent-vue/unplugin-fluent-vue/pull/55) Mark ftl imports side-effect free ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + +## 1.1.4 (2023-03-23) + +## 1.1.3 (2023-03-22) + +#### :bug: Bug Fixes +* [#43](https://github.com/fluent-vue/unplugin-fluent-vue/pull/43) Fix HMR code not being treeshaken ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + +## 1.1.2 (2022-11-09) + +#### :bug: Bug Fixes +* [#31](https://github.com/fluent-vue/unplugin-fluent-vue/pull/31) Do not transform file if there are no translations ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + +## 1.1.1 (2022-10-05) + +#### :star: New Features +* [#29](https://github.com/fluent-vue/unplugin-fluent-vue/pull/29) Add a virtual module that imports all translations for a file ([@Demivan](https://github.com/Demivan)) + +#### Committers: 1 +- Ivan Demchuk ([@Demivan](https://github.com/Demivan)) + ## 1.1.0 (2022-10-02) #### :star: New Features diff --git a/README.md b/README.md index bb986edf..dbb4d2c3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-
+
@@ -31,11 +31,11 @@ npm install unplugin-fluent-vue --save-dev
```ts
// vite.config.js
-import { defineConfig } from 'vite'
import {
ExternalFluentPlugin,
SFCFluentPlugin,
} from 'unplugin-fluent-vue/vite'
+import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
@@ -44,12 +44,14 @@ export default defineConfig({
SFCFluentPlugin({ // define messages in SFCs
blockType: 'fluent', // default 'fluent' - name of the block in SFCs
checkSyntax: true, // default true - whether to check syntax of the messages
+ parseFtl: false, // default false - whether to parse ftl files during build
}),
ExternalFluentPlugin({ // define messages in external ftl files
baseDir: path.resolve('src'), // required - base directory for Vue files
ftlDir: path.resolve('src/locales'), // required - directory with ftl files
locales: ['en', 'da'], // required - list of locales
checkSyntax: true, // default true - whether to check syntax of the messages
+ parseFtl: false, // default false - whether to parse ftl files during build
}),
],
})
diff --git a/__tests__/fixtures/components/external.setup.vue b/__tests__/fixtures/components/external.setup.vue
index 1914ae2a..a4f8cd10 100644
--- a/__tests__/fixtures/components/external.setup.vue
+++ b/__tests__/fixtures/components/external.setup.vue
@@ -1,10 +1,10 @@
+
+