New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

indefinitely-typed

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

indefinitely-typed - npm Package Compare versions

Comparing version

to
1.0.3

0

bin/cli.js
#!/usr/bin/env node
require('../dist/index');

56

dist/index.js

@@ -6,38 +6,26 @@ "use strict";

var minimist = require("minimist");
console.log("=======================");
console.log("indefinitely-typed installation ...");
function copyToTypes(folder, typesDir) {
console.log("---");
console.log("folder: " + folder);
var destDir = path.resolve(typesDir, folder);
if (fs.existsSync(destDir)) {
console.log("deleting existing " + destDir + " , ");
fs.removeSync(destDir);
}
var srcDir = path.resolve(cwd, folder);
console.log("copying " + srcDir + " to " + destDir);
fs.copySync(srcDir, destDir);
console.log(folder + " complete!");
}
var log = console.log;
log("=======================");
log("indefinitely-typed installation ...");
var argv = minimist(process.argv.slice(2));
console.log('args:', argv);
log('args:', argv);
var cwd = process.cwd();
console.log("cwd: " + cwd);
log("cwd: " + cwd);
var pathToPackageJson = path.resolve(cwd, 'package.json');
console.log("looking for package.json at: " + pathToPackageJson);
log("looking for package.json at: " + pathToPackageJson);
if (!fs.existsSync(pathToPackageJson)) {
console.log("package.json not found, aborting.");
log("package.json not found, aborting.");
}
else {
var packageJson = require(pathToPackageJson);
console.log("package name is : " + packageJson.name);
log("package name is : " + packageJson.name);
packageJson.isScoped =
packageJson.name.substr(0, 1) === '@' &&
packageJson.name.indexOf('/') > 1;
console.log("package is " + (packageJson.isScoped ? '' : 'not ') + "scoped.");
log("package is " + (packageJson.isScoped ? '' : 'not ') + "scoped.");
var node_modules = path.resolve(cwd, packageJson.isScoped ? '../..' : '..');
console.log("using node_modules at " + node_modules);
log("using node_modules at " + node_modules);
var segments = node_modules.split(path.sep);
if (segments[segments.length - 1] !== 'node_modules') {
console.log("error: this is not a node_modules folder.");
log("error: this is not a node_modules folder.");
}

@@ -47,6 +35,6 @@ else {

if (!fs.existsSync(types_1)) {
console.log("creating folder " + types_1);
log("creating folder " + types_1);
fs.mkdirSync(types_1);
}
console.log("using @types folder at " + types_1);
log("using @types folder at " + types_1);
var folders = [];

@@ -59,6 +47,18 @@ if (Array.isArray(argv.folder)) {

}
folders.forEach(function (folder) { return copyToTypes(folder, types_1); });
console.log("installation complete!");
folders.forEach(function (folder) {
log("---");
log("folder: " + folder);
var destDir = path.resolve(types_1, folder);
if (fs.existsSync(destDir)) {
log("deleting existing " + destDir + " , ");
fs.removeSync(destDir);
}
var srcDir = path.resolve(cwd, folder);
log("copying " + srcDir + " to " + destDir);
fs.copySync(srcDir, destDir);
log(folder + " complete!");
});
log("installation complete!");
}
}
console.log("=======================");
log("=======================");
{
"name": "indefinitely-typed",
"version": "1.0.2",
"version": "1.0.3",
"description": "🐣 Incubate your TypeScript declarations",

@@ -34,3 +34,3 @@ "keywords": [

"fs-extra": "^7.0.0",
"minimist": "^1.2.0"
"minimist": "^1.2.5"
},

@@ -37,0 +37,0 @@ "devDependencies": {

@@ -5,4 +5,13 @@ # 🐣 indefinitely-typed

[DefinitelyTyped](http://definitelytyped.org/) is the repository for __high quality__ TypeScript type definitions. Use this tool if your definitions are not yet up to that quality bar, but you still need to use them in a project.
## What this does
Copies your folders into the dependee's `node_modules/@types/` folder. Because that's where the TypeScript compiler might look for it - see [TypeScript Module Resolution](https://www.typescriptlang.org/docs/handbook/module-resolution.html).
## Why you may need it
[DefinitelyTyped](http://definitelytyped.org/) is the repository for __high quality__ TypeScript type definitions. Use this tool if:
* your definitions are "pre-release", lacking tests or incomplete, but you still need to use them in a project.
* you need to maintain versioning not possible with the [@types publisher](https://github.com/Microsoft/types-publisher).
* you need to publish on demand, and not wait for the [@types publisher](https://github.com/Microsoft/types-publisher).
## Usage

@@ -9,0 +18,0 @@