Skip to content

Commit

Permalink
fix(ci): wrong ‘node' and ‘deploy' workflows
Browse files Browse the repository at this point in the history
Error:
- In the `node` workflow, the `npm ci` command needs the `package-lock.json` file to work, but this file is removed before running `npm install` with the npm `preinstall` script.
- In the `node` workflow, the version 16 check does not work because the `console.log` is not allowed by eslint in the `EditorJson.vue` file.

Solution:
- Update the `preinstall` npm script to make it faster.
- In the `node` workflow, use the `npm install` command instead of `npm ci`, this command auto runs the npm `preinstall` script which already does a clean install, removing the `node_modules` folder and the `package-lock.json` file.
- Disables the `no-console` slint rule in the `EditorJson.vue` file.

Resolutions:
- https://stackoverflow.com/a/68095189/10855837
- https://stackoverflow.com/a/53325242/10855837
- rogeriochaves/npm-force-resolutions#17
- https://www.npmjs.com/package/force-resolutions
  • Loading branch information
beatrizsmerino committed Jul 5, 2022
1 parent 625a904 commit 160fbb4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Setup Node.js for use with actions
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.x

- name: Checkout branch
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm install
- run: npm run build --if-present
- run: npm test --if-present
2 changes: 1 addition & 1 deletion gh-pages-deploy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-console */
// eslint-disable no-console
const execa = require('execa');
const emoji = require('node-emoji');
const chalk = require('chalk');
Expand Down
61 changes: 26 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"preinstall": "rm -rf node_modules package-lock.json && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions",
"preinstall": "(rm -rf node_modules package-lock.json && npm install --package-lock-only --ignore-scripts --no-audit); npx force-resolutions",
"postinstall": "npm run lint",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
Expand Down
1 change: 1 addition & 0 deletions src/components/EditorJSON.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
},
methods: {
onJsonChange(value) {
// eslint-disable-next-line no-console
console.log('value:', value);
},
getPikachu() {
Expand Down

0 comments on commit 160fbb4

Please sign in to comment.