You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@tech_query/node-toolkit

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tech_query/node-toolkit - npm Package Compare versions

Comparing version
2.0.0-beta.0
to
2.0.0-beta.1
+1
-5
dist/module.d.ts

@@ -20,6 +20,2 @@ export declare function packageNameOf(path: string): string;

export declare function configOf(name: string): Record<string, any>;
export declare function getNPMConfig(key: string): string | Record<string, any> | undefined;
/**
* @see {@link https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/#:~:text=npm%20config%20set%20will%20no%20longer%20accept%20deprecated%20or%20invalid%20config%20options}
*/
export declare function setNPMConfig(key: string, value: any): void;
export declare const stringifyEnv: (data: Record<string, unknown>) => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifyEnv = void 0;
exports.packageNameOf = packageNameOf;

@@ -8,8 +9,5 @@ exports.patternOf = patternOf;

exports.configOf = configOf;
exports.getNPMConfig = getNPMConfig;
exports.setNPMConfig = setNPMConfig;
const path_1 = require("path");
const fs_extra_1 = require("fs-extra");
const yaml_1 = require("yaml");
const child_process_1 = require("child_process");
const language_1 = require("./language");

@@ -75,19 +73,5 @@ const file_1 = require("./file");

}
function getNPMConfig(key) {
const value = ((0, child_process_1.execSync)(`npm get ${key}`) + '').trim();
if (value !== 'undefined')
try {
return JSON.parse(value);
}
catch (_a) {
return value;
}
}
/**
* @see {@link https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/#:~:text=npm%20config%20set%20will%20no%20longer%20accept%20deprecated%20or%20invalid%20config%20options}
*/
function setNPMConfig(key, value) {
const data = JSON.stringify(value);
(0, child_process_1.execSync)(value != null ? `npm set ${key} ${data}` : `npm config delete ${key}`);
console.info(`${key} = ${data}`);
}
const stringifyEnv = (data) => Object.entries(data)
.map(([key, value]) => `${key}=${JSON.stringify(value)}`)
.join('\n');
exports.stringifyEnv = stringifyEnv;
+19
-16
{
"name": "@tech_query/node-toolkit",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"license": "LGPL-3.0",
"author": "shiy2008@gmail.com",
"description": "Toolkit for Node.JS packages",

@@ -14,4 +16,2 @@ "keywords": [

],
"author": "shiy2008@gmail.com",
"license": "LGPL-3.0",
"homepage": "https://tech-query.me/node-toolkit/",

@@ -25,18 +25,8 @@ "repository": {

},
"engines": {
"node": ">=20"
},
"main": "dist/index.js",
"source": "source/index.ts",
"types": "dist/index.d.ts",
"lint-staged": {
"*.{json,yml,ts}": "biome check --write"
},
"jest": {
"preset": "ts-jest"
},
"scripts": {
"prepare": "husky",
"test": "lint-staged && jest",
"build": "rm -rf dist/ docs/ && tsc && typedoc source/",
"prepublishOnly": "npm test && npm run build",
"start": "typedoc && open-cli docs/index.html"
},
"dependencies": {

@@ -63,2 +53,15 @@ "file-type": "^16.5.4",

},
"lint-staged": {
"*.{json,yml,ts}": "biome check --write"
},
"jest": {
"preset": "ts-jest"
},
"scripts": {
"prepare": "husky",
"test": "lint-staged && jest",
"build": "rm -rf dist/ docs/ && tsc && typedoc source/",
"prepublishOnly": "npm test && npm run build",
"start": "typedoc && open-cli docs/index.html"
},
"test": {

@@ -65,0 +68,0 @@ "env": {

@@ -12,6 +12,6 @@ # Node.JS toolkit

| SemVer | status | Node.js |
| :----: | :----------: | :-----: |
| `>=2` | ✅developing | `>=16` |
| `<2` | ❌deprecated | `>=6` |
| SemVer | status | Node.js |
| :----: | :----------: | :-------: |
| `>=2` | ✅developing | `>=20.12` |
| `<2` | ❌deprecated | `>=6` |

@@ -18,0 +18,0 @@ ## Basic usage

import { resolve, basename, dirname } from 'path';
import { readJSONSync, existsSync, readFileSync } from 'fs-extra';
import { parse } from 'yaml';
import { execSync } from 'child_process';

@@ -79,25 +78,5 @@ import { toRegExp } from './language';

export function getNPMConfig(
key: string
): string | Record<string, any> | undefined {
const value = (execSync(`npm get ${key}`) + '').trim();
if (value !== 'undefined')
try {
return JSON.parse(value);
} catch {
return value;
}
}
/**
* @see {@link https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/#:~:text=npm%20config%20set%20will%20no%20longer%20accept%20deprecated%20or%20invalid%20config%20options}
*/
export function setNPMConfig(key: string, value: any) {
const data = JSON.stringify(value);
execSync(
value != null ? `npm set ${key} ${data}` : `npm config delete ${key}`
);
console.info(`${key} = ${data}`);
}
export const stringifyEnv = (data: Record<string, unknown>) =>
Object.entries(data)
.map(([key, value]) => `${key}=${JSON.stringify(value)}`)
.join('\n');