Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate to @nuxt/module-builder #214

Merged
merged 6 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions build.config.ts

This file was deleted.

23 changes: 13 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
"repository": "nuxt-community/strapi-module",
"license": "MIT",
"exports": {
".": "./dist/module.mjs"
".": {
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
}
},
"main": "./dist/module.mjs",
"types": "./dist/module.d.ts",
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"build": "nuxt-module-build",
"dev": "nuxi dev example",
"lint": "eslint --ext .js,.ts,.vue .",
"prepublishOnly": "yarn build",
"prepack": "yarn build",
"release": "yarn lint && standard-version && git push --follow-tags"
},
"dependencies": {
Expand All @@ -26,17 +29,17 @@
"qs": "^6.10.3"
},
"devDependencies": {
"@nuxt/schema": "npm:@nuxt/schema-edge@latest",
"@nuxt/module-builder": "^0.1.6",
"@nuxtjs/eslint-config-typescript": "^8.0.0",
"@types/qs": "^6.9.7",
"eslint": "^8.7.0",
"nuxt3": "latest",
"ohmyfetch": "^0.4.15",
"standard-version": "^9.3.2",
"typescript": "^4.5.4",
"unbuild": "^0.6.7"
"standard-version": "^9.3.2"
},
"publishConfig": {
"access": "public"
},
"build": {
"externals": ["vue", "nuxt3"]
benjamincanac marked this conversation as resolved.
Show resolved Hide resolved
}
}
17 changes: 1 addition & 16 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import defu from 'defu'
import { resolve } from 'pathe'
import { defineNuxtModule, addPlugin } from '@nuxt/kit'
import type { Nuxt } from '@nuxt/schema'
import type { CookieOptions } from 'nuxt3/dist/app/composables/cookie'

