Skip to content

Commit

Permalink
fix: lock file maintenance (#150)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: drop node 14, migrate to nuxt 3
  • Loading branch information
renovate[bot] authored Jul 2, 2023
1 parent 4642661 commit 403d93d
Show file tree
Hide file tree
Showing 14 changed files with 3,712 additions and 6,466 deletions.
2 changes: 1 addition & 1 deletion .baserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
{ "repository": "nuxt-content-git", "description": "Additional module for @nuxt/content that replaces or adds createdAt and updatedAt dates based on the git history." },
{ "repository": "nuxt-babel-runtime", "description": "Nuxt CLI that supports babel. Inspired by @nuxt/typescript-runtime." }
],
"supportedNodeVersions": [14, 16]
"supportedNodeVersions": [16, 18]
}
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-16",
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-20",
"updateContentCommand": "yarn --frozen-lockfile"
}
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
github.event.pull_request.head.ref || '' }}
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- run: git config --global user.email "actions@github.com"
- run: git config --global user.name "GitHub Actions"
- run: yarn --frozen-lockfile
Expand Down Expand Up @@ -54,20 +54,20 @@ jobs:
with:
name: Image Snapshot Diffs
path: "**/__image_snapshots__/__diff_output__"
- if: matrix.os == 'ubuntu-latest' && matrix.node == 16
- if: matrix.os == 'ubuntu-latest' && matrix.node == 20
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
strategy:
matrix:
include:
- node: 14
os: ubuntu-latest
- node: 16
os: ubuntu-latest
- node: 16
- node: 18
os: ubuntu-latest
- node: 20
os: macos-latest
- node: 16
- node: 20
os: windows-latest
name: build
on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deprecated-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
update_existing: true
- if: ${{ !steps.check-deprecated-js-deps.outputs.deprecated &&
steps.create-deprecation-issue.outputs.number }}
uses: peter-evans/close-issue@v2
uses: peter-evans/close-issue@v3
with:
comment: Auto-closing the issue
issue-number: ${{ steps.create-deprecation-issue.outputs.number }}
Expand Down
2 changes: 1 addition & 1 deletion .gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN sudo apt-get install git-lfs
RUN git lfs install

# https://www.gitpod.io/docs/languages/javascript
RUN bash -c 'VERSION="16" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION'
RUN bash -c 'VERSION="20" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION'

RUN echo "\nexport PATH=$(yarn global bin):\$PATH" >> /home/gitpod/.bashrc

Expand Down
2 changes: 2 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ vscode:
- https://sebastianlandwehr.com/vscode-extensions/karlito40.fix-irregular-whitespace-0.1.1.vsix
- https://sebastianlandwehr.com/vscode-extensions/adrianwilczynski.toggle-hidden-1.0.2.vsix
- octref.vetur@0.33.1
- Tobermory.es6-string-html
- zjcompt.es6-string-javascript
121 changes: 21 additions & 100 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ Nuxt pages have a `meta` property that allows to define meta data. These can be

ℹ️ **Note that this module can only extract static data from the pages at build time. It will not work with dynamic data depending on `this`. In case you have an idea how to improve that, feel free to open up an issue or pull request.**

## Compatibility

| nuxt-route-meta | Nuxt |
|-----------------|------|
| <= 5 | 2 |
| >= 6 | 3 |

<!-- INSTALL/ -->
## Install

