mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
chore: added @all for updater
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
const semver = require('semver');
|
||||
const fs = require('fs');
|
||||
const { exec } = require("child_process");
|
||||
const { readdir } = require("fs/promises");
|
||||
|
||||
const runCommand = async (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -45,12 +46,23 @@ async function getFile(path) {
|
||||
|
||||
}
|
||||
|
||||
const getDirectories = async source =>
|
||||
(await readdir(source, { withFileTypes: true }))
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => dirent.name);
|
||||
|
||||
async function main() {
|
||||
/**
|
||||
* @type {string[]}
|
||||
*/
|
||||
let args = process.argv.slice(2);
|
||||
|
||||
if (args[0].startsWith('@all')) {
|
||||
const [_, type] = args[0].split('.');
|
||||
const allPackages = await getDirectories('../../../packages');
|
||||
args = allPackages.map((packageName) => `${ packageName }.${ type }`);
|
||||
}
|
||||
|
||||
if (args[0].startsWith('@auto')) {
|
||||
const [_, type] = args[0].split('.');
|
||||
// List of packages that for some reason are not in the diff.
|
||||
@@ -92,6 +104,7 @@ async function main() {
|
||||
// version: '1.2.3' <--- this is the line we want, we assure that it has a version in the previous if
|
||||
//});
|
||||
const [_, versionValue] = line.split(':');
|
||||
if (!versionValue) continue;
|
||||
const currentVersion = versionValue
|
||||
.trim()
|
||||
.replace(',', '')
|
||||
@@ -113,7 +126,7 @@ async function main() {
|
||||
|
||||
const newVersion = incrementNewVersion(release);
|
||||
console.log(`Updating ${ name } from ${ currentVersion } to ${ newVersion }`);
|
||||
const newCode = code.replace(currentVersion, "'" + newVersion + "'");
|
||||
const newCode = code.replace(currentVersion, `${ newVersion }`);
|
||||
await fs.promises.writeFile(filePath, newCode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user