Skip to content

Commit

Permalink
chore(webapps): add NES version for angularjs-essentials libs
Browse files Browse the repository at this point in the history
related to: #4549
  • Loading branch information
venetrius committed Nov 7, 2024
1 parent bace476 commit d5935f8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
31 changes: 15 additions & 16 deletions webapps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,23 @@
},
"xlts": {
"angular": {
"xltsVersion": "1.9.7",
"dependencies": [
"angular",
"angular-animate",
"angular-cookies",
"angular-loader",
"angular-resource",
"angular-route",
"angular-sanitize",
"angular-touch",
"angular-mocks"
]
"angular": "1.9.7",
"angular-animate": "1.9.7",
"angular-cookies": "1.9.7",
"angular-loader": "1.9.7",
"angular-resource": "1.9.7",
"angular-route": "1.9.7",
"angular-sanitize": "1.9.7",
"angular-touch": "1.9.7",
"angular-mocks": "1.9.7"
},
"bootstrap": {
"xltsVersion": "3.4.5",
"dependencies": [
"bootstrap"
]
"bootstrap": "3.4.5"
},
"angularjs-essentials": {
"angular-ui-bootstrap": "2.5.7",
"angular-translate": "2.20.3",
"angular-moment": "1.3.2"
}
}
}
32 changes: 21 additions & 11 deletions webapps/frontend/scripts/xlts.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,26 @@ const exec = (cmd, successMsg) => {
}).toString();
};

// These are the last supported versions for these packages ?????
const baseVersions = {
'angular-translate': '2.19.1',
'angular-moment': '1.3.0',
'angular-ui-bootstrap': '2.5.6'
};

const getDependencyVersion = (nameSpace, npmPackage, xltsVersion) => {
if (nameSpace !== 'angular') {
return `${npmPackage}@npm:@${scope}/${npmPackage}@${xltsVersion}`;
if (nameSpace === 'angularjs-essentials') {
const baseVersion = baseVersions[npmPackage];
return `${npmPackage}@npm:@${scope}/${nameSpace}@${baseVersion}-${npmPackage}-${xltsVersion}`;
}

if (nameSpace === 'angular') {
const versionPostfix =
npmPackage === 'angular' ? '' : '-' + npmPackage.split('-')[1];
return `${npmPackage}@npm:@${scope}/angularjs@${xltsVersion}${versionPostfix}`;
}

let versionPostfix = npmPackage.split('-')[1] || '';
versionPostfix = versionPostfix ? '-' + versionPostfix : '';
return `${npmPackage}@npm:@${scope}/angularjs@${xltsVersion}${versionPostfix}`;
return `${npmPackage}@npm:@${scope}/${npmPackage}@${xltsVersion}`;
};

const registryConfigured = exec(`npm get @${scope}:registry`) !== 'undefined\n';
Expand All @@ -66,12 +78,10 @@ if (
const xlts = require('../package.json').xlts;

const npmPackages = Object.entries(xlts)
.map(([nameSpace, settings]) =>
settings.dependencies
.map(npmPackage =>
getDependencyVersion(nameSpace, npmPackage, settings.xltsVersion)
)
.join(' ')
.flatMap(([nameSpace, settings]) =>
Object.entries(settings).map(([npmPackage, version]) =>
getDependencyVersion(nameSpace, npmPackage, version)
)
)
.join(' ');

Expand Down

0 comments on commit d5935f8

Please sign in to comment.