64 lines
1.2 KiB
Plaintext
64 lines
1.2 KiB
Plaintext
# Configuration
|
|
|
|
## Library File
|
|
|
|
Library file is a shared utility container every component uses.
|
|
You can put it anywhere as long as you properly update import path.
|
|
|
|
PSW/UI manages its import path using tsconfig path.
|
|
|
|
If you want to follow our rule, you can add a path to your `tsconfig.json`.
|
|
```json
|
|
{
|
|
"compilerOptions": {
|
|
"paths": {
|
|
"@pswui-lib": ["./pswui/lib.tsx"]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## CLI
|
|
|
|
You can use configuration file to change things of CLI.
|
|
|
|
Default config file name is `pswui.config.js`.
|
|
|
|
Here is our config structure:
|
|
```typescript
|
|
export interface Config {
|
|
/**
|
|
* Path that cli will create a file.
|
|
*/
|
|
paths?: {
|
|
components?: 'src/pswui/components' | string
|
|
lib?: 'src/pswui/lib.tsx' | string
|
|
}
|
|
/**
|
|
* Absolute path that will used for import in component
|
|
*/
|
|
import?: {
|
|
lib?: '@pswui-lib' | string
|
|
}
|
|
}
|
|
```
|
|
|
|
You can import `Config` type or `buildConfig` function to use typescript intellisense.
|
|
|
|
```ts
|
|
import { Config } from "@psw-ui/cli"
|
|
|
|
const config: Config = {
|
|
/* ... */
|
|
}
|
|
|
|
export default config;
|
|
```
|
|
|
|
```ts
|
|
import { buildConfig } from "@psw-ui/cli"
|
|
|
|
export default buildConfig({
|
|
/* ... */
|
|
})
|
|
``` |