Skip to content

Commit

Permalink
Update del to use latest version
Browse files Browse the repository at this point in the history
Also add Node.js 19 to build.
Also fix small eslint problems.
Also update devcontainer to use latest versions.
  • Loading branch information
giggio committed Oct 27, 2022
1 parent ec78324 commit ad1c308
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 266 deletions.
8 changes: 4 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:22.04
LABEL maintainer="Giovanni Bassi <giggio@giggio.net>"

ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -13,7 +13,7 @@ RUN apt-get update && \
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER $USERNAME
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
RUN [ "/bin/bash", "-c", "source $HOME/.nvm/nvm.sh && nvm i --no-progress 12.22.7 && nvm i --no-progress 14.18.1 && nvm i --no-progress 16.13.0 && nvm i --no-progress 17.0.1 " ]
RUN [ "/bin/bash", "-c", "source $HOME/.nvm/nvm.sh && nvm alias default 17" ]
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
RUN [ "/bin/bash", "-c", "source $HOME/.nvm/nvm.sh && nvm i --no-progress 14.20.0 && nvm i --no-progress 16.17.1 && nvm i --no-progress 18.11.0 && nvm i --no-progress 19.0.0 " ]
RUN [ "/bin/bash", "-c", "source $HOME/.nvm/nvm.sh && nvm alias default 19" ]
ENV DEBIAN_FRONTEND=dialog
52 changes: 26 additions & 26 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"extends": "eslint:recommended",
"env": {
"browser": false,
"commonjs": true,
"es6": true,
"node": true
"extends": "eslint:recommended",
"env": {
"browser": false,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": false
},
"parserOptions": {
"ecmaFeatures": {
"jsx": false
},
"sourceType": "module",
"ecmaVersion": 2017
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn",
"semi": "error",
"no-console": "off",
"no-var": "error",
"prefer-const": "error"
}
"sourceType": "module",
"ecmaVersion": 2020
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn",
"semi": "error",
"no-console": "off",
"no-var": "error",
"prefer-const": "error"
}
}
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["14.x", "16.x", "18.x"]
node: ["14.x", "16.x", "18.x", "19.x"]
runner: ["windows-latest", "ubuntu-latest", "macos-latest"]
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["14", "16", "18"]
node: ["14", "16", "18", "19"]
steps:
- uses: actions/checkout@v2
- uses: uraimo/run-on-arch-action@v2.1.1
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.x
node-version: 19.x
registry-url: "https://registry.npmjs.org"
- run: npm publish
env:
Expand Down
16 changes: 8 additions & 8 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const fs = require('fs');
const helper = require('./lib/chromedriver');
const axios = require('axios').default;
const path = require('path');
const del = require('del');
const child_process = require('child_process');
const os = require('os');
const url = require('url');
Expand Down Expand Up @@ -267,7 +266,7 @@ async function requestBinary(requestOptions, filePath) {
if (error.response.data) {
error.response.data.on('data', data => console.error(data.toString('utf8')));
try {
await finishedAsync(error.response.data)
await finishedAsync(error.response.data);
} catch (error) {
console.error('Error downloading entire response:', error);
}
Expand Down Expand Up @@ -307,7 +306,8 @@ async function extractDownload(dirToExtractTo) {
}

async function copyIntoPlace(originPath, targetPath) {
await del(targetPath, { force: true });
const { deleteAsync } = await import('del');
await deleteAsync(targetPath, { force: true });
console.log(`Copying from ${originPath} to target path ${targetPath}`);
fs.mkdirSync(targetPath);

Expand Down Expand Up @@ -347,7 +347,7 @@ function getMacOsRealArch() {
return 'mac64_m1';
}

return 'mac_arm64'
return 'mac_arm64';
}

if (process.arch === 'x64') {
Expand All @@ -364,14 +364,14 @@ function isEmulatedRosettaEnvironment() {
const proc = child_process.spawnSync('sysctl', ['-in', 'sysctl.proc_translated']);

// When run with `-in`, the return code is 0 even if there is no `sysctl.proc_translated`
if(proc.status) {
throw new Error('Unexpected return code from sysctl: ' + proc.status);
if (proc.status) {
throw new Error('Unexpected return code from sysctl: ' + proc.status);
}

// If there is no `sysctl.proc_translated` (i.e. not rosetta) then nothing is printed to
// stdout
if(!proc.stdout) {
return false
if (!proc.stdout) {
return false;
}

const processTranslated = proc.stdout.toString().trim();
Expand Down
Loading

0 comments on commit ad1c308

Please sign in to comment.