Category: typescript

TypeScript is not type safe

Let’s say we have an API that return true or false ( TILT – Things I learned Today – http://tiltwebapp.azurewebsites.net/  – returns true if I have learned something today )

What is wrong with this code:

public HasTILTToday():Observable<boolean>{

if(!this.wasLoggedIn)return of(false);

return this.http.get<string>(this.baseUrl+’TILT/HasTILTToday’, {

headers: new HttpHeaders(

        {

‘Authorization’: ‘CustomBearer ‘ + this.jwt,

‘Content-Type’: ‘application/json’

        }),       

responseType: ‘text’ as ‘json’})

    ;

  }

….

Answer : When you subscribe,even the variable is boolean, when you go with typeof is a string ( that contains “true” or “false” ). And this, when you use  a *ngIf =”the bool” – it will have undexpected behaviours.

Solution? The rxjs pipe

public HasTILTToday():Observable<boolean>{

if(!this.wasLoggedIn)return of(false);

return this.http.get<string>(this.baseUrl+’TILT/HasTILTToday’, {

headers: new HttpHeaders(

        {

‘Authorization’: ‘CustomBearer ‘ + this.jwt,

‘Content-Type’: ‘application/json’

        }),       

responseType: ‘text’ as ‘json’})

      .pipe(

map(it=>it===’true’)

      );

  }

Covid Data -CI/ CD–part 5

Now I need that every data ( either from the github .md file, either gathered from https://github.com/CSSEGISandData/COVID-19/ ) be updated into the site.

Github Actions to the rescue!

I have created 2 different workflows : one for gathering the data from the https://systems.jhu.edu/research/public-health/ncov/ , the other for compiling the .md files and the Angular app. Thinking more, I should have had the Angular compiled into another workflow that was called after each one – but this is more AzureDevOps , than GitHub Actions.

1. Workflow for .md and for Angular

You can find the source at https://github.com/ignatandrei/WFH_Resources/blob/master/.github/workflows/blank.yml . It uses a Docker file to compile the Angular: https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/compile.txt and a Docker batch to run the docker file and gather the results : https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/compile.bat

Uses all the previous js and TypeScript files to transform and load data. Copies the data into the docs folder ( to be public available ) and then commits the data back to Github

It is run on both push at a cron job

on:

push:

pull_request:

schedule:

– cron: ‘5 4 * * *’

2. Workflow for gather last country data for Covid

You can find the source at https://github.com/ignatandrei/WFH_Resources/blob/master/.github/workflows/allnewdata.yml .It uses also a Docker file to compile data and run https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/addNew.txt 

And a docker compile file https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/addNew.bat to gather the data from docker.

Also the workflow commits data to github.  It is run at a cron job:

on:

schedule:

– cron: ‘5 2 * * *’

Covid Data–transforming – part 3

I figured out that from data ( .md files and .js files) I need to have a proper data to be processed by the application. Since the application will be a static web app, the easy way is to be a generated js file to be imported into the application.

1.   MD to js

So now I must figure a way to transforme .md files into .js files. I was having dreams about Stankins , but it is not yet ready. So Js to the rescue. You can find the .js file here: https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/server.js

It reads  the folders files

var folders = [“Country”,”Entertainment”,”FreeSoftware”, “Kids”,”Learn”,”MapsAndData”,”NotParsed”];

//…

for (let folder of folders) {

const directoryPath = path.join(__dirname + “/..”, folder);

const list = await rra.list(directoryPath);

then parses a file( e.g. https://github.com/ignatandrei/WFH_Resources/blob/master/Learn/DigitalLibrary.md )  with a lexer

const tokens = marked.lexer(fileContents);

for(let iToken=0;iToken<tokens.length;iToken++){

and writes to a file

fs.writeFileSync(directoryPathWrite,content);

2. Importing  Country data  for Covid

Now I need every data for Covid. I figure out the the only one that have the data is https://github.com/CSSEGISandData/COVID-19/ . However , the data is not always in the same form.

Again, because t Stankins is not yet ready, I recurse to TypeScript. It is better that JS for me – it keeps tracking the errors that you may have . You can find the file at https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/importData.ts

Some pain points :

or there are not always countries – see const NotCountry where  “Diamond Princess” and “MS Zaandam” are countries ( there are cruise ships)

  • I should verify if there is always data for this day, if it exists for the previous ( yes, I know, Covid will eventually disappear or not be registered otherwise than influenza –but, for the moment ,it is ok) :  see async function Verify in https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/importData.ts
  • I have had problems finding a CSV parser to TypeScript – I have found papaparse

3. Importing other data

I need to have the country population for each country, to display the relative percentage of the people . For this, I have the data from https://en.wikipedia.org/wiki/List_of_sovereign_states_and_dependent_territories_by_mortality_rate – but how to import into already existing data https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/countryList.ts ?

Simple: Import data into Excel. Make a case instruction with each country, iterate via countries, ( find discrepancies in names – use alternate names for this) and put the property as js , save the file. See https://github.com/ignatandrei/WFH_Resources/blob/master/makeData/test.ts

.

Bingo Meetings- conclusion–part 25

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

It was a nice journey  to make an application just with TypeScript and Node ecosystem.  There are some missing parts ( e.g. testing the GUI – e2e in JS parlance)

However, some thoughts:

  1. The ecosystem does not have good support for mono-repository (in C# parlance , solution with multiple referencing projects )
    • Yarn Workspaces helps
    • TypeScript compile should be configured
  2. The fact that you wrote once time the definitions is overrated
    • Still some different models for Web API and Console and Web should exists, if you are a purinst ( no swagger reference for console …)
    • The possibilities of mistake  because of the same  model are not trivial
  3. Some tools require better documentation
    1. Finding how in nest return an HTML file is …. gard
    2. The errors are not so self explanatory ( for example, referencing i n warn workspaces something without his references)
  4. Docker really helps to have repeatable builds
    1. CLI is your best friend –  programming and devops
    2. Docker copying results files are perfect
  5. In our days, to be a full cycle programmer is easy with open source and stacks for open source( GitHub, AzureDevOps, Heroku, others)

Bingo Meetings- documenting code–part 24

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

We have already documented the process of reproducing our code on developer PC ( including docker …)  So now we should help programmers understand the code that we have create and it’s general use.

For this, for any project that we have :

1. We should  add a Readme.md file to explain the project

2. We should add documentation for any class

3. We should generate the documentation for any class in a readable form ( preferably html)

3. We should deploy somewhere the documentation

 

For the first point, this is very easy ( although painful to write ). However, we should add a link to the 4th point , the link to the documentation.

For point 2 and 3 (adding documentation for any class and generating html ), we could use https://typedoc.org/  .

And ,because we are used to docker, I created build_code_documentation.txt docker file that runs typedoc on every project

FROM node:10
WORKDIR /app
WORKDIR /app
COPY package.json ./package.json
COPY bingo-cards-api/package.json ./bingo-cards-api/package.json
COPY bingo-cards-api-objects/package.json ./bingo-cards-api-objects/package.json
COPY bingo-cards-ui/package.json ./bingo-cards-ui/package.json
COPY bingo-meeting-console/package.json ./bingo-meeting-console/package.json
COPY bingo-meeting-objects/package.json ./bingo-meeting-objects/package.json
COPY bingo-meeting-objects-test/package.json ./bingo-meeting-objects-test/package.json
COPY yarn.lock ./yarn.lock

RUN yarn install

COPY . ./

RUN npm install –global typedoc
RUN yarn build
RUN typedoc –mode file –out docs/source/bingo-cards-api –ignoreCompilerErrors  –excludePrivate –excludeProtected bingo-cards-api/src
RUN typedoc –mode file –out docs/source/bingo-cards-api-objects –ignoreCompilerErrors  –excludePrivate –excludeProtected bingo-cards-api-objects/src
RUN typedoc –mode file –out docs/source/bingo-cards-ui –ignoreCompilerErrors  –excludePrivate –excludeProtected bingo-cards-ui/src
RUN typedoc –mode file –out docs/source/bingo-meeting-console –ignoreCompilerErrors  –excludePrivate –excludeProtected bingo-meeting-console
RUN typedoc –mode file –out docs/source/bingo-meeting-objects –ignoreCompilerErrors  –excludePrivate –excludeProtected bingo-meeting-objects
RUN typedoc –mode file –out docs/source/bingo-meeting-objects-test –ignoreCompilerErrors  –excludePrivate –excludeProtected bingo-meeting-objects-test

CMD tail -f /dev/null

And the bat file just copy on hard disj

docker build .. -f docker_build_code_documentation.txt -t bingo_build_code_documentation
docker run -d –rm –name bingo_build_code_documentation_container bingo_build_code_documentation
docker cp bingo_build_code_documentation_container:/app/docs/source .
docker container kill bingo_build_code_documentation_container

For the last point, we can deploy documentation at github pages , in a separate folder in docs, named source ( we will just copy the files genetated by docker)

 

You can find the result of the documentation at

bingo-cards-api

bingo-cards-api-objects

bingo-cards-ui

bingo-meeting-console

bingo-meeting-objects

bingo-meeting-objects-test

BingoMeetings–4 steps to run in Docker both WebAPI and Site-part 22

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

Now what I want to achieve is to run the WebAPI and Angular Site in docker. For this, we should compile the Angular site and copy into the WebAPI. Also, WebAPI should serve the index.html file generated by the Angular.

Those are the 4 steps:

1. Ensure that  the Angular routes and WebAPI routes should be different Solution: this is easy achieved by having /api prepended to the WebAPI routes)

2. The WebAPI should be configured as to build to different configurations: for our purpose, calling  root ( /). For docs ( https://alexandru360.github.io/PresentationBingoCards/ ) it should call official deploy http://bingo-meeting-api.herokuapp.com/api/ 

Solution: read about environment https://angular.io/guide/build . I have made a new environment dockerbuild  Rememeber to create a new environment.ts  + a new entry in angular.json to build this configuration + an entry in package.json to build it . Then modify the service to use environment( see the modifications at https://github.com/alexandru360/PresentationBingoCards/commit/6dafb0c0b005d46bc426d128f9caf5d53e039dfa ).

3. For NestJs to serve html file , add nest-middlewares/serve-static  , then add the following code in the appropiate places:

ServeStaticModule

.forRoot({

rootPath: join(__dirname, ‘..’, ‘dist’,’bingo-cards-ui’),

})],

ServeStaticMiddleware.configure(‘/test’ );

consumer.apply(ServeStaticMiddleware).forRoutes(‘/test’);

( see https://github.com/alexandru360/PresentationBingoCards/commit/6dafb0c0b005d46bc426d128f9caf5d53e039dfa )

4. In the docker compile the Angular , then copy the files into WebAPI folder, then run the WebAPI site . See https://github.com/alexandru360/PresentationBingoCards/blob/master/dockerize/docker_runwebapiweb.txt and https://github.com/alexandru360/PresentationBingoCards/blob/master/dockerize/build_RunWebApiWeb.bat

Bingo for meetings-build an Angular app-part 20

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

Now it is time to create some Angular GUI. ( If you want to learn Angular, please visit https://angular.io/ )

Problems encountered:

1. The CreateMeeting did not compile (ng serve ) the CreateMeeting class ( because of the nestjs Swagger  decorators ).

export class CreateMeeting  {
  @ApiModelProperty()
  userName: string;
  @ApiModelProperty()
  meetingName: string;
}

So I ended creating an interface ICreateMeeting with the same definition

export interface ICreateMeeting{
    userName: string;
    meetingName: string;
}
export class CreateMeeting implements ICreateMeeting {
  @ApiModelProperty()
  userName: string;
  @ApiModelProperty()
  meetingName: string;
}

and using in ReactiveForms as

 const c: ICreateMeeting = {userName: '', meetingName: ''};
 this.createMeetingForm = this.formBuilder.group(c);

Also, because the interface have the same signature as the class, we can use to POST data

public SaveMeeting(create: ICreateMeeting): Observable<Meeting> {
    const url: string = this.urlApi + 'meetings';
    return this.httpAPI.post<Meeting>(url, create);
  }

2. We should call WebAPI as http if the site is http and https if the site is https.  The problem is that the URL is hardCoded

private urlApi = 'http://bingo-meeting-api.herokuapp.com/';

We can have to inject the document to obtain the  doc.location.protocol

  constructor(@Inject(DOCUMENT)private doc: Document,  private httpAPI: HttpClient) {
     this.protocol = doc.location.protocol;
  }

but we remember there is a better way with // , that means respecting the protocol

  private urlApi = '//bingo-meeting-api.herokuapp.com/';

 

3. TypeScript – ng build works, but ng build –prod –build-optimizer gives an obscure error.
The solving was to add in the tsconfig.json
“noUnusedLocals”: true,
“noUnusedParameters”: false,

and solve unused declarations.

You can find the results at https://alexandru360.github.io/PresentationBingoCards/

Bingo for meetings–finalizing API for web–part 16

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

The API that we want to create is

  1. create meeting
  2. add participant
  3. check cards
  4. see result meeting(

Those API’s  were simpler for the console application, because of the single participant involved.

There are also some technical problems and some architectural ones.

Let’s start with technical: nestjs suggest ( as per sample project with contacts) to add a route like:

    @Put(':id/addParticipant')
    async addParticipant(@Param('id') id: any, @Body() nameParticipant: string): Promise<Meeting> {
        // console.log(`userName : ${JSON.stringify(cm.userName)}  meetingName: ${JSON.stringify(cm.meetingName)}`);
        return this.meetingsService.AddParticipant(id, nameParticipant);
    }

However , this is not available to be tested via Swagger – so we modify to

export class AddParticipant {
    @ApiModelProperty()
  meetingId: any;
  @ApiModelProperty()
  nameParticipant: string;
}
//CODE OF THE CONTROLLER OMITTED
@Put('addParticipant')
    async addParticipant(@Body() addParticipant: AddParticipant): Promise<Meeting> {
        // console.log(`userName : ${JSON.stringify(cm.userName)}  meetingName: ${JSON.stringify(cm.meetingName)}`);
        return this.meetingsService.AddParticipant(addParticipant.meetingId, addParticipant.nameParticipant);
    }


Also, when we handle in the meeting service the CheckCard we discover to be missing something for the original DDD model . For example, we need a FindCard and FindParticipantAfterName .

public checkCard(idMeeting: any, idCard: number, nameParticipant:string ): Meeting{
        const m = this.meetings.find(it => it.Id === idMeeting );
        // TODO: throw if meeting is null
        const c = m.FindCard(idCard);
        // TODO: throw if card is null
        const p = m.FindParticipantAfterName(nameParticipant);
        // TODO: throw if participant is null

        m.CheckCardByParticipant(c, p);
        return m;

    }

For the architectural ones:

  1. The service that we just created should be tested and put into the right project. It could belong to the bingo-meeting-objects.
  2. The controller has some classes that should be tested. However, the classes involving in the @Body have   swagger attributes, so they cannot be moved into bingo-meeting-objects .
export class AddParticipant {
//bingo-meeting-objects  should not have reference to swagger properties
    @ApiModelProperty()
  meetingId: any;
  @ApiModelProperty()
  nameParticipant: string;
}


Download the actual code from https://github.com/alexandru360/PresentationBingoCards/releases/tag/api_final

Bingo for meetings-nestjs–create meeting api -part 15

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

So now it is time to expose our objects as HTTP API. We have decided to go with nest.js because has support for TypeScript. The documentation to install is pretty obvious at https://docs.nestjs.com/ .

Now we must code the endpoint to create a meeting. As per the nest.js documentation , we should create a module ,a controller and a service to redirect calls . The problem is that , to create a meeting, we should transmit 2 parameters: userName and meetingName. To do this via  HTTP, we must create a new class with this 2 parameters :


export class CreateMeeting {
  readonly userName: string;
  readonly meetingName: string;
}

Also we want to add Swagger as show at https://docs.nestjs.com/recipes/swagger .  And for this, according to the documentation , we should decorate the class:

import { ApiModelProperty } from '@nestjs/swagger';

export class CreateMeeting {
  @ApiModelProperty()
  readonly userName: string;
  @ApiModelProperty()
  readonly meetingName: string;
}

And now we have a controller with 2 functions – get – to show all meetings – and post-  to create the meeting:

@Controller('meetings')
export class MeetingsController {
    constructor(private meetingsService: MeetingService){}

    @Get()
    index(): Meeting[] {
      return this.meetingsService.meetings;
    }

    @Post()
    async create(@Body() cm: CreateMeeting): Promise<Meeting> {
        console.log(`userName : ${JSON.stringify(cm.userName)}  meetingName: ${JSON.stringify(cm.meetingName)}`);
        return this.meetingsService.create(cm.userName, cm.meetingName);

    }
}

And now we have a fully qualified web api that can create a meeting.  And we have swagger to test functions.

That’s good for a start…

Bingo for meetings–typescript making exe console–part 14

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

Now it is the moment to have our first executable release– console application. First, we want to see if the js obtain by compilation of ts run under node ( it runs under  ts-node index.ts , but it runs under node.js ? ). And we see that , when I run node index.js it gives error “ could not find bingo-meeting-object/MeetingFactory”.

It is clear that, even if yean workspaces works well with node and typescript, the final result, index.js , is not prepared to run under node. Solving the problem is about compiling typescript with project references  . The documentation is at https://www.typescriptlang.org/docs/handbook/project-references.html#composite  , and a sample project can be found at https://github.com/RyanCavanaugh/learn-a

It is composed by

1. having a tsconfig.json with

{

“compilerOptions”: {

“target”: “es5”,

“module”: “commonjs”,

“declaration”: true,

“declarationMap”: true,

“sourceMap”: true,

“strict”: false,

“composite”: true,

“esModuleInterop”: true

}

}

and extending in tsconfig.json

“extends”: “../tsconfig.settings.json”,

2. Compiling the projects with

tsc -b .

3. Creating index.ts with all classes exports

export * from “./MeetingsFactory”;

export * from “./Meeting”;

export * from “./Cards”;

export * from “./Participant”;

And now we can execute index.js with node index.jsinto

That means also the referenced projects are compiled into node_modules. That means that will not run without it.

 

We want now to create a console executable for the console project. That means something that compiles everything into an exe  – no matter windows , linux , or macos

We use for that https://www.npmjs.com/package/pkg

In the package.json of the console project we put

“build” : “pkg dist/index.js -c package.json”
In the root package.json we put
“scripts”: {
“test”: “cd bingo-meeting-objects-test && yarn test”,
“runConsole”: “cd bingo-meeting-console && yarn start”,
“buildConsole”:”yarn build && cd bingo-meeting-console && yarn build”,
“build”:”tsc -b .”
}
and yarn buildConsole will build than pkg into windows + linux + macos ( no matter that the windows has 108 MB 😉 )
Also we create a build_console.bat batch and docker_build_console.txt in order to automatically build the console
The docker is simple
FROM node:8
WORKDIR /app
COPY . ./
RUN yarn
RUN yarn buildConsole
CMD tail -f /dev/null
The batch just runs the docker and copy files
docker build .. -f docker_build_console.txt -t bingo_build_console
docker run -d –rm –name bingo_build_console_container bingo_build_console
docker cp bingo_build_console_container:/app/bingo-meeting-console/bingo-meeting-console-win.exe .
docker cp bingo_build_console_container:/app/bingo-meeting-console/bingo-meeting-console-linux .
docker cp bingo_build_console_container:/app/bingo-meeting-console/bingo-meeting-console-macos .
docker container kill bingo_build_console_container
After this, we put into the yaml file to be copied as artifacts

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.