Skip to content

Commit

Permalink
Merge pull request #921 from storyblok/chore/remove-husky-add-eslint-…
Browse files Browse the repository at this point in the history
…flat

chore: remove husky add eslint flat
  • Loading branch information
alvarosabu authored Nov 6, 2024
2 parents 946e846 + 80224a6 commit a6fc3c3
Show file tree
Hide file tree
Showing 51 changed files with 2,296 additions and 907 deletions.
12 changes: 0 additions & 12 deletions .editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

7 changes: 0 additions & 7 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
blank_issues_enabled: false
blank_issues_enabled: false
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/issue.bug.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "\U0001F41E SDK Bug Report"
name: 🐞 SDK Bug Report
description: Report an issue using Nuxt 3 Storyblok SDK
labels: [pending-triage, pending-author]
body:
Expand All @@ -11,7 +11,7 @@ body:
attributes:
label: Describe the issue you're facing
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!
placeholder: My Nuxt 3 Storyblok SDK configuration is ... ## Expected behavior ... ## Current Behavior ...
placeholder: My Nuxt 3 Storyblok SDK configuration is ... # # Expected behavior ... ## Current Behavior ...
validations:
required: true
- type: input
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/issue.fr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "\U0001F58C SDK Feature Request"
name: 🖌 SDK Feature Request
description: Propose a feature or improvement that the Storyblok SDK should have
labels: [enhancement, pending-triage, pending-author]
body:
Expand All @@ -10,15 +10,15 @@ body:
id: feature-description
attributes:
label: Description
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!"
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!'
placeholder: As a developer using Storyblok SDK I want [wish] so that [benefit].
validations:
required: true
- type: textarea
id: suggested-solution
attributes:
label: Suggested solution or improvement
description: "Link to the PR or what implementation you will expect from us (links to external examples if needed)."
description: Link to the PR or what implementation you will expect from us (links to external examples if needed).
validations:
required: true
- type: textarea
Expand Down
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: npm
directory: /
schedule:
interval: "daily"
time: "05:00"
interval: daily
time: '05:00'
commit-message:
prefix: fix
prefix-development: chore
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
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')}}
run: gh pr merge --auto --merge "$PR_URL"
env:
DEPENDENCY: "@storyblok/vue"
DEPENDENCY: '@storyblok/vue'
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.DEPENDABOT_TOKEN}}
17 changes: 17 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run linters
on: [push]

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI

jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run Lint
run: pnpm run lint
38 changes: 38 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Any Commit
on:
push:
branches:
- '**'
tags:
- '!**'

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- run: pnpx pkg-pr-new publish --compact --pnpm
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI


jobs:
release:
runs-on: ubuntu-latest
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run E2E Tests
on: [push]

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI

jobs:
test:
name: E2E Test
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Set up Cypress binary cache
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install dependencies
run: pnpm install
- name: Build lib
run: pnpm run build
- name: Cypress run
run: pnpm run test:e2e
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .husky/commit-msg

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

50 changes: 24 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ npx nuxi@latest module add storyblok
Add following code to modules section of `nuxt.config.js` and replace the accessToken with API token from Storyblok space.

```js
import { defineNuxtConfig } from "nuxt";
import { defineNuxtConfig } from 'nuxt';

export default defineNuxtConfig({
modules: [
["@storyblok/nuxt", { accessToken: "<your-access-token>" }]
['@storyblok/nuxt', { accessToken: '<your-access-token>' }]
// ...
]
});
Expand All @@ -57,12 +57,12 @@ export default defineNuxtConfig({
You can also use the `storyblok` config if you prefer:

```js
import { defineNuxtConfig } from "nuxt";
import { defineNuxtConfig } from 'nuxt';

export default defineNuxtConfig({
modules: ["@storyblok/nuxt"],
modules: ['@storyblok/nuxt'],
storyblok: {
accessToken: "<your-access-token>"
accessToken: '<your-access-token>'
}
});
```
Expand Down Expand Up @@ -97,9 +97,9 @@ While the recommended approach covers most cases, there are specific instances w
// nuxt.config.ts
modules: [
[
"@storyblok/nuxt",
'@storyblok/nuxt',
{
accessToken: "<your-access-token>",
accessToken: '<your-access-token>',
enableSudoMode: true
}
]
Expand All @@ -110,17 +110,17 @@ To include additional functionalities in the SDK's `apiOptions`, such as custom

```js
// plugins/storyblok.js
import { StoryblokVue, apiPlugin } from "@storyblok/vue";
import { apiPlugin, StoryblokVue } from '@storyblok/vue';

export default defineNuxtPlugin(({ vueApp }) => {
vueApp.use(StoryblokVue, {
accessToken: "<your-access-token>",
accessToken: '<your-access-token>',
apiOptions: {
cache: {
type: "custom",
type: 'custom',
custom: {
flush() {
console.log("all right");
console.log('all right');
}
}
}
Expand Down Expand Up @@ -280,17 +280,15 @@ You can easily render rich text by using the `renderRichText` function that come

<script setup>
const props = defineProps({ blok: Object });
const articleContent = computed(() =>
renderRichText(props.blok.articleContent)
);
const articleContent = computed(() => renderRichText(props.blok.articleContent));
</script>
```

You can also set a **custom Schema and component resolver** by passing the options as the second parameter of the `renderRichText` function:

```html
<script setup>
import cloneDeep from "clone-deep";
import cloneDeep from 'clone-deep';
const mySchema = cloneDeep(RichTextSchema); // you can make a copy of the default RichTextSchema
// ... and edit the nodes and marks, or add your own.
Expand All @@ -303,13 +301,13 @@ You can also set a **custom Schema and component resolver** by passing the optio
schema: mySchema,
resolver: (component, blok) => {
switch (component) {
case "my-custom-component":
case 'my-custom-component':
return `<div class="my-component-class">${blok.text}</div>`;
default:
return "Resolver not defined";
return 'Resolver not defined';
}
}
})
},
}),
);
</script>
```
Expand All @@ -333,7 +331,7 @@ In your `nuxt.config.ts`:
export default defineNuxtConfig({
runtimeConfig: {
public: {
storyblokVersion: process.env.STORYBLOK_VERSION || "published"
storyblokVersion: process.env.STORYBLOK_VERSION || 'published'
}
}
});
Expand All @@ -345,19 +343,19 @@ Then you can access the runtime config in your components:
const config = useRuntimeConfig();

const story = await useAsyncStoryblok(
"blog",
'blog',
{
version: config.public.storyblokVersion,
resolve_relations: "overview.featured_story"
resolve_relations: 'overview.featured_story'
},
{ resolveRelations: "overview.featured_story" }
{ resolveRelations: 'overview.featured_story' }
);

//or
// or

const { data: articles } = await storyblokApi.get("cdn/stories", {
const { data: articles } = await storyblokApi.get('cdn/stories', {
version: config.public.storyblokVersion,
starts_with: "blog",
starts_with: 'blog',
is_startpage: false
});
```
Expand Down
8 changes: 4 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { defineConfig } from "cypress";
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
baseUrl: "http://localhost:3000",
baseUrl: 'http://localhost:3000',
viewportWidth: 1600,
viewportHeight: 1400
}
viewportHeight: 1400,
},
});
Loading

0 comments on commit a6fc3c3

Please sign in to comment.