From 03d33dfdef92cc76282263b9c066a729969e60d2 Mon Sep 17 00:00:00 2001 From: Sylvain Marroufin Date: Mon, 24 Jan 2022 12:33:38 +0100 Subject: [PATCH] chore(examples): add `plugins` example (#2855) * chore(examples): add `plugins` example * Update examples/with-plugins/plugins/my-plugin.ts Co-authored-by: Daniel Roe * chore(examples): remove unused variable * fix: updates post-review * Update examples/with-plugins/plugins/my-plugin.ts Co-authored-by: Daniel Roe Co-authored-by: pooya parsa --- examples/README.md | 1 + examples/with-plugins/app.vue | 5 +++++ examples/with-plugins/nuxt.config.ts | 7 +++++++ examples/with-plugins/package.json | 13 +++++++++++++ examples/with-plugins/plugins/my-plugin.ts | 7 +++++++ examples/with-plugins/tsconfig.json | 3 +++ yarn.lock | 9 +++++++++ 7 files changed, 45 insertions(+) create mode 100644 examples/with-plugins/app.vue create mode 100644 examples/with-plugins/nuxt.config.ts create mode 100644 examples/with-plugins/package.json create mode 100644 examples/with-plugins/plugins/my-plugin.ts create mode 100644 examples/with-plugins/tsconfig.json diff --git a/examples/README.md b/examples/README.md index 7ebb407568..c72375a8d0 100644 --- a/examples/README.md +++ b/examples/README.md @@ -14,4 +14,5 @@ | `with-composables` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-composables) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-composables?file=app.vue&terminal=dev) | | `with-layouts` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-layouts) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-layouts?file=app.vue&terminal=dev) | | `with-pages` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-pages) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-pages?file=app.vue&terminal=dev) | +| `with-plugins` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-plugins) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-plugins?file=app.vue&terminal=dev) | | `with-wasm` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-wasm) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-wasm?file=app.vue&terminal=dev) | diff --git a/examples/with-plugins/app.vue b/examples/with-plugins/app.vue new file mode 100644 index 0000000000..867f816526 --- /dev/null +++ b/examples/with-plugins/app.vue @@ -0,0 +1,5 @@ + diff --git a/examples/with-plugins/nuxt.config.ts b/examples/with-plugins/nuxt.config.ts new file mode 100644 index 0000000000..9850816d15 --- /dev/null +++ b/examples/with-plugins/nuxt.config.ts @@ -0,0 +1,7 @@ +import { defineNuxtConfig } from 'nuxt3' + +export default defineNuxtConfig({ + modules: [ + '@nuxt/ui' + ] +}) diff --git a/examples/with-plugins/package.json b/examples/with-plugins/package.json new file mode 100644 index 0000000000..56c9bdc009 --- /dev/null +++ b/examples/with-plugins/package.json @@ -0,0 +1,13 @@ +{ + "name": "example-with-plugins", + "private": true, + "scripts": { + "build": "nuxi build", + "dev": "nuxi dev", + "start": "nuxi preview" + }, + "devDependencies": { + "@nuxt/ui": "npm:@nuxt/ui-edge@latest", + "nuxt3": "latest" + } +} diff --git a/examples/with-plugins/plugins/my-plugin.ts b/examples/with-plugins/plugins/my-plugin.ts new file mode 100644 index 0000000000..df28887c51 --- /dev/null +++ b/examples/with-plugins/plugins/my-plugin.ts @@ -0,0 +1,7 @@ +export default defineNuxtPlugin((/* nuxtApp */) => { + return { + provide: { + myPlugin: () => 'String generated from my auto-imported plugin!' + } + } +}) diff --git a/examples/with-plugins/tsconfig.json b/examples/with-plugins/tsconfig.json new file mode 100644 index 0000000000..4b34df1571 --- /dev/null +++ b/examples/with-plugins/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "./.nuxt/tsconfig.json" +} diff --git a/yarn.lock b/yarn.lock index 0026ee7bd8..491cbfaea5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10755,6 +10755,15 @@ __metadata: languageName: unknown linkType: soft +"example-with-plugins@workspace:examples/with-plugins": + version: 0.0.0-use.local + resolution: "example-with-plugins@workspace:examples/with-plugins" + dependencies: + "@nuxt/ui": "npm:@nuxt/ui-edge@latest" + nuxt3: latest + languageName: unknown + linkType: soft + "example-with-wasm@workspace:examples/with-wasm": version: 0.0.0-use.local resolution: "example-with-wasm@workspace:examples/with-wasm"