Skip to content

Commit 79415cc

Browse files
authored
chore: skeleton-react package cleanup (#2672)
1 parent 210e923 commit 79415cc

Some content is hidden

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

49 files changed

+2007
-1745
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "pnpm -F @skeletonlabs/skeleton test",
88
"preinstall": "npx only-allow pnpm",
99
"postinstall": "pnpm -r sync",
10-
"dev": "pnpm --no-sort --filter=skeleton.dev dev",
10+
"dev": "pnpm --no-sort --filter=next.skeleton.dev dev",
1111
"csa": "node ./packages/create-skeleton-app/src/index.js --types=typescript --prettier --eslint --playwright=false --vitest=false --codeblocks --popups --typography --forms -t=skeleton --skeletontemplate=welcome -p=sites --monorepo --inspector",
1212
"csl": "node ./packages/create-skeleton-app/src/index.js --types=typescript --library --prettier --eslint --playwright --vitest --codeblocks --popups --typography --forms -t=skeleton --skeletontemplate=bare -p=packages --monorepo --inspector",
1313
"templategen": "node ./scripts/template-gen.js",
@@ -53,7 +53,6 @@
5353
"rimraf": "^5.0.5",
5454
"shelljs": "^0.8.5"
5555
},
56-
"packageManager": "[email protected]",
5756
"engines": {
5857
"pnpm": ">=8.14.0"
5958
},

