Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ea2b560a5 | |||
| 60aef4cc01 | |||
| 692752fb30 | |||
| a5e940b003 |
2367
package-lock.json
generated
2367
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/node-utils",
|
"name": "@ztimson/node-utils",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "CSS Utility Classes",
|
"description": "CSS Utility Classes",
|
||||||
"author": "ztimson",
|
"author": "ztimson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -10,27 +10,24 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git.zakscode.com:ztimson/node-utils"
|
"url": "git.zakscode.com:ztimson/node-utils"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.cjs",
|
"type": "module",
|
||||||
"module": "./dist/index.mjs",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"import": "./dist/index.mjs",
|
"import": "./dist/index.js"
|
||||||
"require": "./dist/index.cjs"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx tsc && npx vite build",
|
"build": "tsc",
|
||||||
"docs": "typedoc --cleanOutputDir false --out ./docs --entryPoints src/**/*.ts --readme none",
|
"docs": "typedoc --cleanOutputDir false --out ./docs --entryPoints src/**/*.ts --readme none",
|
||||||
"watch": "npx vite build --watch"
|
"watch": "tsc --watch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^24.0.0",
|
"@types/node": "^24.0.0",
|
||||||
"typedoc": "^0.28.5",
|
"typedoc": "^0.28.5",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3"
|
||||||
"vite": "^6.3.5",
|
|
||||||
"vite-plugin-dts": "^4.5.4"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
|||||||
16
src/cli.ts
16
src/cli.ts
@@ -1,11 +1,17 @@
|
|||||||
import {exec, execSync} from 'child_process';
|
import {execSync, spawn} from 'node:child_process';
|
||||||
|
|
||||||
export function $(str: TemplateStringsArray, ...args: string[]): Promise<string> {
|
export function $(str: TemplateStringsArray, ...args: string[]): Promise<string> {
|
||||||
let cmd = str.reduce((acc, part, i) => acc + part + (args[i] || ''), '');
|
let cmd = str.reduce((acc, part, i) => acc + part + (args[i] || ''), '');
|
||||||
return new Promise((res, rej) => exec(cmd, (err, stdout, stderr) => {
|
return new Promise((res, rej) => {
|
||||||
if(err) return rej(stderr || err);
|
const proc = spawn(cmd, {shell: true});
|
||||||
return res(stdout);
|
let stdout = '', stderr = '';
|
||||||
}))
|
proc.stdout.on('data', (data) => stdout += data);
|
||||||
|
proc.stderr.on('data', (data) => stderr += data);
|
||||||
|
proc.on('close', (code) => {
|
||||||
|
if(code !== 0) return rej(new Error(stderr || stdout));
|
||||||
|
res(stdout.trim());
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function $Sync(str: TemplateStringsArray, ...args: string[]): string {
|
export function $Sync(str: TemplateStringsArray, ...args: string[]): string {
|
||||||
|
|||||||
@@ -3,18 +3,15 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "NodeNext",
|
"module": "ESNext",
|
||||||
"lib": ["ESNext"],
|
"lib": ["ESNext"],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
/* Bundler mode */
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"noEmit": true,
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
/* Linting */
|
|
||||||
"strict": true
|
"strict": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import {resolve} from 'path';
|
|
||||||
import {defineConfig} from 'vite';
|
|
||||||
import dts from 'vite-plugin-dts';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
build: {
|
|
||||||
lib: {
|
|
||||||
entry: resolve(process.cwd(), 'src/index.ts'),
|
|
||||||
name: 'node-utils',
|
|
||||||
fileName: (format: string) => format === 'es' ? 'index.mjs' : 'index.cjs'
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: [
|
|
||||||
'child_process',
|
|
||||||
'readline'
|
|
||||||
],
|
|
||||||
},
|
|
||||||
emptyOutDir: true,
|
|
||||||
minify: false,
|
|
||||||
sourcemap: true
|
|
||||||
},
|
|
||||||
plugins: [dts()],
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user