This repository has been archived by the owner on Nov 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
2,616 additions
and
2,177 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# @info | ||
# https://github.community/t5/GitHub-Actions/Start-a-workflow-from-another-workflow/td-p/37586 | ||
name: main | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# https://github.com/JamesIves/github-pages-deploy-action#getting-started-airplane | ||
- name: checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false | ||
# https://github.com/denolib/setup-deno | ||
- uses: denolib/setup-deno@master | ||
with: | ||
deno-version: 1.4.0 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 15.0.1 | ||
- name: install | ||
run: yarn | ||
- name: test | ||
run: ./rad test | ||
# - name: deploy | ||
# uses: peaceiris/actions-gh-pages@v3 | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: ./public | ||
|
||
# release | ||
# - name: setup-node | ||
# uses: actions/setup-node@v1 | ||
# with: | ||
# node-version: 12 | ||
# - name: Release | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# run: | | ||
# npm init -y \ | ||
# && \ | ||
# npm install -D \ | ||
# "@semantic-release/commit-analyzer" \ | ||
# "@semantic-release/release-notes-generator" \ | ||
# "@semantic-release/github" \ | ||
# "@semantic-release/exec" \ | ||
# && \ | ||
# npx semantic-release |
Empty file.
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
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,58 @@ | ||
import { produce } from "./generate"; | ||
|
||
produce({ | ||
urls: { | ||
apiRoot: "https://lua-api.factorio.com/latest", | ||
}, | ||
}).catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
import * as fs from "fs/promises"; | ||
import { produce, GenerateResult, printTs } from "."; | ||
import meow from "meow"; | ||
|
||
const printLang = (lang: string, ir: GenerateResult) => { | ||
switch (lang) { | ||
case "ts": | ||
case "typescript": | ||
return printTs(ir); | ||
case "json": | ||
case "json-ir": | ||
return JSON.stringify(ir, null, 2); | ||
default: | ||
throw new Error(`unsupported lang: ${lang}. did you mean ts or json?`); | ||
} | ||
}; | ||
|
||
async function go() { | ||
const cli = meow( | ||
` | ||
Usage | ||
$ factorio-type-kit --language=[...] | ||
Options | ||
--language, -l ts,json | ||
--output, -o path/to/filename/outupt.[ts|json] | ||
Examples | ||
$ factorio-type-kit -l ts -o factorio.schema.d.ts | ||
`, | ||
{ | ||
flags: { | ||
language: { | ||
type: "string", | ||
alias: "l", | ||
}, | ||
out: { | ||
type: "string", | ||
alias: "o", | ||
}, | ||
}, | ||
} | ||
); | ||
try { | ||
const ir = await produce(); | ||
const output = await printLang(cli.flags.language!, ir); | ||
if (cli.flags.out) { | ||
await fs.writeFile(cli.flags.out, output); | ||
} else { | ||
console.log(output); | ||
} | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
go(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.