Skip to content

Commit 7e4ef51

Browse files
committed
build: copy static assets in dev
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 568f990 commit 7e4ef51

7 files changed

Lines changed: 19 additions & 87 deletions

File tree

.env.template

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# GitHub Personal Access Token for GraphQL Codegen
2-
GITHUB_TOKEN=some-pat
2+
GITHUB_TOKEN=some-pat
3+
4+
# Custom OAuth Client ID for GitHub Device Flow
5+
#OAUTH_CLIENT_ID=some-client-id

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Build application
6969
run: pnpm build
7070
env:
71-
VITE_OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
71+
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
7272

7373
- name: Package and publish for ${{ matrix.platform }}
7474
run: ${{ matrix.package-cmd }}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We also suggest you read the [Project Philosophy](#project-philosophy) in our do
1010
> [!TIP]
1111
> _Optional: If you prefer to use your own OAuth credentials, you can do so by passing them as environment variables when bundling the app. This is optional as the app has some default "development" keys (use at your own discretion)._
1212
> ```shell
13-
> VITE_OAUTH_CLIENT_ID="123" pnpm build
13+
> OAUTH_CLIENT_ID="123" pnpm build
1414
> ```
1515
1616
To get started:

pnpm-lock.yaml

Lines changed: 0 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const Constants = {
5757

5858
GITHUB_HOSTNAME: 'github.com' as Hostname,
5959

60-
OAUTH_DEVICE_FLOW_CLIENT_ID: import.meta.env.VITE_OAUTH_CLIENT_ID as ClientID,
60+
OAUTH_DEVICE_FLOW_CLIENT_ID: process.env.OAUTH_CLIENT_ID as ClientID,
6161

6262
// GitHub Enterprise Cloud with Data Residency uses *.ghe.com domains
6363
GITHUB_ENTERPRISE_CLOUD_DATA_RESIDENCY_HOSTNAME: 'ghe.com',

src/vite-env.d.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

vite.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,17 @@ export default defineConfig(({ command }) => {
176176
outDir: fileURLToPath(new URL('build', import.meta.url)),
177177
emptyOutDir: true,
178178
},
179+
// Define build-time replacements for the main process bundle.
180+
// During CI builds `process.env.OAUTH_CLIENT_ID` will be injected via the environment.
181+
define: isBuild
182+
? {
183+
'process.env.OAUTH_CLIENT_ID': JSON.stringify(
184+
process.env.OAUTH_CLIENT_ID ?? '',
185+
),
186+
}
187+
: {
188+
// Development Keys - See CONTRIBUTING.md
189+
'process.env.OAUTH_CLIENT_ID': JSON.stringify('Ov23liQIkFs5ehQLNzHF'),
190+
},
179191
};
180192
});

0 commit comments

Comments
 (0)