@storyblok/nuxt 5.5.2 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +12 -0
- package/.eslintignore +3 -0
- package/.eslintrc +7 -0
- package/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/.github/ISSUE_TEMPLATE/issue.bug.yml +68 -0
- package/.github/ISSUE_TEMPLATE/issue.fr.yml +40 -0
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/dependabot-automerge.yml +28 -0
- package/.github/workflows/release.yml +30 -0
- package/.husky/commit-msg +6 -0
- package/.husky/pre-commit +4 -0
- package/.nuxtrc +1 -0
- package/.prettierignore +1 -0
- package/README.md +35 -17
- package/cypress/.eslintrc +3 -0
- package/cypress/e2e/index.cy.ts +34 -0
- package/cypress/fixtures/stories.json +7 -0
- package/cypress/support/commands.ts +25 -0
- package/cypress/support/e2e.ts +20 -0
- package/cypress.config.ts +11 -0
- package/package.json +74 -30
- package/playground/README.md +63 -0
- package/playground/app.vue +3 -0
- package/playground/error.vue +22 -0
- package/playground/nuxt.config.ts +18 -0
- package/playground/package-lock.json +11660 -0
- package/playground/package.json +17 -0
- package/playground/pages/[...slug].vue +17 -0
- package/playground/pages/index.vue +21 -0
- package/playground/public/favicon.ico +0 -0
- package/playground/server/tsconfig.json +3 -0
- package/playground/storyblok/sub/Feature.vue +16 -0
- package/playground/storyblok/sub/Grid.vue +19 -0
- package/playground/storyblok/sub/Page.vue +19 -0
- package/playground/storyblok/sub/Teaser.vue +19 -0
- package/playground/tsconfig.json +4 -0
- package/playground-e2e/nuxt.config.ts +24 -0
- package/playground-e2e/package.json +15 -0
- package/playground-e2e/pages/[...slug].vue +20 -0
- package/playground-e2e/pages/index.vue +19 -0
- package/playground-e2e/pages/test.vue +7 -0
- package/playground-e2e/pages/vcalong.vue +17 -0
- package/playground-e2e/plugins/storyblok.js +21 -0
- package/playground-e2e/storyblok/sub/Feature.vue +14 -0
- package/playground-e2e/storyblok/sub/Grid.vue +19 -0
- package/playground-e2e/storyblok/sub/Page.vue +19 -0
- package/playground-e2e/storyblok/sub/Teaser.vue +19 -0
- package/playground-e2e/tsconfig.json +11 -0
- package/src/module.ts +90 -0
- package/src/runtime/composables/useAsyncStoryblok.ts +33 -0
- package/{dist/runtime/plugin.mjs → src/runtime/plugin.ts} +1 -0
- package/tsconfig.json +3 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -13
- package/dist/module.json +0 -5
- package/dist/module.mjs +0 -58
- package/dist/runtime/composables/useAsyncStoryblok.d.ts +0 -2
- package/dist/runtime/composables/useAsyncStoryblok.mjs +0 -25
- package/dist/runtime/plugin.d.ts +0 -2
- package/dist/types.d.ts +0 -15
package/.editorconfig
ADDED
package/.eslintignore
ADDED
package/.eslintrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: "\U0001F41E SDK Bug Report"
|
|
2
|
+
description: Report an issue using Nuxt 3 Storyblok SDK
|
|
3
|
+
labels: [pending-triage, pending-author]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
You're now going to fill out a bug report at the Nuxt 3 Storyblok SDK. Thanks a lot for taking the time and let's make Storyblok open source projects better together!
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: bug-description
|
|
11
|
+
attributes:
|
|
12
|
+
label: Describe the issue you're facing
|
|
13
|
+
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description so we can review it. Thanks in advance!
|
|
14
|
+
placeholder: My Nuxt 3 Storyblok SDK configuration is ... ## Expected behavior ... ## Current Behavior ...
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: input
|
|
18
|
+
id: reproduction
|
|
19
|
+
attributes:
|
|
20
|
+
label: Reproduction
|
|
21
|
+
description: Please provide a link to a repo or Stackblitz that can reproduce the issue you ran into. A minimal reproduction is required, if a report is vague or has no reproduction, it will receive a "need reproduction" label.
|
|
22
|
+
placeholder: Reproduction URL
|
|
23
|
+
validations:
|
|
24
|
+
required: true
|
|
25
|
+
- type: textarea
|
|
26
|
+
id: reproduction-steps
|
|
27
|
+
attributes:
|
|
28
|
+
label: Steps to reproduce
|
|
29
|
+
description: Please provide any reproduction steps that may need to be described.
|
|
30
|
+
placeholder: List the commands or configuration you set when you faced the error, and describe with process you follow to get the error.
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: system-info
|
|
33
|
+
attributes:
|
|
34
|
+
label: System Info
|
|
35
|
+
description: Output of `npx envinfo --system --npmPackages '{ nuxt, @storyblok/*}' --binaries --browsers`
|
|
36
|
+
render: shell
|
|
37
|
+
placeholder: System, Binaries, Browsers, Nuxt 3 & Storyblok SDK version
|
|
38
|
+
validations:
|
|
39
|
+
required: true
|
|
40
|
+
- type: dropdown
|
|
41
|
+
id: package-manager
|
|
42
|
+
attributes:
|
|
43
|
+
label: Used Package Manager
|
|
44
|
+
description: Select the used package manager
|
|
45
|
+
options:
|
|
46
|
+
- npm
|
|
47
|
+
- yarn
|
|
48
|
+
- pnpm
|
|
49
|
+
validations:
|
|
50
|
+
required: true
|
|
51
|
+
- type: textarea
|
|
52
|
+
id: logs
|
|
53
|
+
attributes:
|
|
54
|
+
label: Error logs (Optional)
|
|
55
|
+
description: |
|
|
56
|
+
Optional if provided reproduction. Please copy and paste the log text.
|
|
57
|
+
- type: checkboxes
|
|
58
|
+
id: checkboxes
|
|
59
|
+
attributes:
|
|
60
|
+
label: Validations
|
|
61
|
+
description: Before submitting the issue, please make sure you do the following
|
|
62
|
+
options:
|
|
63
|
+
- label: Follow our [Code of Conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client)
|
|
64
|
+
required: true
|
|
65
|
+
- type: markdown
|
|
66
|
+
attributes:
|
|
67
|
+
value: |
|
|
68
|
+
> This template was inspired by the [Vite issue template](https://github.com/vitejs/vite/blob/main/.github/ISSUE_TEMPLATE/bug_report.yml)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: "\U0001F58C SDK Feature Request"
|
|
2
|
+
description: Propose a feature or improvement that the Storyblok SDK should have
|
|
3
|
+
labels: [enhancement, pending-triage, pending-author]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for helping us improve the Storyblok open source project, you rock!
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: feature-description
|
|
11
|
+
attributes:
|
|
12
|
+
label: Description
|
|
13
|
+
description: "Clear and concise description of what you want to include or enhance from the SDK. Please make the reason and usecases as detailed as possible. If you intend to submit a PR for this feature request, tell us in the description so we can review and be aware of it. Thanks in advance!"
|
|
14
|
+
placeholder: As a developer using Storyblok SDK I want [wish] so that [benefit].
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: suggested-solution
|
|
19
|
+
attributes:
|
|
20
|
+
label: Suggested solution or improvement
|
|
21
|
+
description: "Link to the PR or what implementation you will expect from us (links to external examples if needed)."
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: additional-context
|
|
26
|
+
attributes:
|
|
27
|
+
label: Additional context
|
|
28
|
+
description: Any other context or screenshots about the feature request here.
|
|
29
|
+
- type: checkboxes
|
|
30
|
+
id: checkboxes
|
|
31
|
+
attributes:
|
|
32
|
+
label: Validations
|
|
33
|
+
description: Before submitting the feature request, please make sure you do the following
|
|
34
|
+
options:
|
|
35
|
+
- label: Follow our [Code of Conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client)
|
|
36
|
+
required: true
|
|
37
|
+
- type: markdown
|
|
38
|
+
attributes:
|
|
39
|
+
value: |
|
|
40
|
+
> This template was inspired by the [Vite FR template](https://github.com/vitejs/vite/blob/main/.github/ISSUE_TEMPLATE/feature_request.yml)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# **** AUTOMERGE ****
|
|
2
|
+
# Merge automatically the PR that contain a minor or patch update on the dependency you define in env.DEPENDENCY
|
|
3
|
+
# - Inspiration: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
|
|
4
|
+
|
|
5
|
+
name: Dependabot auto-merge
|
|
6
|
+
on: pull_request
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
pull-requests: write
|
|
10
|
+
contents: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
dependabot:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
if: ${{ github.actor == 'dependabot[bot]' }}
|
|
16
|
+
steps:
|
|
17
|
+
- name: Dependabot metadata
|
|
18
|
+
id: metadata
|
|
19
|
+
uses: dependabot/fetch-metadata@v1.1.1
|
|
20
|
+
with:
|
|
21
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
22
|
+
- name: Enable auto-merge for Dependabot PRs
|
|
23
|
+
if: ${{contains(steps.metadata.outputs.dependency-names, env.DEPENDENCY) && (steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor')}}
|
|
24
|
+
run: gh pr merge --auto --merge "$PR_URL"
|
|
25
|
+
env:
|
|
26
|
+
DEPENDENCY: "@storyblok/vue"
|
|
27
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
|
28
|
+
GITHUB_TOKEN: ${{secrets.DEPENDABOT_TOKEN}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Release CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
release:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
- name: Setup Node
|
|
16
|
+
uses: actions/setup-node@v3
|
|
17
|
+
with:
|
|
18
|
+
node-version: "18"
|
|
19
|
+
cache: "npm"
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: npm ci && cd playground && npm ci && cd ..
|
|
22
|
+
- name: Build lib
|
|
23
|
+
run: npm run build
|
|
24
|
+
- name: Cypress run
|
|
25
|
+
run: npm run test:e2e
|
|
26
|
+
- name: Release
|
|
27
|
+
env:
|
|
28
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
30
|
+
run: npx semantic-release
|
package/.nuxtrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typescript.includeWorkspace=true
|
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
**/templates/plugin.js
|
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ To link your Vue components to the equivalent one in your Storyblok space:
|
|
|
168
168
|
|
|
169
169
|
> Take into account that if you name a component inside the `storyblok` folder the same as another in the `components` folder, it won't work properly. Tip: Keep the components in your Nuxt project with different names.
|
|
170
170
|
|
|
171
|
-
- For each
|
|
171
|
+
- For each component, use the `v-editable` directive on its root element, passing the `blok` property that they receive:
|
|
172
172
|
|
|
173
173
|
```html
|
|
174
174
|
<div v-editable="blok" / >
|
|
@@ -186,13 +186,26 @@ To link your Vue components to the equivalent one in your Storyblok space:
|
|
|
186
186
|
|
|
187
187
|
#### Composition API
|
|
188
188
|
|
|
189
|
-
The simplest way is by using the `useAsyncStoryblok` one-liner composable (it's autoimported)
|
|
189
|
+
The simplest way is by using the `useAsyncStoryblok` one-liner composable (it's autoimported). Where you need to pass as first parameter the `slug`, while the second and third parameters, `apiOptions` and `bridgeOptions` respectively, are optional.
|
|
190
|
+
|
|
191
|
+
Check the available [apiOptions](https://www.storyblok.com/docs/api/content-delivery/v2#core-resources/stories/retrieve-one-story?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-nuxt) in our API docs and [bridgeOptions](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-nuxt) passed to the Storyblok Bridge.
|
|
190
192
|
|
|
191
193
|
> If you want to know more about versioning `{ version: "draft" /* or "publish" */ }` then go to the section [Working with preview and/or production environments](#3-working-with-preview-andor-production-environments)
|
|
192
194
|
|
|
193
195
|
```html
|
|
194
196
|
<script setup>
|
|
195
|
-
const story = await useAsyncStoryblok(
|
|
197
|
+
const story = await useAsyncStoryblok(
|
|
198
|
+
"vue",
|
|
199
|
+
{ version: "draft", resolve_relations: "Article.author" }, // API Options
|
|
200
|
+
{ resolveRelations: ["Article.author"], resolveLinks: "url" } // Bridge Options
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
if (story.value.status) {
|
|
204
|
+
throw createError({
|
|
205
|
+
statusCode: story.value.status,
|
|
206
|
+
statusMessage: story.value.response
|
|
207
|
+
});
|
|
208
|
+
}
|
|
196
209
|
</script>
|
|
197
210
|
|
|
198
211
|
<template>
|
|
@@ -200,22 +213,27 @@ The simplest way is by using the `useAsyncStoryblok` one-liner composable (it's
|
|
|
200
213
|
</template>
|
|
201
214
|
```
|
|
202
215
|
|
|
203
|
-
Which is the short-hand equivalent to using `useStoryblokApi` inside `
|
|
216
|
+
Which is the short-hand equivalent to using `useStoryblokApi` inside `useState` and `useStoryblokBridge` functions separately:
|
|
204
217
|
|
|
205
218
|
```html
|
|
206
219
|
<script setup>
|
|
207
|
-
const story =
|
|
220
|
+
const story = useState();
|
|
208
221
|
const storyblokApi = useStoryblokApi();
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
222
|
+
|
|
223
|
+
const { data } = await storyblokApiInstance.get(
|
|
224
|
+
`cdn/stories/vue`,
|
|
225
|
+
{
|
|
226
|
+
version: "draft"
|
|
227
|
+
}
|
|
214
228
|
);
|
|
215
|
-
story.value = data.
|
|
229
|
+
story.value = data.story;
|
|
216
230
|
|
|
217
231
|
onMounted(() => {
|
|
218
|
-
useStoryblokBridge(
|
|
232
|
+
useStoryblokBridge(
|
|
233
|
+
story.value.id,
|
|
234
|
+
(evStory) => (story.value = evStory),
|
|
235
|
+
{ resolveRelations: ["Article.author"], resolveLinks: "url" } // Bridge Options
|
|
236
|
+
);
|
|
219
237
|
});
|
|
220
238
|
</script>
|
|
221
239
|
|
|
@@ -224,7 +242,7 @@ Which is the short-hand equivalent to using `useStoryblokApi` inside `useAsyncDa
|
|
|
224
242
|
</template>
|
|
225
243
|
```
|
|
226
244
|
|
|
227
|
-
>
|
|
245
|
+
> `useState` is an SSR-friendly `ref` replacement. Its value will be preserved after server-side rendering (during client-side hydration).
|
|
228
246
|
|
|
229
247
|
#### Rendering Rich Text
|
|
230
248
|
|
|
@@ -285,15 +303,15 @@ Check the official docs on how to [access different content versions](https://ww
|
|
|
285
303
|
|
|
286
304
|
#### useAsyncStoryblok(slug, apiOptions, bridgeOptions)
|
|
287
305
|
|
|
288
|
-
(Recommended Option)
|
|
306
|
+
(Recommended Option) Uses [`useState`](https://v3.nuxtjs.org/api/composables/use-state) under the hood to help with SSR compatibility.
|
|
289
307
|
|
|
290
|
-
Check the available [apiOptions](https://
|
|
308
|
+
Check the available [apiOptions](https://www.storyblok.com/docs/api/content-delivery/v2#core-resources/stories/retrieve-one-story?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-nuxt) (passed to `storyblok-js-client`) and [bridgeOptions](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-nuxt) (passed to the Storyblok Bridge).
|
|
291
309
|
|
|
292
310
|
#### useStoryblok(slug, apiOptions, bridgeOptions)
|
|
293
311
|
|
|
294
|
-
It could be helpful to use `useStoryblok` instead of `useAsyncStoryblok` when we need to make client-side requests, for example, getting personalized data for a logged user.
|
|
312
|
+
It could be helpful to use `useStoryblok` instead of `useAsyncStoryblok` when we need to make full client-side requests, for example, getting personalized data for a logged user.
|
|
295
313
|
|
|
296
|
-
Check the available [apiOptions](https://
|
|
314
|
+
Check the available [apiOptions](https://www.storyblok.com/docs/api/content-delivery/v2#core-resources/stories/retrieve-one-story?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-nuxt) (passed to `storyblok-js-client`) and [bridgeOptions](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-nuxt) (passed to the Storyblok Bridge).
|
|
297
315
|
|
|
298
316
|
#### useStoryblokApi()
|
|
299
317
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
describe("@storyblok/nuxt", () => {
|
|
2
|
+
describe("Composition API", () => {
|
|
3
|
+
beforeEach(() => {
|
|
4
|
+
// cy.intercept("https://api.storyblok.com/**", {
|
|
5
|
+
// fixture: "stories.json"
|
|
6
|
+
// }).as("getStories");
|
|
7
|
+
cy.visit("/vue/test");
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("should fetch and render stories", () => {
|
|
11
|
+
it("Renders the expected story when loading the components", () => {
|
|
12
|
+
cy.get("[data-test=page]").should("exist");
|
|
13
|
+
cy.get("[data-test=grid]").should("exist");
|
|
14
|
+
cy.get("[data-test=feature]").should("have.length", 2);
|
|
15
|
+
cy.get("[data-test=teaser]").should("exist").and("have.text", "hello");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe("Composition API - Long form", () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
cy.visit("/vue");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should fetch and render stories", () => {
|
|
26
|
+
it("Renders the expected story when loading the components", () => {
|
|
27
|
+
cy.get("[data-test=page]").should("exist");
|
|
28
|
+
cy.get("[data-test=grid]").should("exist");
|
|
29
|
+
cy.get("[data-test=feature]").should("have.length", 3);
|
|
30
|
+
cy.get("[data-test=teaser]").should("exist").and("have.text", "hello");
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ***********************************************
|
|
2
|
+
// This example commands.js shows you how to
|
|
3
|
+
// create various custom commands and overwrite
|
|
4
|
+
// existing commands.
|
|
5
|
+
//
|
|
6
|
+
// For more comprehensive examples of custom
|
|
7
|
+
// commands please read more here:
|
|
8
|
+
// https://on.cypress.io/custom-commands
|
|
9
|
+
// ***********************************************
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
// -- This is a parent command --
|
|
13
|
+
// Cypress.Commands.add('login', (email, password) => { ... })
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
// -- This is a child command --
|
|
17
|
+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
|
18
|
+
//
|
|
19
|
+
//
|
|
20
|
+
// -- This is a dual command --
|
|
21
|
+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
// -- This will overwrite an existing command --
|
|
25
|
+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// ***********************************************************
|
|
2
|
+
// This example support/index.js is processed and
|
|
3
|
+
// loaded automatically before your test files.
|
|
4
|
+
//
|
|
5
|
+
// This is a great place to put global configuration and
|
|
6
|
+
// behavior that modifies Cypress.
|
|
7
|
+
//
|
|
8
|
+
// You can change the location of this file or turn off
|
|
9
|
+
// automatically serving support files with the
|
|
10
|
+
// 'supportFile' configuration option.
|
|
11
|
+
//
|
|
12
|
+
// You can read more here:
|
|
13
|
+
// https://on.cypress.io/configuration
|
|
14
|
+
// ***********************************************************
|
|
15
|
+
|
|
16
|
+
// Import commands.js using ES2015 syntax:
|
|
17
|
+
import "./commands";
|
|
18
|
+
|
|
19
|
+
// Alternatively you can use CommonJS syntax:
|
|
20
|
+
// require('./commands')
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineConfig } from "cypress";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
e2e: {
|
|
5
|
+
// We've imported your old cypress plugins here.
|
|
6
|
+
// You may want to clean this up later by importing these.
|
|
7
|
+
baseUrl: "http://localhost:3000",
|
|
8
|
+
viewportWidth: 1600,
|
|
9
|
+
viewportHeight: 1400
|
|
10
|
+
}
|
|
11
|
+
});
|
package/package.json
CHANGED
|
@@ -1,56 +1,100 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/nuxt",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Storyblok Nuxt module",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/module.cjs",
|
|
7
|
+
"types": "./dist/types.d.ts",
|
|
6
8
|
"exports": {
|
|
7
9
|
".": {
|
|
10
|
+
"types": "./dist/types.d.ts",
|
|
8
11
|
"import": "./dist/module.mjs",
|
|
9
12
|
"require": "./dist/module.cjs"
|
|
10
13
|
}
|
|
11
14
|
},
|
|
12
|
-
"main": "./dist/module.cjs",
|
|
13
|
-
"types": "./dist/types.d.ts",
|
|
14
|
-
"files": [
|
|
15
|
-
"dist"
|
|
16
|
-
],
|
|
17
|
-
"repository": "https://github.com/storyblok/storyblok-nuxt",
|
|
18
15
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"build": "nuxt-module-build
|
|
21
|
-
"
|
|
16
|
+
"prepack": "nuxt-module-build",
|
|
17
|
+
"build": "nuxt-module-build",
|
|
18
|
+
"dev": "nuxi dev playground",
|
|
19
|
+
"dev:build": "nuxi build playground",
|
|
20
|
+
"dev:preview": "nuxi preview playground",
|
|
21
|
+
"prepare:playground": "nuxi prepare playground",
|
|
22
|
+
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
|
|
23
|
+
"prepare": "husky install",
|
|
22
24
|
"cy:open": "cypress open",
|
|
23
25
|
"cy:run": "cypress run",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"test:e2e-
|
|
28
|
-
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@nuxt/kit": "^3.4.2",
|
|
31
|
-
"@storyblok/vue": "^7.1.11"
|
|
26
|
+
"test:e2e": "start-server-and-test dev http://localhost:3000 cy:run",
|
|
27
|
+
"test:e2e-watch": "start-server-and-test dev http://localhost:3000 cy:open",
|
|
28
|
+
"pretest:e2e-static": "nuxi generate playground",
|
|
29
|
+
"test:e2e-static": "start-server-and-test dev:preview http://localhost:3000 cy:run",
|
|
30
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"@babel/core": "^7.22.6",
|
|
35
33
|
"@cypress/vite-dev-server": "^5.0.5",
|
|
36
|
-
"@nuxt/
|
|
37
|
-
"
|
|
38
|
-
"
|
|
34
|
+
"@nuxt/eslint-config": "^0.1.1",
|
|
35
|
+
"@nuxt/module-builder": "^0.4.0",
|
|
36
|
+
"@nuxt/schema": "^3.6.5",
|
|
37
|
+
"@nuxt/test-utils": "^3.6.5",
|
|
38
|
+
"@types/node": "^20.4.4",
|
|
39
|
+
"cypress": "^12.17.2",
|
|
40
|
+
"@commitlint/cli": "^17.6.7",
|
|
41
|
+
"@commitlint/config-conventional": "^17.6.7",
|
|
42
|
+
"@nuxtjs/eslint-config-typescript": "latest",
|
|
43
|
+
"eslint": "^8.45.0",
|
|
44
|
+
"eslint-config-prettier": "^9.0.0",
|
|
39
45
|
"eslint-plugin-cypress": "^2.13.3",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
46
|
+
"eslint-plugin-vue": "^9.15.1",
|
|
47
|
+
"husky": "^8.0.3",
|
|
48
|
+
"lint-staged": "^13.2.3",
|
|
49
|
+
"nuxt": "^3.6.5",
|
|
50
|
+
"prettier": "^3.0.0",
|
|
51
|
+
"start-server-and-test": "^2.0.0"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@nuxt/kit": "^3.6.5",
|
|
55
|
+
"@storyblok/vue": "^7.1.11",
|
|
56
|
+
"prettier": "^3.0.0"
|
|
57
|
+
},
|
|
58
|
+
"lint-staged": {
|
|
59
|
+
"*.{vue,js,css}": [
|
|
60
|
+
"prettier --write",
|
|
61
|
+
"eslint"
|
|
62
|
+
],
|
|
63
|
+
"*.md": [
|
|
64
|
+
"prettier --write"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"commitlint": {
|
|
68
|
+
"extends": [
|
|
69
|
+
"@commitlint/config-conventional"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"eslintConfig": {
|
|
73
|
+
"extends": [
|
|
74
|
+
"eslint:recommended",
|
|
75
|
+
"@nuxtjs/eslint-config-typescript",
|
|
76
|
+
"plugin:vue/vue3-recommended",
|
|
77
|
+
"prettier"
|
|
78
|
+
],
|
|
79
|
+
"rules": {
|
|
80
|
+
"vue/multi-word-component-names": 1
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"eslintIgnore": [
|
|
84
|
+
"**/templates/plugin.js",
|
|
85
|
+
"playground/app.vue"
|
|
86
|
+
],
|
|
87
|
+
"prettier": {
|
|
88
|
+
"trailingComma": "none",
|
|
89
|
+
"tabWidth": 2,
|
|
90
|
+
"semi": true,
|
|
91
|
+
"singleQuote": false
|
|
43
92
|
},
|
|
44
93
|
"release": {
|
|
45
94
|
"branches": [
|
|
46
95
|
"main"
|
|
47
96
|
]
|
|
48
97
|
},
|
|
49
|
-
"contributors": [
|
|
50
|
-
{
|
|
51
|
-
"name": "Alexander Feiglstorfer <delooks@gmail.com>"
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
98
|
"publishConfig": {
|
|
55
99
|
"access": "public"
|
|
56
100
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Nuxt 3 Minimal Starter
|
|
2
|
+
|
|
3
|
+
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Make sure to install the dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# npm
|
|
11
|
+
npm install
|
|
12
|
+
|
|
13
|
+
# pnpm
|
|
14
|
+
pnpm install
|
|
15
|
+
|
|
16
|
+
# yarn
|
|
17
|
+
yarn install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Development Server
|
|
21
|
+
|
|
22
|
+
Start the development server on `http://localhost:3000`:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# npm
|
|
26
|
+
npm run dev
|
|
27
|
+
|
|
28
|
+
# pnpm
|
|
29
|
+
pnpm run dev
|
|
30
|
+
|
|
31
|
+
# yarn
|
|
32
|
+
yarn dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Production
|
|
36
|
+
|
|
37
|
+
Build the application for production:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# npm
|
|
41
|
+
npm run build
|
|
42
|
+
|
|
43
|
+
# pnpm
|
|
44
|
+
pnpm run build
|
|
45
|
+
|
|
46
|
+
# yarn
|
|
47
|
+
yarn build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Locally preview production build:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# npm
|
|
54
|
+
npm run preview
|
|
55
|
+
|
|
56
|
+
# pnpm
|
|
57
|
+
pnpm run preview
|
|
58
|
+
|
|
59
|
+
# yarn
|
|
60
|
+
yarn preview
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|