Skip to content

Commit 163c235

Browse files
authored
Merge pull request #37 from thefrontside/cl/cli-build
Implement a basic CLI build
2 parents f454021 + a60819f commit 163c235

File tree

4 files changed

+63
-4
lines changed

4 files changed

+63
-4
lines changed

.github/workflows/cli-release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow will install Deno then run Deno lint and test.
2+
# For more information see: https://github.com/denoland/setup-deno
3+
4+
name: Release CLI
5+
6+
on:
7+
push:
8+
tags:
9+
- "graphgen-cli-v*"
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: checkout
20+
uses: actions/checkout@v3
21+
22+
- name: setup deno
23+
# uses: denoland/setup-deno@v1
24+
uses: denoland/setup-deno@004814556e37c54a2f6e31384c9e18e983317366
25+
with:
26+
deno-version: v1.25.x
27+
28+
- name: Get Version
29+
id: vars
30+
run: echo ::set-output name=version::$(echo ${{github.ref_name}} | sed 's/^v//')
31+
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v2
35+
with:
36+
node-version: 14.x
37+
registry-url: https://registry.npmjs.com
38+
39+
- name: Build
40+
run: deno task build:cli
41+
env:
42+
VERSION: ${{steps.vars.outputs.version}}
43+
44+
- name: Release
45+
uses: softprops/action-gh-release@v1
46+
with:
47+
# note you'll typically need to create a personal access token
48+
# with permissions to create releases in the other repo
49+
token: ${{ secrets.FRONTSIDEJACK_GITHUB_TOKEN }}
50+
files: build/cli/*
51+
fail_on_unmatched_files: true
52+
env:
53+
GITHUB_REPOSITORY: thefrontside/graphgen

cli/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Hello World");

deno.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"tasks": {
3-
"build:npm": "deno run -A tasks/build-npm.ts"
3+
"build:npm": "deno run -A tasks/build-npm.ts",
4+
"build:cli:windows": "deno compile -o build/cli/graphgen-x86_64-pc-windows-msvc.exe --target x86_64-pc-windows-msvc --allow-read --allow-net cli/main.ts",
5+
"build:cli:linux": "deno compile -o build/cli/graphgen-x86_64-unknown-linux-gnu --target x86_64-unknown-linux-gnu --allow-read --allow-net cli/main.ts",
6+
"build:cli:macos-m1": "deno compile -o build/cli/graphgen-aarch64-apple-darwin --target aarch64-apple-darwin --allow-read --allow-net cli/main.ts",
7+
"build:cli:macos-intel": "deno compile -o build/cli/graphgen-x86_64-apple-darwin --target x86_64-apple-darwin --allow-read --allow-net cli/main.ts",
8+
"build:cli": "deno task build:cli:windows && deno task build:cli:linux && deno task build:cli:macos-m1 && deno task build:cli:macos-intel"
49
},
510
"lint": {
611
"rules": {

src/graphql/analyze.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,11 @@ function sizeOf(field: GQLField): Size {
309309
if (directive) {
310310
assert(directive.arguments, "@size must have arguments");
311311
let meanArg = directive.arguments?.find((arg) => arg.name.value === "mean");
312-
let mean = parseInt((meanArg?.value as graphql.IntValueNode).value ?? 5);
312+
let mean = parseInt((meanArg?.value as graphql.IntValueNode)?.value ?? 5);
313313
let minArg = directive.arguments?.find(({ name }) => name.value === "min");
314-
let min = parseInt((minArg?.value as graphql.IntValueNode).value ?? 0);
314+
let min = parseInt((minArg?.value as graphql.IntValueNode)?.value ?? 0);
315315
let maxArg = directive.arguments?.find(({ name }) => name.value === "max");
316-
let max = parseInt((maxArg?.value as graphql.IntValueNode).value ?? 10);
316+
let max = parseInt((maxArg?.value as graphql.IntValueNode)?.value ?? 10);
317317
let standardDeviationArg = directive.arguments?.find(({ name }) =>
318318
name.value === "standardDeviation"
319319
);

0 commit comments

Comments
 (0)