Skip to content

Commit

Permalink
feat: build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 12, 2020
1 parent 88f69e1 commit 8402b8b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions release/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89212,6 +89212,7 @@ function changeVersionNumbers(version, project) {
var _a;
const file = editJsonFile(_.path);
const packageObject = file.toObject();
logger.info(`Updating ${_.packageObject.name} to version ${version}`);
file.set('version', version);
if (project.hasWorkspaces()) {
const workspaceNames = packages.map(_ => _.packageObject.name);
Expand All @@ -89220,36 +89221,35 @@ function changeVersionNumbers(version, project) {
const dependencies = (_a = packageObject[field]) !== null && _a !== void 0 ? _a : {};
for (let dependencyName of Object.keys(dependencies)) {
if (workspaceNames.includes(dependencyName)) {
console.log(`old dependency ${dependencyName}`);
console.log(`old field ${field}`);
logger.info(`Updating workspace ${field} '${dependencyName}' to version ${version}`);
dependencyName = dependencyName.replace('.', '\\.');
field = field.replace('.', '\\.');
console.log(`new dependency ${dependencyName}`);
console.log(`new field ${field}`);
const key = `${field}.${dependencyName}`;
console.log(`version ${version}`);
console.log(`set ${key}`);
file.set(`${key}`, version);
file.set(key, version);
}
}
}
}
console.log(file.toObject());
file.save();
});
}
function publishPackages(project, version) {
return __awaiter(this, void 0, void 0, function* () {
const packages = getPackages(project);
let allSucceeded = true;
for (const root of packages.map(_ => _.rootFolder)) {
for (const packageToPublish of packages) {
if (packageToPublish.packageObject.private === true) {
logger.info(`Skipping publishing of ${packageToPublish.packageObject.name}`);
continue;
}
logger.info(`Publishing ${packageToPublish.packageObject.name}`);
const args = [];
const prerelease = version.prerelease;
if ((prerelease === null || prerelease === void 0 ? void 0 : prerelease.length) && prerelease.length > 0) {
args.push('--tag');
args.push(prerelease[0]);
}
if ((yield exec_1.exec('npm publish', args, { ignoreReturnCode: true, cwd: root })) !== 0)
if ((yield exec_1.exec('npm publish', args, { ignoreReturnCode: true, cwd: project.root })) !== 0)
allSucceeded = false;
}
return allSucceeded;
Expand Down

0 comments on commit 8402b8b

Please sign in to comment.