-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move config editing to deno * fix readme and icon not being moved properly * Update README with new inputs * Update README.md
- Loading branch information
1 parent
24b69ce
commit 47dd0d6
Showing
7 changed files
with
107 additions
and
10 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
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,10 +1,11 @@ | ||
FROM ubuntu as setup | ||
FROM denoland/deno as setup | ||
WORKDIR / | ||
RUN ["apt", "update", "-yy"] | ||
RUN ["apt", "install", "wget", "-yy"] | ||
RUN ["wget", "-O", "tcli.tar.gz", "https://github.com/thunderstore-io/thunderstore-cli/releases/download/0.1.4/tcli-0.1.4-linux-x64.tar.gz"] | ||
RUN ["tar", "xvf", "tcli.tar.gz"] | ||
RUN ["mv", "-v", "tcli-0.1.4-linux-x64/tcli", "/bin/tcli"] | ||
COPY ./entrypoint.sh /entrypoint.sh | ||
COPY ./cfg_edit.js /cfg_edit.js | ||
RUN ["chmod", "+x", "/entrypoint.sh"] | ||
ENTRYPOINT ["/entrypoint.sh"] |
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
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,72 @@ | ||
import * as TOML from "https://unpkg.com/@aduh95/toml@0.4.2/web/toml2js.js"; | ||
|
||
//init toml parser for some reason idk there was no Deno native module | ||
await TOML.default(); | ||
|
||
|
||
|
||
//Read in thunderstore.toml | ||
const tstore = TOML.parse(await Deno.readTextFile("./thunderstore.toml")); | ||
|
||
const name = Deno.env.get("TS_NAME"); | ||
const version = Deno.env.get("TS_VERSION"); | ||
const desc = Deno.env.get("TS_DESCRIPTION"); | ||
const homepage = Deno.env.get("TS_WEBSITE"); | ||
const categories = Deno.env.get("TS_CATEGORIES").replace(/\n/g, ''); | ||
const deps = Deno.env.get("TS_DEPS").replace(/\n/g, ' '); | ||
const community = Deno.env.get("TS_COMMUNITY"); | ||
const nsfw = Deno.env.get("TS_NSFW"); | ||
const wrap = Deno.env.get("TS_WRAP"); | ||
|
||
console.log(deps) | ||
|
||
//these should be set already but we're rewriting the whole file anyways | ||
tstore.package.name = name; | ||
tstore.package.versionNumber = version; | ||
tstore.package.description = desc; | ||
|
||
tstore.publish.communities = [community]; | ||
tstore.build.copy[0].target = wrap; | ||
tstore.package.dependencies = {}; | ||
|
||
console.log(tstore.build); | ||
|
||
//check for optional inputs | ||
if (homepage && homepage !== "") { | ||
tstore.package.websiteUrl = homepage; | ||
} | ||
|
||
if (nsfw && nsfw !== "" ) { | ||
tstore.package.containsNsfwContent = true | ||
} | ||
|
||
if (categories && categories !== "") { | ||
//only keep truthy elements from the split | ||
tstore.publish.categories = categories.split(' ').filter(e => e).map(e=> e.toLowerCase()); | ||
} | ||
|
||
if (deps && deps !== "") { | ||
const p = {}; | ||
for (let d of deps.split(' ')) { | ||
if(!d) | ||
continue; | ||
if (!d.includes('@')) { | ||
console.log("Malformed dependency at ", d); | ||
Deno.exit(-1); | ||
} | ||
|
||
const parts = d.split('@'); | ||
p[parts[0]] = parts[1]; | ||
} | ||
|
||
console.log(p); | ||
tstore.package.dependencies = p; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
//write config file back to disk | ||
Deno.writeTextFile("./thunderstore.toml", TOML.stringify(tstore)); |
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