Make package

This commit is contained in:
2026-03-09 16:59:43 +01:00
parent 19bb022290
commit 5733a35459
7 changed files with 578 additions and 273 deletions

154
README.md
View File

@@ -1,73 +1,99 @@
# React + TypeScript + Vite
# CyberDuck
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
CyberDuck is a small React component library and theme (Cyberpunk yellow) built on Bootstrap and MUI styles.
Currently, two official plugins are available:
## Installation
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
If you are developing locally you can install from the repository directory:
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```bash
npm pack
npm install /path/to/cyberduck-0.0.0.tgz
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
Install directly from the repository
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
If you don't want to publish to the npm registry you can install the package directly from the Git repository:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```bash
npm install git+https://git.maze.io/maze/cyberduck.git
# or a specific branch or tag
npm install git+https://git.maze.io/maze/cyberduck.git#main
```
Note: when installing from a git repository, npm will clone the source. For consumers to get built artifacts (the `dist` bundle and compiled types) the repository must either include the `dist` output or provide a `prepare`/build step that runs on install. If you prefer not to publish, using `npm pack` from the repo owner (tarball) ensures the built `dist` is included.
## Including styles
CyberDuck emits a single bundled stylesheet. Preferred import options:
- Import the packaged CSS via the package export (recommended):
```ts
import 'cyberduck/css'
```
- Import the compiled CSS file directly (older setups):
```ts
import 'cyberduck/dist/cyberduck.css'
```
- If you want to include and compile the SCSS source in your app (allows customization), import the SCSS entry:
```scss
@use 'cyberduck/styles/cyberduck.scss' as *;
```
Or in a JS/TS entry that supports Sass imports:
```ts
import 'cyberduck/styles/cyberduck.scss'
```
## Using the `Layout` component
CyberDuck exports a small set of layout components. Example usage of the `Layout` component together with `Navbar` and `Footer`:
```tsx
import React from 'react'
import { Layout, Navbar, Footer } from 'cyberduck'
import 'cyberduck/css'
function App() {
return (
<Layout>
<Navbar />
<main className="container py-4">
<h1>Hello from CyberDuck</h1>
<p>Use the provided layout primitives and styles as building blocks.</p>
</main>
<Footer />
</Layout>
)
}
export default App
```
You can also import specific components via subpath imports if you prefer:
```ts
import { Navbar } from 'cyberduck'
// or
import { Navbar } from 'cyberduck/Navbar'
```
## Peer dependencies
- `react` and `react-dom` (install in your project)
- `bootstrap` (CSS utilities used by components)
- `react-router` / `react-router-dom` (if you use routing components)
## Publishing
The package repository is: `git+https://git.maze.io/maze/cyberduck.git`. The package exposes `main`, `module`, and TypeScript `types` fields and emits declaration files in `dist/types`.
## Contributing
See the repository for contributing guidelines and style rules.