New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

typedpkg-plugin-scripts

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedpkg-plugin-scripts

[![npm version](https://badge.fury.io/js/typedpkg-plugin-scripts.svg)](https://badge.fury.io/js/typedpkg-plugin-scripts) [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC) [![TypeScript](https://img.s

latest
npmnpm
Version
0.2.14-0
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

Scripts plugin for typedpkg

npm version License: ISC TypeScript

A typedpkg plugin that automatically generates npm scripts for files in a scripts directory, with configurable runners for different file types.

Overview

This plugin scans a specified directory for script files and automatically generates npm scripts based on the file names and their extensions. It supports multiple file types through configurable runners, making it easy to execute TypeScript, Python, JavaScript, shell scripts, and more directly through npm scripts.

Features

Automatic Script Generation

  • Scans a configurable directory (default: scripts) for script files
  • Generates npm script names based on file names (converts underscores to hyphens, lowercases)
  • Supports multiple file extensions through configurable runners

Configurable Runners

Map file extensions to their execution commands:

  • .ts files → tsx (TypeScript execution)
  • .py files → python (Python scripts)
  • .js files → node (JavaScript execution)
  • .sh files → bash (Shell scripts)
  • Any custom file type with appropriate runner

Smart Naming

  • Converts file names to kebab-case npm script names
  • Example: build_database.tsbuild-database script
  • Example: Deploy_App.pydeploy-app script

Usage

Add this plugin to your typedpkg configuration:

export default {
  plugins: ['scripts'],
  config: {
    pkg_ts: {
      plugins: {
        scripts: {
          dir: 'scripts', // optional, defaults to 'scripts'
          runners: {
            ts: 'tsx',
            py: 'python',
            js: 'node',
            sh: 'bash',
          },
        },
      },
    },
  },
}

Configuration

The plugin accepts these configuration options:

dir (optional)

  • Type: string
  • Default: 'scripts'
  • Description: Directory to scan for script files

Examples:

  • "./scripts"
  • "src/scripts"
  • "tools"

runners (required)

  • Type: Record<string, string>
  • Description: Maps file extensions to their execution commands

Example:

{
  "ts": "tsx",        // TypeScript files
  "py": "python",     // Python files
  "js": "node",       // JavaScript files
  "sh": "bash",       // Shell scripts
  "rb": "ruby",       // Ruby scripts
  "go": "go run"      // Go files
}

Example

Given this directory structure:

scripts/
├── build_database.ts
├── deploy_app.py
├── cleanup.sh
└── generate_docs.js

With this configuration:

{
  dir: 'scripts',
  runners: {
    'ts': 'tsx',
    'py': 'python',
    'sh': 'bash',
    'js': 'node'
  }
}

The plugin generates these npm scripts:

{
  "build-database": "tsx scripts/build_database.ts",
  "deploy-app": "python scripts/deploy_app.py",
  "cleanup": "bash scripts/cleanup.sh",
  "generate-docs": "node scripts/generate_docs.js"
}

Run them with:

npm run build-database
npm run deploy-app
npm run cleanup
npm run generate-docs

Development

yarn pkg:build    # Build the plugin
yarn install      # Install dependencies

License

ISC

FAQs

Package last updated on 25 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts