Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add preview package support #1490

Merged
merged 5 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build-docs": "lerna run build-docs",
"eslint": "eslint ./libraries/*/src/*.ts ./libraries/*/src/**/*.ts",
"eslint-fix": "eslint ./libraries/*/src/*.ts ./libraries/*/src/**/*.ts --fix",
"set-dependency-versions": "node tools/util/updateDependenciesInPackageJsons.js ./libraries ${Version} botframework-expressions botbuilder-lg botframework-streaming botbuilder botbuilder-ai botbuilder-dialogs botbuilder-core botbuilder-applicationinsights botbuilder-testing botframework-connector botframework-config botframework-schema testbot && node tools/util/updateDependenciesInPackageJsons.js ./transcripts ${Version} botbuilder botbuilder-ai botbuilder-dialogs",
"set-dependency-versions": "node tools/util/updateDependenciesInPackageJsons.js ./libraries ${Version} ${PreviewPackageVersion} botframework-expressions botbuilder-lg botframework-streaming botbuilder botbuilder-ai botbuilder-dialogs botbuilder-core botbuilder-applicationinsights botbuilder-testing botframework-connector botframework-config botframework-schema testbot && node tools/util/updateDependenciesInPackageJsons.js ./transcripts ${Version} botbuilder botbuilder-ai botbuilder-dialogs",
"update-versions": "lerna run set-version && npm run set-dependency-versions"
},
"dependencies": {
Expand Down
21 changes: 18 additions & 3 deletions tools/util/updateDependenciesInPackageJsons.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ console.log('Started ' + (new Date()));
var myArgs = process.argv.slice(2);
var rootPath = myArgs[0];
var newVersion = myArgs[1];
var dependencies = myArgs.slice(2);
var previewVersion = myArgs[2] || process.env.PreviewPackageVersion;
// This is a hack to deal with the inconsistencies between CI and daily builds right now
if(previewVersion === 'botframework-expressions') {
previewVersion = undefined;
}
var previewPackages = {
'botbuilder-lg': true,
'botframework-expressions': true
}
var dependencies = myArgs.slice(previewVersion ? 3 : 2);
console.log('newVersion =', newVersion);
console.log('previewVersion = ' + previewVersion);
console.log('dependencies =');
console.log(dependencies);
console.log('Preview packages: ');
console.log(JSON.stringify(previewPackages, null, ' '));

// Update versions for specified dependencies in package.json file
function updateDependencies(filePath) {
Expand All @@ -20,10 +32,13 @@ function updateDependencies(filePath) {
return console.log(err);
}

console.log('Updating file: ' + filePath);

var result = '';
dependencies.forEach(function (dependency) {
var findString = new RegExp('("dependencies":)(.+?)("' + dependency + '":\\s*")([^\/"]+)', "gms")
var replaceString = '$1$2$3' + newVersion;
var findString = new RegExp('("dependencies":)(.+?)("' + dependency + '":\\s*")([^\/"]+)', 'gms')
var replaceString = '$1$2$3' + ((previewVersion && previewPackages[dependency]) ? previewVersion : newVersion);
console.log('Replace string: ' + replaceString);
result = data.replace(findString, replaceString);
data = result;
});
Expand Down