Skip to content

Commit e39bcdc

Browse files
committed
refactor: convert into monorepo
1 parent ed7602f commit e39bcdc

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

+3017
-1447
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ jobs:
2222
run: bun lint
2323
- name: Typecheck
2424
run: bun typecheck
25-
# TODO: Complete when refactored into monorepo
26-
# - name: Test
27-
# run: bun run test:cov --watch=false
28-
# - name: Test e2e
29-
# run: bun run --cwd e2e test:e2e --watch=false
25+
- name: Test
26+
run: bun plugin test:cov --watch=false
27+
- name: Test e2e
28+
run: bun run --cwd e2e test:e2e --watch=false
3029
- name: Test build
3130
run: bun run build

bun.lock

Lines changed: 1306 additions & 0 deletions
Large diffs are not rendered by default.

bun.lockb

-329 KB
Binary file not shown.

e2e-v3/package.json

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

package.json

Lines changed: 17 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,30 @@
11
{
2-
"name": "eslint-plugin-svelte-tailwindcss",
3-
"type": "module",
4-
"version": "0.1.0-next.8",
5-
"packageManager": "[email protected]",
6-
"description": "ESLint plugin for Svelte and Tailwind CSS",
7-
"author": "Miquel De Domingo",
8-
"license": "MIT",
9-
"homepage": "https://github.com/mikededo/eslint-plugin-svelte-tailwindcss",
10-
"repository": {
11-
"type": "git",
12-
"url": "git+https://github.com/mikededo/eslint-plugin-svelte-tailwindcss.git"
13-
},
14-
"bugs": "https://github.com/mikededo/eslint-plugin-svelte-tailwindcss/issues",
15-
"keywords": [
16-
"eslint",
17-
"eslintplugin",
18-
"svelte",
19-
"tailwindcss",
20-
"tailwind",
21-
"tailwindcss-svelte",
22-
"eslint-plugin-svelte",
23-
"eslint-plugin-tailwindcss",
24-
"eslint-plugin-tailwind",
25-
"eslint-plugin-tailwindcss-svelte"
26-
],
27-
"sideEffects": false,
28-
"exports": {
29-
".": {
30-
"types": "./dist/index.d.ts",
31-
"import": "./dist/index.mjs",
32-
"require": "./dist/index.cjs"
33-
}
34-
},
35-
"main": "./dist/index.mjs",
36-
"module": "./dist/index.mjs",
37-
"types": "./dist/index.d.ts",
38-
"files": [
39-
"dist"
40-
],
2+
"name": "root",
3+
"private": true,
4+
"packageManager": "[email protected]",
415
"scripts": {
42-
"build": "unbuild",
43-
"gen:rule": "bun run scripts/rule.ts",
44-
"gen:update": "bun run scripts/update.ts",
45-
"lint": "eslint . --max-warnings 0",
46-
"lint:fix": "eslint . --max-warnings 0 --fix",
47-
"test": "vitest .",
48-
"test:cov": "vitest . --coverage",
49-
"test:e2e": "vitest",
50-
"typecheck": "tsc --noEmit"
51-
},
52-
"peerDependencies": {
53-
"eslint": ">=9.0.0"
54-
},
55-
"dependencies": {
56-
"clear-module": "4.1.2",
57-
"enhanced-resolve": "5.18.1",
58-
"escalade": "3.2.0",
59-
"jiti": "2.4.2",
60-
"postcss": "8.5.3",
61-
"postcss-import": "16.1.0",
62-
"synckit": "0.10.0",
63-
"tailwindcss": "3.4.16"
6+
"install:plugin": "bun install --cwd packages/plugin",
7+
"install:v3": "bun install --cwd packages/test/v3",
8+
"install:v4": "bun install --cwd packages/test/v4",
9+
"lint": "eslint ./packages/plugin --max-warnings 0",
10+
"plugin": "bun run --cwd packages/plugin",
11+
"preinstall": "bun install:plugin && bun install:v3 && bun install:v4",
12+
"pretest:v3": "bun plugin build",
13+
"test:plugin": "bun plugin test",
14+
"test:v3": "bun v3 test",
15+
"test:v4": "bun v4 test",
16+
"v3": "bun run --cwd packages/test/v3",
17+
"v4": "bun run --cwd packages/test/v4"
6418
},
6519
"devDependencies": {
6620
"@antfu/eslint-config": "3.11.2",
6721
"@changesets/cli": "2.27.10",
6822
"@svitejs/changesets-changelog-github-compact": "1.2.0",
6923
"@types/bun": "latest",
70-
"@types/eslint": "9.6.1",
71-
"@types/node": "22.10.1",
72-
"@types/postcss-import": "14.0.3",
73-
"@typescript-eslint/parser": "8.18.0",
74-
"@typescript-eslint/rule-tester": "8.19.0",
75-
"@vitest/coverage-v8": "2.1.8",
76-
"commander": "12.1.0",
7724
"eslint": "9.16.0",
7825
"eslint-plugin-format": "0.1.3",
79-
"eslint-plugin-svelte": "^2.46.1",
80-
"jq": "1.7.2",
81-
"svelte": "5.10.0",
82-
"svelte-eslint-parser": "1.0.0-next.4",
26+
"eslint-plugin-svelte": "2.46.1",
8327
"typescript": "5.7.2",
84-
"unbuild": "2.0.0",
85-
"vite": "6.0.3",
8628
"vitest": "2.1.8"
87-
},
88-
"workspaces": ["e2e*", "."]
29+
}
8930
}
File renamed without changes.

