Socket
Socket
Sign inDemoInstall

@definitelytyped/utils

Package Overview
Dependencies
Maintainers
7
Versions
260
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@definitelytyped/utils - npm Package Compare versions

Comparing version 0.0.188 to 0.0.189

9

CHANGELOG.md
# @definitelytyped/utils
## 0.0.189
### Patch Changes
- f53f17f6: Use package dependencies to manage TypeScript, instead of `$HOME/.dts`
- Updated dependencies [f53f17f6]
- Updated dependencies [f53f17f6]
- @definitelytyped/typescript-packages@0.0.2
## 0.0.188

@@ -4,0 +13,0 @@

6

dist/typescript-installer.d.ts
import { TypeScriptVersion } from "@definitelytyped/typescript-versions";
export type TsVersion = TypeScriptVersion | "local";
export declare function installAllTypeScriptVersions(): Promise<void>;
export declare function installTypeScriptNext(): Promise<void>;
export declare function install(version: TsVersion | "next" | "rc"): Promise<void>;
export declare function cleanTypeScriptInstalls(): Promise<void>;
export declare function typeScriptPath(version: TsVersion | "next" | "rc", tsLocal: string | undefined): string;
export declare function typeScriptPath(version: TsVersion, tsLocal: string | undefined): string;

@@ -26,52 +26,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.typeScriptPath = exports.cleanTypeScriptInstalls = exports.install = exports.installTypeScriptNext = exports.installAllTypeScriptVersions = void 0;
const assert = require("assert");
const child_process_1 = require("child_process");
const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
const process = __importStar(require("process"));
const typescript_versions_1 = require("@definitelytyped/typescript-versions");
const installsDir = path.join(os.homedir(), ".dts", "typescript-installs");
async function installAllTypeScriptVersions() {
for (const v of typescript_versions_1.TypeScriptVersion.shipped) {
await install(v);
}
// `shipped + [rc, next] == supported` during the RC period. During that time, typescript@rc needs to be installed too.
if (typescript_versions_1.TypeScriptVersion.shipped.length + 2 === typescript_versions_1.TypeScriptVersion.supported.length) {
await install("rc");
}
await installTypeScriptNext();
}
exports.installAllTypeScriptVersions = installAllTypeScriptVersions;
async function installTypeScriptNext() {
await install("next");
}
exports.installTypeScriptNext = installTypeScriptNext;
async function install(version) {
if (version === "local") {
return;
}
const dir = installDir(version);
if (!fs.existsSync(dir)) {
console.log(`Installing to ${dir}...`);
await fs.promises.mkdir(dir, { recursive: true });
await fs.promises.writeFile(path.join(dir, "package.json"), JSON.stringify({
description: `Installs typescript@${version}`,
repository: "N/A",
license: "MIT",
dependencies: {
typescript: version,
},
}));
await execAndThrowErrors("npm install --ignore-scripts --no-shrinkwrap --no-package-lock --no-bin-links", dir);
console.log("Installed!");
console.log("");
}
}
exports.install = install;
function cleanTypeScriptInstalls() {
return fs.promises.rm(installsDir, { recursive: true, force: true });
}
exports.cleanTypeScriptInstalls = cleanTypeScriptInstalls;
exports.typeScriptPath = void 0;
const typeScriptPackages = __importStar(require("@definitelytyped/typescript-packages"));
function typeScriptPath(version, tsLocal) {

@@ -81,34 +33,5 @@ if (version === "local") {

}
return path.join(installDir(version), "node_modules", "typescript");
return typeScriptPackages.resolve(version);
}
exports.typeScriptPath = typeScriptPath;
function installDir(version) {
assert(version !== "local");
if (version === "next")
version = typescript_versions_1.TypeScriptVersion.latest;
if (version === "rc")
version = typescript_versions_1.TypeScriptVersion.supported[typescript_versions_1.TypeScriptVersion.supported.length - 2];
return path.join(installsDir, version);
}
/** Run a command and return the stdout, or if there was an error, throw. */
async function execAndThrowErrors(cmd, cwd) {
// tslint:disable-next-line:promise-must-complete
return new Promise((resolve, reject) => {
const env = { ...process.env };
if (env.NODE_OPTIONS && env.NODE_OPTIONS.includes("--require")) {
delete env.NODE_OPTIONS;
}
(0, child_process_1.exec)(cmd, { encoding: "utf8", cwd, env }, (err, _stdout, stderr) => {
if (stderr) {
console.error(stderr);
}
if (err) {
reject(err);
}
else {
resolve();
}
});
});
}
//# sourceMappingURL=typescript-installer.js.map
{
"name": "@definitelytyped/utils",
"version": "0.0.188",
"version": "0.0.189",
"description": "Shared utilities for DefinitelyTyped tools",

@@ -25,3 +25,4 @@ "homepage": "https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/utils#readme",

"which": "^4.0.0",
"@definitelytyped/typescript-versions": "0.0.182"
"@definitelytyped/typescript-versions": "0.0.182",
"@definitelytyped/typescript-packages": "0.0.2"
},

@@ -28,0 +29,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc