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

Upgrade and make boilerplate client focus again #44

Merged
merged 13 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
NEXT_PUBLIC_BASE_URL='https://demo-api.dwarvesf.com/api/v1'
NEXT_PUBLIC_API_MOCKING=disabled
NEXT_PUBLIC_BASE_URL='/api'
8 changes: 4 additions & 4 deletions .github/workflows/storybook-netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
with:
access_token: ${{ github.token }}

- name: Use Node.js 16.x
uses: actions/setup-node@v1
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
version: 16.x
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: 8.2.0
version: 9.0.6

- name: Build Storybook
run: |
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
- opened
- synchronize

env:
NEXT_PUBLIC_BASE_URL: https://demo-api.dwarvesf.com/api/v1

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -20,14 +17,14 @@ jobs:
with:
access_token: ${{ github.token }}

- name: Use Node.js 16.x
uses: actions/setup-node@v1
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
version: 16.x
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: 8.2.0
version: 9.0.6

- name: Jest run
run: |
Expand Down
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit ""
pnpm dlx commitlint --edit $1 --verbose
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
102 changes: 0 additions & 102 deletions .spectral.js

This file was deleted.

46 changes: 0 additions & 46 deletions .storybook/main.js

This file was deleted.

56 changes: 56 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import type { StorybookConfig } from '@storybook/nextjs'
import path from 'path'
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')

const storybookConfig: StorybookConfig = {
framework: {
name: '@storybook/nextjs',
options: { builder: { useSWC: true } },
},
staticDirs: ['../public'],
stories: [
'../src/components/**/*.stories.mdx',
'../src/components/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-storysource',
'@storybook/addon-styling-webpack',
],
webpackFinal: async (config) => {
if (config.resolve) {
config.resolve.plugins = [
new TsconfigPathsPlugin({
configFile: path.resolve(__dirname, '../tsconfig.json'),
}),
]
}

if (config.module?.rules) {
// This modifies the existing image rule to exclude `.svg` files
// since we handle those with `@svgr/webpack`.
const imageRule = config.module.rules.find((rule: any) => {
if (typeof rule !== 'string' && rule.test instanceof RegExp) {
return rule.test.test('.svg')
}
})
if (typeof imageRule !== 'string') {
;(imageRule as any).exclude = /\.svg$/
}

config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
})
}

config.module?.rules?.push({
test: /\.mjs$/,
include: [/node_modules/],
type: 'javascript/auto',
})

return config
},
}
export default storybookConfig
4 changes: 0 additions & 4 deletions .storybook/manager.js

This file was deleted.

7 changes: 4 additions & 3 deletions .storybook/preview.js → .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { RouterContext } from 'next/dist/shared/lib/router-context' // next 11.2
import './index.css'
import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime'
import './styles.css'
import { Parameters } from '@storybook/react'

export const parameters = {
export const parameters: Parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
nextRouter: {
Provider: RouterContext.Provider,
Expand Down
File renamed without changes.
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,12 @@ pnpm dev
Open [http://localhost:3000](http://localhost:3000) with your favorite browser
to see your project.

## Deployment
## Links

| Environment | URL |
| ----------- | ------------------------------------------ |
| Prod | https://df-nextjs-boilerplate.netlify.app/ |

## Resources

| Name | Description | Link |
| ---------- | ----------- | ---------------------------------------------------- |
| UI Docs | Storybook | https://df-nextjs-boilerplate-storybook.netlify.app/ |
| API Docs | Swagger | https://demo-api.dwarvesf.com/swagger/index.html |
| API Source | Go | https://github.com/dwarvesf/go-api.git |
| Environment | URL |
| ----------- | ---------------------------------------------------- |
| Preview | https://df-nextjs-boilerplate.netlify.app/ |
| Storybook | https://df-nextjs-boilerplate-storybook.netlify.app/ |

## Documentation

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/auth.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe('User Sign-up and Login', () => {

it('should allow a visitor to sign-up, login, and logout', function () {
const userInfo = {
email: 'demo@dwarves.foundation',
password: 'Testing@123',
email: 'test@d.foundation',
password: 'Thepassword1',
}

cy.visit('/')
Expand Down
22 changes: 8 additions & 14 deletions docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ to see your project.
│── cypress # Cypress configuration and tests
├── tailwind.config.js # Tailwind CSS configuration
├── tsconfig.json # TypeScript configuration
├── .spectral.js # IBM OpenAPI Ruleset for Orval used on validating the rules for Swagger
└── orval.config.js # Orval api generator configuration
```

### Develop UI components
Expand All @@ -63,26 +61,22 @@ The UI document then should be live at

If your team use Swagger to document APIs, we support a node script to generate
TypeScript interfaces via your Swagger scheme. In
[orval.config.js](../orval.config.js), change the default path to the location
of your Swagger JSON doc.

```diff
input: {
- target: 'https://demo-api.dwarvesf.com/swagger/doc.json',
+ target: 'your-api-swagger-json',
...
}
[package.json](../package.json), change the default path to the location of your
Swagger JSON doc.

```
- "fetch-definitions": "swagger-typescript-api --no-client -p ./libs/swagger.json -o ./types -n schema.ts",
+ "fetch-definitions": "swagger-typescript-api --no-client -p your-api-swagger-json -o ./types -n schema.ts",

Then, you can run the script locally to generate TypeScript definitions for the
APIs:

```bash
pnpm generate:api
pnpm fetch-definitions
```

The generated models and api clients will be located at [api](../src/api)
folder.
The generated interfaces will be located at
[types/schema.ts](../types/schema.ts).

## Read on:

Expand Down
Binary file modified docs/img/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading