Files
test-repo/scripts/release/release.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
842 B
JavaScript
Raw Normal View History

2018-06-05 16:37:52 -03:00
#!/usr/bin/env node
2022-10-12 12:45:37 +08:00
/* This file can't use any dependency since the dependencies may not installed yet */
2021-07-26 09:24:44 +08:00
import { exec } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
2018-08-08 23:49:22 +08:00
2022-10-12 12:45:37 +08:00
const directory = path.dirname(fileURLToPath(import.meta.url));
function runCommand(command) {
return new Promise((resolve, reject) => {
const { stdout, stderr } = exec(command, { cwd: directory }, (error) => {
if (error) {
reject(error);
} else {
resolve();
}
});
stdout.pipe(process.stdout);
stderr.pipe(process.stderr);
2018-06-05 16:37:52 -03:00
});
}
2022-10-12 12:45:37 +08:00
// Fetch git tags to get the previous version number (i.e. the latest tag)
await runCommand("git fetch --tags");
// Install script's dependencies before any require
await runCommand("yarn");
2022-10-14 17:17:47 +08:00
// Ready to run
await import("./run.js");