Skip to content

Commit

Permalink
fix(ci): wrong 'node' and 'deploy' workflows when using node versions…
Browse files Browse the repository at this point in the history
… >14

Error:
- In the `node` workflow, the `npm ci` command does not work, it needs the `package-lock.json` file to work, but this file is removed by the npm `preinstall` script.
- In the `node` workflow, the version 16 check does not work because the `console.log` file is not allowed by eslint in the `EditorJson.vue` file.

Solution:
- Use in workflows the `npm install` command instead of `npm ci`. The `npm install` automatically 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.
- Use `node` version 14 for the project, the following versions still do not work.

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 cecba97
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v3

- name: Clean install dependencies
run: npm ci
- name: Clean install dependencies (install:clean)
run: npm install

- name: Run deploy script
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
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
106 changes: 53 additions & 53 deletions package-lock.json

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

8 changes: 6 additions & 2 deletions src/components/EditorJSON.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
},
methods: {
onJsonChange(value) {
/* eslint-disable no-alert, no-console, no-debugger */
console.log('value:', value);
/* eslint-enable no-alert, no-console */
},
getPikachu() {
const url = 'https://pokeapi.co/api/v2/pokemon/pikachu';
Expand All @@ -72,13 +74,15 @@
});
},
onCopy() {
// eslint-disable-next-line no-alert
/* eslint-disable no-alert, no-console, no-debugger */
alert('Copied JSON to the clipboard');
/* eslint-enable no-alert, no-console */
},
onError(e) {
// eslint-disable-next-line no-alert, no-console
/* eslint-disable no-alert, no-console, no-debugger */
alert('Failed to copy JSON to the clipboard');
console.log(e);
/* eslint-enable no-alert, no-console */
},
onSave() {
localStorage.setItem('editor-json', JSON.stringify(this.json));
Expand Down

0 comments on commit cecba97

Please sign in to comment.