MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getChangedPackages

Method getChangedPackages

scripts/bumpVersions.js:173–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171 }
172
173 getChangedPackages() {
174 let packagesIndex = process.argv.findIndex(arg => arg === '--add' || arg === '--only');
175 if (packagesIndex >= 0) {
176 for (let pkg of process.argv.slice(packagesIndex + 1)) {
177 this.changedPackages.add(pkg);
178 }
179 if (process.argv[packagesIndex] === '--only') {
180 return;
181 }
182 }
183
184 // Diff each package individually. Some packages might have been skipped during last release,
185 // so we cannot simply look at the last tag on the whole repo.
186 for (let name in this.workspacePackages) {
187 let filePath = this.workspacePackages[name].location + '/package.json';
188 let pkg = JSON.parse(fs.readFileSync(filePath, 'utf8'));
189 if (isSkipped(pkg)) {
190 console.log('skip', name);
191 continue;
192 }
193
194 if (!pkg.private) {
195 // Diff this package since the last published version, according to the package.json.
196 // We create a git tag for each package version.
197 let tag = `${pkg.name}@${pkg.version}`;
198 let res = spawn('git', [
199 'diff',
200 '--exit-code',
201 tag + '..HEAD',
202 this.workspacePackages[name].location,
203 ':!**/docs/**',
204 ':!**/test/**',
205 ':!**/stories/**',
206 ':!**/chromatic/**'
207 ]);
208 if (res.status !== 0) {
209 this.changedPackages.add(name);
210 }
211 }
212 }
213 }
214
215 async getVersionBumps() {
216 return new Promise(resolve => {

Callers 1

runMethod · 0.95

Calls 4

isSkippedFunction · 0.85
sliceMethod · 0.80
addMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected