Skip to content

Commit

Permalink
feat: check for dashes to args and add or remove them as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgriffing committed Mar 6, 2020
1 parent 6b671af commit 4e6c56a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,25 @@ async function run() {
await exec.exec(`${pkgManager} install`);
console.log("Finished installing dependencies.");

const scullyArgs = core.getInput("scully-args");
const buildArgs = core.getInput("build-args");
let buildArgs = core.getInput("build-args").trim();
// Add dashes if a user passes args and doesnt have them.
if (buildArgs !== "" && buildArgs.indexOf("-- ") !== 0) {
buildArgs = `-- ${buildArgs}`;
}

let scullyArgs = core.getInput("scully-args").trim();
// Remove dashes if the scullyArgs have them
// This is because we now pass --nw by default.
if (scullyArgs.indexOf("-- ") === 0) {
scullyArgs = scullyArgs.slice(3);
}

console.log("Ready to build your Scully site!");
console.log(`Building with: ${pkgManager} run build ${buildArgs}`);
await exec.exec(`${pkgManager} run build ${buildArgs}`, []);
console.log("Finished building your site.");

await exec.exec(`${pkgManager} run scully ${scullyArgs}`, []);
await exec.exec(`${pkgManager} run scully -- --nw ${scullyArgs}`, []);
console.log("Finished Scullying your site.");

const cnameExists = await ioUtil.exists("./CNAME");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scully-gh-pages-action",
"version": "1.1.0",
"version": "1.2.0",
"description": "GitHub Action to build and deploy your Scully site to GitHub Pages ❤️🎩",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4e6c56a

Please sign in to comment.