Skip to content

Commit 5bd2059

Browse files
committed
chore: cache .astro on ci, alias docs to pnpm run doc on root, add docs to ci, fix overlapping paths on changelog lodaer for docs, ignore docs for changesets, add prettier vsc extension to .vscode, ignore error in extension vite setup
1 parent a7cc591 commit 5bd2059

File tree

10 files changed

+200
-541
lines changed

10 files changed

+200
-541
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"linked": [],
77
"baseBranch": "main",
88
"updateInternalDependencies": "patch",
9-
"ignore": ["smc-root"]
9+
"ignore": ["smc-docs"]
1010
}

.github/workflows/build.yml

Lines changed: 143 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -4,88 +4,146 @@ on:
44
pull_request:
55

66
jobs:
7-
extension:
8-
name: Build extension
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Checkout repository
12-
uses: actions/checkout@v5
13-
14-
- name: Setup pnpm
15-
uses: pnpm/action-setup@v4
16-
17-
- name: Setup Node.js
18-
uses: actions/setup-node@v5
19-
with:
20-
node-version: 22.x
21-
cache: "pnpm"
22-
cache-dependency-path: "./pnpm-lock.yaml"
23-
24-
- name: Install dependencies
25-
run: pnpm install --frozen-lockfile
26-
27-
- name: Build extension
28-
run: pnpm ext build
29-
30-
- name: Upload extension
31-
uses: actions/upload-artifact@v4
32-
with:
33-
name: SMC Extension ${{ github.sha }}
34-
path: ./apps/extension/dist
35-
36-
dashboard:
37-
name: Build dashboard
38-
runs-on: ubuntu-latest
39-
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v5
42-
43-
- name: Setup pnpm
44-
uses: pnpm/action-setup@v4
45-
46-
- name: Setup Node.js
47-
uses: actions/setup-node@v5
48-
with:
49-
node-version: 22.x
50-
cache: "pnpm"
51-
cache-dependency-path: "./pnpm-lock.yaml"
52-
53-
- name: Install dependencies
54-
run: pnpm install --frozen-lockfile
55-
56-
- name: Build extension
57-
run: pnpm dash build
58-
59-
- name: Upload extension
60-
uses: actions/upload-artifact@v4
61-
with:
62-
name: SMC Dashboard ${{ github.sha }}
63-
path: ./apps/dashboard/dist
64-
api:
65-
name: Build API
66-
runs-on: ubuntu-latest
67-
steps:
68-
- name: Checkout repository
69-
uses: actions/checkout@v5
70-
71-
- name: Setup pnpm
72-
uses: pnpm/action-setup@v4
73-
74-
- name: Setup Node.js
75-
uses: actions/setup-node@v5
76-
with:
77-
node-version: 22.x
78-
cache: "pnpm"
79-
cache-dependency-path: "./pnpm-lock.yaml"
80-
81-
- name: Install dependencies
82-
run: pnpm install --frozen-lockfile
83-
84-
- name: Build extension
85-
run: pnpm api build
86-
87-
- name: Upload extension
88-
uses: actions/upload-artifact@v4
89-
with:
90-
name: SMC API ${{ github.sha }}
91-
path: ./apps/api/dist
7+
extension:
8+
name: Build extension
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v5
13+
14+
- name: Cache Astro data # Speeds up postinstall time
15+
uses: actions/cache@v4
16+
with:
17+
path: |
18+
**/.astro
19+
key: smc-astro-cache-${{ github.repository }}
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v5
26+
with:
27+
node-version: 22.x
28+
cache: 'pnpm'
29+
cache-dependency-path: './pnpm-lock.yaml'
30+
31+
- name: Install dependencies
32+
run: pnpm install --frozen-lockfile
33+
34+
- name: Build extension
35+
run: pnpm ext build
36+
37+
- name: Upload extension
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: SMC Extension ${{ github.sha }}
41+
path: ./apps/extension/dist
42+
43+
docs:
44+
name: Build docs
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v5
49+
50+
- name: Cache Astro data
51+
uses: actions/cache@v4
52+
with:
53+
path: |
54+
**/.astro
55+
key: smc-astro-cache-${{ github.repository }}
56+
57+
- name: Setup pnpm
58+
uses: pnpm/action-setup@v4
59+
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v5
62+
with:
63+
node-version: 22.x
64+
cache: 'pnpm'
65+
cache-dependency-path: './pnpm-lock.yaml'
66+
67+
- name: Install dependencies
68+
run: pnpm install --frozen-lockfile
69+
70+
- name: Build extension
71+
run: pnpm doc build
72+
73+
- name: Upload extension
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: SMC Docs ${{ github.sha }}
77+
path: ./apps/dashboard/dist
78+
79+
dashboard:
80+
name: Build dashboard
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Checkout repository
84+
uses: actions/checkout@v5
85+
86+
- name: Cache Astro data
87+
uses: actions/cache@v4
88+
with:
89+
path: |
90+
**/.astro
91+
key: smc-astro-cache-${{ github.repository }}
92+
93+
- name: Setup pnpm
94+
uses: pnpm/action-setup@v4
95+
96+
- name: Setup Node.js
97+
uses: actions/setup-node@v5
98+
with:
99+
node-version: 22.x
100+
cache: 'pnpm'
101+
cache-dependency-path: './pnpm-lock.yaml'
102+
103+
- name: Install dependencies
104+
run: pnpm install --frozen-lockfile
105+
106+
- name: Build extension
107+
run: pnpm dash build
108+
109+
- name: Upload extension
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: SMC Dashboard ${{ github.sha }}
113+
path: ./apps/dashboard/dist
114+
115+
api:
116+
name: Build API
117+
runs-on: ubuntu-latest
118+
steps:
119+
- name: Checkout repository
120+
uses: actions/checkout@v5
121+
122+
- name: Cache Astro data # Speeds up postinstall time
123+
uses: actions/cache@v4
124+
with:
125+
path: |
126+
**/.astro
127+
key: smc-astro-cache-${{ github.repository }}
128+
129+
- name: Setup pnpm
130+
uses: pnpm/action-setup@v4
131+
132+
- name: Setup Node.js
133+
uses: actions/setup-node@v5
134+
with:
135+
node-version: 22.x
136+
cache: 'pnpm'
137+
cache-dependency-path: './pnpm-lock.yaml'
138+
139+
- name: Install dependencies
140+
run: pnpm install --frozen-lockfile
141+
142+
- name: Build extension
143+
run: pnpm api build
144+
145+
- name: Upload extension
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: SMC API ${{ github.sha }}
149+
path: ./apps/api/dist

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"recommendations": ["astro-build.astro-vscode"],
2+
"recommendations": ["astro-build.astro-vscode", "esbenp.prettier-vscode"],
33
"unwantedRecommendations": []
44
}

