Skip to content

Commit

Permalink
Minor refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
KDean-Dolphin committed Feb 3, 2025
1 parent 73ae328 commit 81db544
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ function arg<T>(option: string, value: T | undefined, defaultValue?: T): string
* Options from which to build command-line arguments.
*/
export function exec(parameterOptions: unknown): never {
const fileOptions: unknown = fs.existsSync("./pandoc-spec.options.json") ?
JSON.parse(fs.readFileSync("./pandoc-spec.options.json", {
const configurationFile = "pandoc-spec.options.json";

const fileOptions: unknown = fs.existsSync(configurationFile) ?
JSON.parse(fs.readFileSync(configurationFile, {
encoding: "utf8"
})) :
undefined;
Expand Down
7 changes: 3 additions & 4 deletions src/puppeteer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ export class PuppeteerConfigurator {

this._inputConfigurationFile = path.resolve(inputDirectory, configurationFile);

const workingConfigurationFile = path.resolve(configurationFile);

if (fs.existsSync(this._inputConfigurationFile)) {
// Assume file is only partially complete.
this._state = State.FromInputPartial;

this._configurationFileContent = fs.readFileSync(this._inputConfigurationFile).toString();
} else if (fs.existsSync(workingConfigurationFile)) {
} else if (fs.existsSync(configurationFile)) {
this._state = State.FromWorking;

this._configurationFileContent = fs.readFileSync(workingConfigurationFile).toString();
this._configurationFileContent = fs.readFileSync(configurationFile).toString();
} else {
this._state = State.NotFound;

Expand Down

0 comments on commit 81db544

Please sign in to comment.