Skip to content

Commit 233eaca

Browse files
committed
refactor: monorepo
1 parent 46032a3 commit 233eaca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+5074
-3435
lines changed

.changeset/ten-views-grab.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@chialab/sveltekit-utils": minor
3+
"@chialab/sveltekit-dev-utils": minor
4+
---
5+
6+
Refactor to monorepo with configs and utils packages

.eslintrc.cjs

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

.github/workflows/lint.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,16 @@ jobs:
1515
uses: actions/setup-node@v4
1616
with:
1717
node-version: 'lts/*'
18-
cache: yarn
19-
20-
- name: Get Yarn cache directory path
21-
id: yarn-cache-dir-path
22-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
23-
24-
- name: Setup Yarn cache
25-
uses: actions/cache@v4
26-
with:
27-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-yarn-
18+
cache: pnpm
3119

3220
- name: Install project dependencies
33-
run: yarn install
21+
run: pnpm install
3422

3523
- name: Check
36-
run: yarn run check
24+
run: pnpm run check
3725

3826
- name: Check eslint
39-
run: yarn run eslint-check
27+
run: pnpm run eslint-check
4028

4129
- name: Check prettier
42-
run: yarn run prettier-check
30+
run: pnpm run prettier-check

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ jobs:
1818
uses: actions/setup-node@v4
1919
with:
2020
node-version: 'lts/*'
21-
cache: yarn
21+
cache: pnpm
2222

2323
- name: Install project dependencies
24-
run: yarn install
24+
run: pnpm install
2525

2626
- name: Build project
27-
run: yarn build
27+
run: pnpm build
2828

2929
- name: Create Release Pull Request or Publish to npm
3030
id: changesets
3131
uses: changesets/action@v1
3232
with:
33-
publish: yarn changeset publish
33+
publish: pnpm changeset publish
3434
createGithubReleases: true
3535
env:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,10 @@ jobs:
1818
uses: actions/setup-node@v4
1919
with:
2020
node-version: ${{ matrix.node }}
21-
cache: yarn
22-
23-
- name: Get Yarn cache directory path
24-
id: yarn-cache-dir-path
25-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
26-
27-
- name: Setup Yarn cache
28-
uses: actions/cache@v4
29-
with:
30-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
31-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
32-
restore-keys: |
33-
${{ runner.os }}-yarn-
21+
cache: pnpm
3422

3523
- name: Install project dependencies
36-
run: yarn install
24+
run: pnpm install
3725

3826
- name: Setup Playwright cache
3927
uses: actions/cache@v4
@@ -42,10 +30,10 @@ jobs:
4230
key: ${{ runner.os }}-playwright
4331

4432
- name: Install Playwright browsers
45-
run: yarn run playwright install --with-deps
33+
run: pnpm run playwright install --with-deps
4634

4735
- name: Check
48-
run: yarn run test:unit:coverage
36+
run: pnpm run test:unit:coverage
4937

5038
- name: Upload coverage reports to Codecov
5139
uses: codecov/codecov-action@v5

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.DS_Store
22
node_modules
33
/dist
4-
/.svelte-kit
54
/package
65
/public
76
/.env.production
@@ -12,3 +11,4 @@ vite.config.js.timestamp-*
1211
vite.config.ts.timestamp-*
1312
*.tsbuildinfo
1413
.pnpm-cache
14+
.svelte-kit

README.md

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,59 @@
11
# SvelteKit Utils
22

