0.6.9 • Published 4 years ago

windowslib v0.6.9

Weekly downloads
61
License
Apache Public Lic...
Repository
github
Last release
4 years ago

Windows Utility Library

A suite of Windows development-related functions.

Installation

npm install windowslib

API

OS

os.name

Retrieves the operating system name.

Returns a String.

import { os } from 'windowslib';

console.log(os.name);
Microsoft Windows 10 Home Single Language

os.version

Retrieves the operating system version.

Returns a String.

import { os } from 'windowslib';

console.log(os.version);
10.0.17763

Visual Studio

getVisualStudios(opts)

ArgumentTypeDescriptionDefault
optsObjectVarious options.
opts.allBooleanWhen true, returns all Visual Studio installations regardless if they are "complete".false
opts.forceBooleanWhen true, bypasses cache and forces redetection.false

Returns a Promise that resolves Array of windowslib.vs.VisualStudio objects.

import windowslib from 'windowslib';

const { getVisualStudios } = windowslib.vs;

console.log(await getVisualStudios());
[
  VisualStudio {
    complete: true,
    msbuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe',
    name: 'Visual Studio Community 2017',
    path: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community',
    productId: 'Microsoft.VisualStudio.Product.Community',
    version: '15.9.28307.665',
    vsdevcmd: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\VsDevCmd.bat'
  },
  VisualStudio {
    complete: true,
    msbuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe',
    name: 'Visual Studio Community 2019',
    path: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community',
    productId: 'Microsoft.VisualStudio.Product.Community',
    version: '16.1.28917.181',
    vsdevcmd: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\Tools\\VsDevCmd.bat'
  }
]

Windows SDKs

Windows SDKs are installed by Visual Studio, but live outside Visual Studio. Furthermore, a Windows SDK can contain multiple revisions. This API allows you to scan a directory for Windows SDKs or a list of directories derived from values in the Windows Registry to scan for Windows SDKs.

detectSDKs(dir)

Detects Windows SDKs in a specific directory.

ArgumentTypeDescription
dirStringA path to scan for Windows SDKs.

Returns an Array of windowslib.sdk.SDK objects.

import windowslib from 'windowslib';

const sdks = windowslib.sdk.detectSDKs('/path/to/windows/sdk');

console.log(sdks);
[
  SDK {
    majorVersion: 10,
    version: '10.0.17763.0',
    binDir: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0',
    includeDir: 'C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0',
    platformsDir: 'C:\\Program Files (x86)\\Windows Kits\\10\\Platforms\\UAP\\10.0.17763.0',
    executables: {
      makecert: {
        arm: null,
        arm64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\arm64\\makecert.exe',
        x86: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\makecert.exe',
        x64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64\\makecert.exe'
      },
      pvk2pfx: {
        arm: null,
        arm64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\arm64\\pvk2pfx.exe',
        x86: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\pvk2pfx.exe',
        x64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64\\pvk2pfx.exe'
      },
      WinAppDeployCmd: {
        arm: null,
        arm64: null,
        x86: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\WinAppDeployCmd.exe',
        x64: null
      }
    },
    name: 'Windows 10, version 1809',
    minVSVersion: '15.0.25909.02'
  }
]

getWindowsSDKs(force)

Gets Windows SDKs based on the default path in addition to paths derived from values in the Windows Registry.

ArgumentTypeDescriptionDefault
forceBooleanWhen true, bypasses cache and forces redetection.false

Returns a Promise that resolves an Array of windowslib.sdk.SDK objects.

import windowslib from 'windowslib';

const sdks = await windowslib.sdk.getWindowsSDKs();

console.log(sdks);
[
  SDK {
    majorVersion: 10,
    version: '10.0.17763.0',
    binDir: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0',
    includeDir: 'C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0',
    platformsDir: 'C:\\Program Files (x86)\\Windows Kits\\10\\Platforms\\UAP\\10.0.17763.0',
    executables: {
      makecert: {
        arm: null,
        arm64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\arm64\\makecert.exe',
        x86: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\makecert.exe',
        x64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64\\makecert.exe'
      },
      pvk2pfx: {
        arm: null,
        arm64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\arm64\\pvk2pfx.exe',
        x86: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\pvk2pfx.exe',
        x64: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64\\pvk2pfx.exe'
      },
      WinAppDeployCmd: {
        arm: null,
        arm64: null,
        x86: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\WinAppDeployCmd.exe',
        x64: null
      }
    },
    name: 'Windows 10, version 1809',
    minVSVersion: '15.0.25909.02'
  }
]

