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

Nx #77

Closed
wants to merge 31 commits into from
Closed

Nx #77

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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
96 changes: 96 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"env": {
"browser": true,
"es2020": true
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"node": {
"extensions": [".ts", ".tsx"]
},
"typescript": {
"alwaysTryTypes": true,
"project": ["packages/*/tsconfig.*?.json", "tsconfig.base.json"]
}
}
},
"extends": [
// General Prettier defaults
"airbnb",
"plugin:@typescript-eslint/recommended",
"plugin:tailwindcss/recommended",
"prettier"
],
"plugins": ["@nx", "@typescript-eslint", "import", "react"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": "off",
// Standard ESLint config
"indent": "off",
"quotes": ["error", "double"],
"camelcase": ["error", { "properties": "always" }],
"linebreak-style": ["error", "unix"],
"eol-last": ["error", "always"],
"max-len": ["error", { "code": 150, "tabWidth": 4 }],
"no-console": "warn",
"no-debugger": "warn",
"no-param-reassign": ["error", { "props": false }],
"no-bitwise": "off",
"no-shadow": "off",
"no-use-before-define": "off",
"no-restricted-imports": ["error", { "patterns": ["..*", "!@/*"] }],
"no-unused-vars": "off",
"no-useless-constructor": "off",
"no-empty-function": "off",
"max-classes-per-file": "off",

// TypeScript plugin config
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/no-empty-function": "off",

"react/react-in-jsx-scope": "off",
"react/jsx-filename-extension": [0],

// Import plugin config (used to intelligently validate module import statements)
"import/prefer-default-export": "off",
"import/extensions": "off",
"import/no-unresolved": "off",
"import/no-extraneous-dependencies": "off",

"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"react/prop-types": "off",

"tailwindcss/no-custom-classname": "off",
"tailwindcss/migration-from-tailwind-2": "off"
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": [
"plugin:@nx/typescript",
"plugin:import/recommended",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"createDefaultProgram": true
},
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
}
82 changes: 41 additions & 41 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
name: Continuous Integration and Deployment

on:
pull_request:
push:
branches:
- master
- beta
pull_request:
push:
branches:
- master
- beta

jobs:
Integration_And_Deployment:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"

- name: Install Top Level Dependencies
run: npm ci

- name: Lint packages
run: npm run lint

- name: Build Packages
run: npm run build

- name: Test Packages
run: npm run test

- name: Deploy Prod
if: github.ref == 'refs/heads/master'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: npm run deploy:prod

- name: Deploy Beta
if: github.ref == 'refs/heads/beta'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: npm run deploy:beta
Integration_And_Deployment:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"

- name: Install Top Level Dependencies
run: npm ci

- name: Lint packages
run: npm run lint

- name: Build Packages
run: npm run build

- name: Test Packages
run: npm run test

- name: Deploy Prod
if: github.ref == 'refs/heads/master'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: npm run deploy:prod

- name: Deploy Beta
if: github.ref == 'refs/heads/beta'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: npm run deploy:beta
40 changes: 39 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
node_modules/
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist
tmp
/out-tsc

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
**/.wrangler

# System Files
.DS_Store
Thumbs.db
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
package-lock.json
17 changes: 17 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
pluginSearchDirs: false,
printWidth: 100,
trailingComma: "all",
useTabs: false,
tabWidth: 4,
semi: true,
singleQuote: false,
overrides: [
{
files: "*.json",
options: {
parser: "json",
},
},
],
};
5 changes: 1 addition & 4 deletions .vscode/extentions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"aaron-bond.better-comments"
]
"recommendations": ["dbaeumer.vscode-eslint", "aaron-bond.better-comments"]
}
40 changes: 20 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"[typescript][javascript][typescriptreact]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
},
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"eslint.format.enable": true,
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "file:///Users/maxfisher/shadow/polyratings/.github/workflows/deploy.yml"
},
"files.eol": "\n",
"files.insertFinalNewline": true,
"typescript.tsdk": "node_modules\\typescript\\lib",
"cSpell.words": [
"Connor",
"Dahms",
"Evals",
"Krier",
"Lanning",
"Polyratings",
"Scroller",
"Thattayathu"
],
"files.eol": "\n",
"files.insertFinalNewline": true,
"typescript.tsdk": "node_modules\\typescript\\lib",
"cSpell.words": [
"Connor",
"Dahms",
"Evals",
"Krier",
"Lanning",
"Polyratings",
"Scroller",
"Thattayathu"
]
}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Polyratings Monorepo

Lerna monorepo to contain all polyratings related code
Nx monorepo to contain all polyratings related code

## Packages

- [frontend](./packages/frontend/) - Frontend react app deployed at <https://polyratings.dev>
- [backend](./packages/backend/) - Backend typescript app deployed on Cloudflare Workers
- [cron](./packages/cron/) - nightly job that syncs data between environments as well as backs up the professor list to a separate git [repo](TODO://PROVIDE_URL)
- [eslint-config](./packages/eslint-config/) - shared eslint config that is enforced in all other packages
- [frontend](./packages/frontend/) - Frontend react app deployed at <https://polyratings.dev>
- [backend](./packages/backend/) - Backend typescript app deployed on Cloudflare Workers
- [cron](./packages/cron/) - nightly job that syncs data between environments as well as backs up the professor list to a separate git [repo](TODO://PROVIDE_URL)
- [eslint-config](./packages/eslint-config/) - shared eslint config that is enforced in all other packages

## Getting Ready for development

Expand All @@ -20,18 +20,18 @@ In order to set up for development you have one of two options:

## Setup

Since this repository is organized using lerna setup is a little different than standard js projects.
Since this repository is organized using Nx setup is a little different than standard js projects.

Install top level JS dependencies

```bash
npm install
```

This will install lerna and all of the dependencies for all of the sub packages and sym link dependent packages. Finally run:
This will install all of the dependencies for all of the sub packages and sym link dependent packages. Finally run:

```bash
npm run build
nx run-many -t build
```

This will build all of the projects and put shared files where they are supposed to be.
Expand Down
Loading
Loading