packages/skeleton-react/package.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
"type": "module",
55
"scripts": {
66
"dev": "vite",
7-
"build": "tsc && vite build",
7+
"build": "vite build",
8+
"package": "tsc --project tsconfig.package.json",
9+
"package:watch": "tsc --project tsconfig.package.json --watch",
810
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
911
"preview": "vite preview",
1012
"test": "vitest run",
1113
"test:watch": "vitest",
1214
"schema": "node ./scripts/generator.js"
1315
},
1416
"publishConfig": {
15-
"types": "./dist/index.d.ts",
1617
"exports": {
1718
".": {
1819
"types": "./dist/index.d.ts",
@@ -25,25 +26,26 @@
2526
"./dist/index.d.ts"
2627
]
2728
}
28-
},
29-
"registry": "http://localhost:4873"
29+
}
3030
},
31-
"types": "./src/lib/index.ts",
31+
"types": "./dist/index.d.ts",
3232
"exports": {
3333
".": {
34-
"types": "./src/lib/index.ts",
35-
"default": "./src/lib/index.ts"
34+
"types": "./dist/index.d.ts",
35+
"default": "./dist/index.js"
3636
},
37-
"./*": "./src/lib/*"
37+
"./schemas": "./src/lib/schemas.ts"
3838
},
3939
"files": [
4040
"./dist/**/*.js",
4141
"./dist/**/*.map",
42-
"./dist/**/*.tsx",
4342
"./dist/**/*.d.ts",
4443
"./dist/**/*.cjs",
4544
"./dist/**/*.d.cts",
46-
"!./dist/**/*.test.*"
45+
"!./dist/**/*.test.*",
46+
"!./dist/**/schema.json",
47+
"!./dist/schemas.js",
48+
"!./dist/schemas.d.ts"
4749
],
4850
"dependencies": {
4951
"react": "^18.2.0",
+29-27
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
import { promises as fs } from "fs";
2-
import { execSync } from 'node:child_process';
2+
import { execSync } from "node:child_process";
33

44
const config = {
5-
dirPath: 'src/components',
6-
inputFileName: 'types.ts',
7-
outputFileName: 'schema.json',
5+
dirPath: "src/lib/components",
6+
inputFileName: "types.ts",
7+
outputFileName: "schema.json",
88
};
99

1010
async function init() {
11-
const list = await fs.readdir(config.dirPath, { recursive: true });
12-
list.forEach(async (file) => {
13-
// Exclude all but types.ts files
14-
if (!file.includes(config.inputFileName)) return;
15-
16-
// The full path with filename and extension
17-
const filePath = `${config.dirPath}/${file}`;
18-
19-
// The path containing the types file
20-
const locationPath = filePath.replace(config.inputFileName, "");
21-
22-
// DEBUG: Limit to Accordion Only ---------
23-
// if (!file.includes("Accordion")) return;
24-
// ----------------------------------------
25-
26-
// Execute Generator
27-
// https://github.com/YousefED/typescript-json-schema?tab=readme-ov-file
28-
execSync(`typescript-json-schema --propOrder=true --esModuleInterop --required=true '${filePath}' '*' --out '${locationPath}/${config.outputFileName}'`);
29-
30-
// Log
31-
console.log('Schema generated for', filePath);
32-
});
11+
const list = await fs.readdir(config.dirPath, { recursive: true });
12+
list.forEach(async (file) => {
13+
// Exclude all but types.ts files
14+
if (!file.includes(config.inputFileName)) return;
15+
16+
// The full path with filename and extension
17+
const filePath = `${config.dirPath}/${file}`;
18+
19+
// The path containing the types file
20+
const locationPath = filePath.replace(config.inputFileName, "");
21+
22+
// DEBUG: Limit to Accordion Only ---------
23+
// if (!file.includes("Accordion")) return;
24+
// ----------------------------------------
25+
26+
// Execute Generator
27+
// https://github.com/YousefED/typescript-json-schema?tab=readme-ov-file
28+
execSync(
29+
`typescript-json-schema --propOrder=true --esModuleInterop --required=true '${filePath}' '*' --out '${locationPath}/${config.outputFileName}'`
30+
);
31+
32+
// Log
33+
console.log("Schema generated for", filePath);
34+
});
3335
}
3436

35-
init();
37+
init();
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { describe, expect, it } from "vitest";
22
import { render } from "@testing-library/react";
3-
import App from "./App";
3+
import App from "./App.js";
44

55
describe("App", () => {
6-
it("renders the component", () => {
7-
const { getByTestId } = render(<App />);
8-
expect(getByTestId("app")).toBeInTheDocument();
9-
});
6+
it("renders the component", () => {
7+
const { getByTestId } = render(<App />);
8+
expect(getByTestId("app")).toBeInTheDocument();
9+
});
1010
});

packages/skeleton-react/src/App.tsx

+48-48
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
import { Suspense } from "react";
22
import { RouterProvider } from "react-router-dom";
3-
import { router } from "./router";
3+
import { router } from "./router.js";
44

55
function App() {
6-
return (
7-
<div
8-
className="h-screen grid grid-cols-[320px_minmax(0,_1fr)]"
9-
data-testid="app"
10-
>
11-
{/* Nav */}
12-
<div className="bg-surface-100-900 p-8 overflow-y-auto space-y-8">
13-
<a
14-
className="bg-blue-500 text-white p-2 type-scale-3 font-bold font-mono"
15-
href="/"
16-
>
17-
skeleton-react
18-
</a>
19-
<hr className="hr" />
20-
{/* Components */}
21-
<div className="space-y-8">
22-
<span className="font-bold">Components</span>
23-
<nav className="flex flex-col gap-2 type-scale-2">
24-
{/* <a className="anchor" href="/components/test">
6+
return (
7+
<div
8+
className="h-screen grid grid-cols-[320px_minmax(0,_1fr)]"
9+
data-testid="app"
10+
>
11+
{/* Nav */}
12+
<div className="bg-surface-100-900 p-8 overflow-y-auto space-y-8">
13+
<a
14+
className="bg-blue-500 text-white p-2 type-scale-3 font-bold font-mono"
15+
href="/"
16+
>
17+
skeleton-react
18+
</a>
19+
<hr className="hr" />
20+
{/* Components */}
21+
<div className="space-y-8">
22+
<span className="font-bold">Components</span>
23+
<nav className="flex flex-col gap-2 type-scale-2">
24+
{/* <a className="anchor" href="/components/test">
2525
Test
2626
</a> */}
27-
<a className="anchor" href="/components/accordions">
28-
Accordions
29-
</a>
30-
<a className="anchor" href="/components/avatars">
31-
Avatars
32-
</a>
33-
<a className="anchor" href="/components/app-bars">
34-
App Bars
35-
</a>
36-
<a className="anchor" href="/components/progress">
37-
Progress
38-
</a>
39-
<a className="anchor" href="/components/tabs">
40-
Tabs
41-
</a>
42-
</nav>
43-
</div>
44-
</div>
45-
{/* Page */}
46-
<main className="p-8 overflow-y-auto">
47-
{/* --- Route Slot --- */}
48-
<Suspense fallback={<div>Loading...</div>}>
49-
<RouterProvider router={router} />
50-
</Suspense>
51-
{/* --- / --- */}
52-
</main>
53-
</div>
54-
);
27+
<a className="anchor" href="/components/accordions">
28+
Accordions
29+
</a>
30+
<a className="anchor" href="/components/avatars">
31+
Avatars
32+
</a>
33+
<a className="anchor" href="/components/app-bars">
34+
App Bars
35+
</a>
36+
<a className="anchor" href="/components/progress">
37+
Progress
38+
</a>
39+
<a className="anchor" href="/components/tabs">
40+
Tabs
41+
</a>
42+
</nav>
43+
</div>
44+
</div>
45+
{/* Page */}
46+
<main className="p-8 overflow-y-auto">
47+
{/* --- Route Slot --- */}
48+
<Suspense fallback={<div>Loading...</div>}>
49+
<RouterProvider router={router} />
50+
</Suspense>
51+
{/* --- / --- */}
52+
</main>
53+
</div>
54+
);
5555
}
5656

5757
export default App;

0 commit comments

Comments
 (0)