# @flatjs/forge

## Usages

### The configuration file `flatjs-forge.config.ts`;

```ts
import { defineConfig } from '@flatjs/forge/define-config';

export default defineConfig({
  output: {
    format: 'cjs',
  },
  plugin: {
    pluginConfigs: {
      babelOptions: {
        usePreset: 'react',
      },
      terserOptions: true,
    },
  },
});
```

Note:

1. Can use `.mts` extension if your package.json without `"type": "module"`
2. Can use `.ts`,`.mts` extension if your package.json with `"type": "module"`

### Forge CLI

define `scripts` in package.json

```json
{ "forge": "flatjs-forge" }
```

1. Using Npm scripts

- `yarn forge build --dts`
- `yarn forge build --dts -f=esm`

2. Using npx

- `npx flatjs-forge build --dts`
- `npx flatjs-forge build --dts -f=esm`

3. Show basic tips

- `yarn forge -h`
- `yarn forge help`

- `npx flatjs-forge -h`
- `npx flatjs-forge help`

4. Show help info for command `build`

- `yarn forge build -h`
- `yarn forge help build`

- `npx flatjs-forge build -h`
- `npx flatjs-forge help build`

Notes: if we must use `--dts=false` instead using `-d=false` to indicate `dts:false`, The same usage goes for the other boolean types (`-c=false` => `--compress=false`)

## Note: because below configuration of `tsconfig.json `

```json
{ "baseUrl": "./src" }
```

We should not create folder name like `rollup` in `src/rollup`;

1. while we use `import { moduleX } from rollup`; it will resolve `moduleX` from `src/rollup` instead import from `node_modules`
2. while use `vitest` it may broken cause of wrong `rollup` imported.
3. change `src/rollup` to `src/create-rollup` is ok.
