@jagcolombat/repair-mismatch

1.1.5 • Public • Published

Repair Mismatch

Is a utility for repair error in metadata version mismatch between versions of Angular.

Reason:

If you have a Angular project 4 and you need use a package compiled with Angular 5 or higher, you could see this error: "ERROR in Metadata version mismatch for module ..." Usually this succeed because of that metadata files version 4 of package can't understand by the compiler because your Angular 4 project only can read metadata files up to version 3. Then appear this utility. Other solution is upgrade your project and maybe the best, but not always is possible.

Installation:

npm i @jagcolombat/repair-mismatch

Configure:

The module repairMismatch can receive like parameter one object with three properties: mismatch, modules and useState.

modules: This property is required and expect a string array of node modules name´s, that you have in your folder node_modules or will have after npm install. These must are modules compiled with Angular 5 or higher.

useState: This property is used for optimize the repairMismatch process. Expect a boolean value and by default is false.

mismatch: This property is used for optimize the repairMismatch process. Expect a boolean value and by default is false. This property is used on combination with property useState.

If useState is set to true, when finish the repairMismatch process, mismatch will set to true. Of this manner when you run again the repairMismatch process, this verify if already was executed process, indicated by mismatch property equal to true, and not run again.

However, if you want force rerun again repairMismatch process, and in previous repairMismatch process, you set useState to true, you need set mismatch property to false for this new process.

On other hand, if you want always that execute repairMismatch process ignore mismatch property and rerun the process set useState to false.

Example of use:

  1. In an Angular 4 project install repair-mismatch module

    npm i @jagcolombat/repair-mismatch --save-dev

  2. Create a file JavaScript, for example rpmm.js, and input the following snippet code:

    const rpmm = require('repair-mismatch');
    rpmm({ modules: ['ngx-vis'] });
    

    Note: In this case i use ngx-vis@1.0.1 (compiled with Angular 6) and I want to use this in an Angular 4 project.

  3. In package.json of your Angular 4 project in section script add the following:

    "prestart": "node rpmm.js"

  4. When you execute npm start, for serve your angular-cli project, before is executed the script "prestart" and therefore the repairMismatch process.

Package Sidebar

Install

npm i @jagcolombat/repair-mismatch

Weekly Downloads

4

Version

1.1.5

License

ISC

Unpacked Size

5.08 kB

Total Files

5

Last publish

Collaborators

  • jagcolombat