@ffflorian/jszip-cli 3.14.3 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,7 @@ export declare class JSZipCLI {
7
7
  private readonly configFile?;
8
8
  private readonly extractService;
9
9
  private readonly logger;
10
- private options;
11
- private readonly terminalOptions?;
10
+ private readonly options;
12
11
  constructor(options?: TerminalOptions);
13
12
  /**
14
13
  * Add files and directories to the ZIP file.
package/dist/JSZipCLI.js CHANGED
@@ -14,16 +14,17 @@ const defaultOptions = {
14
14
  };
15
15
  export class JSZipCLI {
16
16
  constructor(options) {
17
- this.terminalOptions = options;
18
17
  this.logger = logdown('jszip-cli/index', {
19
18
  logger: console,
20
19
  markdown: false,
21
20
  });
22
21
  this.configExplorer = cosmiconfigSync('jszip');
23
- this.options = { ...defaultOptions, ...this.terminalOptions };
22
+ this.options = { ...defaultOptions, ...options };
23
+ if (this.options.configFile) {
24
+ const configFileData = this.checkConfigFile();
25
+ this.options = { ...defaultOptions, ...configFileData, ...options };
26
+ }
24
27
  this.logger.state.isEnabled = this.options.verbose;
25
- this.logger.info('Merged options', this.options);
26
- this.checkConfigFile();
27
28
  this.logger.info('Loaded options', this.options);
28
29
  this.buildService = new BuildService(this.options);
29
30
  this.extractService = new ExtractService(this.options);
@@ -89,10 +90,6 @@ export class JSZipCLI {
89
90
  return this.buildService.save();
90
91
  }
91
92
  checkConfigFile() {
92
- if (!this.options.configFile) {
93
- this.logger.info('Not using any configuration file.');
94
- return;
95
- }
96
93
  let configResult = null;
97
94
  if (typeof this.options.configFile === 'string') {
98
95
  try {
@@ -111,12 +108,11 @@ export class JSZipCLI {
111
108
  }
112
109
  }
113
110
  if (!configResult || configResult.isEmpty) {
114
- this.logger.info('Not using any configuration file.');
111
+ this.logger.info('Configuration file not found or empty.');
115
112
  return;
116
113
  }
117
114
  const configFileData = configResult.config;
118
115
  this.logger.info(`Using configuration file ${configResult.filepath}`);
119
- this.options = { ...defaultOptions, ...configFileData, ...this.terminalOptions };
120
- this.logger.state.isEnabled = this.options.verbose;
116
+ return configFileData;
121
117
  }
122
118
  }
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "vitest": "4.0.16"
20
20
  },
21
21
  "engines": {
22
- "node": ">= 18.0"
22
+ "node": ">= 18"
23
23
  },
24
24
  "files": [
25
25
  "dist"
@@ -42,6 +42,6 @@
42
42
  "test": "vitest run"
43
43
  },
44
44
  "type": "module",
45
- "version": "3.14.3",
46
- "gitHead": "8c51af36ec3439ba37e2aaa27fe9ae1ef86f8d0b"
45
+ "version": "3.15.0",
46
+ "gitHead": "b968c846095113cbe57fbdd34e4593a4dea8a1c9"
47
47
  }