Skip to content

Commit 50cda5e

Browse files
committed
Initial commit
0 parents  commit 50cda5e

35 files changed

+19263
-0
lines changed

Diff for: .editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 120
11+
tab_width = 2
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

Diff for: .eslintrc.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["**/*"],
4+
"plugins": ["@nrwl/nx"],
5+
"overrides": [
6+
{
7+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8+
"rules": {
9+
"@nrwl/nx/enforce-module-boundaries": [
10+
"error",
11+
{
12+
"enforceBuildableLibDependency": true,
13+
"allow": [],
14+
"depConstraints": [
15+
{
16+
"sourceTag": "*",
17+
"onlyDependOnLibsWithTags": ["*"]
18+
}
19+
]
20+
}
21+
]
22+
}
23+
},
24+
{
25+
"files": ["*.ts", "*.tsx"],
26+
"extends": ["plugin:@nrwl/nx/typescript"],
27+
"rules": {}
28+
},
29+
{
30+
"files": ["*.js", "*.jsx"],
31+
"extends": ["plugin:@nrwl/nx/javascript"],
32+
"rules": {}
33+
}
34+
]
35+
}

Diff for: .gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
# dependencies
9+
node_modules
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
.c9/
16+
*.launch
17+
.settings/
18+
*.sublime-workspace
19+
20+
# IDE - VSCode
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json
26+
27+
# misc
28+
/.sass-cache
29+
/connect.lock
30+
/coverage
31+
/libpeerconnection.log
32+
npm-debug.log
33+
yarn-error.log
34+
testem.log
35+
/typings
36+
37+
# System Files
38+
.DS_Store
39+
Thumbs.db

Diff for: .prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Add files here to ignore them from prettier formatting
2+
3+
/dist
4+
/coverage

Diff for: .prettierrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"semi": false,
5+
"trailingComma": "es5",
6+
"arrowParens": "avoid",
7+
"useTabs": false,
8+
"tabWidth": 2
9+
}

Diff for: .vscode/extensions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"nrwl.angular-console",
4+
"esbenp.prettier-vscode",
5+
"firsttris.vscode-jest-runner",
6+
"dbaeumer.vscode-eslint"
7+
]
8+
}

