Skip to content

Commit 158eeda

Browse files
committed
Add versioning opinion
1 parent bfa36db commit 158eeda

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
> Opinionated starter template for SvelteKit
44
5-
The Svelte-world is akin to the universes of
5+
Svelte-world is akin to the fiery aftermath when the universes of
66
[Mad Max](https://en.wikipedia.org/wiki/Mad_Max:_Fury_Road) and
7-
[Split](<https://en.wikipedia.org/wiki/Split_(2016_American_film)>) collided - full of peril,
8-
violent sandstorms and new beginnings with a touch of disassociative personality disorder.
7+
[Split](<https://en.wikipedia.org/wiki/Split_(2016_American_film)>) collide - full of peril, violent
8+
sandstorms and new beginnings with a touch of disassociative personality disorder.
99

1010
To help navigate through this madness, just like how Moses parted the Red Sea, behold the emergence
1111
of this repo. Cue angels singing. The best way to describe this is it's like a brick-layer - but
@@ -16,19 +16,19 @@ So let's get started.
1616

1717
## Usage
1818

19-
### Create Svelte
19+
### Step 1: Create Svelte
2020

2121
Generate the base template using `create-svelte` with these recommended options:
2222

23-
- [x] Skeleton project
23+
- [x] Skeleton or Library project
2424
- [x] JavaScript with JSDoc comments
25-
- [x] ESLint, Prettier and Playwight/Vitest
25+
- [x] Include ESLint, Prettier and Playwight
2626

2727
```
2828
$ npm create svelte@latest my-app
2929
```
3030

31-
### Run combo-patcher
31+
### Step 2: Run the combo-patcher
3232

3333
Then, layer the patches based on the last-known SvelteKit decisions. This uses
3434
[zx](https://github.com/google/zx), so make sure that's installed.
@@ -37,7 +37,7 @@ Then, layer the patches based on the last-known SvelteKit decisions. This uses
3737
$ zx https://cdn.jsdelivr.net/gh/zerodevx/svelte-starter@2/index.mjs my-app
3838
```
3939

40-
### Update dependencies
40+
### Step 3: Update dependencies
4141

4242
Finally, apply the finishing touches.
4343

@@ -96,14 +96,22 @@ module.exports = {
9696
Seriously, don't use SSR unless you really need to. Installs `adapter-static` and adds sensible
9797
defaults.
9898

99-
### Custom fonts
99+
### Versioning
100+
101+
Use the `version` from `package.json` in SvelteKit's native versioning system, like so:
102+
103+
```js
104+
import { version } from '$app/environment' // `version` string from `package.json`
105+
```
106+
107+
### Fonts
100108

101109
Use `@fontsource-variable` for self-hosted open-source fonts.
102110

103-
### Custom icons
111+
### Icons
104112

105113
Use `@iconify/tailwind` plugin for high-performance css-only icons. Apply icon classes using
106-
`icon-[{prefix}--{name}]`. Install icon sets at `@iconify-json/{name}`. Only icons you use will be
114+
`icon-[{prefix}--{name}]`. Install icon sets at `@iconify-json/{prefix}`. Only icons you use will be
107115
included in your build. Read more at
108116
[Iconify](https://github.com/iconify/iconify/tree/main/plugins/tailwind).
109117

index.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ await spinner('add adapter-static', async () => {
7575
)
7676
})
7777

78+
await spinner('add versioning', async () => {
79+
await patchFiles(
80+
path.join(name, 'svelte.config.js'),
81+
[
82+
`static';`,
83+
`static';\nimport { readFileSync } from 'node:fs'\n\nconst { version: name } = JSON.parse(readFileSync(new URL('package.json', import.meta.url), 'utf8'))\n`
84+
],
85+
[`adapter()`, `adapter(),version:{name}`]
86+
)
87+
})
88+
7889
await spinner('add fontsource', async () => {
7990
await patchPackage(name, '+@fontsource-variable/inter')
8091
await patchFiles(path.join(name, 'src', 'routes', '+layout.svelte'), [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zerodevx/sveltekit-starter",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "Opinionated starter template for SvelteKit",
55
"author": "Jason Lee <[email protected]>",
66
"scripts": {

0 commit comments

Comments
 (0)