Skip to content

Commit

Permalink
[apps/www] Add storybook back (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
54nd10 authored Jan 9, 2024
1 parent 2deb242 commit 553b7f0
Show file tree
Hide file tree
Showing 120 changed files with 4,377 additions and 1,257 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on: pull_request

jobs:
linter:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: true
- name: Run linter
run: pnpm run lint
build:
name: Build Code Base
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: true
- name: Build cms
run: pnpm run build
# Already done by vercel
# - name: Build www
# run: pnpm run build:www
component-check:
name: Storybook
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: 'Install Node'
uses: actions/setup-node@v3
with:
node-version: '20.x'
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install -w www
- name: Check for missing stories
id: check
run: pnpm run storybook:check
- name: Comment PR
if: ${{failure() || success()}}
uses: thollander/actions-comment-pull-request@v2
with:
filePath: './storybook-check.md'
- name: Fail if stories are missing
if: ${{failure()}}
run: exit 1
18 changes: 0 additions & 18 deletions .github/workflows/linter.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,4 @@ public/blog
.env
.vscode
*.dump
storybook-check.md
18 changes: 9 additions & 9 deletions apps/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
"strapi": "strapi"
},
"dependencies": {
"@strapi/plugin-i18n": "^4.15.5",
"@strapi/plugin-users-permissions": "4.15.5",
"@strapi/provider-upload-aws-s3": "^4.15.5",
"@strapi/strapi": "4.15.5",
"@strapi/typescript-utils": "^4.15.5",
"better-sqlite3": "9.1.1",
"@strapi/plugin-i18n": "^4.16.2",
"@strapi/plugin-users-permissions": "4.16.2",
"@strapi/provider-upload-aws-s3": "^4.16.2",
"@strapi/strapi": "4.16.2",
"@strapi/typescript-utils": "^4.16.2",
"better-sqlite3": "9.2.2",
"glob": "^10.3.10",
"pg": "^8.11.3",
"pg-connection-string": "^2.6.2",
"react": "^x",
"react-dom": "^x",
"react-router-dom": "^5.2.0",
"strapi-plugin-multi-select": "^1.2.2",
"react-router-dom": "x",
"strapi-plugin-multi-select": "^1.2.3",
"strapi-plugin-placeholder": "^4.4.0",
"strapi-plugin-populate-deep": "^3.0.1",
"strapi-plugin-preview-button": "^2.2.1",
Expand All @@ -39,7 +39,7 @@
"devDependencies": {
"@types/pg": "^8.10.9",
"dotenv": "^16.3.1",
"tsx": "^4.3.0"
"tsx": "^x"
},
"engines": {
"node": "18.x",
Expand Down
13 changes: 6 additions & 7 deletions apps/cms/src/plugins/revalidate-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@
"develop": "tsc -p tsconfig.server.json -w"
},
"dependencies": {
"@strapi/design-system": "^1.6.3",
"@strapi/helper-plugin": "^4.6.0",
"@strapi/icons": "^1.6.3",
"prop-types": "^15.7.2"
"@strapi/design-system": "^1.13.1",
"@strapi/helper-plugin": "^4.16.2",
"@strapi/icons": "^1.13.0",
"prop-types": "^15.8.1"
},
"devDependencies": {
"@strapi/typescript-utils": "^4.6.0",
"@strapi/typescript-utils": "^4.16.2",
"@types/react": "x",
"@types/react-dom": "x",
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^5.1.26",
"@types/styled-components": "^5.1.34",
"react": "x",
"react-dom": "x",
"react-router-dom": "^x",
"styled-components": "^5.3.6",
"typescript": "x"
},
"peerDependencies": {
Expand Down
71 changes: 71 additions & 0 deletions apps/cms/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,75 @@ export interface PluginUploadFolder extends Schema.CollectionType {
}
}

export interface PluginContentReleasesRelease extends Schema.CollectionType {
collectionName: 'strapi_releases'
info: {
singularName: 'release'
pluralName: 'releases'
displayName: 'Release'
}
options: {
draftAndPublish: false
}
pluginOptions: {
'content-manager': {
visible: false
}
'content-type-builder': {
visible: false
}
}
attributes: {
name: Attribute.String & Attribute.Required
releasedAt: Attribute.DateTime
actions: Attribute.Relation<
'plugin::content-releases.release',
'oneToMany',
'plugin::content-releases.release-action'
>
createdAt: Attribute.DateTime
updatedAt: Attribute.DateTime
createdBy: Attribute.Relation<'plugin::content-releases.release', 'oneToOne', 'admin::user'> & Attribute.Private
updatedBy: Attribute.Relation<'plugin::content-releases.release', 'oneToOne', 'admin::user'> & Attribute.Private
}
}

export interface PluginContentReleasesReleaseAction extends Schema.CollectionType {
collectionName: 'strapi_release_actions'
info: {
singularName: 'release-action'
pluralName: 'release-actions'
displayName: 'Release Action'
}
options: {
draftAndPublish: false
}
pluginOptions: {
'content-manager': {
visible: false
}
'content-type-builder': {
visible: false
}
}
attributes: {
type: Attribute.Enumeration<['publish', 'unpublish']> & Attribute.Required
entry: Attribute.Relation<'plugin::content-releases.release-action', 'morphToOne'>
contentType: Attribute.String & Attribute.Required
release: Attribute.Relation<
'plugin::content-releases.release-action',
'manyToOne',
'plugin::content-releases.release'
>
createdAt: Attribute.DateTime
updatedAt: Attribute.DateTime
createdBy: Attribute.Relation<'plugin::content-releases.release-action', 'oneToOne', 'admin::user'> &
Attribute.Private
updatedBy: Attribute.Relation<'plugin::content-releases.release-action', 'oneToOne', 'admin::user'> &
Attribute.Private
}
}

export interface PluginTranslateBatchTranslateJob extends Schema.CollectionType {
collectionName: 'translate_batch_translate_jobs'
info: {
Expand Down Expand Up @@ -1249,6 +1318,8 @@ declare module '@strapi/types' {
'admin::transfer-token-permission': AdminTransferTokenPermission
'plugin::upload.file': PluginUploadFile
'plugin::upload.folder': PluginUploadFolder
'plugin::content-releases.release': PluginContentReleasesRelease
'plugin::content-releases.release-action': PluginContentReleasesReleaseAction
'plugin::translate.batch-translate-job': PluginTranslateBatchTranslateJob
'plugin::i18n.locale': PluginI18NLocale
'plugin::users-permissions.permission': PluginUsersPermissionsPermission
Expand Down
37 changes: 37 additions & 0 deletions apps/www/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type {StorybookConfig} from '@storybook/nextjs'

import {join, dirname, resolve} from 'path'
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')))
}
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-onboarding'),
getAbsolutePath('@storybook/addon-interactions')
],
framework: {
name: getAbsolutePath('@storybook/nextjs'),
options: {}
},
docs: {
autodocs: 'tag'
},
webpackFinal: async (config) => {
config.resolve.plugins = [
new TsconfigPathsPlugin({
configFile: resolve(__dirname, '../tsconfig.json')
})
]

return config
}
}
export default config
24 changes: 24 additions & 0 deletions apps/www/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type {Preview} from '@storybook/react'
import '../src/styles/global.css'
import config from '../tailwind.config'

const preview: Preview = {
parameters: {
backgrounds: {
default: '56kcloud',
values: [{name: '56kcloud', value: config.theme.extend.colors.background}]
},
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i
}
},
nextjs: {
appDirectory: true
}
}
}

