Skip to content

Commit

Permalink
feat: enhanced onebanner/multibanner.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 21, 2022
1 parent 9cb9175 commit 3112f8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -82,10 +82,11 @@ bannerjs.multibanner({

```ts
import { PackageJson } from 'types-package-json';
export * from './cli.js';

export declare function getPackage(rootPath?: string): PackageJson;
export declare function onebanner(option?: PackageJson): string;
export declare function multibanner(option?: PackageJson): string;
export declare function onebanner(option?: PackageJson, rootPath?: string): string;
export declare function multibanner(option?: PackageJson, rootPath?: string): string;
```

## Use in gulp
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Expand Up @@ -31,8 +31,8 @@ export function getPackage(rootPath: string = process.cwd()): PackageJson {
return pkg;
}

export function onebanner(option?: PackageJson) {
let bn = getPackage();
export function onebanner(option?: PackageJson, rootPath: string = process.cwd()) {
let bn = getPackage(rootPath);
if (option) {
bn = Object.assign(bn, option);
}
Expand All @@ -46,8 +46,8 @@ export function onebanner(option?: PackageJson) {
].filter(Boolean).join(' ');
}

export function multibanner(option?: PackageJson) {
let bn = getPackage();
export function multibanner(option?: PackageJson, rootPath: string = process.cwd()) {
let bn = getPackage(rootPath);
if (option) bn = Object.assign(bn, option);
return [
'/**!',
Expand Down

0 comments on commit 3112f8e

Please sign in to comment.