Skip to content

Commit

Permalink
update to v13 (#2)
Browse files Browse the repository at this point in the history
* @angular/cdk@10

* @angular/material@10

* @angular/cli@10

* @angular/cli@11

* @angular/cli@11

* @angular/material@11

* @angular/cdk@12

* @angular/cli@12

* @angular/material@12

* @angular/cdk@13

* @angular/cli@13

* @angular/material@13

* @ngrx/store

* apollo-angular

* finish
  • Loading branch information
soulmonk authored Feb 12, 2022
1 parent 653437f commit d326c25
Show file tree
Hide file tree
Showing 42 changed files with 407 additions and 236 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.angular/cache
.idea
node_modules
dist
package-lock.json
package-lock.json
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM node:16-alpine AS BUILD_SERVER

RUN apk update && apk add bash python3 g++ make

# Create app directory
WORKDIR /usr/src/app

# Bundle app source
COPY ./server .

RUN npm install --production

FROM node:16-alpine AS BUILD_WEB

RUN apk update && apk add bash python3 g++ make

# Create app directory
WORKDIR /usr/src/app

RUN npm i -g npm
COPY package.json .

# TODO pear dependecyfor appolo angular
RUN npm install --force

# Bundle app source
COPY . .

RUN npm run build:prod

FROM node:16-alpine
WORKDIR /usr/src/app

COPY --from=BUILD_SERVER /usr/src/app/ ./
COPY --from=BUILD_WEB /usr/src/app/dist/ndfsm-frontend ./dist

EXPOSE 3500
# npm to dirrect node command
CMD [ "node", "app.js" ]
28 changes: 9 additions & 19 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "dist/ndfsm-frontend",
"index": "src/index.html",
"main": "src/main.ts",
Expand All @@ -38,7 +37,13 @@
"styles": [
"src/styles.scss"
],
"scripts": []
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
Expand All @@ -51,9 +56,7 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
Expand All @@ -80,7 +83,8 @@
}
]
}
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
Expand Down Expand Up @@ -125,20 +129,6 @@
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**",
"src/app/debug/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
Expand Down
6 changes: 3 additions & 3 deletions baseOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"appName": "NDFSM app",
"log": true,
"apiServers": {
"auth": "http://localhost:3000/auth",
"ndfsmFleaMarket": "http://localhost:3000/ndfsm-flea-market",
"financeStats": "http://localhost:3000/finance-stats"
"auth": "https://auth.fallensoulmonk.org",
"ndfsmFleaMarket": "https://ndfsm-flea-market.fallensoulmonk.org",
"financeStats": "https://finance.fallensoulmonk.org"
}
}
2 changes: 1 addition & 1 deletion e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
Expand Down
93 changes: 42 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "ndfsm_js",
"version": "1.1.0",
"version": "1.2.0",
"description": "NDFSM frontend on Angular2",
"main": "index.js",
"scripts": {
"ng": "ng",
"serve:prod_proxy": "ng serve --proxy-config proxy.conf.json",
"serve:prod": "ng serve --proxy-config proxy-local.conf.json --prod",
"serve:prod": "ng serve --proxy-config proxy-local.conf.json --configuration production",
"serve": "ng serve",
"serve:hmr:prod": "ng serve --proxy-config proxy.conf.json --hmr -e=hmr",
"serve:hmr": "ng serve --proxy-config proxy-local.conf.json --hmr -e=hmr",
"build": "ng build",
"build:prod": "ng build --prod --build-optimizer --vendor-chunk",
"build:prod": "ng build --configuration production --build-optimizer --vendor-chunk",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
Expand All @@ -22,68 +22,59 @@
"author": "Vitalii Melnykov (fsoulmonk@gmail.com)",
"license": "MIT",
"dependencies": {
"@angular-devkit/schematics": "^9.0.3",
"@angular/animations": "^9.0.2",
"@angular/cdk": "^9.0.1",
"@angular/common": "^9.0.2",
"@angular/compiler": "^9.0.2",
"@angular/core": "^9.0.2",
"@angular/forms": "^9.0.2",
"@angular/material": "^9.0.1",
"@angular/platform-browser": "^9.0.2",
"@angular/platform-browser-dynamic": "^9.0.2",
"@angular/router": "^9.0.2",
"@angular/service-worker": "^9.0.2",
"@ngrx/effects": "^9.0.0-beta.1",
"@ngrx/entity": "^9.0.0-beta.1",
"@ngrx/router-store": "^9.0.0-beta.1",
"@ngrx/schematics": "^9.0.0-beta.1",
"@ngrx/store": "^9.0.0-beta.1",
"@ngrx/store-devtools": "^9.0.0-beta.1",
"apollo-angular": "^1.8.0",
"@angular-devkit/schematics": "^13.2.3",
"@angular/animations": "^13.2.2",
"@angular/cdk": "^13.2.2",
"@angular/common": "^13.2.2",
"@angular/compiler": "^13.2.2",
"@angular/core": "^13.2.2",
"@angular/forms": "^13.2.2",
"@angular/material": "^13.2.2",
"@angular/platform-browser": "^13.2.2",
"@angular/platform-browser-dynamic": "^13.2.2",
"@angular/router": "^13.2.2",
"@angular/service-worker": "^13.2.2",
"@ngrx/effects": "^13.0.2",
"@ngrx/entity": "^13.0.2",
"@ngrx/router-store": "^13.0.2",
"@ngrx/schematics": "^13.0.2",
"@ngrx/store": "^13.0.2",
"@ngrx/store-devtools": "^13.0.2",
"apollo-angular": "^2.6.0",
"bootstrap": "^4.4.1",
"core-js": "^3.6.4",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jasmine": "^3.5.0",
"jquery": "^3.4.1",
"popper.js": "^1.16.1",
"rxjs": "^6.5.4",
"socket.io-client": "^2.3.0",
"tslib": "^1.10.0",
"zone.js": "~0.10.2",
"apollo-angular-link-http": "^1.9.0",
"apollo-link": "^1.2.11",
"apollo-client": "^2.6.0",
"apollo-cache-inmemory": "^1.6.0",
"graphql-tag": "^2.10.0",
"graphql": "^14.5.0"
"tslib": "^2.0.0",
"zone.js": "~0.11.4",
"graphql": "^15.0.0",
"@apollo/client": "^3.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.3",
"@angular/cli": "9.0.3",
"@angular/compiler-cli": "^9.0.2",
"@angular/language-service": "^9.0.2",
"@angular-devkit/build-angular": "~13.2.3",
"@angular/cli": "13.2.3",
"@angular/compiler-cli": "^13.2.2",
"@angular/language-service": "^13.2.2",
"@angularclass/hmr": "^2.1.3",
"@types/jasmine": "~3.5.5",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^13.7.4",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.4.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.16",
"karma-chrome-launcher": "~3.1.0",
"karma-cli": "~2.0.0",
"karma-coverage-istanbul-reporter": "^2.1.1",
"karma-jasmine": "~3.1.1",
"karma-jasmine-html-reporter": "^1.5.2",
"pre-commit": "^1.2.2",
"protractor": "^5.4.3",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.6.2",
"tslint": "~6.0.0",
"typescript": "3.7.5"
},
"pre-commit": [
"lint"
]
"tslint": "~6.1.0",
"typescript": "4.5.5"
}
}
59 changes: 59 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict'

