Skip to content

Commit f71d3d0

Browse files
authored
Merge pull request #16 from AndrewLester/ssg-sveltekit
Add SvelteKit as an option for static_site_generator setting
2 parents c61e34f + 9ff7f29 commit f71d3d0

File tree

12 files changed

+80
-3
lines changed

12 files changed

+80
-3
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runs:
66
main: 'dist/index.js'
77
inputs:
88
static_site_generator:
9-
description: 'Optional static site generator to attempt to configure: "nuxt", "next", or "gatsby"'
9+
description: 'Optional static site generator to attempt to configure: "nuxt", "next", "gatsby", or "sveltekit"'
1010
required: false
1111
generator_config_file:
1212
description: 'Optional file path to static site generator configuration file'

dist/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14908,6 +14908,20 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
1490814908
pathPrefix: path
1490914909
}
1491014910
}
14911+
case 'sveltekit':
14912+
// SvelteKit does not want a trailing slash
14913+
if (path.endsWith('/')) {
14914+
path = path.slice(0, -1)
14915+
}
14916+
14917+
return {
14918+
configurationFile: generatorConfigFile || './svelte.config.js',
14919+
blankConfigurationFile: __nccwpck_require__.ab + "sveltekit.js",
14920+
properties: {
14921+
// Configure a base path
14922+
'kit.paths.base': path
14923+
}
14924+
}
1491114925
default:
1491214926
throw `Unsupported static site generator: ${staticSiteGenerator}`
1491314927
}
@@ -16429,6 +16443,7 @@ async function main() {
1642916443
setPagesPath({ staticSiteGenerator, generatorConfigFile, path: siteUrl.pathname })
1643016444
}
1643116445
outputPagesBaseUrl(siteUrl)
16446+
core.exportVariable('GITHUB_PAGES', 'true')
1643216447
} catch (error) {
1643316448
core.setFailed(error)
1643416449
process.exit(1)

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sveltekit.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Default Pages configuration for SvelteKit
2+
import adapter from '@sveltejs/adapter-auto'
3+
4+
export default {
5+
kit: {
6+
adapter: adapter()
7+
}
8+
}

src/blank-configurations/sveltekit.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Default Pages configuration for SvelteKit
2+
import adapter from '@sveltejs/adapter-auto'
3+
4+
export default {
5+
kit: {
6+
adapter: adapter()
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Default Pages configuration for SvelteKit
2+
import adapter from '@sveltejs/adapter-auto'
3+
4+
export default {
5+
kit: {
6+
paths: { base: '/docs' },
7+
adapter: adapter()
8+
}
9+
}

src/fixtures/sveltekit/blank.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// This file is not read by the test suite
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import adapter from '@sveltejs/adapter-auto'
2+
3+
/** @type {import('@sveltejs/kit').Config} */
4+
const config = {
5+
kit: {
6+
paths: { base: '/docs' },
7+
adapter: adapter()
8+
}
9+
}
10+
11+
export default config

src/fixtures/sveltekit/default.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import adapter from '@sveltejs/adapter-auto'
2+
3+
/** @type {import('@sveltejs/kit').Config} */
4+
const config = {
5+
kit: {
6+
adapter: adapter()
7+
}
8+
}
9+
10+
export default config

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ async function main() {
1818
setPagesPath({ staticSiteGenerator, generatorConfigFile, path: siteUrl.pathname })
1919
}
2020
outputPagesBaseUrl(siteUrl)
21+
core.exportVariable('GITHUB_PAGES', 'true')
2122
} catch (error) {
2223
core.setFailed(error)
2324
process.exit(1)

0 commit comments

Comments
 (0)