Skip to content

Commit

Permalink
feat: add defineConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwgs committed May 25, 2021
1 parent 761e1ec commit aa79c49
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,14 @@ module.exports = {
indent: 0,
'no-await-in-loop': 0,
'unicorn/no-array-for-each': 0,
'unicorn/filename-case': [
'error',
{
cases: {
camelCase: true,
pascalCase: true,
},
},
],
},
}
6 changes: 4 additions & 2 deletions examples/sdk-demo/.avengerrc.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
export default {
import { defineConfig } from '../../packages/cli/lib'

export default defineConfig({
esm: 'rollup',
cjs: 'rollup',
outFile: 'sdk',
umd: {
name: 'SDK',
sourcemap: true,
},
}
})
11 changes: 11 additions & 0 deletions packages/cli/src/defineConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* @Author: ahwgs
* @Date: 2021-05-25 11:25:02
* @Last Modified by: ahwgs
* @Last Modified time: 2021-05-25 11:26:58
*/
import { IBuildConfigOpt } from '@osdoc-dev/avenger-shared'

export function defineConfig(config: IBuildConfigOpt): IBuildConfigOpt {
return config
}
1 change: 1 addition & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './common'
export * from './command'
export * from './defineConfig'
17 changes: 17 additions & 0 deletions website/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ export default {
}
```

同时,`avenger` 支持导出 `defineConfig` 函数辅助我们进行配置,如;

```typescript
import { defineConfig } from '@osdoc-dev/avenger-cli'

export default defineConfig({
esm: 'rollup',
cjs: 'rollup',
outFile: 'sdk',
umd: {
name: 'SDK',
sourcemap: true,
},
})

```

## entry

* Type: `string`
Expand Down

0 comments on commit aa79c49

Please sign in to comment.