From 3002df22de35c44117a3a5b83c6b731cf8132512 Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Wed, 6 Feb 2019 17:26:46 -0800 Subject: Updated publish script --- build_and_publish_to_github_pages.js | 26 -------------------------- npm_run_puplish.js | 26 ++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 build_and_publish_to_github_pages.js create mode 100644 npm_run_puplish.js diff --git a/build_and_publish_to_github_pages.js b/build_and_publish_to_github_pages.js deleted file mode 100644 index e4f0da9..0000000 --- a/build_and_publish_to_github_pages.js +++ /dev/null @@ -1,26 +0,0 @@ -const ghpages = require('gh-pages'); -const path = require('path'); -const fs = require('fs-extra') - -const pathOfPublic = path.join(__dirname, 'public'); -const pathOfV1 = path.join(pathOfPublic, 'v1'); -const pathOfApps = path.join(pathOfV1, 'apps'); -const pathOfList = path.join(pathOfV1, 'autoGeneratedList.json'); - -fs.readdir(pathOfApps, function (err, items) { - for (var i = 0; i < items.length; i++) { - items[i] = items[i].replace('.json', ''); - } - - fs.outputJsonSync(pathOfList, { - appList: items - }); - - ghpages.publish('public', function (err) { - if (err) - console.log(err); - else - console.log('Built and deployed successfully'); - }); - -}); \ No newline at end of file diff --git a/npm_run_puplish.js b/npm_run_puplish.js new file mode 100644 index 0000000..e4f0da9 --- /dev/null +++ b/npm_run_puplish.js @@ -0,0 +1,26 @@ +const ghpages = require('gh-pages'); +const path = require('path'); +const fs = require('fs-extra') + +const pathOfPublic = path.join(__dirname, 'public'); +const pathOfV1 = path.join(pathOfPublic, 'v1'); +const pathOfApps = path.join(pathOfV1, 'apps'); +const pathOfList = path.join(pathOfV1, 'autoGeneratedList.json'); + +fs.readdir(pathOfApps, function (err, items) { + for (var i = 0; i < items.length; i++) { + items[i] = items[i].replace('.json', ''); + } + + fs.outputJsonSync(pathOfList, { + appList: items + }); + + ghpages.publish('public', function (err) { + if (err) + console.log(err); + else + console.log('Built and deployed successfully'); + }); + +}); \ No newline at end of file diff --git a/package.json b/package.json index 16d6c3e..564cff7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "One Click App Repository for CapRover", "main": "build_and_publish_to_github_pages.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "publish": "node ./npm_run_puplish.js" }, "repository": { "type": "git", -- cgit v1.2.3