Skip to content

Commit

Permalink
Initial commit of @nxpm/stack
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Mar 8, 2021
1 parent 024da13 commit a103c9d
Show file tree
Hide file tree
Showing 798 changed files with 33,941 additions and 1,173 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NODE_ENV=development
PORT=3000
DATABASE_URL=postgresql://prisma:prisma@localhost:5432/prisma?schema=stack-v4160-api8050914
JWT_SECRET=NxpmDotDevJwtSecret
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"parserOptions": { "project": "./tsconfig.*?.json" },
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}
44 changes: 44 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-test

on:
pull_request:
push:
branches:
- main

env:
NX_BRANCH: ${{ github.event.number }}
NX_RUN_GROUP: ${{ github.run_id }}
DATABASE_URL: postgresql://nxpm:nxpm@localhost:5432/nxpm?schema=public
JWT_SECRET: NxpmDotDevJwtSecret

jobs:
build:
services:
postgres:
image: postgres:12
env:
POSTGRES_DB: nxpm
POSTGRES_USER: nxpm
POSTGRES_PASSWORD: nxpm
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
node-version: [14.x]
operating-system: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Setup node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn format:check
- run: yarn test:ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ testem.log
# System Files
.DS_Store
Thumbs.db
.env
8 changes: 4 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Add files here to ignore them from prettier formatting

/dist
/coverage
package.json
dist
coverage
tmp
8 changes: 6 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"singleQuote": true
}
"singleQuote": true,
"printWidth": 120,
"semi": false,
"trailingComma": "all",
"arrowParens": "always"
}
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"recommendations": [

"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
]
}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:14-alpine

WORKDIR /workspace

COPY package.json yarn.lock /workspace/

RUN yarn

COPY . .

RUN yarn build

CMD ["yarn", "start"]
116 changes: 50 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,78 @@
# Web

This project was generated using [@nxpm/stack](https://github.com/nxpm/stack) which is based on [Nx](https://nx.dev).

# StackV4160
<p align="center"><img src="https://avatars.githubusercontent.com/u/65322676?v=4" width="450"></p>

This project was generated using [Nx](https://nx.dev).
# Setup

<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="450"></p>
After download this project, you first need to run the setup.

🔎 **Nx is a set of Extensible Dev Tools for Monorepos.**
Make sure to have Docker running, it will use `docker-compose` to start the database server.

## Adding capabilities to your workspace
```shell
yarn setup
```

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

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

Below are our core plugins:
```shell
yarn dev:api
```

- [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`
Start Web

There are also many [community plugins](https://nx.dev/nx-community) you could add.
```shell
yarn dev:web
```

## Generate an application
# Generate GraphQL SDK

Run `nx g @nrwl/react:app my-app` to generate an application.
The queries for the GraphQL SDK are stored in `libs/shared/util/sdk/src/graphql`.

> You can use any of the plugins above to generate applications as well.
After updating the queries you can re-generate the SDK:

When using Nx, you can create multiple applications and libraries in the same workspace.
```shell
yarn build:sdk
```

## Generate a library
Or run it in watch mode

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

> You can also use any of the plugins above to generate libraries as well.
# Building the project

Libraries are shareable across libraries and applications. They can be imported from `@stack-v4160/mylib`.
You can build both apps into a production build:

## Development server
```shell
yarn build
```

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.
After that, you can run the production app:

## Code scaffolding
```shell
yarn start
```

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

## Build
```shell
yarn build:api
```

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.
Build Web

## Running unit tests
```shell
yarn build:web
```

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

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.



## ☁ Nx Cloud

### Computation Memoization in the Cloud

<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-cloud-card.png"></p>

Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly.

Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers.

Visit [Nx Cloud](https://nx.app/) to learn more.
```markdown
Api: api
Web: web
```
Loading

0 comments on commit a103c9d

Please sign in to comment.