packages/plugin/bun.lock

Lines changed: 1339 additions & 0 deletions
Large diffs are not rendered by default.

packages/plugin/package.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"name": "eslint-plugin-svelte-tailwindcss",
3+
"type": "module",
4+
"version": "0.1.0-next.8",
5+
"description": "ESLint plugin for Svelte and Tailwind CSS",
6+
"author": "Miquel De Domingo",
7+
"license": "MIT",
8+
"homepage": "https://github.com/mikededo/eslint-plugin-svelte-tailwindcss",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/mikededo/eslint-plugin-svelte-tailwindcss.git"
12+
},
13+
"bugs": "https://github.com/mikededo/eslint-plugin-svelte-tailwindcss/issues",
14+
"keywords": [
15+
"eslint",
16+
"eslintplugin",
17+
"svelte",
18+
"tailwindcss",
19+
"tailwind",
20+
"tailwindcss-svelte",
21+
"eslint-plugin-svelte",
22+
"eslint-plugin-tailwindcss",
23+
"eslint-plugin-tailwind",
24+
"eslint-plugin-tailwindcss-svelte"
25+
],
26+
"sideEffects": false,
27+
"exports": {
28+
".": {
29+
"types": "./dist/index.d.ts",
30+
"import": "./dist/index.mjs",
31+
"require": "./dist/index.cjs"
32+
}
33+
},
34+
"main": "./dist/index.mjs",
35+
"module": "./dist/index.mjs",
36+
"types": "./dist/index.d.ts",
37+
"files": [
38+
"dist"
39+
],
40+
"scripts": {
41+
"build": "unbuild",
42+
"gen:rule": "bun run scripts/rule.ts",
43+
"gen:update": "bun run scripts/update.ts",
44+
"lint": "eslint . --max-warnings 0",
45+
"lint:fix": "eslint . --max-warnings 0 --fix",
46+
"test": "vitest .",
47+
"test:cov": "vitest . --coverage",
48+
"typecheck": "tsc --noEmit"
49+
},
50+
"peerDependencies": {
51+
"eslint": ">=9.0.0"
52+
},
53+
"dependencies": {
54+
"clear-module": "4.1.2",
55+
"enhanced-resolve": "5.18.1",
56+
"escalade": "3.2.0",
57+
"jiti": "2.4.2",
58+
"postcss": "8.5.3",
59+
"postcss-import": "16.1.0",
60+
"synckit": "0.10.0",
61+
"tailwindcss": "3.4.16"
62+
},
63+
"devDependencies": {
64+
"@types/eslint": "9.6.1",
65+
"@types/node": "22.10.1",
66+
"@types/postcss-import": "14.0.3",
67+
"@typescript-eslint/parser": "8.18.0",
68+
"@typescript-eslint/rule-tester": "8.19.0",
69+
"@vitest/coverage-v8": "2.1.8",
70+
"commander": "12.1.0",
71+
"eslint": "9.16.0",
72+
"eslint-plugin-format": "0.1.3",
73+
"eslint-plugin-svelte": "2.46.1",
74+
"jq": "1.7.2",
75+
"svelte": "5.10.0",
76+
"svelte-eslint-parser": "1.0.0-next.4",
77+
"typescript": "5.7.2",
78+
"unbuild": "2.0.0",
79+
"vite": "6.0.3",
80+
"vitest": "2.1.8"
81+
}
82+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/plugin/src/utils/dir.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fileURLToPath } from 'node:url';
2+
3+
export const workerDir = fileURLToPath(new URL(
4+
import.meta.env.MODE === 'test' ? '../workers/config-v4.ts' : './workers/config-v4.cjs',
5+
import.meta.url
6+
));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/utils/sort-classes.ts renamed to packages/plugin/src/utils/sort-classes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const bigIntSorter = ([, a]: [string, bigint | null], [, z]: [string, bigint | n
2323

2424
const getClassOrderSync = createSyncFn<
2525
(path: string, clases: string[]) => Promise<[string, bigint | null][]>
26-
>(workerDir);
26+
>(workerDir, import.meta.env.MODE === 'test' ? { tsRunner: 'tsx' } : undefined);
2727

2828
export const sortClasses = (className: string, twConfig: string) => {
2929
if (typeof className !== 'string' || className === '') {
File renamed without changes.

src/workers/config-v4.ts renamed to packages/plugin/src/workers/config-v4.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const pathToContextMap = createExpiringMap<null | string, ContextContainer>(10_0
3131
* the CSS file that uses them. However, we don't want missing files to prevent
3232
* everything from working so we'll let the error handler decide how to proceed.
3333
*/
34-
function createLoader<T>({
34+
const createLoader = <T>({
3535
filepath,
3636
jiti,
3737
legacy,
@@ -41,10 +41,10 @@ function createLoader<T>({
4141
jiti: Jiti;
4242
legacy: boolean;
4343
onError: (id: string, error: unknown, resourceType: string) => T;
44-
}) {
44+
}) => {
4545
const cacheKey = `${+Date.now()}`;
4646

47-
async function loadFile(id: string, base: string, resourceType: string) {
47+
const loadFile = async (id: string, base: string, resourceType: string) => {
4848
try {
4949
const resolved = resolveJsFrom(base, id);
5050

@@ -55,7 +55,7 @@ function createLoader<T>({
5555
} catch (err) {
5656
return onError(id, err, resourceType);
5757
}
58-
}
58+
};
5959

6060
if (legacy) {
6161
const baseDir = path.dirname(filepath);
@@ -66,7 +66,7 @@ function createLoader<T>({
6666
base,
6767
module: await loadFile(id, base, resourceType)
6868
});
69-
}
69+
};
7070

7171
const getBaseDir = (filePath: string): string => filePath
7272
? path.dirname(filePath)
File renamed without changes.
File renamed without changes.

packages/plugin/vitest.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
coverage: {
6+
exclude: ['src/**/index.ts'],
7+
include: ['src/{rules,utils}/**/*.ts'],
8+
provider: 'v8'
9+
},
10+
globals: true,
11+
reporters: 'dot'
12+
}
13+
});

0 commit comments

Comments
 (0)