export interface ModuleOptions {
Expand Down Expand Up @@ -51,7 +50,7 @@ export default defineNuxtModule<ModuleOptions>({
version: 'v4',
cookie: {}
},
setup (options: ModuleOptions, nuxt: Nuxt) {
setup (options, nuxt) {
// Make sure url is set
if (!options.url) {
throw new Error('Missing `STRAPI_URL` in `.env`')
Expand All @@ -78,17 +77,3 @@ export default defineNuxtModule<ModuleOptions>({
})
}
})

declare module '@nuxt/schema' {
benjamincanac marked this conversation as resolved.
Show resolved Hide resolved
interface ConfigSchema {
publicRuntimeConfig?: {
strapi?: ModuleOptions
}
}
interface NuxtConfig {
strapi?: ModuleOptions
}
interface NuxtOptions {
strapi?: ModuleOptions
}
}
35 changes: 23 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,17 @@
unctx "^1.0.2"
untyped "^0.3.0"

"@nuxt/module-builder@^0.1.6":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@nuxt/module-builder/-/module-builder-0.1.7.tgz#6de83fa24a839265d43abdb5ecf8ec85456ca765"
integrity sha512-ueTrJhXrKKxGp6VAe2C/nOqTeRoy0qfq9RH2QVl0kq0duDyQHCe1e8dw8yBbYjTlSvfqBPYaraxpX8i2zis2cw==
dependencies:
consola "^2.15.3"
mlly "^0.3.19"
mri "^1.2.0"
pathe "^0.2.0"
unbuild "^0.6.7"

"@nuxt/nitro@npm:@nuxt/[email protected]":
version "3.0.0-27375427.d07d572"
resolved "https://registry.yarnpkg.com/@nuxt/nitro-edge/-/nitro-edge-3.0.0-27375427.d07d572.tgz#e386f6c28d81b49d8ddd0ea84006de2d609eb6ce"
Expand Down Expand Up @@ -463,7 +474,7 @@
vue-bundle-renderer "^0.3.5"
vue-server-renderer "^2.6.14"

"@nuxt/schema@npm:@nuxt/[email protected]", "@nuxt/schema@npm:@nuxt/schema-edge@latest":
"@nuxt/schema@npm:@nuxt/[email protected]":
version "3.0.0-27375427.d07d572"
resolved "https://registry.yarnpkg.com/@nuxt/schema-edge/-/schema-edge-3.0.0-27375427.d07d572.tgz#f8e507303915da05021d8f89e0e2e2563490f435"
integrity sha512-OMMGsSM7FP6htA2yTqPW5Mlm7I3bFftF9a9HneCSnTpXZ0Yc1vKX/zXfu3sfSpDN/WBHQZ10O1K62fiy2tuLpA==
Expand Down Expand Up @@ -713,9 +724,9 @@
integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==

"@types/node@*":
version "17.0.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.9.tgz#0b7f161afb5b1cc12518d29b2cdc7175d5490628"
integrity sha512-5dNBXu/FOER+EXnyah7rn8xlNrfMOQb/qXnw4NQgLkCygKBKhdmF/CA5oXVOKZLBEahw8s2WP9LxIcN/oDDRgQ==
version "17.0.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.10.tgz#616f16e9d3a2a3d618136b1be244315d95bd7cab"
integrity sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
Expand Down Expand Up @@ -2452,9 +2463,9 @@ [email protected]:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

electron-to-chromium@^1.4.17:
version "1.4.47"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.47.tgz#5d5535cdbca2b9264abee4d6ea121995e9554bbe"
integrity sha512-ZHc8i3/cgeCRK/vC7W2htAG6JqUmOUgDNn/f9yY9J8UjfLjwzwOVEt4MWmgJAdvmxyrsR5KIFA/6+kUHGY0eUA==
version "1.4.48"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.48.tgz#1948b5227aa0ca1ed690945eae1adbe9e7904575"
integrity sha512-RT3SEmpv7XUA+tKXrZGudAWLDpa7f8qmhjcLaM6OD/ERxjQ/zAojT8/Vvo0BSzbArkElFZ1WyZ9FuwAYbkdBNA==

emoji-regex@^8.0.0:
version "8.0.0"
Expand Down Expand Up @@ -4889,7 +4900,7 @@ object.values@^1.1.5:
define-properties "^1.1.3"
es-abstract "^1.19.1"

ohmyfetch@^0.4.14, ohmyfetch@^0.4.15, ohmyfetch@^0.4.5:
ohmyfetch@^0.4.14, ohmyfetch@^0.4.5:
version "0.4.15"
resolved "https://registry.yarnpkg.com/ohmyfetch/-/ohmyfetch-0.4.15.tgz#c7059d2952abacfaaaebd82efab754aca53a5c04"
integrity sha512-AJKiMh4s+VYLLiAQi3tZn4Zh/xYr94nOX9FLGVVdbXo7QWrrKIfGweACIKaB06PjQdZtkICzcmNN+CQSR+9vQQ==
Expand Down Expand Up @@ -6494,7 +6505,7 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^4.5.2, typescript@^4.5.4:
typescript@^4.5.2:
version "4.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8"
integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==
Expand Down Expand Up @@ -6672,9 +6683,9 @@ validate-npm-package-license@^3.0.1:
spdx-expression-parse "^3.0.0"

vite@^2.7.12:
version "2.7.12"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.7.12.tgz#7784ab19e7ff98f6a192d2d7d877480a8c2b7e7d"
integrity sha512-KvPYToRQWhRfBeVkyhkZ5hASuHQkqZUUdUcE3xyYtq5oYEPIJ0h9LWiWTO6v990glmSac2cEPeYeXzpX5Z6qKQ==
version "2.7.13"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.7.13.tgz#99b56e27dfb1e4399e407cf94648f5c7fb9d77f5"
integrity sha512-Mq8et7f3aK0SgSxjDNfOAimZGW9XryfHRa/uV0jseQSilg+KhYDSoNb9h1rknOy6SuMkvNDLKCYAYYUMCE+IgQ==
dependencies:
esbuild "^0.13.12"
postcss "^8.4.5"
Expand Down