Skip to content

Commit 7def292

Browse files
committed
fix(config): fix withDefaultSkip
1 parent 3798ac5 commit 7def292

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

mod.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,14 @@ export async function loadConfig() {
138138
const { config } = await _loadConfig<Config>({
139139
name: "nzip",
140140
packageJson: true,
141+
defaultConfig,
141142
});
143+
144+
if (config?.withDefaultSkip === false) {
145+
defaultConfig.skip.forEach((s) => {
146+
config.skip = config.skip?.filter((cs) => cs !== s);
147+
});
148+
}
142149
return config;
143150
}
144151

@@ -152,12 +159,9 @@ export async function loadOptions(options: Options) {
152159

153160
if (options.withConfig) {
154161
const config = await loadConfig();
155-
const name = config?.name ?? defaultConfig.name;
162+
const name = config?.name;
156163
const output = `${name}.${options.type}`;
157164
const externalSkip = config?.skip ?? [];
158-
if (config?.withDefaltSkip) {
159-
externalSkip.push(...defaultConfig.skip);
160-
}
161165
return {
162166
cwd,
163167
output,

src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ export interface Config {
1212
/**
1313
* @default true
1414
*/
15-
withDefaltSkip?: boolean;
15+
withDefaultSkip?: boolean;
1616
}
1717

1818
export const defaultConfig: Required<Config> = {
1919
name: "default",
2020
skip: [
2121
/(?<=[\\\/])(node_modules|temp|cache|dist|\.(nuxt|nitro|output))(?=[\\\/])/,
2222
],
23-
withDefaltSkip: true,
23+
withDefaultSkip: true,
2424
};

0 commit comments

Comments
 (0)