Friday, March 24, 2017

Angular 4 is out!

Angular 4 is out! My first reaction was WHAT? Did I miss the release of Angular 3 somewhere? Turns out that they decided to skip a version to align with the Angular version 4 router(an announcement that I missed somehow).

The focus on this release is making Angular applications smaller and faster. I’ll start upgrading my projects this weekend.

Expect a follow-up post with my experiences soon…

PS: Here is the announcement on their blog: http://angularjs.blogspot.be/2017/03/angular-400-now-available.html

Thursday, March 23, 2017

TypeScript - TS2403 Subsequent variable declarations must have the same type. Variable 'module' must be of type 'NodeModule'

Got a TypeScript error when trying to get my Angular app up and running:

Error      TS2403  Subsequent variable declarations must have the same type.  Variable 'module' must be of type 'NodeModule', but here has type '{ id: string; }'.   TypeScript Virtual Projects               C:\projects\MyAngularClient\src\typings.d.ts               2             Active

To fix it, I had to comment out the module declaration typings.d.ts:

Wednesday, March 22, 2017

Eventsourcing - One table with 3 columns, that’s all you need to build any kind of application

If you are new to EventSourcing I can recommend the eBay Tech Talk in Berlin, Raimo Radczewski did a great introduction about EventSourcing and CQRS.

Best quote during the talk:

One table with three columns; with EventSourcing, that’s all you need to develop an e-commerce system, a CRM app, or any kind of application you can imagine.

Tuesday, March 21, 2017

NPM Package.json publishing configuration

When managing your package.json file there are 2 use cases that can impact how you configure it:

I don't want my package published at all. It's private.

To enable this set "private": true in your package.json. This will prevent it from being published at all.

If you try to accidently publish the package, you’ll get the following feedback:

C:\projects\test\npmtest>npm publish
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\BaWu\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "publish"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.5

npm ERR! This package has been marked as private
npm ERR! Remove the 'private' field from the package.json to publish it.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <
https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\projects\test\npmtest\npm-debug.log

I only want my package to be published to an internal registry.

Add a "publishConfig":{"registry":"http://my-internal-registry.local"} section to your package.json to force it to be published only to your internal registry.

Invoking the ‘npm publish’ command will publish the package to the specified registry.

More information at http://browsenpm.org/package.json

Monday, March 20, 2017

ProGet: NPM connector returns no records

At a customer we are using ProGet as our internal package manager server. ProGet supports a lot of different package formats including NPM and NuGet. Thanks to the usage of connectors you can even link to other package sources like the official NuGet feed or the official NPM registry.

Unfortunately after creating an NPM feed and linking it to the official NPM registry(https://registry.npmjs.org) using a connector, the connector didn’t do anything and our feed remained empty.

Turns out that a scheduled task exists that indexes the Npm registry but it only runs once a week by default.

To find this scheduled task, go to your Proget site and click on the Administration icon image on the right

image

After logging in, go to Scheduled Tasks below System settings

image

In the list of Scheduled Tasks you should find the ‘FullNpmConnectorIndex’ task. You can invoke it immediatelly by clicking on the ‘Play’ button at the right.

image

Friday, March 17, 2017

Visual Studio 2017 Poster

The Microsoft team created a poster showing off some of their favorite parts of Visual Studio 2017. Time to get your A1 printer started and spice up your team room.

visualstudio2017_productlaunchposter-1

You can download the  PDF or check the web infographic version.

Thursday, March 16, 2017

Angular CLI - You have to be inside an angular-cli project in order to use the build command

After creating an Angular application using the following Angular CLI command;

ng new appname

You should open the newly created appname folder before invoking any other ng command. Otherwise you get the following error message:

You have to be inside an angular-cli project in order to use the <commandname> command

Unfortunately I got the same error after pulling an Angular project created by a colleague from our GIT repo. Although I was certainly in the correct folder, I saw the above error again Sad smile.

Turned out that the Angular project was created using a newer version of the Angular CLI. After updating to the latest version of the @angular/cli package the problem disappeared.

Remark: Here are the steps to correctly update Angular CLI: https://github.com/angular/angular-cli#updating-angular-cli