Skip to content

Commit

Permalink
chore: use pnpm and node 18 (#198)
Browse files Browse the repository at this point in the history
* refactor: use pnpm

* ci: enable corepack

* Apply suggestions from code review

---------

Co-authored-by: kazuya kawaguchi <[email protected]>
  • Loading branch information
BobbieGoede and kazupon authored May 15, 2024
1 parent dded092 commit ae4629c
Show file tree
Hide file tree
Showing 12 changed files with 12,317 additions and 9,720 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ jobs:
runs-on: Ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Enable corepack
run: corepack enable
- uses: actions/setup-node@v1
with:
registry-url: "https://registry.npmjs.org"
- run: git switch next
- run: |
if [ -f "yarn.lock" ]; then
yarn install
if [ -f "pnpm-lock.yaml" ]; then
pnpm install
else
npm install
fi
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [14, 16]
node: [18, 20, 22]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Enable corepack
run: corepack enable
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
cache: 'pnpm'
- name: Install
run: yarn install
run: pnpm install
- name: Build
run: yarn build
run: pnpm build
- name: Test
run: yarn test
run: pnpm test
6 changes: 3 additions & 3 deletions docs/@intlify/vue-i18n-extensions-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Transform `v-t` custom directive

**Signature:**
```typescript
export declare function transformVTDirective<Messages = {}, DateTimeFormats = {}, NumberFormats = {}, Legacy extends boolean = true>(options?: TransformVTDirectiveOptions<Messages, DateTimeFormats, NumberFormats, Legacy>): DirectiveTransform;
export declare function transformVTDirective<Messages extends Record<string, unknown> = {}, DateTimeFormats extends Record<string, unknown> = {}, NumberFormats extends Record<string, unknown> = {}, Legacy extends boolean = true>(options?: TransformVTDirectiveOptions<Messages, DateTimeFormats, NumberFormats, Legacy>): DirectiveTransform;
```

#### Parameters
Expand Down Expand Up @@ -81,7 +81,7 @@ Transform options for `v-t` custom directive

**Signature:**
```typescript
export interface TransformVTDirectiveOptions<Messages = {}, DateTimeFormats = {}, NumberFormats = {}, Legacy extends boolean = true>
export interface TransformVTDirectiveOptions<Messages extends Record<string, unknown> = {}, DateTimeFormats extends Record<string, unknown> = {}, NumberFormats extends Record<string, unknown> = {}, Legacy extends boolean = true>
```


Expand All @@ -98,7 +98,7 @@ i18n?: I18n<Messages, DateTimeFormats, NumberFormats, Legacy>;

#### Remarks

If this option is specified, `v-t` custom diretive transform uses an I18n instance to pre-translate. The translation will use the global resources registered in the I18n instance, that is, `v-t` diretive transform is also a limitation that the resources of each component cannot be used.
If this option is specified, `v-t` custom directive transform uses an I18n instance to pre-translate. The translation will use the global resources registered in the I18n instance, that is, `v-t` directive transform is also a limitation that the resources of each component cannot be used.

##### mode

Expand Down
11 changes: 2 additions & 9 deletions example/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
<p v-t="{ path: hello, locale: 'en' }"></p>
</template>

<script>
<script setup>
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
export default {
name: 'App',
setup() {
const hello = ref('hello')
return { hello, ...useI18n() }
}
}
const hello = ref('hello')
</script>
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@types/node": "^18.11.17",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"@vue/compiler-core": "^3.2.45",
"@vue/compiler-sfc": "^3.2.45",
"@vue/compiler-ssr": "^3.2.45",
"@vue/runtime-dom": "^3.2.45",
Expand Down Expand Up @@ -106,7 +107,7 @@
"url": "git+https://github.com/intlify/vue-i18n-extensions.git"
},
"scripts": {
"build": "yarn build:transpile && yarn build:extract && yarn build:docs",
"build": "pnpm build:transpile && pnpm build:extract && pnpm build:docs",
"build:docs": "api-docs-gen ./temp/vue-i18n-extensions.api.json -c ./docsgen.config.js -o ./docs",
"build:extract": "api-extractor run -l -c ./api-extractor.json --typescript-compiler-folder node_modules/typescript",
"build:transpile": "tsc -p .",
Expand All @@ -119,18 +120,18 @@
"example": "webpack serve --config example/webpack.config.js --inline --hot",
"fix": "npm-run-all --parallel lint:eslint:fix format:fix",
"format": "prettier --config .prettierrc --ignore-path .prettierignore --list-different '**/*.{js,json,html}'",
"format:fix": "yarn format --write",
"format:fix": "pnpm format --write",
"lint": "npm-run-all --parallel lint:eslint lint:secret",
"lint:eslint": "eslint ./src ./test --ext .ts --cache",
"lint:eslint:fix": "yarn lint:eslint --fix",
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:secret": "npx secretlint \"**/*\"",
"release:prepare": "shipjs prepare",
"release:trigger": "shipjs trigger",
"test": "yarn lint && yarn test:cover && yarn test:e2e",
"test:cover": "yarn clean:cache:jest && yarn test:unit --coverage",
"test": "pnpm lint && pnpm test:cover && pnpm test:e2e",
"test:cover": "pnpm clean:cache:jest && pnpm test:unit --coverage",
"test:e2e": "jest --runInBand --config ./jest.e2e.config.js",
"test:unit": "yarn clean:cache:jest && jest --env node",
"test:watch": "yarn clean:cache:jest && jest --env node --watch",
"test:unit": "pnpm clean:cache:jest && jest --env node",
"test:watch": "pnpm clean:cache:jest && jest --env node --watch",
"watch": "tsc -p . --watch"
},
"types": "dist/vue-i18n-extensions.d.ts"
Expand Down
Loading

0 comments on commit ae4629c

Please sign in to comment.