Skip to content

Commit

Permalink
feat: migrate to nrwl (#59)
Browse files Browse the repository at this point in the history
* feat: migrate to nrwl

* fix: type issue with material picker

* docs: update readme

* fix: lint issue for front

* fix: lint issue with router

* fix: issue with imports

* fix(front): export issue

* fix: issues with import

* perf(admin): optimize sidebar render
  • Loading branch information
vharadkou authored and mkinitcpio committed Nov 29, 2019
1 parent b1e2268 commit 1a93d76
Show file tree
Hide file tree
Showing 479 changed files with 17,274 additions and 35,000 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
40 changes: 40 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "@nrwl/nx"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"rules": {
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"allow": [],
"depConstraints": [
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
]
}
]
},
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"comma-dangle": ["error", "always-multiline"]
}
}
]
}
2 changes: 1 addition & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"js-machine-app": {
"hosting": {
"js-machine-app": [
"js-machine-app"
"js-machine-app-staging"
],
"js-machine-admin": [
"js-machine-admin"
Expand Down
115 changes: 44 additions & 71 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,71 +1,44 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*

# Firebase cache
.firebase/

# Firebase config

# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# Webstorm configuration
.idea

js-machine-app-key.json
.config
# 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

# System Files
.DS_Store
Thumbs.db

/.firebase
firebase-debug.log
swagger.json
routes.ts
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
6 changes: 2 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"trailingComma": "all",
"printWidth": 80,
"semi": true,
"singleQuote": true
"singleQuote": true,
"trailingComma": "all"
}
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode"
]
}
90 changes: 84 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,91 @@

https://js-machine-app.web.app/

Link to [Firebase CLI docs](https://firebase.google.com/docs/cli/)
Link to [Azure DevOps](https://dev.azure.com/jsmachineteam/js-machine-app/_build)

How to run firebase [functions](https://firebase.google.com/docs/functions/local-emulator)
To proxy to the main server you should change "target" property at the proxy.conf.json:

Hot to run firebase [emulator](https://github.com/firebase/quickstart-nodejs/tree/master/firestore-emulator/javascript-quickstart)
```
{
"/api": {
"target": "https://europe-west1-js-machine-app.cloudfunctions.net",
"secure": false
}
}
Link to [Azure DevOps](https://dev.azure.com/jsmachineteam/js-machine-app/_build). Here we have a build pipeline to check pull requests and release pipeline for deployment to Firebase.
```

To proxy on the main server you should change proxy property at the package.json in js_machine_front:
"proxy": "https://us-central1-js-machine-app.cloudfunctions.net/"
This project was generated using [Nx](https://nx.dev).

<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/nx-logo.png" width="450"></p>

🔎 **Nx is a set of Extensible Dev Tools for Monorepos.**

## Adding capabilities to your workspace

Nx supports many plugins which add capabilities for developing different types of applications and different tools.

These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.

Below are some plugins which you can add to your workspace:

- [React](https://reactjs.org)
- `npm install --save-dev @nrwl/react`
- Web (no framework frontends)
- `npm install --save-dev @nrwl/web`
- [Angular](https://angular.io)
- `npm install --save-dev @nrwl/angular`
- [Nest](https://nestjs.com)
- `npm install --save-dev @nrwl/nest`
- [Express](https://expressjs.com)
- `npm install --save-dev @nrwl/express`
- [Node](https://nodejs.org)
- `npm install --save-dev @nrwl/node`

## Generate an application

Run `nx g @nrwl/react:app my-app` to generate an application.

> You can use any of the plugins above to generate applications as well.
When using Nx, you can create multiple applications and libraries in the same workspace.

## Generate a library

Run `nx g @nrwl/react:lib my-lib` to generate a library.

> You can also use any of the plugins above to generate libraries as well.
Libraries are sharable across libraries and applications. They can be imported from `@js-machine-app/mylib`.

## Development server

Run `nx serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

## Code scaffolding

Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component.

## Build

Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io).

Run `nx affected:test` to execute the unit tests affected by a change.

## Running end-to-end tests

Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).

Run `nx affected:e2e` to execute the end-to-end tests affected by a change.

## Understand your workspace

Run `nx dep-graph` to see a diagram of the dependencies of your projects.

## Further help

Visit the [Nx Documentation](https://nx.dev) to learn more.
1 change: 1 addition & 0 deletions apps/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions apps/api/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "../../.eslintrc", "rules": {} }
5 changes: 5 additions & 0 deletions apps/api/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
name: 'api',
preset: '../../jest.config.js',
coverageDirectory: '../../coverage/apps/api'
};
37 changes: 37 additions & 0 deletions apps/api/src/app/controllers/digests.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Controller, Get, Post, Route, Delete, Body, Path, Put } from 'tsoa';
import { Digest } from '@js-machine-app/models';
import { Inject } from '@js-machine-app/api/ioc';
import { DigestsService } from '@js-machine-app/api/services/digests';

@Route('digests')
export class DigestsController extends Controller {
@Inject() private digestsService!: DigestsService;

@Get()
public async getDigests(): Promise<Digest[]> {
return this.digestsService.getDigests();
}

@Get('{id}')
public async getDigestById(@Path() id: string): Promise<Digest> {
return this.digestsService.getDigestById(id);
}

@Post()
public async createDigest(@Body() digest: Digest): Promise<string> {
return this.digestsService.createDigest(digest);
}

@Put('{id}')
public async updateDigest(
@Path() id: string,
@Body() digest: Digest,
): Promise<void> {
return this.digestsService.updateDigest(id, digest);
}

@Delete('{id}')
public async deleteDigest(@Path() id: string): Promise<void> {
return this.digestsService.deleteDigest(id);
}
}
19 changes: 19 additions & 0 deletions apps/api/src/app/controllers/events.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Controller, Get, Route } from 'tsoa';
import { Event } from '@js-machine-app/models';
import { Inject } from '@js-machine-app/api/ioc';
import { EventsService } from '@js-machine-app/api/services/events';

@Route('events')
export class EventsController extends Controller {
@Inject() private eventsService!: EventsService;

@Get()
public async getEvents(): Promise<Event[]> {
return this.eventsService.getEvents();
}

@Get('recent')
public async getRecentEvents(): Promise<Event[]> {
return this.eventsService.getRecentEvents();
}
}
19 changes: 19 additions & 0 deletions apps/api/src/app/controllers/feedbacks.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Controller, Get, Post, Route, Body } from 'tsoa';
import { Inject } from '@js-machine-app/api/ioc';
import { FeedbackService } from '@js-machine-app/api/services/feedback';
import { Feedback } from '@js-machine-app/models';

@Route('feedbacks')
export class FeedbacksController extends Controller {
@Inject() private feedbackService!: FeedbackService;

@Get()
public async getFeedbacks(): Promise<Feedback[]> {
return this.feedbackService.getFeedbacks();
}

@Post()
public async createFeedback(@Body() feedback: Feedback): Promise<string> {
return this.feedbackService.createFeedback(feedback);
}
}
3 changes: 3 additions & 0 deletions apps/api/src/app/controllers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './digests.controller';
export * from './events.controller';
export * from './feedbacks.controller';
Loading

0 comments on commit 1a93d76

Please sign in to comment.