diff --git a/.gitignore b/.gitignore index 0711527..8b518fb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Node /node_modules +package-lock.json npm-debug.log yarn-error.log diff --git a/package-lock.json b/package-lock.json index de574ff..5ce3295 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "ng-packagr": "^16.2.0", - "typescript": "~5.1.3" + "typescript": "~4.9.5" } }, "node_modules/@ampproject/remapping": { @@ -12084,16 +12084,16 @@ "dev": true }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=14.17" + "node": ">=4.2.0" } }, "node_modules/ua-parser-js": { @@ -21692,9 +21692,9 @@ "dev": true }, "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index 4dc8771..8091b9f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "watch": "ng build --watch --configuration development", "test": "ng test", "build-lib": "ng-packagr -p projects/$npm_config_lib/ng-package.json", - "package": "tsc package.ts && node package.ts" + "package": "tsc package.ts && node package.js" }, "private": true, "dependencies": { @@ -36,6 +36,6 @@ "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "ng-packagr": "^16.2.0", - "typescript": "~5.1.3" + "typescript": "~4.9.5" } } diff --git a/package.ts b/package.ts index 43d5246..223eccd 100644 --- a/package.ts +++ b/package.ts @@ -1,5 +1,4 @@ import * as process from "process"; -import {error} from "ng-packagr/lib/utils/log"; const { exec } = require('child_process'); @@ -14,6 +13,7 @@ console.log('Cloning ' + repository); function installDependency(index: number) { if(index < dependencies.length) { + console.log(`Installing ${dependencies[index]}`); exec(`npm run build-lib --lib=${dependencies[index]}`, (error:string) => { if(error) { console.error(`Error packaging ${dependencies[index]}: ${error}`); @@ -21,12 +21,13 @@ function installDependency(index: number) { return; } process.chdir('../'); - exec(`npm install --no-save ./${repository}/projects/${dependencies[index]}`, (installError: string) => { + exec(`npm install --no-save $(npm pack ./${repository}/projects/${dependencies[index]} | tail -1)`, (installError: string) => { if(error) { console.error(`Error installing ${dependencies[index]}: ${installError}`); - clean(); + clean('./'); return; } + console.log(`${dependencies[index]} has been installed successfully`); process.chdir(repository); installDependency(index + 1); }); @@ -36,11 +37,11 @@ function installDependency(index: number) { } } -function clean() { +function clean(directory: string = '../') { /** Clean files after packaging */ console.log('Cleaning files') - process.chdir('../') - exec(`rm -rf ${repository} package.js`, (error: string) => { + process.chdir(directory) + exec(`rm -rf ${repository} package.js *.tgz`, (error: string) => { if(error) { console.error(`Error cleaning files: ${error}`); return;