-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from Pure-D/install-served
- Loading branch information
Showing
7 changed files
with
166 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
* text=auto | ||
|
||
# don't diff machine generated files | ||
dist/ -diff | ||
package-lock.json -diff | ||
pnpm-lock.yaml -diff | ||
|
||
# Built files | ||
dist/ -diff | ||
dist/** filter=lfs diff=lfs merge=lfs -text |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
import downloadRelease from "@terascope/fetch-github-release" | ||
import { join, dirname, extname, basename } from "path" | ||
import { remove, ensureDir } from "fs-extra" | ||
import decompress from "decompress" | ||
import decompressTarxz from "decompress-tarxz" | ||
|
||
// function to download serve-d binaries from GitHub | ||
export async function getServeD() { | ||
const distFolder = join(dirname(__dirname), "dist") | ||
|
||
await remove(distFolder) | ||
await ensureDir(distFolder) | ||
|
||
const assets = ((await downloadRelease( | ||
/* username */ "Pure-D", | ||
/* repo */ "serve-d", | ||
/* download folder */ distFolder, | ||
/* filter release */ undefined, | ||
/* filter asset */ undefined, // (asset) => asset.name.indexOf(platform) >= 0, | ||
true | ||
)) as unknown) as string[] | ||
|
||
for (const asset of assets) { | ||
const platform = basename(asset).match(/windows|linux|osx/)[0] | ||
const downloadFolder = join(distFolder, platform) | ||
if (extname(asset) === ".xz") { | ||
await decompress(asset, downloadFolder, { | ||
plugins: [decompressTarxz()], | ||
}) | ||
} else { | ||
await decompress(asset, downloadFolder) | ||
} | ||
remove(asset) | ||
} | ||
} | ||
|
||
getServeD() | ||
.then(() => console.log("Done")) | ||
.catch((e) => { | ||
throw e | ||
}) |
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,3 @@ | ||
{ | ||
"extends": "../src/tsconfig.json" | ||
} |
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