feat: throw error if the platform is not linux
This commit is contained in:
12
dist/index.js
vendored
12
dist/index.js
vendored
@@ -91,7 +91,7 @@ function runCommand(command) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.runCommand = runCommand;
|
exports.runCommand = runCommand;
|
||||||
function install(version) {
|
function installOnLinux(version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const system = runCommand('uname -s');
|
const system = runCommand('uname -s');
|
||||||
const hardware = runCommand('uname -m');
|
const hardware = runCommand('uname -m');
|
||||||
@@ -101,6 +101,16 @@ function install(version) {
|
|||||||
return installerPath;
|
return installerPath;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function install(version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'linux':
|
||||||
|
return installOnLinux(version);
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform: ${process.platform}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
exports.install = install;
|
exports.install = install;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -16,7 +16,7 @@ export async function runCommand(command: string): Promise<string> {
|
|||||||
return output.trim()
|
return output.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function install(version: string): Promise<string> {
|
async function installOnLinux(version: string): Promise<string> {
|
||||||
const system = runCommand('uname -s')
|
const system = runCommand('uname -s')
|
||||||
const hardware = runCommand('uname -m')
|
const hardware = runCommand('uname -m')
|
||||||
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`
|
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`
|
||||||
@@ -24,3 +24,12 @@ export async function install(version: string): Promise<string> {
|
|||||||
await exec(`chmod +x ${installerPath}`)
|
await exec(`chmod +x ${installerPath}`)
|
||||||
return installerPath
|
return installerPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function install(version: string): Promise<string> {
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'linux':
|
||||||
|
return installOnLinux(version)
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform: ${process.platform}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user