Skip to content

Commit

Permalink
Version 🐒monke: Add Typegoose + type-graphql, modify architecture on …
Browse files Browse the repository at this point in the history
…the backend, update packages
  • Loading branch information
Sebastp committed Nov 22, 2021
1 parent 111a1ba commit 12ff29a
Show file tree
Hide file tree
Showing 39 changed files with 10,610 additions and 37,770 deletions.
13 changes: 0 additions & 13 deletions .babelrc

This file was deleted.

13 changes: 3 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,13 @@
"es6": true
},
"extends": [
"airbnb",
"next",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"prettier",
"prettier/react"
],
"plugins": [
"@typescript-eslint",
"react",
"prettier",
"graphql",
"better-styled-components"
"prettier"
],
"plugins": ["@typescript-eslint", "react", "prettier", "graphql"],
"rules": {
"prettier/prettier": "error",
"no-var": "warn",
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
package.json
package-lock.json
public
styles/base
styles/vendors
2 changes: 1 addition & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"stylelint-scss"
],
"extends": "stylelint-config-standard",
"ignoreFiles": ["./styles/base/**", "./styles/vendors/**"],
"ignoreFiles": ["./styles/vendors/**"],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<a href="https://github.com/codica2" target="_blank"><img src="https://img.shields.io/badge/licence-MIT-green.svg" /></a>
</p>


## Project boostrap built with:

- React.js
- Next.js
- Typescript
Expand All @@ -19,9 +19,10 @@
- GraphQl
- EsLint
- Prettier
- Jest tests
- Jest
- Nodemon
- Styled Components
- Typegoose
- Type-graphql

## How to use

Expand All @@ -42,10 +43,8 @@ Configuration in this project is not perfect - it's just my own preference, and

## To see before coding;

- [pure-functions-immutability-and-other-software-superpowers](https://medium.com/dailyjs/pure-functions-immutability-and-other-software-superpowers-dfe6039af8f6)
- [Check out this to read more about /server/graphql workings](https://github.com/Urigo/merge-graphql-schemas)
- [Context management choice](https://www.youtube.com/watch?v=Q54YDGC_t3Y)
- [Apollo context management](https://www.apollographql.com/docs/react/data/local-state/)
- [graphql-tag](https://devstore.io/js/graphql-tag)

PS; I'm always looking for interesting freelance/full time opportunities, hmu @ [email protected]
55 changes: 25 additions & 30 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
module.exports = {
transform: {
"^.+\\.(js|jsx)?$": "babel-jest"
"^.+\\.(js|jsx)?$": "babel-jest",
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.ts?$",
preset: "ts-jest",

transform: {
"^.+\\.(t|j)sx?$": "ts-jest",
},
testEnvironment: "node",
globals: {
jsx: "react",
"ts-jest": {
"tsConfig": "tsconfig.jest.json"
}
tsConfig: "tsconfig.jest.json",
},
},
setupFiles: [
"<rootDir>/tests/test-setup.ts"
],
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx"
],
transformIgnorePatterns: [
"<rootDir>/node_modules/"
],
setupFiles: ["<rootDir>/tests/test-setup.ts"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
transformIgnorePatterns: ["<rootDir>/node_modules/"],
moduleNameMapper: {
"~graphql/(.*)": "<rootDir>/graphql/$1",
"~graphqlQ/(.*)": "<rootDir>/graphql/queries/$1",
"~graphqlM/(.*)": "<rootDir>/graphql/mutations/$1",
"~views/(.*)": "<rootDir>/views/$1",
"~viewsUi/(.*)": "<rootDir>/views/ui/$1",
"~viewsComp/(.*)": "<rootDir>/views/components/$1",
"~viewsLay/(.*)": "<rootDir>/views/layouts/$1",
"~styles/(.*)": "<rootDir>/styles/$1",
"~lib/(.*)": "<rootDir>/lib/$1",
"~assets/(.*)": "<rootDir>/assets/$1",
"~styles/(.*)": "<rootDir>/styles/$1",
"~static/(.*)": "<rootDir>/public/static/$1"
}
}
"@graphql/(.*)": "<rootDir>/graphql/$1",
"@constants/(.*)": "<rootDir>/constants/$1",
"@views/(.*)": "<rootDir>/views/$1",
"@views/(.*)": "<rootDir>/views/$1",
"@viewsUi/(.*)": "<rootDir>/views/ui/$1",
"@viewsComp/(.*)": "<rootDir>/views/components/$1",
"@viewsLay/(.*)": "<rootDir>/views/layouts/$1",
"@styles/(.*)": "<rootDir>/styles/$1",
"@lib/(.*)": "<rootDir>/lib/$1",
"@assets/(.*)": "<rootDir>/assets/$1",
"@styles/(.*)": "<rootDir>/styles/$1",
"@static/(.*)": "<rootDir>/public/static/$1",
},
};


4 changes: 4 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
93 changes: 45 additions & 48 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,53 @@
require('dotenv').config()
const path = require('path')
const Dotenv = require('dotenv-webpack')
const withImages = require('next-images')
require("dotenv").config();
const path = require("path");
const withImages = require("next-images");

const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");


const configureWebpack = (config, { dev }) => {
config.plugins = config.plugins || []

config.plugins.push(
// Read the .env file
new Dotenv({
path: path.join(__dirname, '.env'),
systemvars: true
})
);


if (config.resolve.plugins) {
config.resolve.plugins.push(new TsconfigPathsPlugin());
} else {
config.resolve.plugins = [new TsconfigPathsPlugin()];
}

config.module.rules.push({
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000,
name: '[name].[ext]'
}
}
})

config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader'
})

if (dev) {
config.module.rules.push({
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'eslint-loader',
})
}
config.plugins = config.plugins || [];

if (config.resolve.plugins) {
config.resolve.plugins.push(new TsconfigPathsPlugin());
} else {
config.resolve.plugins = [new TsconfigPathsPlugin()];
}

config.module.rules.push({
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: {
loader: "url-loader",
options: {
limit: 100000,
name: "[name].[ext]",
},
},
});

config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: "graphql-tag/loader",
});

if (dev) {
config.module.rules.push({
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "eslint-loader",
});
config.devtool = "cheap-module-eval-source-map";
}

return config;
};


module.exports = withImages({ webpack: configureWebpack })
module.exports = withImages({
webpack: {
...configureWebpack,
sassOptions: {
includePaths: [path.join(__dirname, "styles")],
},
}
});

3 changes: 2 additions & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ignore": [".git", "node_modules/**/node_modules", "*.gql"],
"watch": ["server/*"],
"ext": "*",
"exec": "ts-node --project tsconfig.server.json -r tsconfig-paths/register server/index.ts"
"exec": "ts-node --project tsconfig.server.json -r tsconfig-paths/register -r dotenv/config server/index.ts"
}
Loading

0 comments on commit 12ff29a

Please sign in to comment.