3-
**SvelteKit Utils** is a set of libraries and utilities to improve the development experience with [SvelteKit](https://kit.svelte.dev/).
3+
**SvelteKit Utils** is a collection of utilities and configurations to improve the development experience with [SvelteKit](https://kit.svelte.dev/).
4+
There are actually 2 packages in this repository:
5+
- @chialab/sveltekit-utils: A set of utility types and functions
6+
- @chialab/sveltekit-dev-utils: A set of configurations (eslint, stylelint, prettier)
7+
8+
`sveltekit-dev-utils` package is meant to be used as a dev dependency, while `sveltekit-utils` is meant to be used as a dependency.
49

510
## Usage
611

7-
Package is distribuited as NPM packages through the official NPM registry.
12+
Packages are distribuited as NPM packages through the official NPM registry.
813

914
### Install
1015

11-
Then, you can use the `npm` cli or the `yarn` package manager to install the package as a dependency:
16+
You can use the `npm` cli or the `pnpm` package manager to install the package as a dependency:
1217

13-
```
18+
```sh
1419
npm install @chialab/sveltekit-utils
1520
```
1621

22+
```sh
23+
pnpm add @chialab/sveltekit-utils
24+
```
25+
26+
```sh
27+
npm install @chialab/sveltekit-dev-utils
28+
```
29+
30+
```sh
31+
pnpm add @chialab/sveltekit-dev-utils
32+
```
33+
34+
`svelte-dev-utils` exports 3 config that you can use as follows:
35+
36+
For example for the eslint config create the `eslint.config.js` file in the root of your project and add the following:
37+
38+
```js
39+
import cfg from '@chialab/sveltekit-dev-utils/eslint-config';
40+
41+
export default cfg;
1742
```
18-
yarn add @chialab/sveltekit-utils
43+
44+
You can extend the config as follows:
45+
46+
```js
47+
import cfg from '@chialab/sveltekit-dev-utils/eslint-config';
48+
49+
export default [
50+
...cfg,
51+
{
52+
rules: {
53+
'no-console': 'off'
54+
}
55+
}
56+
];
1957
```
2058

2159
## License

package.json

Lines changed: 5 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,11 @@
11
{
2-
"name": "@chialab/sveltekit-utils",
2+
"name": "@chialab/sveltekit-tools",
3+
"version": "0.0.2",
34
"license": "MIT",
4-
"version": "0.1.0-alpha.2",
5+
"description": "A collection of utilities and configurations for SvelteKit projects.",
56
"type": "module",
6-
"files": [
7-
"dist",
8-
".eslintrc.cjs"
9-
],
10-
"exports": {
11-
".": {
12-
"types": "./dist/index.d.ts",
13-
"svelte": "./dist/index.js",
14-
"default": "./dist/index.js"
15-
},
16-
"./server": {
17-
"types": "./dist/server/index.d.ts",
18-
"node": "./dist/server/index.js",
19-
"svelte": null,
20-
"default": null
21-
},
22-
"./logger": {
23-
"types": "./dist/logger.d.ts",
24-
"default": "./dist/logger.js"
25-
},
26-
"./utils": {
27-
"types": "./dist/utils/index.d.ts",
28-
"default": "./dist/utils/index.js"
29-
}
30-
},
31-
"scripts": {
32-
"dev": "vite dev",
33-
"start": "yarn dev",
34-
"build": "svelte-kit sync && svelte-package",
35-
"app:build": "vite build",
36-
"app:preview-build": "vite preview | pino-pretty",
37-
"test:unit": "vitest run",
38-
"test:unit:coverage": "vitest run --coverage",
39-
"test:unit:watch": "vitest watch",
40-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
41-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
42-
"eslint-check": "eslint --ignore-path .gitignore . --ext .js,.cjs,.ts,.svelte",
43-
"eslint-fix": "eslint --fix --ignore-path .gitignore . --ext .js,.cjs,.ts,.svelte",
44-
"prettier-check": "prettier --check \"./**/*.{json,css,js,cjs,ts,svelte}\"",
45-
"prettier-fix": "prettier --write \"./**/*.{json,css,js,cjs,ts,svelte}\"",
46-
"lint": "yarn run check && yarn run eslint-check && yarn run prettier-fix",
47-
"lint-fix-all": "yarn run eslint-fix && yarn run prettier-fix"
48-
},
49-
"dependencies": {
50-
"@heyputer/kv.js": "fquffio/kv.js#fix/strict-mode",
51-
"cookie": "^1.0.2",
52-
"pino": "^9.5.0",
53-
"redis": "^4.7.0",
54-
"xml-js": "^1.6.11"
55-
},
567
"devDependencies": {
57-
"@changesets/cli": "^2.27.10",
58-
"@sveltejs/adapter-static": "^3.0.6",
59-
"@sveltejs/kit": "^2.8.1",
60-
"@sveltejs/package": "^2.3.7",
61-
"@sveltejs/vite-plugin-svelte": "^5.0.0",
62-
"@types/node": "^22.9.1",
63-
"@typescript-eslint/eslint-plugin": "^8.15.0",
64-
"@typescript-eslint/parser": "^8.15.0",
65-
"@vitest/browser": "^3.0.5",
66-
"@vitest/coverage-v8": "^3.0.5",
67-
"eslint": "^8.57.1",
68-
"eslint-config-prettier": "^9.1.0",
69-
"eslint-plugin-svelte": "^2.46.0",
70-
"pino-pretty": "^13.0.0",
71-
"playwright": "^1.50.1",
72-
"prettier": "^3.3.3",
73-
"prettier-plugin-svelte": "^3.3.1",
74-
"svelte": "^5.0.0",
75-
"svelte-check": "^4.1.4",
76-
"tslib": "^2.8.1",
77-
"typescript": "^5.6.3",
78-
"vite": "^6.0.0",
79-
"vitest": "^3.0.5"
80-
},
81-
"peerDependencies": {
82-
"@sveltejs/kit": "^2.0.0",
83-
"svelte": "^4.2.1 || ^5.0.0"
8+
"@changesets/cli": "^2.27.10"
849
},
85-
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
10+
"packageManager": "pnpm@10.6.2+sha256.20072a1f6edd17646ea9234bf32c42d563dad37b2973e97a2dde5c17774a824d"
8611
}

.prettierignore renamed to packages/dev-utils/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111

1212
# Ignore files for PNPM, NPM and YARN
1313
pnpm-lock.yaml
14+
pnpm-workspace.yaml
1415
.pnpm-cache

.prettierrc renamed to packages/dev-utils/.prettierrc.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{
1+
/** @type {import('prettier').Config} */
2+
export default {
23
"printWidth": 120,
34
"tabWidth": 2,
45
"useTabs": true,
@@ -11,4 +12,4 @@
1112
"endOfLine": "auto",
1213
"plugins": ["prettier-plugin-svelte"],
1314
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
14-
}
15+
};

0 commit comments

Comments
 (0)