Skip to content

Commit

Permalink
feat: add install script (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
lino-levan authored Mar 15, 2023
1 parent 9b52fe5 commit df5202c
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: ci

on: [push, pull_request]
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Deploy

on: [push, pull_request]
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
deploy:
Expand All @@ -20,7 +24,7 @@ jobs:
deno-version: v1.x

- name: Install Pyro
run: deno install -Af --reload --config ./deno.jsonc -n pyro ./cli.ts
run: deno task install

- name: Build the website
working-directory: ./www
Expand Down
6 changes: 3 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"tasks": {
"install": "deno install -Af --reload --config ./deno.jsonc -n pyro ./cli.ts"
"install": "deno run -Ar install.ts ."
},
"imports": {
"preact": "https://esm.sh/preact@10.11.0",
"preact/": "https://esm.sh/preact@10.11.0/",
"preact": "https://esm.sh/preact@10.13.1",
"preact/": "https://esm.sh/preact@10.13.1/",
"preact-render-to-string": "https://esm.sh/*[email protected]",
"std/": "https://deno.land/[email protected]/",
"gfm": "https://deno.land/x/[email protected]/mod.ts",
Expand Down
36 changes: 36 additions & 0 deletions install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// I'm preemptively sorry about this install script.
// Deno has a bug where you can't --config from a remote
// location which makes it impossible afaik to do this
// another way. If you have a better idea, open a PR!

let config_file = "./384y89xnd.jsonc";
const install_from = Deno.args[0] ?? "https://deno.land/x/pyro";

if (install_from === ".") {
config_file = "./deno.jsonc";
} else {
Deno.writeFileSync(
config_file,
new Uint8Array(
await (await fetch(install_from + "/deno.jsonc")).arrayBuffer(),
),
);
}

const command = new Deno.Command(Deno.execPath(), {
args: [
"install",
"-Afr",
"--config",
config_file,
"-n",
"pyro",
install_from + "/cli.ts",
],
});

command.outputSync();

if (install_from !== ".") {
Deno.removeSync(config_file);
}
2 changes: 1 addition & 1 deletion www/pages/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pyro(raptor) is essentially just a [Deno CLI tool](https://deno.land).
If these requirements are met, you should be able to install the CLI:

```bash
deno install -Af --reload --config https://deno.land/x/pyro/deno.jsonc -n pyro https://deno.land/x/pyro/cli.ts
deno run -Ar https://deno.land/x/pyro/install.ts
```

## Scaffold your first site
Expand Down
2 changes: 1 addition & 1 deletion www/pages/guides/deployment/deno-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
deno-version: v1.x

- name: Install Pyro
run: deno install -Af --reload --config https://deno.land/x/pyro/deno.jsonc -n pyro https://deno.land/x/pyro/cli.ts
run: deno run -Ar https://deno.land/x/pyro/install.ts

- name: Build the website
working-directory: ./www
Expand Down
2 changes: 1 addition & 1 deletion www/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Understand Pyro in **5 minutes** by trying it out!
First install Pyro

```bash
deno install -Af --reload --config https://deno.land/x/pyro/deno.jsonc -n pyro https://deno.land/x/pyro/cli.ts
deno run -Ar https://deno.land/x/pyro/install.ts
```

Create the site
Expand Down

0 comments on commit df5202c

Please sign in to comment.