Skip to content

Commit 4f93843

Browse files
authored
Fix pages (#647)
* Update linting, formatting, and deployment configs Migrated ESLint config to eslint.config.js and removed legacy .eslintrc.cjs and .eslintignore. Updated .gitignore and .prettierignore for modern Svelte/Vite setups. Improved .prettierrc overrides. Refreshed README for new Svelte CLI. Overhauled GitHub Pages workflow for better caching, build, and deployment. Updated dependencies in package.json and package-lock.json. * Update pages.yaml * Update pages.yaml * Update pages.yaml
1 parent 922d72b commit 4f93843

File tree

16 files changed

+1806
-1445
lines changed

16 files changed

+1806
-1445
lines changed

.github/workflows/pages.yaml

Lines changed: 59 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,71 @@
1-
name: "Deploy pages to GitHub Pages"
1+
name: Deploy pages to GitHub Pages
22

33
on:
44
push:
5-
branches:
6-
- "main"
7-
release:
8-
- "released"
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
98
workflow_dispatch:
109

11-
permissions:
12-
contents: "read"
13-
pages: "write"
14-
id-token: "write"
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
env:
15+
BUILD_PATH: "pages"
1516

16-
concurrency:
17-
group: "pages"
18-
cancel-in-progress: false
17+
permissions:
18+
contents: read
19+
pages: write
1920

2021
jobs:
21-
Deploy:
22-
environment:
23-
name: "github-pages"
24-
url: "${{ steps.deployment.outputs.page_url }}"
25-
runs-on: "ubuntu-latest"
26-
defaults:
27-
run:
28-
working-directory: "./pages"
22+
BuildPages:
23+
runs-on: ubuntu-24.04
24+
2925
steps:
30-
- name: "Checkout"
31-
uses: "actions/checkout@v4"
32-
- name: "Setup Pages"
33-
uses: "actions/configure-pages@v3"
34-
with:
35-
static_site_generator: "sveltekit"
36-
- uses: "actions/setup-node@v3"
26+
- name: Checkout
27+
uses: actions/checkout@v5
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@v5
3731
with:
38-
node-version: 20
39-
cache: "npm"
40-
cache-dependency-path: "./pages/package-lock.json"
41-
- name: "Install dependencies"
42-
run: "npm install"
43-
- name: "Build pages"
44-
run: "npm run build"
32+
node-version: 22
33+
cache: npm
34+
cache-dependency-path: ${{ env.BUILD_PATH }}/package-lock.json
35+
36+
- name: Setup Pages
37+
id: pages
38+
uses: actions/configure-pages@v5
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
working-directory: ${{ env.BUILD_PATH }}
43+
44+
- name: Build pages
45+
run: npm run build
46+
working-directory: ${{ env.BUILD_PATH }}
4547
env:
46-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
47-
- name: "Upload artifact"
48-
uses: "actions/upload-pages-artifact@v2"
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
BASE_PATH: ${{ steps.pages.outputs.base_path }}
50+
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v4
4953
with:
50-
path: "./pages/build"
51-
- name: "Deploy to GitHub Pages"
52-
id: "deployment"
53-
uses: "actions/deploy-pages@v2"
54+
path: ${{ env.BUILD_PATH }}/build
55+
56+
57+
DeployPages:
58+
runs-on: "ubuntu-24.04"
59+
60+
needs: [BuildPages]
61+
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
66+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
67+
68+
steps:
69+
- name: Deploy to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v4

pages/.eslintignore

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

pages/.eslintrc.cjs

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

pages/.gitignore

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
.DS_Store
21
node_modules
3-
/build
2+
3+
# Output
4+
.output
5+
.vercel
6+
.netlify
7+
.wrangler
48
/.svelte-kit
5-
/package
9+
/build
10+
11+
# OS
12+
.DS_Store
13+
Thumbs.db
14+
15+
# Env
616
.env
717
.env.*
818
!.env.example
9-
.vercel
10-
.output
19+
!.env.test
20+
21+
# Vite
1122
vite.config.js.timestamp-*
1223
vite.config.ts.timestamp-*

pages/.prettierignore

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
.DS_Store
2-
node_modules
3-
/build
4-
/.svelte-kit
5-
/package
6-
.env
7-
.env.*
8-
!.env.example
9-
10-
# Ignore files for PNPM, NPM and YARN
11-
pnpm-lock.yaml
1+
# Package Managers
122
package-lock.json
3+
pnpm-lock.yaml
134
yarn.lock
5+
bun.lock
6+
bun.lockb
7+
8+
# Miscellaneous
9+
/static/

pages/.prettierrc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"trailingComma": "none",
55
"printWidth": 100,
66
"plugins": ["prettier-plugin-svelte"],
7-
"pluginSearchDirs": ["."],
8-
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
7+
"overrides": [
8+
{
9+
"files": "*.svelte",
10+
"options": {
11+
"parser": "svelte"
12+
}
13+
}
14+
]
915
}

pages/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# create-svelte
1+
# sv
22

3-
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
3+
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
44

55
## Creating a project
66

77
If you're seeing this, you've probably already done this step. Congrats!
88

9-
```bash
9+
```sh
1010
# create a new project in the current directory
11-
npm create svelte@latest
11+
npx sv create
1212

1313
# create a new project in my-app
14-
npm create svelte@latest my-app
14+
npx sv create my-app
1515
```
1616

1717
## Developing
1818

1919
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
2020

21-
```bash
21+
```sh
2222
npm run dev
2323

2424
# or start the server and open the app in a new browser tab
@@ -29,10 +29,10 @@ npm run dev -- --open
2929

3030
To create a production version of your app:
3131

32-
```bash
32+
```sh
3333
npm run build
3434
```
3535

3636
You can preview the production build with `npm run preview`.
3737

38-
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
38+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.

pages/eslint.config.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import prettier from 'eslint-config-prettier';
2+
import { fileURLToPath } from 'node:url';
3+
import { includeIgnoreFile } from '@eslint/compat';
4+
import js from '@eslint/js';
5+
import svelte from 'eslint-plugin-svelte';
6+
import { defineConfig } from 'eslint/config';
7+
import globals from 'globals';
8+
import ts from 'typescript-eslint';
9+
import svelteConfig from './svelte.config.js';
10+
11+
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
12+
13+
export default defineConfig(
14+
includeIgnoreFile(gitignorePath),
15+
js.configs.recommended,
16+
...ts.configs.recommended,
17+
...svelte.configs.recommended,
18+
prettier,
19+
...svelte.configs.prettier,
20+
{
21+
languageOptions: {
22+
globals: { ...globals.browser, ...globals.node }
23+
},
24+
rules: {
25+
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
26+
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
27+
'no-undef': 'off'
28+
}
29+
},
30+
{
31+
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
32+
languageOptions: {
33+
parserOptions: {
34+
projectService: true,
35+
extraFileExtensions: ['.svelte'],
36+
parser: ts.parser,
37+
svelteConfig
38+
}
39+
}
40+
}
41+
);

0 commit comments

Comments
 (0)