MCPcopy Index your code
hub / github.com/adobe/react-spectrum / getExistingPackages

Method getExistingPackages

scripts/bumpVersions.js:131–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129 }
130
131 async getExistingPackages() {
132 // Find what packages already exist on npm
133 let packages = Object.keys(this.workspacePackages);
134 for (let i = 0; i < packages.length; i += 20) {
135 let promises = [];
136 for (let name of packages.slice(i, i + 20)) {
137 let filePath = this.workspacePackages[name].location + '/package.json';
138 let pkg = JSON.parse(fs.readFileSync(filePath, 'utf8'));
139 if (pkg.private) {
140 continue;
141 }
142
143 console.log('Checking ' + name + ' on npm');
144
145 promises.push(
146 fetch(`https://registry.npmjs.com/${name}`)
147 .then(res => {
148 if (res.ok) {
149 return res.json();
150 }
151 })
152 .then(json => {
153 if (!json) {
154 return;
155 }
156
157 let tags = json['dist-tags'];
158 for (let tag in tags) {
159 if (!tags[tag].includes('nightly')) {
160 this.existingPackages.add(name);
161 break;
162 }
163 }
164 })
165 );
166 }
167
168 await Promise.all(promises);
169 }
170 }
171
172 getChangedPackages() {
173 let packagesIndex = process.argv.findIndex(arg => arg === '--add' || arg === '--only');

Callers 1

runMethod · 0.95

Calls 4

sliceMethod · 0.80
pushMethod · 0.80
addMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected