Add package-lock.json in gitignore. Fix package ts file.

This commit is contained in:
Konstantinos Triantafyllou 2023-09-14 12:21:30 +03:00
parent 7e0e641e5f
commit d7a1eecf52
4 changed files with 18 additions and 16 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
# Node
/node_modules
package-lock.json
npm-debug.log
yarn-error.log

16
package-lock.json generated
View File

@ -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": {

View File

@ -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"
}
}

View File

@ -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;