-
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore:
skeleton-react
package cleanup (#2672)
- Loading branch information
1 parent
210e923
commit 79415cc
Showing
49 changed files
with
2,007 additions
and
1,745 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
import { promises as fs } from "fs"; | ||
import { execSync } from 'node:child_process'; | ||
import { execSync } from "node:child_process"; | ||
|
||
const config = { | ||
dirPath: 'src/components', | ||
inputFileName: 'types.ts', | ||
outputFileName: 'schema.json', | ||
dirPath: "src/lib/components", | ||
inputFileName: "types.ts", | ||
outputFileName: "schema.json", | ||
}; | ||
|
||
async function init() { | ||
const list = await fs.readdir(config.dirPath, { recursive: true }); | ||
list.forEach(async (file) => { | ||
// Exclude all but types.ts files | ||
if (!file.includes(config.inputFileName)) return; | ||
|
||
// The full path with filename and extension | ||
const filePath = `${config.dirPath}/${file}`; | ||
|
||
// The path containing the types file | ||
const locationPath = filePath.replace(config.inputFileName, ""); | ||
|
||
// DEBUG: Limit to Accordion Only --------- | ||
// if (!file.includes("Accordion")) return; | ||
// ---------------------------------------- | ||
|
||
// Execute Generator | ||
// https://github.com/YousefED/typescript-json-schema?tab=readme-ov-file | ||
execSync(`typescript-json-schema --propOrder=true --esModuleInterop --required=true '${filePath}' '*' --out '${locationPath}/${config.outputFileName}'`); | ||
|
||
// Log | ||
console.log('Schema generated for', filePath); | ||
}); | ||
const list = await fs.readdir(config.dirPath, { recursive: true }); | ||
list.forEach(async (file) => { | ||
// Exclude all but types.ts files | ||
if (!file.includes(config.inputFileName)) return; | ||
|
||
// The full path with filename and extension | ||
const filePath = `${config.dirPath}/${file}`; | ||
|
||
// The path containing the types file | ||
const locationPath = filePath.replace(config.inputFileName, ""); | ||
|
||
// DEBUG: Limit to Accordion Only --------- | ||
// if (!file.includes("Accordion")) return; | ||
// ---------------------------------------- | ||
|
||
// Execute Generator | ||
// https://github.com/YousefED/typescript-json-schema?tab=readme-ov-file | ||
execSync( | ||
`typescript-json-schema --propOrder=true --esModuleInterop --required=true '${filePath}' '*' --out '${locationPath}/${config.outputFileName}'` | ||
); | ||
|
||
// Log | ||
console.log("Schema generated for", filePath); | ||
}); | ||
} | ||
|
||
init(); | ||
init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { render } from "@testing-library/react"; | ||
import App from "./App"; | ||
import App from "./App.js"; | ||
|
||
describe("App", () => { | ||
it("renders the component", () => { | ||
const { getByTestId } = render(<App />); | ||
expect(getByTestId("app")).toBeInTheDocument(); | ||
}); | ||
it("renders the component", () => { | ||
const { getByTestId } = render(<App />); | ||
expect(getByTestId("app")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
import { Suspense } from "react"; | ||
import { RouterProvider } from "react-router-dom"; | ||
import { router } from "./router"; | ||
import { router } from "./router.js"; | ||
|
||
function App() { | ||
return ( | ||
<div | ||
className="h-screen grid grid-cols-[320px_minmax(0,_1fr)]" | ||
data-testid="app" | ||
> | ||
{/* Nav */} | ||
<div className="bg-surface-100-900 p-8 overflow-y-auto space-y-8"> | ||
<a | ||
className="bg-blue-500 text-white p-2 type-scale-3 font-bold font-mono" | ||
href="/" | ||
> | ||
skeleton-react | ||
</a> | ||
<hr className="hr" /> | ||
{/* Components */} | ||
<div className="space-y-8"> | ||
<span className="font-bold">Components</span> | ||
<nav className="flex flex-col gap-2 type-scale-2"> | ||
{/* <a className="anchor" href="/components/test"> | ||
return ( | ||
<div | ||
className="h-screen grid grid-cols-[320px_minmax(0,_1fr)]" | ||
data-testid="app" | ||
> | ||
{/* Nav */} | ||
<div className="bg-surface-100-900 p-8 overflow-y-auto space-y-8"> | ||
<a | ||
className="bg-blue-500 text-white p-2 type-scale-3 font-bold font-mono" | ||
href="/" | ||
> | ||
skeleton-react | ||
</a> | ||
<hr className="hr" /> | ||
{/* Components */} | ||
<div className="space-y-8"> | ||
<span className="font-bold">Components</span> | ||
<nav className="flex flex-col gap-2 type-scale-2"> | ||
{/* <a className="anchor" href="/components/test"> | ||
Test | ||
</a> */} | ||
<a className="anchor" href="/components/accordions"> | ||
Accordions | ||
</a> | ||
<a className="anchor" href="/components/avatars"> | ||
Avatars | ||
</a> | ||
<a className="anchor" href="/components/app-bars"> | ||
App Bars | ||
</a> | ||
<a className="anchor" href="/components/progress"> | ||
Progress | ||
</a> | ||
<a className="anchor" href="/components/tabs"> | ||
Tabs | ||
</a> | ||
</nav> | ||
</div> | ||
</div> | ||
{/* Page */} | ||
<main className="p-8 overflow-y-auto"> | ||
{/* --- Route Slot --- */} | ||
<Suspense fallback={<div>Loading...</div>}> | ||
<RouterProvider router={router} /> | ||
</Suspense> | ||
{/* --- / --- */} | ||
</main> | ||
</div> | ||
); | ||
<a className="anchor" href="/components/accordions"> | ||
Accordions | ||
</a> | ||
<a className="anchor" href="/components/avatars"> | ||
Avatars | ||
</a> | ||
<a className="anchor" href="/components/app-bars"> | ||
App Bars | ||
</a> | ||
<a className="anchor" href="/components/progress"> | ||
Progress | ||
</a> | ||
<a className="anchor" href="/components/tabs"> | ||
Tabs | ||
</a> | ||
</nav> | ||
</div> | ||
</div> | ||
{/* Page */} | ||
<main className="p-8 overflow-y-auto"> | ||
{/* --- Route Slot --- */} | ||
<Suspense fallback={<div>Loading...</div>}> | ||
<RouterProvider router={router} /> | ||
</Suspense> | ||
{/* --- / --- */} | ||
</main> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
Oops, something went wrong.