const S = require('fluent-schema')
const path = require('path')

async function statusService (fastify, opts) {
fastify.route({
method: 'GET',
path: '/status',
handler: onStatus,
schema: {
response: {
200: S.object().prop('status', S.string())
}
}
})

async function onStatus (req, reply) {
return { status: 'ok' }
}
}

async function setup (fastify, opts) {

fastify.setNotFoundHandler(onMain)

await statusService(fastify)

fastify.register(require('fastify-static'), {
root: path.resolve(process.env.PATH_TO_APP_DIST), // TODO temporary
prefix: '/', // optional: default '/'
})

fastify.route({
method: 'GET',
url: '/',
handler: onMain
})

function onMain (req, reply) {
reply.sendFile('index.html')
}
}

if (require.main !== module) {
module.exports = setup
return
}

const fastify = require('fastify')({
logger: {
level: 'info'
},
})


setup(fastify)
.then(fastify.listen(3500, '0.0.0.0'))
.then(() => console.log('Running...'))
25 changes: 25 additions & 0 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "web",
"version": "1.0.0",
"description": "",
"main": "app.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "standard && tap test/**/*.test.js",
"start": "fastify start -l info app.js",
"dev": "fastify start -l info -P app.js"
},
"keywords": [],
"author": "Vitalii Melnykov <fsoulmonk@gmail.com>",
"license": "MIT",
"dependencies": {
"fastify": "^3.27.1",
"fastify-static": "^4.5.0",
"fluent-schema": "^1.0.4"
},
"devDependencies": {
"standard": "*"
}
}
10 changes: 5 additions & 5 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { TestBed, async } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';

import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));

it('should create the app', async(() => {
it('should create the app', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));

it(`should have as title 'app'`, async(() => {
it(`should have as title 'app'`, waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));

it('should render title in a h1 tag', async(() => {
it('should render title in a h1 tag', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const routerStateConfig: StoreRouterConfig = {
BrowserAnimationsModule,
BrowserModule,
HttpClientModule,
RouterModule.forRoot(appRoutes),
RouterModule.forRoot(appRoutes, { relativeLinkResolution: 'legacy' }),
StoreModule.forRoot(reducers, {metaReducers, runtimeChecks: {strictStateImmutability: true, strictActionImmutability: true}}),

StoreRouterConnectingModule.forRoot(routerStateConfig),
Expand Down
Loading

0 comments on commit d326c25

Please sign in to comment.