Skip to content

Commit

Permalink
Initialized project
Browse files Browse the repository at this point in the history
  • Loading branch information
marbiano authored and marbiano committed Aug 15, 2020
0 parents commit cc9c5fc
Show file tree
Hide file tree
Showing 19 changed files with 6,970 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"node": true,
"browser": true,
"es6": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:react-hooks/recommended"
],
"plugins": ["react", "@typescript-eslint", "prettier", "graphql"],
"rules": {
"react/react-in-jsx-scope": "off"
}
}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 80,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"EditorConfig.editorconfig",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.snippetSuggestions": "top",
"editor.formatOnSave": true,
"javascript.validate.enable": false,
"eslint.enable": true,
"git.ignoreLimitWarning": true
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# next-starter
# nextists
2 changes: 2 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "next-starter",
"version": "0.0.1",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "9.5.1",
"react": "16.13.1",
"react-dom": "16.13.1"
},
"devDependencies": {
"@types/node": "^14.0.27",
"@types/react": "^16.9.45",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.5",
"eslint-plugin-react-hooks": "^4.0.8",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.0.5",
"tailwindcss": "^1.6.2",
"typescript": "^3.9.7"
}
}
3 changes: 3 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
plugins: ['tailwindcss', 'postcss-preset-env'],
};
Empty file added src/lib/api.ts
Empty file.
Empty file added src/lib/types.ts
Empty file.
7 changes: 7 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import '../styles/index.css';

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

export default MyApp;
15 changes: 15 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { GetStaticProps, GetStaticPaths } from 'next';

interface PageProps {}

const IndexPage: React.FC<PageProps> = () => {
return <h1>Hello, fellow Nextronaut!</h1>;
};

export const getStaticProps: GetStaticProps = async (context) => {
return {
props: {},
};
};

export default IndexPage;
43 changes: 43 additions & 0 deletions src/pages/r/[id].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { GetStaticProps, GetStaticPaths } from 'next';
import { useRouter } from 'next/router';
import DefaultErrorPage from 'next/error';

interface PageProps {
resource: {
id: string;
};
}

const ResourcePage: React.FC<PageProps> = ({ resource }) => {
const router = useRouter();
const { isFallback } = router;

if (isFallback) {
return <div>Loading...</div>;
}

if (!resource) {
return <DefaultErrorPage statusCode={404} />;
}

return <div>Resource ID: {resource.id}</div>;
};

export const getStaticProps: GetStaticProps = async ({ params }) => {
const { id } = params;

return {
props: {
resource: { id },
},
};
};

export const getStaticPaths: GetStaticPaths = async () => {
return {
paths: [{ params: { id: 'foo' } }, { params: { id: 'bar' } }],
fallback: true,
};
};

export default ResourcePage;
3 changes: 3 additions & 0 deletions src/styles/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
11 changes: 11 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
purge: [
'./src/components/**/*.{js,ts,jsx,tsx}',
'./src/pages/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {},
},
variants: {},
plugins: [],
};
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
Loading

0 comments on commit cc9c5fc

Please sign in to comment.