Warn if current is not the last version (#1161)

fix https://github.com/ethereum/remix-project/issues/938
pull/1176/head^2
yann300 4 years ago committed by GitHub
parent d9d8ad53f6
commit 7c80d0d6e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      libs/remixd/package.json
  2. 16
      libs/remixd/src/bin/remixd.ts
  3. 20
      package-lock.json
  4. 3
      package.json

@ -44,7 +44,9 @@
"commander": "^2.20.3", "commander": "^2.20.3",
"fs-extra": "^3.0.1", "fs-extra": "^3.0.1",
"isbinaryfile": "^3.0.2", "isbinaryfile": "^3.0.2",
"ws": "^7.3.0" "ws": "^7.3.0",
"latest-version": "^5.1.0",
"semver": "^6.3.0"
}, },
"python": { "python": {
"execPath": "python3", "execPath": "python3",

@ -1,4 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import latestVersion from 'latest-version'
import * as semver from 'semver'
import WebSocket from '../websocket' import WebSocket from '../websocket'
import * as servicesList from '../serviceList' import * as servicesList from '../serviceList'
import * as WS from 'ws' // eslint-disable-line import * as WS from 'ws' // eslint-disable-line
@ -8,6 +10,18 @@ import * as fs from 'fs-extra'
import * as path from 'path' import * as path from 'path'
import * as program from 'commander' import * as program from 'commander'
async function warnLatestVersion () {
const latest = await latestVersion('@remix-project/remixd')
const pjson = require('../package.json')
if (semver.eq(latest, pjson.version)) {
console.log('\x1b[32m%s\x1b[0m', `[INFO] you are using the latest version ${latest}`)
} else if (semver.gt(latest, pjson.version)) {
console.log('\x1b[33m%s\x1b[0m', `[WARN] latest version of remixd is ${latest}, you are using ${pjson.version}`)
console.log('\x1b[33m%s\x1b[0m', '[WARN] please update using the following command:')
console.log('\x1b[33m%s\x1b[0m', '[WARN] npm install @remix-project/remixd -g')
}
}
const services = { const services = {
git: (readOnly: boolean) => new servicesList.GitClient(readOnly), git: (readOnly: boolean) => new servicesList.GitClient(readOnly),
folder: (readOnly: boolean) => new servicesList.Sharedfolder(readOnly) folder: (readOnly: boolean) => new servicesList.Sharedfolder(readOnly)
@ -40,6 +54,8 @@ function startService<S extends 'git' | 'folder'> (service: S, callback: (ws: WS
}).parse(process.argv) }).parse(process.argv)
// eslint-disable-next-line // eslint-disable-next-line
await warnLatestVersion()
if (!program.remixIde) { if (!program.remixIde) {
console.log('\x1b[33m%s\x1b[0m', '[WARN] You can only connect to remixd from one of the supported origins.') console.log('\x1b[33m%s\x1b[0m', '[WARN] You can only connect to remixd from one of the supported origins.')
} else { } else {

20
package-lock.json generated

@ -15178,8 +15178,7 @@
"deep-extend": { "deep-extend": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
"dev": true
}, },
"deep-is": { "deep-is": {
"version": "0.1.3", "version": "0.1.3",
@ -21217,8 +21216,7 @@
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
"dev": true
}, },
"init-package-json": { "init-package-json": {
"version": "1.10.3", "version": "1.10.3",
@ -24668,7 +24666,6 @@
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz",
"integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==",
"dev": true,
"requires": { "requires": {
"package-json": "^6.3.0" "package-json": "^6.3.0"
} }
@ -33827,7 +33824,6 @@
"version": "6.5.0", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz",
"integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==",
"dev": true,
"requires": { "requires": {
"got": "^9.6.0", "got": "^9.6.0",
"registry-auth-token": "^4.0.0", "registry-auth-token": "^4.0.0",
@ -35709,7 +35705,6 @@
"version": "1.2.8", "version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
"dev": true,
"requires": { "requires": {
"deep-extend": "^0.6.0", "deep-extend": "^0.6.0",
"ini": "~1.3.0", "ini": "~1.3.0",
@ -36217,10 +36212,9 @@
} }
}, },
"registry-auth-token": { "registry-auth-token": {
"version": "4.2.0", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz",
"integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==", "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==",
"dev": true,
"requires": { "requires": {
"rc": "^1.2.8" "rc": "^1.2.8"
} }
@ -36229,7 +36223,6 @@
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz",
"integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==",
"dev": true,
"requires": { "requires": {
"rc": "^1.2.8" "rc": "^1.2.8"
} }
@ -39088,8 +39081,7 @@
"strip-json-comments": { "strip-json-comments": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
"dev": true
}, },
"strong-log-transformer": { "strong-log-transformer": {
"version": "2.1.0", "version": "2.1.0",

@ -159,6 +159,7 @@
"isbinaryfile": "^3.0.2", "isbinaryfile": "^3.0.2",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"jszip": "^3.6.0", "jszip": "^3.6.0",
"latest-version": "^5.1.0",
"merge": "^1.2.0", "merge": "^1.2.0",
"npm-install-version": "^6.0.2", "npm-install-version": "^6.0.2",
"react": "16.13.1", "react": "16.13.1",
@ -273,7 +274,7 @@
"request": "^2.83.0", "request": "^2.83.0",
"rimraf": "^2.6.1", "rimraf": "^2.6.1",
"selenium-standalone": "^6.17.0", "selenium-standalone": "^6.17.0",
"semver": "^6.1.2", "semver": "^6.3.0",
"solc": "0.7.4", "solc": "0.7.4",
"swarmgw": "^0.3.1", "swarmgw": "^0.3.1",
"tap-spec": "^5.0.0", "tap-spec": "^5.0.0",

Loading…
Cancel
Save