From 0e7fbcbd0bc4b5e40621a293ed328846b3da56eb Mon Sep 17 00:00:00 2001 From: curben Date: Fri, 26 Oct 2018 17:49:15 +1030 Subject: [PATCH] Use local package only and replace 'latest' with version number https://firstdoit.com/no-need-for-globals-using-npm-dependencies-in-npm-scripts-3dfb478908?gi=9f1ea80a068 Specify 'latest' doesn't necessarily install the latest version https://stackoverflow.com/a/39650983 --- .gitlab-ci.yml | 8 ++------ netlify.toml | 2 +- package.json | 30 +++++++++++++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f34cdf8..14623e9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,12 +6,8 @@ test: - node_modules/ # Node modules and dependencies script: - - npm install -g snyk hexo-cli - - npm install # install node modules - - snyk auth $SNYK_TOKEN - - snyk protect # Apply patches to node modules - - snyk test # Check node modules for vulnerability - - hexo generate # Generate static files for debugging + - npm install + - npm run build only: - master # this job will affect only the 'master' branch diff --git a/netlify.toml b/netlify.toml index 81c1126..531e285 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,6 +1,6 @@ [context.production] publish = "public" - command = "snyk auth $SNYK_TOKEN && snyk protect && snyk test && hexo generate" + command = "npm run build" [[headers]] for = "/*" diff --git a/package.json b/package.json index 79bcb27..7bca29e 100644 --- a/package.json +++ b/package.json @@ -5,18 +5,22 @@ "hexo": { "version": "3.8.0" }, + "scripts": { + "build": "snyk auth $SNYK_TOKEN && snyk protect && snyk test && hexo generate" + }, "dependencies": { - "hexo": "latest", - "hexo-nofollow": "latest", - "hexo-generator-archive": "latest", - "hexo-generator-category": "latest", - "hexo-generator-index": "latest", - "hexo-generator-tag": "latest", - "hexo-renderer-ejs": "latest", - "hexo-renderer-marked": "latest", - "hexo-renderer-stylus": "latest", - "hexo-server": "latest", - "hexo-yam": "latest", - "snyk": "latest" + "hexo": "^3.8.0", + "hexo-cli": "^1.1.0", + "hexo-generator-archive": "^0.1.5", + "hexo-generator-category": "^0.1.3", + "hexo-generator-index": "^0.2.1", + "hexo-generator-tag": "^0.2.0", + "hexo-nofollow": "^1.0.2", + "hexo-renderer-ejs": "^0.3.1", + "hexo-renderer-marked": "^0.3.2", + "hexo-renderer-stylus": "^0.3.3", + "hexo-server": "^0.3.3", + "hexo-yam": "^1.0.2", + "snyk": "^1.105.0" } -} \ No newline at end of file +}