-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compat): create scripts to fetch metadata
- Loading branch information
1 parent
3d096cb
commit 1df6f60
Showing
5 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const fetchPackageNames = require("./fetch_package_names"); | ||
const _ = require("lodash"); | ||
|
||
const fetchArgsArray = [ | ||
{ | ||
organization: "webpack-contrib", | ||
suffix: "-loader" | ||
}, | ||
{ | ||
organization: "webpack-contrib", | ||
suffix: "-plugin" | ||
} | ||
]; | ||
|
||
async function fetchPackageNamesPromise(organization, suffix) { | ||
return new Promise((resolve, reject) => { | ||
fetchPackageNames({organization, suffix}, (err, data) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
resolve(data); | ||
}); | ||
}); | ||
} | ||
|
||
async function getPackageJsonFiles(namesArray) { | ||
const packageJson = require("package-json"); | ||
return Promise.all(namesArray.map((name) => packageJson(name, {allMetadata: true}) )); | ||
} | ||
|
||
async function main() { | ||
try { | ||
const [loaderNames, pluginNames] = await Promise.all( | ||
fetchArgsArray.map(({organization, suffix}) => fetchPackageNamesPromise(organization, suffix)) | ||
); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
const packageFiles = await getPackageJsonFiles([...loaderNames, ...pluginNames].map(d => d.name)); | ||
This comment has been minimized.
Sorry, something went wrong.
lencioni
Contributor
|
||
|
||
console.log(packageFiles); | ||
|
||
// TODO: Write to disk the JSON file that gets fetched and then add to script workflow. | ||
// This should be saved in ./src/Compatibility/packages.json | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We probably want to fill this out with relevant packages from other orgs/users. Do you happen to know if there is any canonicalish list sitting around somewhere?