Skip to content

Commit

Permalink
pugneum/cli: read input from file instead of stdin
Browse files Browse the repository at this point in the history
Pugneum sites will have a pugneum.json file
which specifies the options for building them.
Read in this file implicitly instead of reading standard input.
  • Loading branch information
matheusmoreira committed Sep 9, 2023
1 parent 92d96aa commit 7b45236
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/pugneum/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const EXIT_CODES = {
NOT_FILE: 5
};

function readAndValidateInput(stream) {
const input = fs.readFileSync(stream.fd, 'utf8');
function readAndValidateInput(path) {
const input = fs.readFileSync(path, 'utf8');
const json = JSON.parse(input);
const {inputDirectory, outputDirectory, baseDirectory} = json;

Expand All @@ -53,7 +53,7 @@ function readAndValidateInput(stream) {
return {inputDirectory, outputDirectory, baseDirectory};
}

const {baseDirectory, inputDirectory, outputDirectory} = readAndValidateInput(process.stdin);
const {baseDirectory, inputDirectory, outputDirectory} = readAndValidateInput('pugneum.json');

const pg = require('pugneum');
const pgExtension = /\.pg$/;
Expand Down

0 comments on commit 7b45236

Please sign in to comment.