Skip to content

Commit

Permalink
Merge pull request #52 from tosaken1116/develop
Browse files Browse the repository at this point in the history
release
  • Loading branch information
tosaken1116 authored Oct 29, 2023
2 parents 435a0ee + 82891e0 commit 140b735
Show file tree
Hide file tree
Showing 112 changed files with 3,078 additions and 253 deletions.
5 changes: 5 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NEXT_PUBLIC_BACKEND_URL=
ACCESS_KEY_ID=
SECRET_ACCESS_KEY=
REGION=
S3_BUCKET_NAME=
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ build/
_templates/
setup.js
*.config.*
src/apis
src/api/**/*
22 changes: 9 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,23 @@
"plugin:jsx-a11y/recommended",
"next/core-web-vitals",
"prettier",
"plugin:storybook/recommended"
"plugin:storybook/recommended",
"plugin:tailwindcss/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": [
"react",
"import",
"unused-imports",
"jsx-a11y",
"@typescript-eslint",
"@tanstack/query"
],
"plugins": ["react", "import", "unused-imports", "jsx-a11y", "tailwindcss"],
"settings": {
"tailwindcss": {
"callees": ["cn"]
}
},
"rules": {
"@tanstack/query/exhaustive-deps": "error",
"@tanstack/query/prefer-query-object-syntax": "error",
"@tanstack/query/stable-query-client": "error",
// 関数の戻り値の型を明示的に指定する
"@typescript-eslint/explicit-function-return-type": "error",

"tailwindcss/no-custom-classname": "off",
// 必要な場合にのみアロー関数の本体を使用する
"arrow-body-style": ["error", "as-needed"],

Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "schemas"]
path = schemas
[submodule "schema"]
path = schema
url = [email protected]:tosaken1116/Somniosus_schema.git
2 changes: 1 addition & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Preview } from '@storybook/react';

import '../src/app/globals.css';
const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
"nextjs",
"precommit",
"tailwindcss"
],
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
}
9 changes: 6 additions & 3 deletions aspida.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
module.exports = {
input: 'src/apis/', // "input" of aspida is "output" for openapi2aspida
outputEachDir: true, // Generate $api.ts in each endpoint directory
openapi: { inputFile: './schemas/build/openapi.yml' },
input: 'api',
outputEachDir: true,
openapi: {
inputFile: './schema/build/openapi.yml',
outputDir: 'src/api',
},
};
Binary file modified bun.lockb
Binary file not shown.
16 changes: 16 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/libs/utils"
}
}
4 changes: 2 additions & 2 deletions cspell.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// language - current active spelling language
"language": "en",
// words - list of words to be always considered correct
"words": ["autodocs"],
"ignorePaths": ["./src/apis"]
"words": ["aspida", "autodocs", "clsx"],
"ignorePaths": ["src/api/**/*"]
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// For example "hte" should be "the"
Expand Down
17 changes: 15 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {
images: {
domains: ['avatars.githubusercontent.com'],
},
env: {
ACCESS_KEY_ID: process.env.ACCESS_KEY_ID,
SECRET_ACCESS_KEY: process.env.SECRET_ACCESS_KEY,
REGION: process.env.REGION,
S3_BUCKET_NAME: process.env.S3_BUCKET_NAME,
},
experimental: {
serverActions: true,
},
};

module.exports = nextConfig
module.exports = nextConfig;
36 changes: 30 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"prepare": "husky install",
"generate:type": "rm -r src/apis && openapi2aspida -c ./aspida.config.js",
"commitmsg": "commitlint -e $GIT_PARAMS",
"mock": "prism mock ./schema/build/openapi.yml",
"type": "openapi2aspida -c ./aspida.config.js --dotenv .env.local",
"fmt": "prettier --write 'src/**/*.{js,jsx,ts,tsx,json,css,scss}'",
"check:lint": "eslint 'src/**/*.{ts,tsx}' --report-unused-disable-directives --max-warnings 0",
"check:cspell": "cspell -c ./cspell.config.json \"./src/**/*\" --unique --no-progress --no-summary",
Expand All @@ -36,10 +38,27 @@
]
},
"dependencies": {
"@tanstack/react-query": "^4.36.1",
"next": "13.5.4",
"@aspida/fetch": "^1.14.0",
"@aws-sdk/client-s3": "^3.438.0",
"@aws-sdk/lib-storage": "^3.438.0",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@stoplight/prism-cli": "^5.5.0",
"@tanstack/react-query": "^5.0.5",
"aspida": "^1.14.0",
"date-fns": "^2.30.0",
"lucide-react": "^0.288.0",
"next": "13.5.6",
"react": "18.2.0",
"react-dom": "18.2.0"
"react-dom": "18.2.0",
"react-error-boundary": "^4.0.11",
"react-icons": "^4.11.0"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
Expand All @@ -63,33 +82,38 @@
"@testing-library/react": "^14.0.0",
"@tsconfig/strictest": "^2.0.1",
"@types/jest": "^29.5.4",
"@types/node": "20.8.4",
"@types/node": "20.8.8",
"@types/react": "18.2.28",
"@types/react-dom": "18.2.13",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"autoprefixer": "^10.4.16",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cspell": "^7.3.2",
"eslint": "8.51.0",
"eslint-config-next": "13.5.4",
"eslint-config-next": "13.5.6",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-storybook": "^0.6.13",
"eslint-plugin-tailwindcss": "^3.13.0",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^8.0.3",
"hygen": "^6.2.11",
"jest": "^29.6.4",
"jest-environment-jsdom": "^29.6.4",
"lint-staged": "^14.0.1",
"lint-staged": "^15.0.2",
"markuplint": "^3.12.1",
"npm-run-all": "^4.1.5",
"openapi2aspida": "^0.23.2",
"postcss": "^8.4.31",
"prettier": "^3.0.1",
"storybook": "^7.2.2",
"tailwind-merge": "^1.14.0",
"tailwindcss": "^3.3.3",
"tailwindcss-animate": "^1.0.7",
"ts-jest": "^29.1.1",
"typescript": "5.2.2"
},
Expand Down
1 change: 1 addition & 0 deletions schema
Submodule schema added at 2fc205
61 changes: 39 additions & 22 deletions src/apis/$api.ts → src/api/$api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { AspidaClient, BasicHeaders } from 'aspida';
import type { Methods as Methods_1vmdska } from './accounts/_id@string';
import type { Methods as Methods_17l7lnu } from './accounts/register';
import type { Methods as Methods_1nkw4za } from './accounts/register/password';
import type { Methods as Methods_66bvhy } from './accounts/update';
import type { Methods as Methods_12twjkf } from './follows/create/_id@string';
import type { Methods as Methods_1ot5dgu } from './follows/delete/_id@string';
Expand All @@ -14,14 +15,15 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
const prefix = (baseURL === undefined ? 'http://localhost:8000' : baseURL).replace(/\/$/, '');
const PATH0 = '/accounts';
const PATH1 = '/accounts/register';
const PATH2 = '/accounts/update';
const PATH3 = '/follows/create';
const PATH4 = '/follows/delete';
const PATH5 = '/likes/create';
const PATH6 = '/likes/delete';
const PATH7 = '/tweets/delete';
const PATH8 = '/tweets/get/timeline';
const PATH9 = '/tweets/post';
const PATH2 = '/accounts/register/password';
const PATH3 = '/accounts/update';
const PATH4 = '/follows/create';
const PATH5 = '/follows/delete';
const PATH6 = '/likes/create';
const PATH7 = '/likes/delete';
const PATH8 = '/tweets/delete';
const PATH9 = '/tweets/get/timeline';
const PATH10 = '/tweets/post';
const GET = 'GET';
const POST = 'POST';
const PUT = 'PUT';
Expand All @@ -47,6 +49,21 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
};
},
register: {
password: {
/**
* @param option.body - password to create
* @returns success
*/
post: (option: { body: Methods_1nkw4za['post']['reqBody'], config?: T | undefined }) =>
fetch<Methods_1nkw4za['post']['resBody'], BasicHeaders, Methods_1nkw4za['post']['status']>(prefix, PATH2, POST, option).json(),
/**
* @param option.body - password to create
* @returns success
*/
$post: (option: { body: Methods_1nkw4za['post']['reqBody'], config?: T | undefined }) =>
fetch<Methods_1nkw4za['post']['resBody'], BasicHeaders, Methods_1nkw4za['post']['status']>(prefix, PATH2, POST, option).json().then(r => r.body),
$path: () => `${prefix}${PATH2}`,
},
/**
* @param option.body - account to create
* @returns success
Expand All @@ -67,20 +84,20 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
* @returns success
*/
put: (option: { body: Methods_66bvhy['put']['reqBody'], config?: T | undefined }) =>
fetch<Methods_66bvhy['put']['resBody'], BasicHeaders, Methods_66bvhy['put']['status']>(prefix, PATH2, PUT, option).json(),
fetch<Methods_66bvhy['put']['resBody'], BasicHeaders, Methods_66bvhy['put']['status']>(prefix, PATH3, PUT, option).json(),
/**
* @param option.body - account to update
* @returns success
*/
$put: (option: { body: Methods_66bvhy['put']['reqBody'], config?: T | undefined }) =>
fetch<Methods_66bvhy['put']['resBody'], BasicHeaders, Methods_66bvhy['put']['status']>(prefix, PATH2, PUT, option).json().then(r => r.body),
$path: () => `${prefix}${PATH2}`,
fetch<Methods_66bvhy['put']['resBody'], BasicHeaders, Methods_66bvhy['put']['status']>(prefix, PATH3, PUT, option).json().then(r => r.body),
$path: () => `${prefix}${PATH3}`,
},
},
follows: {
create: {
_id: (val2: string) => {
const prefix2 = `${PATH3}/${val2}`;
const prefix2 = `${PATH4}/${val2}`;

return {
/**
Expand All @@ -99,7 +116,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
},
delete: {
_id: (val2: string) => {
const prefix2 = `${PATH4}/${val2}`;
const prefix2 = `${PATH5}/${val2}`;

return {
/**
Expand All @@ -120,7 +137,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
likes: {
create: {
_id: (val2: string) => {
const prefix2 = `${PATH5}/${val2}`;
const prefix2 = `${PATH6}/${val2}`;

return {
/**
Expand All @@ -139,7 +156,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
},
delete: {
_id: (val2: string) => {
const prefix2 = `${PATH6}/${val2}`;
const prefix2 = `${PATH7}/${val2}`;

return {
/**
Expand All @@ -160,7 +177,7 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
tweets: {
delete: {
_id: (val2: string) => {
const prefix2 = `${PATH7}/${val2}`;
const prefix2 = `${PATH8}/${val2}`;

return {
/**
Expand All @@ -183,13 +200,13 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
* @returns success
*/
get: (option?: { config?: T | undefined } | undefined) =>
fetch<Methods_um4wq7['get']['resBody'], BasicHeaders, Methods_um4wq7['get']['status']>(prefix, PATH8, GET, option).json(),
fetch<Methods_um4wq7['get']['resBody'], BasicHeaders, Methods_um4wq7['get']['status']>(prefix, PATH9, GET, option).json(),
/**
* @returns success
*/
$get: (option?: { config?: T | undefined } | undefined) =>
fetch<Methods_um4wq7['get']['resBody'], BasicHeaders, Methods_um4wq7['get']['status']>(prefix, PATH8, GET, option).json().then(r => r.body),
$path: () => `${prefix}${PATH8}`,
fetch<Methods_um4wq7['get']['resBody'], BasicHeaders, Methods_um4wq7['get']['status']>(prefix, PATH9, GET, option).json().then(r => r.body),
$path: () => `${prefix}${PATH9}`,
},
},
post: {
Expand All @@ -198,14 +215,14 @@ const api = <T>({ baseURL, fetch }: AspidaClient<T>) => {
* @returns success
*/
post: (option: { body: Methods_hsfp97['post']['reqBody'], config?: T | undefined }) =>
fetch<Methods_hsfp97['post']['resBody'], BasicHeaders, Methods_hsfp97['post']['status']>(prefix, PATH9, POST, option).json(),
fetch<Methods_hsfp97['post']['resBody'], BasicHeaders, Methods_hsfp97['post']['status']>(prefix, PATH10, POST, option).json(),
/**
* @param option.body - tweet to delete
* @returns success
*/
$post: (option: { body: Methods_hsfp97['post']['reqBody'], config?: T | undefined }) =>
fetch<Methods_hsfp97['post']['resBody'], BasicHeaders, Methods_hsfp97['post']['status']>(prefix, PATH9, POST, option).json().then(r => r.body),
$path: () => `${prefix}${PATH9}`,
fetch<Methods_hsfp97['post']['resBody'], BasicHeaders, Methods_hsfp97['post']['status']>(prefix, PATH10, POST, option).json().then(r => r.body),
$path: () => `${prefix}${PATH10}`,
},
},
};
Expand Down
Loading

0 comments on commit 140b735

Please sign in to comment.