-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
8b0d2bf
commit 98511a2
Showing
18 changed files
with
188 additions
and
19 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
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,17 @@ | ||
import { browser } from "$app/env"; | ||
|
||
export const getApiUrl = () => { | ||
if (!browser) { | ||
// During SSR, request the local API server directly. | ||
// This assumes the same port is used in production | ||
// and during development. | ||
return "http://localhost:3579"; | ||
} | ||
// In the browser, request /api on the current domain. | ||
// This works in production because this will use | ||
// https://<domain>/api/..., which is the public URL to the | ||
// API server. | ||
// This works in development because Vite is configured | ||
// to proxy localhost:3000/api/... to the local API server. | ||
return "/api"; | ||
} |
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
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,10 @@ | ||
--- | ||
# Installation paths | ||
nvm_home: "{{ ansible_env.HOME }}" | ||
nvm_root: "{{ ansible_env.HOME }}/.nvm" | ||
|
||
# nvm version to install | ||
nvm_version: "v0.39.1" | ||
|
||
# Node.js version to install | ||
nvm_node_version: "v16.13.2" |
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,6 @@ | ||
- name: Install nvm | ||
shell: > | ||
curl https://raw.githubusercontent.com/nvm-sh/nvm/{{ nvm_version }}/install.sh | bash | ||
args: | ||
chdir: "{{ nvm_home }}" | ||
creates: "{{ nvm_root }}/nvm.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- name: Install nvm | ||
import_tasks: install.yml | ||
|
||
- name: Install Node version | ||
import_tasks: node.yml |
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,37 @@ | ||
- name: Install Node binary | ||
shell: >- | ||
source {{ nvm_root }}/nvm.sh && nvm install {{ nvm_node_version }} | ||
args: | ||
executable: /bin/bash | ||
creates: "{{ nvm_root }}/versions/{{ nvm_node_version }}" | ||
|
||
# Get Node and npm bin paths, taking into account that Ansible does not run | ||
# commands as a user by default. | ||
# See: https://stackoverflow.com/a/58744872 | ||
- name: Get node binary path | ||
shell: bash -ilc 'which node' | ||
register: which_node | ||
- name: Set node_bin_path fact | ||
set_fact: | ||
node_bin_path: "{{ which_node.stdout | trim() }}" | ||
- name: Get npm binary path | ||
shell: bash -ilc 'which npm' | ||
register: which_npm | ||
- name: Set npm_bin_path fact | ||
set_fact: | ||
npm_bin_path: "{{ which_npm.stdout | trim() }}" | ||
# Create symlinks to node/npm. This step is required so that Ansible | ||
# commands can access them without having to refer to the full binary paths. | ||
# (Nvm shims are only available through a shell, which, again, Ansible does not do by default.) | ||
- name: Create node bin symlink | ||
file: | ||
src: "{{ node_bin_path }}" | ||
dest: /usr/local/bin/node | ||
state: link | ||
become: true | ||
- name: Create npm bin symlink | ||
file: | ||
src: "{{ npm_bin_path }}" | ||
dest: /usr/local/bin/npm | ||
state: link | ||
become: true |
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,4 @@ | ||
- name: Ensure build is up to date | ||
shell: | ||
cmd: make build | ||
chdir: "{{ workdir }}" |
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,6 @@ | ||
- name: Ensure Node dependencies are installed | ||
npm: | ||
path: "{{ workdir }}/client" | ||
ci: true | ||
state: present | ||
become: true |
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