-
Notifications
You must be signed in to change notification settings - Fork 0
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 #7 from kratos-mc/release/pre-built
Release a new version `1.1.0-pre`
- Loading branch information
Showing
10 changed files
with
718 additions
and
46 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,18 @@ | ||
const fse = require("fs-extra"); | ||
const { hideBin } = require("yargs/helpers"); | ||
|
||
const shortenArgv = hideBin(process.argv); | ||
if (shortenArgv.length === 0) { | ||
throw new Error(`Directory has not provided, using ./rm-scripts <path>`); | ||
} | ||
|
||
const willRemoveDirectory = shortenArgv[0]; | ||
if (fse.existsSync(willRemoveDirectory)) { | ||
// Empty the directory | ||
fse.emptyDirSync(willRemoveDirectory); | ||
fse.rmSync(willRemoveDirectory, { force: true, recursive: true }); | ||
|
||
console.log(`Eliminated ${willRemoveDirectory}`); | ||
} else { | ||
console.log(`warn: not found ${willRemoveDirectory}`); | ||
} |
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,39 @@ | ||
import { AssetIndexContent } from "./Version"; | ||
import needle, { NeedleOptions } from "needle"; | ||
|
||
/** | ||
* A reference that point to the asset json file. | ||
* Asset json file contains all asset item references to download. | ||
* | ||
*/ | ||
export interface AssetIndexReference { | ||
/** | ||
* The id of the asset. | ||
*/ | ||
id: string; | ||
/** | ||
* Checksum as sha1 for the asset json file. | ||
*/ | ||
sha1: string; | ||
/** | ||
* File size of the json reference. | ||
*/ | ||
size: number; | ||
/** | ||
* Total file size for all assets inside the reference after downloaded. | ||
*/ | ||
totalSize: number; | ||
/** | ||
* Url that point to json file. | ||
*/ | ||
url: string; | ||
} | ||
|
||
export async function getAssetIndexFromReference( | ||
reference: AssetIndexReference, | ||
options?: NeedleOptions | ||
): Promise<AssetIndexContent> { | ||
const response = await needle("get", reference.url, options); | ||
|
||
return response.body; | ||
} |
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,3 +1,5 @@ | ||
import * as Manifest from "./Manifest"; | ||
import * as Version from "./Version"; | ||
import * as Asset from "./Asset"; | ||
|
||
export { Manifest }; | ||
export { Manifest, Version, Asset }; |
Oops, something went wrong.