Skip to content

Commit f487345

Browse files
CHANGE: @W-19397345@: Use provided workingFolder instead of creating new temp dirs
1 parent 8a6dc78 commit f487345

File tree

78 files changed

+478
-1530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+478
-1530
lines changed

.node-scripts/validate-changed-package-versions.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ const fs = require('fs');
33
const cp = require('child_process');
44
const semver = require('semver');
55

6+
const DELETED_VERSION = '0.0.0-DELETED';
7+
68
function main() {
79
const changedFiles = readChangedFilesFile(process.argv[2]);
810
if (changedFiles.length === 0) {
@@ -49,7 +51,7 @@ function identifyMeaningfullyChangedPackages(changedFiles) {
4951

5052
for (const changedFile of changedFiles) {
5153
const changedPackage = convertFileNameToPackageNameIfPossible(changedFile);
52-
if (changedPackage && !isFileInTestFolder(changedFile)) {
54+
if (changedPackage && !isFileInTestFolder(changedFile) && !isPackageThatHasNotPublished(changedPackage)) {
5355
changedPackages.add(changedPackage);
5456
}
5557
}
@@ -77,6 +79,10 @@ function identifyIncorrectlyVersionedPackages(changedPackages) {
7779
const incorrectlyVersionedPackages = [];
7880
for (const changedPackage of changedPackages) {
7981
const packageVersion = getPackageVersion(changedPackage);
82+
if (packageVersion === DELETED_VERSION) {
83+
continue;
84+
}
85+
8086
if (!packageVersion.endsWith('-SNAPSHOT')) {
8187
incorrectlyVersionedPackages.push(`${changedPackage} (currently versioned as ${packageVersion}) lacks a trailing "-SNAPSHOT"`);
8288
continue;
@@ -104,7 +110,16 @@ function getLatestReleasedVersion(changedPackage) {
104110

105111
function getPackageVersion(changedPackage) {
106112
const packageJsonPath = path.join(changedPackage, 'package.json');
113+
if (!fs.existsSync(packageJsonPath)) {
114+
return DELETED_VERSION;
115+
}
107116
return JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')).version;
108117
}
109118

119+
function isPackageThatHasNotPublished(changedPackage) {
120+
return [
121+
"packages/ENGINE-TEMPLATE"
122+
].includes(changedPackage);
123+
}
124+
110125
main();

0 commit comments

Comments
 (0)