Expand Down Expand Up @@ -102,126 +109,40 @@ export default {

That's it! Now you can access the meta data in `route.meta` from anywhere as you know it from [vue-router](https://www.npmjs.com/package/vue-router). The module takes all properties that all properties that are not functions, and the meta property itself is merged into the result. So `route.meta` from the example above is `{ auth: true, theme: 'water' }`.

Here is an example to use it inside `this.extendRoutes` in a module:
Here is an example to use it inside `nuxt.hook('pages:extend')` in a module:

```js
export default function () {
this.extendRoutes(routes =>
routes.forEach(route => {
export default defineNuxtModule((options, nuxt) =>
nuxt.hook('pages:extend', routes =>
for (const route of routes) {
if (route.meta.auth) {
// do something with auth routes
}
})
}
)
}
)
```

## TypeScript

The module has built-in support for TypeScript. Requirement is that the TypeScript module is installed as described in [the Nuxt TypeScript docs](https://typescript.nuxtjs.org/guide/setup).

```js
<script lang="ts">
import Vue from 'vue'

export default class MyComponent extends Vue {
meta = {
foo: true,
},
}
</script>
```

## Supported APIs

### Plain object
## Composition API

```js
<script>
export default {
<script setup>
definePageMeta({
auth: true,
meta: {
theme: 'water',
},
}
</script>
```

This API does not make much sense with TypeScript because you do not have type information in the components.

### Options API

```js
<script>
import Vue from 'vue'

export default class MyComponent extends Vue {
meta = {
foo: true,
},
}
</script>
```

As of writing this, Nuxt with TypeScript does not seem to support the options API with Nuxt-specific properties like `asyncData`, `fetch`, `meta`, etc. In case this changes, open up an issue.

### Class API

```js
<script>
import Vue from 'vue'

export default class MyComponent extends Vue {
meta = {
foo: true,
},
}
})
</script>
```

### Property decorator

Plain JavaScript: Install [nuxt-property-decorator](https://github.com/nuxt-community/nuxt-property-decorator).

```js
<script>
import { Vue, Component } from 'nuxt-property-decorator'

@Component
export default class MyComponent extends Vue {
meta = {
foo: true,
},
}
</script>
```
## TypeScript

TypeScript:
The module has built-in support for TypeScript.

```js
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'

@Component
export default class MyComponent extends Vue {
meta = {
foo: true,
},
}
</script>
```

## Composition API

This package ships with support for the Vue composition API. When setting up your nuxt project, make sure to follow the [`@nuxtjs/composition-api` guide](https://composition-api.nuxtjs.org/getting-started/setup) closely.

```js
<script>
import { defineComponent } from '@nuxtjs/composition-api'

export default defineComponent({
auth: true,
meta: {
auth: true,
theme: 'water',
},
})
</script>
Expand Down
33 changes: 19 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,32 @@
"dependencies": {
"@babel/core": "^7.11.1",
"@babel/traverse": "^7.13.13",
"@dword-design/functions": "^4.0.0",
"@vue/compiler-sfc": "^3.3.4",
"ast-to-literal": "^0.0.5",
"deepmerge": "^4.3.1",
"fs-extra": "^11.1.0",
"ts-ast-to-literal": "^3.0.10",
"typescript": "~4.2",
"vue-template-compiler": "^2.6.11"
"lodash-es": "^4.17.21",
"ts-ast-to-literal": "^3.0.10"
},
"devDependencies": {
"@dword-design/base": "^9.1.7",
"@nuxt/typescript-build": "^2.1.0",
"@nuxtjs/composition-api": "^0.27.0",
"depcheck-package-name": "^3.0.0",
"nuxt": "^2.15.3",
"nuxt-property-decorator": "^2.9.1",
"@babel/plugin-proposal-pipeline-operator": "^7.22.5",
"@dword-design/base": "^10.1.2",
"@dword-design/functions": "^5.0.22",
"@dword-design/tester": "^2.0.19",
"@dword-design/tester-plugin-tmp-dir": "^2.1.26",
"depcheck-package-name": "^3.0.1",
"execa": "^7.1.1",
"expect": "^29.5.0",
"nuxt": "^3.6.1",
"nuxt-babel-runtime": "^4.0.0",
"output-files": "^2.0.0",
"vue-class-component": "^7.2.6",
"vue-property-decorator": "^9.1.2",
"with-local-tmp-dir": "^5.0.0"
"typescript": "^5.1.6"
},
"peerDependencies": {
"typescript": "*"
},
"engines": {
"node": ">=14"
"node": ">=16"
},
"publishConfig": {
"access": "public"
Expand Down
Loading

0 comments on commit 403d93d

Please sign in to comment.