From e3ea88853bb45a5e8b14b44f464df1d6176b968c Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 2 Jul 2022 23:31:48 +0200 Subject: Use package.json scripts for netlify commands --- netlify.toml | 8 ++++---- package-lock.json | 3 ++- package.json | 12 +++++++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/netlify.toml b/netlify.toml index c1cdc73..a1dbd9f 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,6 +1,6 @@ [build] publish = 'public' - command = 'hugo --source=exampleSite --gc --verbose --destination ../public' + command = 'npm run build:prod' [context.production.environment] HUGO_VERSION = '0.101.0' @@ -9,20 +9,20 @@ HUGO_GOOGLEANALYTICS = 'G-DP9Q137C3X' [context.split1] - command = 'hugo --source=exampleSite --gc --enableGitInfo --destination ../public' + command = 'npm run build:split1' [context.split1.environment] HUGO_VERSION = '0.101.0' HUGO_ENV = 'production' [context.deploy-preview] - command = 'hugo --source=exampleSite --gc --buildDrafts --buildFuture --baseURL $DEPLOY_PRIME_URL --destination ../public' + command = 'npm run build:preview' [context.deploy-preview.environment] HUGO_VERSION = '0.101.0' [context.branch-deploy] - command = 'hugo --source=exampleSite --gc --baseURL $DEPLOY_PRIME_URL --destination ../public' + command = 'npm run build:branch' [context.branch-deploy.environment] HUGO_VERSION = '0.101.0' diff --git a/package-lock.json b/package-lock.json index e345e80..567f49d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,8 @@ "eslint": "^8.18.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-import": "^2.25.4", - "eslint-plugin-node": "^11.1.0" + "eslint-plugin-node": "^11.1.0", + "rimraf": "^3.0.2" } }, "node_modules/@eslint/eslintrc": { diff --git a/package.json b/package.json index 471dcce..05c1145 100644 --- a/package.json +++ b/package.json @@ -20,17 +20,23 @@ "author": "Serghei Iakovlev", "main": "index.js", "scripts": { - "build": "hugo --source=exampleSite --gc --verbose --minify --destination ../public", + "clean": "rimraf public", + "build": "hugo --source=exampleSite --gc --verbose --destination ../public", + "build:prod": "hugo --source=exampleSite --destination ../public", + "build:split1": "hugo --source=exampleSite --enableGitInfo --destination ../public", + "build:preview": "HUGO_PREVIEW=true hugo --source=exampleSite --buildDrafts --buildFuture --baseURL $DEPLOY_PRIME_URL --destination ../public", + "build:branch": "hugo --source=exampleSite --buildDrafts --buildFuture --baseURL $DEPLOY_PRIME_URL --destination ../public", + "server": "HUGO_PREVIEW=true HUGO_ENV=development hugo server --verbose --source=exampleSite --buildDrafts --buildFuture --ignoreCache --disableFastRender", "lint": "npm run lint:js && npm run lint:editorconfig", "lint:editorconfig": "editorconfig-checker", "lint:js": "eslint static/js/*.js", - "vendor:js": "cp node_modules/jquery/dist/jquery.min.js assets/js/vendor", - "server": "hugo server --source=exampleSite --disableFastRender" + "vendor:js": "cp node_modules/jquery/dist/jquery.min.js assets/js/vendor" }, "dependencies": { "jquery": "^3.6.0" }, "devDependencies": { + "rimraf": "^3.0.2", "editorconfig-checker": "^4.0.2", "eslint": "^8.18.0", "eslint-config-airbnb-base": "^15.0.0", -- cgit v1.2.3