Install
$ pnpm install -D os-lang
$ yarn add -D os-lang
$ npm install -D os-lang
Usage
use import
import { osLang, osLangSync } from '@node-kit/os-lang'
osLang()
osLangSync()
use require
const { osLang, osLangSync } = require('@node-kit/os-lang')
osLang()
osLangSync()
API reference
- Usage:
osLang(cwd)
& osLangSync(cwd)
- Parameters:
Param | Description | Type | Optional value | Required | Default value |
---|
cwd | running path | string | - | false | - |
declare type ModulesYML = Record<string, unknown> & {
packageManager: string
}
declare function normalizePMSpec(pm: string): PackageManager
declare interface PackageManager {
name: string
version?: string
}
declare function osLang(cwd?: string): Promise<PackageManager | null>
declare function osLangSync(cwd?: string): PackageManager | null
- simple use
import { osLang, osLangSync } from '@node-kit/os-lang'
osLang().then(info => {
console.log('The package manager is: ', info)
})
console.log('The package manager is: ', osLangSync())
Issues & Support
Please open an issue here.
License
MIT