From a95c60e4bc2d7bfde09a4d52df4d403b5748330e Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 22 Aug 2021 18:01:43 +0300 Subject: [PATCH] package.json: Add npm prepare script We need this because we are installing directly from git instead of via npmjs.com so we need to make sure that npm builds the libraries after installing. The caveat is that we need to use --legacy-peer-deps when building md-menu because of some bug in npm that causes it to prefer higher versions when range is given (we have @angular/forms@^9.0.0...): > npm ERR! Could not resolve dependency: > npm ERR! peer @angular/common@"10.2.5" from @angular/forms@10.2.5 > npm ERR! node_modules/@angular/forms > npm ERR! peer @angular/forms@"^9.0.0 || ^10.0.0-0" from @angular/material@9.2.4 > npm ERR! node_modules/@angular/material > npm ERR! peer @angular/material@">=7.0.0 <10.0.0" from the root project Also, it seems the npm postinstall was not necessary. See: https://github.com/npm/cli/issues/3152 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f4365f..dea25e9 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "pub:lib:ngx-bootstrap": "cd dist/ngx-tour-ngx-bootstrap && npm publish", "pub:lib:ngx-popper": "cd dist/ngx-tour-ngx-popper && npm publish", "pub:lib:md-menu": "cd dist/ngx-tour-md-menu && npm publish", - "postinstall": "ngcc" + "prepare": "npm run build:lib:core && npm run build:lib:md-menu --legacy-peer-deps" }, "dependencies": { "@angular/animations": "^9.1.13",