Code Monkey home page Code Monkey logo

all-node-versions's Introduction

GitHub stats

all-node-versions's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar ehmicky avatar maxim-mazurok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

all-node-versions's Issues

Type definitions for TypeScript

Guidelines

  • Please search other issues to make sure this feature has not already been requested.

Which problem is this feature request solving?

I need to use this with typescript, and it doesn't have type definitions

Describe the solution you'd like

This is what works for me:

declare module "all-node-versions" {
  function DefaultFunction(options?: {
    mirror?: string;
    fetch?: boolean;
  }): Promise<{
    versions: string[];
    majors: { major: number; latest: string; lts?: string }[];
  }>;
  export = DefaultFunction;
}

in typings\all-node-versions\index.d.ts
with "typeRoots": ["./node_modules/@types", "./typings"], in tsconfig.json

Pull request (optional)

  • I can submit a pull request.

Add default npm versions

Guidelines

  • Please search other issues to make sure this feature has not already been requested.

Which problem is this feature request solving?

I'm writing a script that would use listr and nodeenv to install deps and run tests for all projects recursively, it detects required node and npm versions from package.json engines section, and to optimize it I need to know if node version I'm installing is shipped with npm version that I need by default, or if I need to pass --npm=... --with-npm to nodeenv.

Describe the solution you'd like

Something like [{node: "16.3.0", npm: "7.15.1"}, ...]

Pull request (optional)

  • I can submit a pull request.

SyntaxError: await is only valid in async function

Error:

Following instructions as per the README results in:

SyntaxError: await is only valid in async function

Steps to reproduce:

Following the README is enough:

username@hostname MSYS /d
$ mkdir temp

username@hostname MSYS /d
$ cd temp

username@hostname MSYS /d/temp
$ npm install all-node-versions

added 76 packages, and audited 77 packages in 9s

9 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

username@hostname MSYS /d/temp
$ nano all-node-versions.js

And paste:

const allNodeVersions = require('all-node-versions')

const { versions, majors } = await allNodeVersions(options)

console.log(versions)
// ['13.13.0', '13.12.0', ..., '0.1.15', '0.1.14']

console.log(majors)
// [
//   { major: 13, latest: '13.13.0' },
//   { major: 12, latest: '12.16.2', lts: 'erbium' },
//   { major: 11, latest: '11.15.0' },
//   { major: 10, latest: '10.20.1', lts: 'dubnium' },
//   { major: 9, latest: '9.11.2' },
//   { major: 8, latest: '8.17.0', lts: 'carbon' },
//   { major: 7, latest: '7.10.1' },
//   { major: 6, latest: '6.17.1', lts: 'boron' },
//   { major: 5, latest: '5.12.0' },
//   { major: 4, latest: '4.9.1', lts: 'argon' },
//   { major: 0, latest: '0.12.18' }
// ]

After saving and exiting:

username@hostname MSYS /d/temp
$ node all-node-versions.js
D:\temp\all-node-versions.js:3

const { versions, majors } = await allNodeVersions(options)
                             ^^^^^

SyntaxError: await is only valid in async function
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.