vswhere

vswhere is a tool developed by Microsoft for locating Visual Studio installations. It's distributed with Visual Studio 2017 15.2. windowslib exposes an API that attempts to locate vswhere. It is used by windowslib's Visual Studio API, but you can use it directly.

import windowslib from 'windowslib';

const vswhere = await windowslib.vswhere.getVSWhere();
console.log(vswhere);
VSWhere {
	exe: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe'
}
const products = await vswhere.query();
[
  {
    instanceId: '07c9e7e5',
    installDate: '2019-04-25T20:47:12Z',
    installationName: 'VisualStudio/15.9.12+28307.665',
    installationPath: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community',
    installationVersion: '15.9.28307.665',
    productId: 'Microsoft.VisualStudio.Product.Community',
    productPath: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\devenv.exe',
    state: 4294967295,
    isComplete: true,
    isLaunchable: true,
    isPrerelease: false,
    isRebootRequired: false,
    displayName: 'Visual Studio Community 2017',
    description: 'Free, fully-featured IDE for students, open-source and individual developers',
    channelId: 'VisualStudio.15.Release',
    channelUri: 'https://aka.ms/vs/15/release/channel',
    enginePath: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service',
    releaseNotes: 'https://go.microsoft.com/fwlink/?LinkId=660692#15.9.12',
    thirdPartyNotices: 'https://go.microsoft.com/fwlink/?LinkId=660708',
    updateDate: '2019-05-23T18:27:39.6289144Z',
    catalog: {
      buildBranch: 'd15.9',
      buildVersion: '15.9.28307.665',
      id: 'VisualStudio/15.9.12+28307.665',
      localBuild: 'build-lab',
      manifestName: 'VisualStudio',
      manifestType: 'installer',
      productDisplayVersion: '15.9.12',
      productLine: 'Dev15',
      productLineVersion: '2017',
      productMilestone: 'RTW',
      productMilestoneIsPreRelease: 'False',
      productName: 'Visual Studio',
      productPatchVersion: '12',
      productPreReleaseMilestoneSuffix: '1.0',
      productRelease: 'RTW',
      productSemanticVersion: '15.9.12+28307.665',
      requiredEngineVersion: '1.18.1049.33485'
    },
    properties: {
      campaignId: '13132988.1488924318',
      channelManifestId: 'VisualStudio.15.Release/15.9.12+28307.665',
      nickname: '',
      setupEngineFilePath: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe'
    }
  }
]

Certs

Not implemented yet.

License

This project is open source under the Apache Public License v2 and is developed by Axway, Inc and the community. Please read the LICENSE file included in this distribution for more information.

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

6 years ago

0.6.9

6 years ago

0.6.8

6 years ago

0.6.7

7 years ago

0.6.6

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.5

7 years ago

0.5.4

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

8 years ago

0.4.30

8 years ago

0.4.29

8 years ago

0.4.27

8 years ago

0.4.25

8 years ago

0.4.24

8 years ago

0.4.23

8 years ago

0.4.22

8 years ago

0.4.21

8 years ago

0.4.20

8 years ago

0.4.19

8 years ago

0.4.18

8 years ago

0.4.17

8 years ago

0.4.16

8 years ago

0.4.15

8 years ago

0.4.13

9 years ago

0.4.12

9 years ago

0.4.11

9 years ago

0.4.10

9 years ago

0.4.9

9 years ago

0.4.8

9 years ago

0.4.7

9 years ago

0.4.6

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.22

9 years ago

0.1.21

9 years ago

0.1.20

9 years ago

0.1.19

9 years ago

0.1.18

9 years ago

0.1.17

9 years ago

0.1.16

9 years ago

0.1.15

9 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago