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

Set up the project structure #2

Merged
merged 12 commits into from
Mar 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(app): fix eslint errors
  • Loading branch information
tericcabrel committed Mar 20, 2022
commit 26976f9691129e6fa622ae916f7408d4aa52b37c
2 changes: 1 addition & 1 deletion apps/core/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
HOST=https://localhost
PORT=4500
PORT=7501
1 change: 1 addition & 0 deletions apps/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "MIT",
"scripts": {
"build": "tsc",
"clean": "rm -rf .turbo dist",
"dev": "nodemon --watch \"*.ts\" --exec \"ts-node\" ./src/index.ts",
"lint": "eslint src"
},
Expand Down
4 changes: 2 additions & 2 deletions apps/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { sortNumbers } from '@sharingan/utils';

dotenv.config();

const HOST = process.env.HOST || 'https://localhost';
const PORT = parseInt(process.env.PORT || '4500');
const HOST = process.env.HOST ?? 'https://localhost';
const PORT = parseInt(process.env.PORT ?? '7501');

const app = express();

Expand Down
3 changes: 2 additions & 1 deletion apps/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"lib": ["dom"],
"outDir": "./dist",
"composite": true,
"declaration": true,
"composite": true
},
"include": [
"./src/**/*",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Open [https://localhost:3000](https://localhost:3000) with your browser to see the

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [https://localhost:3000/api/hello](https://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [https://localhost:3000/api/hello](https://localhost:3000/api/hello). This endpoint can be edited in `pages/api/index.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

Expand Down
7 changes: 4 additions & 3 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"clean": "rm -rf .turbo .next",
"dev": "next dev --port 7500",
"lint": "next lint",
"start": "next start"
},
"dependencies": {
"next": "12.1.0",
Expand Down
8 changes: 4 additions & 4 deletions apps/web/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import '../styles/globals.css';
import type { AppProps } from 'next/app';

function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
return <Component {...pageProps} />;
}

export default MyApp
export default MyApp;
13 changes: 0 additions & 13 deletions apps/web/pages/api/hello.ts

This file was deleted.

10 changes: 10 additions & 0 deletions apps/web/pages/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next';

type Data = {
name: string;
};

export default function handler(req: NextApiRequest, res: NextApiResponse<Data>) {
res.status(200).json({ name: 'Sharingan' });
}
31 changes: 11 additions & 20 deletions apps/web/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NextPage } from 'next'
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import type { NextPage } from 'next';
import Head from 'next/head';
import Image from 'next/image';
import styles from '../styles/Home.module.css';

const Home: NextPage = () => {
return (
Expand All @@ -18,8 +18,7 @@ const Home: NextPage = () => {
</h1>

<p className={styles.description}>
Get started by editing{' '}
<code className={styles.code}>pages/index.tsx</code>
Get started by editing <code className={styles.code}>pages/index.tsx</code>
</p>

<div className={styles.grid}>
Expand All @@ -33,22 +32,14 @@ const Home: NextPage = () => {
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>

<a
href="https://github.com/vercel/next.js/tree/canary/examples"
className={styles.card}
>
<a href="https://github.com/vercel/next.js/tree/canary/examples" className={styles.card}>
<h2>Examples &rarr;</h2>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<a href="https://vercel.com/new" className={styles.card}>
<h2>Deploy &rarr;</h2>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
<p>Instantly deploy your Next.js site to a public URL with Vercel.</p>
</a>
</div>
</main>
Expand All @@ -66,7 +57,7 @@ const Home: NextPage = () => {
</a>
</footer>
</div>
)
}
);
};

export default Home
export default Home;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "turbo run dev --no-cache --parallel --continue",
"lint": "turbo run lint",
"test": "turbo run test",
"clean": "turbo run clean && rm -rf node_modules",
"clean": "turbo run clean",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"private": true,
Expand Down
1 change: 1 addition & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"license": "MIT",
"scripts": {
"build": "tsc",
"clean": "rm -rf .turbo dist",
"lint": "eslint src index.ts"
},
"dependencies": {
Expand Down
8 changes: 0 additions & 8 deletions packages/utils/src/common/sort.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { sortBy } from 'lodash';

const args: any = {};

const HOST = process.env.HOST || 'https://localhost';

const sortNumbers = (numbers: number[]) => {
const varf = args.test || '';

console.log(varf, HOST);

return sortBy(numbers);
};

Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"lint": {
"outputs": []
},
"clean": {
"outputs": []
},
"dev": {
"cache": false
}
Expand Down