11// export * from "./src/deps.ts";
22export * from "./src/compress.ts" ;
33export * from "./src/decompress.ts" ;
4+ export * from "./src/config.ts" ;
45import { tar , zip } from "./src/compress.ts" ;
56import {
67 Command ,
@@ -17,7 +18,8 @@ import {
1718} from "./src/deps.ts" ;
1819import { version } from "./src/version.ts" ;
1920import { untar , unzip } from "./src/decompress.ts" ;
20- type ExternalSkip = Array < string | RegExp > ;
21+ import { defaultConfig } from "./src/config.ts" ;
22+ import type { Config } from "./src/config.ts" ;
2123
2224if ( import . meta. main ) {
2325 const types = new EnumType ( [ "tar" , "zip" ] ) ;
@@ -110,16 +112,11 @@ export async function mayBeExists(output: string) {
110112
111113export async function walkFiles (
112114 dir : string ,
113- externalskip : ExternalSkip = [ ] ,
115+ externalskip = defaultConfig . skip ,
114116) {
115117 const files : string [ ] = [ ] ;
116- const skip = [
117- / (?< = [ \\ \/ ] ) ( n o d e _ m o d u l e s | t e m p | c a c h e | d i s t | \. ( n u x t | n i t r o | o u t p u t ) ) (? = [ \\ \/ ] ) / ,
118- ] ;
119118
120- externalskip ?. forEach ( ( s ) => {
121- skip . push ( typeof s === "string" ? new RegExp ( s ) : s ) ;
122- } ) ;
119+ const skip = externalskip ?. map ( ( s ) => typeof s === "string" ? new RegExp ( s ) : s )
123120
124121 for await (
125122 const entry of walk ( dir , {
@@ -137,9 +134,7 @@ export async function walkFiles(
137134
138135export async function loadConfig ( ) {
139136 const { loadConfig : _loadConfig } = await import ( "npm:c12@1.5.1" ) ;
140- const { config } = await _loadConfig <
141- { skip ?: ExternalSkip ; name ?: string }
142- > ( {
137+ const { config } = await _loadConfig < Config > ( {
143138 name : "nzip" ,
144139 packageJson : true ,
145140 } ) ;
@@ -156,7 +151,7 @@ export async function loadOptions(options: Options) {
156151
157152 if ( options . withConfig ) {
158153 const config = await loadConfig ( ) ;
159- const name = config ?. name ?? "default" ;
154+ const name = config ?. name ?? defaultConfig . name
160155 const output = `${ name } .${ options . type } ` ;
161156 const externalSkip = config ?. skip ?? [ ] ;
162157 return {
0 commit comments