export default preview
68 changes: 35 additions & 33 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,66 +12,68 @@
"storybook": "storybook dev -p 6006"
},
"dependencies": {
"@faker-js/faker": "^8.2.0",
"@heroicons/react": "^2.0.18",
"@heroicons/react": "^2.1.1",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@slack/web-api": "^6.11.0",
"@types/luxon": "^3.3.3",
"child_process": "^1.0.2",
"clsx": "^2.0.0",
"date-fns": "^2.30.0",
"clsx": "^2.1.0",
"date-fns": "^3.1.0",
"dotenv": "^16.3.1",
"framer-motion": "^10.16.4",
"humanize-duration": "^3.30.0",
"lucide-react": "0.298.0",
"luxon": "^3.4.3",
"markdown-to-jsx": "^7.3.2",
"next": "^14.0.1",
"next-translate": "^2.6.1",
"next-translate-plugin": "^2.6.1",
"framer-motion": "^10.17.9",
"humanize-duration": "^3.31.0",
"lucide-react": "0.307.0",
"luxon": "^3.4.4",
"markdown-to-jsx": "^7.4.0",
"next": "^14.0.4",
"notion-to-tailwind": "0.0.12",
"open-graph-scraper": "^6.3.2",
"plaiceholder": "^3.0.0",
"react": "x",
"react-confetti-explosion": "^2.1.2",
"react-dom": "x",
"react-hook-form": "^7.47.0",
"react-image-size": "^2.0.2",
"react-hook-form": "^7.49.2",
"react-image-size": "^2.3.2",
"react-responsive-masonry": "^2.1.7",
"react-twitter-widgets": "^1.11.0",
"slugify": "^1.6.6",
"tailwind-merge": "^2.0.0",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
},
"devDependencies": {
"@faker-js/faker": "^x",
"@headlessui/react": "^1.7.17",
"@storybook/addon-essentials": "^7.5.2",
"@storybook/addon-interactions": "^7.5.2",
"@storybook/addon-links": "^7.5.2",
"@storybook/addon-essentials": "^7.6.7",
"@storybook/addon-interactions": "^7.6.7",
"@storybook/addon-links": "^7.6.7",
"@storybook/addon-onboarding": "^1.0.10",
"@storybook/addon-styling": "^1.3.7",
"@storybook/blocks": "^7.5.2",
"@storybook/nextjs": "^7.5.2",
"@storybook/react": "^7.5.2",
"@storybook/react-webpack5": "^7.5.2",
"@storybook/blocks": "^7.6.7",
"@storybook/nextjs": "^7.6.7",
"@storybook/react": "^7.6.7",
"@storybook/react-webpack5": "^7.6.7",
"@storybook/test": "^7.6.7",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.6",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"@types/humanize-duration": "^3.27.2",
"@types/node": "^20.8.10",
"@types/humanize-duration": "^3.27.4",
"@types/luxon": "^3.4.0",
"@types/node": "^x",
"@types/react": "^x",
"@types/react-responsive-masonry": "^2.1.2",
"@types/react-responsive-masonry": "^2.1.3",
"autoprefixer": "^10.4.16",
"buffer-image-size": "^0.6.4",
"eslint-config-next": "14.0.1",
"eslint-config-next": "14.0.4",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-storybook": "^0.6.15",
"postcss": "^8.4.31",
"storybook": "^7.5.2",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2"
"fast-glob": "^3.3.2",
"postcss": "^8.4.33",
"storybook": "^7.6.7",
"tailwindcss": "^3.4.1",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"tsx": "x",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit 553b7f0

Please sign in to comment.