Diff for: README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
3+
# NxPackageTest
4+
5+
This project was generated using [Nx](https://nx.dev).
6+
7+
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="450"></p>
8+
9+
🔎 **Smart, Fast and Extensible Build System**
10+
11+
## Adding capabilities to your workspace
12+
13+
Nx supports many plugins which add capabilities for developing different types of applications and different tools.
14+
15+
These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.
16+
17+
Below are our core plugins:
18+
19+
- [React](https://reactjs.org)
20+
- `npm install --save-dev @nrwl/react`
21+
- Web (no framework frontends)
22+
- `npm install --save-dev @nrwl/web`
23+
- [Angular](https://angular.io)
24+
- `npm install --save-dev @nrwl/angular`
25+
- [Nest](https://nestjs.com)
26+
- `npm install --save-dev @nrwl/nest`
27+
- [Express](https://expressjs.com)
28+
- `npm install --save-dev @nrwl/express`
29+
- [Node](https://nodejs.org)
30+
- `npm install --save-dev @nrwl/node`
31+
32+
There are also many [community plugins](https://nx.dev/community) you could add.
33+
34+
## Generate an application
35+
36+
Run `nx g @nrwl/react:app my-app` to generate an application.
37+
38+
> You can use any of the plugins above to generate applications as well.
39+
40+
When using Nx, you can create multiple applications and libraries in the same workspace.
41+
42+
## Generate a library
43+
44+
Run `nx g @nrwl/react:lib my-lib` to generate a library.
45+
46+
> You can also use any of the plugins above to generate libraries as well.
47+
48+
Libraries are shareable across libraries and applications. They can be imported from `@nx-package-test/mylib`.
49+
50+
## Development server
51+
52+
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.
53+
54+
## Code scaffolding
55+
56+
Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component.
57+
58+
## Build
59+
60+
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.
61+
62+
## Running unit tests
63+
64+
Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io).
65+
66+
Run `nx affected:test` to execute the unit tests affected by a change.
67+
68+
## Running end-to-end tests
69+
70+
Run `nx e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).
71+
72+
Run `nx affected:e2e` to execute the end-to-end tests affected by a change.
73+
74+
## Understand your workspace
75+
76+
Run `nx graph` to see a diagram of the dependencies of your projects.
77+
78+
## Further help
79+
80+
Visit the [Nx Documentation](https://nx.dev) to learn more.

Diff for: apps/.gitkeep

Whitespace-only changes.

Diff for: apps/api/.eslintrc.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

Diff for: apps/api/jest.config.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'api',
4+
preset: '../../jest.preset.js',
5+
globals: {
6+
'ts-jest': {
7+
tsconfig: '<rootDir>/tsconfig.spec.json',
8+
},
9+
},
10+
testEnvironment: 'node',
11+
transform: {
12+
'^.+\\.[tj]s$': 'ts-jest',
13+
},
14+
moduleFileExtensions: ['ts', 'js', 'html'],
15+
coverageDirectory: '../../coverage/apps/api',
16+
};

Diff for: apps/api/project.json

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
3+
"sourceRoot": "apps/api/src",
4+
"projectType": "application",
5+
"targets": {
6+
"build": {
7+
"executor": "@nrwl/webpack:webpack",
8+
"outputs": ["{options.outputPath}"],
9+
"options": {
10+
"outputPath": "dist/apps/api",
11+
"main": "apps/api/src/main.ts",
12+
"tsConfig": "apps/api/tsconfig.app.json",
13+
"assets": ["apps/api/src/assets"],
14+
"target": "node",
15+
"compiler": "tsc"
16+
},
17+
"configurations": {
18+
"production": {
19+
"optimization": true,
20+
"extractLicenses": true,
21+
"inspect": false
22+
}
23+
}
24+
},
25+
"serve": {
26+
"executor": "@nrwl/node:node",
27+
"options": {
28+
"buildTarget": "api:build"
29+
},
30+
"configurations": {
31+
"production": {
32+
"buildTarget": "api:build:production"
33+
}
34+
}
35+
},
36+
"lint": {
37+
"executor": "@nrwl/linter:eslint",
38+
"outputs": ["{options.outputFile}"],
39+
"options": {
40+
"lintFilePatterns": ["apps/api/**/*.ts"]
41+
}
42+
},
43+
"test": {
44+
"executor": "@nrwl/jest:jest",
45+
"outputs": ["coverage/apps/api"],
46+
"options": {
47+
"jestConfig": "apps/api/jest.config.ts",
48+
"passWithNoTests": true
49+
}
50+
}
51+
},
52+
"tags": []
53+
}

Diff for: apps/api/src/app/.gitkeep

Whitespace-only changes.

Diff for: apps/api/src/app/app.controller.spec.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Test, TestingModule } from '@nestjs/testing';
2+
3+
import { AppController } from './app.controller';
4+
import { AppService } from './app.service';
5+
6+
describe('AppController', () => {
7+
let app: TestingModule;
8+
9+
beforeAll(async () => {
10+
app = await Test.createTestingModule({
11+
controllers: [AppController],
12+
providers: [AppService],
13+
}).compile();
14+
});
15+
16+
describe('getData', () => {
17+
it('should return "Welcome to api!"', () => {
18+
const appController = app.get<AppController>(AppController);
19+
expect(appController.getData()).toEqual({ message: 'Welcome to api!' });
20+
});
21+
});
22+
});

Diff for: apps/api/src/app/app.controller.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Controller, Get } from '@nestjs/common';
2+
3+
import { AppService } from './app.service';
4+
5+
@Controller()
6+
export class AppController {
7+
constructor(private readonly appService: AppService) {}
8+
9+
@Get()
10+
getData() {
11+
return this.appService.getData();
12+
}
13+
}

Diff for: apps/api/src/app/app.module.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Module } from '@nestjs/common';
2+
3+
import { AppController } from './app.controller';
4+
import { AppService } from './app.service';
5+
6+
@Module({
7+
imports: [],
8+
controllers: [AppController],
9+
providers: [AppService],
10+
})
11+
export class AppModule {}

Diff for: apps/api/src/app/app.service.spec.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Test } from '@nestjs/testing';
2+
3+
import { AppService } from './app.service';
4+
5+
describe('AppService', () => {
6+
let service: AppService;
7+
8+
beforeAll(async () => {
9+
const app = await Test.createTestingModule({
10+
providers: [AppService],
11+
}).compile();
12+
13+
service = app.get<AppService>(AppService);
14+
});
15+
16+
describe('getData', () => {
17+
it('should return "Welcome to api!"', () => {
18+
expect(service.getData()).toEqual({ message: 'Welcome to api!' });
19+
});
20+
});
21+
});

Diff for: apps/api/src/app/app.service.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Injectable } from '@nestjs/common';
2+
3+
@Injectable()
4+
export class AppService {
5+
getData(): { message: string } {
6+
return { message: 'Welcome to api!' };
7+
}
8+
}

Diff for: apps/api/src/assets/.gitkeep

Whitespace-only changes.

Diff for: apps/api/src/main.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* This is not a production server yet!
3+
* This is only a minimal backend to get started.
4+
*/
5+
6+
import { Logger } from '@nestjs/common';
7+
import { NestFactory } from '@nestjs/core';
8+
9+
import { AppModule } from './app/app.module';
10+
11+
async function bootstrap() {
12+
const app = await NestFactory.create(AppModule);
13+
const globalPrefix = 'api';
14+
app.setGlobalPrefix(globalPrefix);
15+
const port = process.env.PORT || 3333;
16+
await app.listen(port);
17+
Logger.log(
18+
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
19+
);
20+
}
21+
22+
bootstrap();

0 commit comments

Comments
 (0)