apps/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "smc-api",
33
"private": true,
4-
"version": "1.0.0",
4+
"version": "0.0.1",
55
"author": "StopMalwareContent Contributors",
66
"type": "module",
77
"main": "dist/index.js",

apps/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@astrojs/starlight": "~0.36.0",
16-
"astro": "~5.6.1",
16+
"astro": "~5.14.1",
1717
"sharp": "~0.34.2",
1818
"starlight-changelogs": "~0.2.1",
1919
"starlight-sidebar-topics": "~0.6.1",

apps/docs/src/content.config.ts

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,29 @@ import { docsSchema } from "@astrojs/starlight/schema"
44
import { changelogsLoader } from "starlight-changelogs/loader"
55

66
export const collections = {
7-
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
8-
changelogs: defineCollection({
9-
loader: changelogsLoader([
10-
{
11-
title: "Dashboard Changelog",
12-
provider: "changeset",
13-
base: "changelog",
14-
changelog: "../dashboard/CHANGELOG.md"
15-
},
16-
{
17-
title: "API Changelog",
18-
provider: "changeset",
19-
base: "changelog",
20-
changelog: "../api/CHANGELOG.md"
21-
},
22-
{
23-
title: "Extension Changelog",
24-
provider: "changeset",
25-
base: "changelog",
26-
changelog: "../extension/CHANGELOG.md"
27-
}
28-
])
29-
})
30-
}
7+
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
8+
changelogs: defineCollection(
9+
{
10+
loader: changelogsLoader([
11+
{
12+
title: 'Dashboard Changelog',
13+
provider: 'changeset',
14+
base: 'changelog/dashboard',
15+
changelog: '../dashboard/CHANGELOG.md'
16+
},
17+
{
18+
title: 'API Changelog',
19+
provider: 'changeset',
20+
base: 'changelog/api',
21+
changelog: '../api/CHANGELOG.md'
22+
},
23+
{
24+
title: 'Extension Changelog',
25+
provider: 'changeset',
26+
base: 'changelog/extension',
27+
changelog: '../extension/CHANGELOG.md'
28+
}
29+
])
30+
}
31+
)
32+
};

apps/extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "smc-extension",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "0.0.1",
55
"author": "StopMalwareContent Contributors",
66
"type": "module",
77
"scripts": {

apps/extension/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import manifest from "./manifest.json"
44

55
export default defineConfig({
66
plugins: [
7+
//@ts-expect-error idk why it type errors here but it works and it used to not type error
78
crx({ manifest }) // CRXJS auto-parses manifest and wires entries (content scripts, service_worker, pages)
89
],
910
build: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"api": "pnpm --filter=smc-api",
88
"dash": "pnpm --filter=smc-dashboard",
99
"doc": "pnpm --filter=smc-docs",
10+
"docs": "pnpm run doc",
1011
"ext": "pnpm --filter=smc-extension",
1112
"prettier:check": "prettier --check .",
1213
"prettier:fix": "prettier --write ."

0 commit comments

Comments
 (0)