Skip to content

Commit bf2cf08

Browse files
authored
Merge pull request #17 from kakkokari-gtyih/fix-update-deps
enhance: Support Nuxt v4
2 parents be829b4 + 1027f2c commit bf2cf08

File tree

11 files changed

+5575
-3841
lines changed

11 files changed

+5575
-3841
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[microCMS](https://microcms.io) integration for [Nuxt](https://nuxt.com/).
44

55
Attention❗️
6-
This module is intended for Nuxt version 3. If you are using version 2, please perform `npm install nuxt-microcms-module@2` and refer [here](https://github.com/microcmsio/nuxt-microcms-module/tree/v2#readme).
6+
This module is intended for Nuxt version 3 and 4. If you are using version 2, please perform `npm install nuxt-microcms-module@2` and refer [here](https://github.com/microcmsio/nuxt-microcms-module/tree/v2#readme).
77

88
## Getting Started
99

build.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineBuildConfig } from 'unbuild';
2+
3+
export default defineBuildConfig({
4+
rollup: {
5+
emitCJS: true,
6+
},
7+
});

eslint.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @ts-check
2+
import { createConfigForNuxt } from '@nuxt/eslint-config';
3+
import eslintConfigPrettier from 'eslint-config-prettier';
4+
5+
export default createConfigForNuxt({})
6+
.override('nuxt/vue/rules', {
7+
rules: {
8+
'vue/html-self-closing': 'off',
9+
},
10+
})
11+
.prepend(eslintConfigPrettier);
12+

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,36 @@
2323
"type": "module",
2424
"exports": {
2525
".": {
26-
"types": "./dist/types.d.ts",
26+
"types": "./dist/types.d.mts",
2727
"import": "./dist/module.mjs",
2828
"require": "./dist/module.cjs"
2929
}
3030
},
3131
"main": "./dist/module.cjs",
32-
"types": "./dist/types.d.ts",
32+
"types": "./dist/types.d.mts",
3333
"files": [
3434
"dist"
3535
],
3636
"scripts": {
3737
"dev": "nuxi dev playground",
3838
"dev:build": "nuxi build playground",
39-
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
39+
"dev:prepare": "nuxt-module-build build --stub && nuxi prepare playground",
4040
"lint": "eslint .",
41-
"prepublishOnly": "nuxi prepare playground && yarn lint && nuxt-module-build"
41+
"prepublishOnly": "nuxi prepare playground && yarn lint && nuxt-module-build build"
4242
},
4343
"dependencies": {
44-
"@nuxt/kit": "^3.5.3",
44+
"@nuxt/kit": "^4.0.0",
4545
"defu": "^6.1.2",
46-
"microcms-js-sdk": "^2.5.0"
46+
"microcms-js-sdk": "^3.2.0"
4747
},
4848
"devDependencies": {
49-
"@nuxt/eslint-config": "^0.1.1",
50-
"@nuxt/module-builder": "^0.4.0",
51-
"@nuxt/schema": "^3.5.3",
49+
"@nuxt/eslint-config": "^1.6.0",
50+
"@nuxt/module-builder": "^1.0.1",
51+
"@nuxt/schema": "^4.0.0",
5252
"@nuxt/test-utils": "^3.5.3",
53-
"@types/node": "^18.11.9",
54-
"eslint": "^8.42.0",
55-
"eslint-config-prettier": "^8.8.0",
56-
"nuxt": "^3.5.3"
53+
"@types/node": "^24.0.14",
54+
"eslint": "^9.31.0",
55+
"eslint-config-prettier": "^10.1.5",
56+
"nuxt": "^4.0.0"
5757
}
5858
}

playground/nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default defineNuxtConfig({
2+
compatibilityDate: '2025-07-18',
23
modules: [
34
[
45
'../src/module',

src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineNuxtModule<ModuleOptions>({
1414
name: 'nuxt-microcms-module',
1515
configKey: 'microCMS',
1616
compatibility: {
17-
nuxt: '^3.0.0',
17+
nuxt: '^3.0.0 || ^4.0.0',
1818
},
1919
},
2020
setup(options, nuxt) {

src/runtime/composables/useMicroCMSGet.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
MicroCMSListResponse,
33
MicroCMSListContent,
44
MicroCMSObjectContent,
@@ -31,12 +31,12 @@ type MicroCMSGetObjectArgs = {
3131
queries?: MicroCMSQueries;
3232
};
3333

34-
type FetchOptions<T extends unknown> = Omit<
34+
type FetchOptions<T = void> = Omit<
3535
Parameters<typeof useFetch<T, FetchError, string, 'get'>>,
3636
'baseURL' | 'query' | 'method'
3737
>[1];
3838

39-
const method = 'GET';
39+
const method = 'get';
4040

4141
const useMicroCMSGet = <T>(
4242
{ url, queries }: MicroCMSGetArgs,

0 commit comments

Comments
 (0)