CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-js-lib--cli

CLI tool for scaffolding JavaScript and TypeScript third-party libraries with modern development practices

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

project-creation.mddocs/

Project Creation

Complete project scaffolding functionality for creating new JavaScript and TypeScript library projects with modern development tooling.

Capabilities

New Command

Creates a new library project with interactive configuration or pre-specified options.

jslib new [projectname] [options]
jslib n [projectname] [options]

# Options:
--force, -f              # Force create (overwrite existing project)
--config, -c             # Initialize only the configuration file
--npmname, -n <name>     # Initialize the npm package name  
--umdname, --umd <name>  # Initialize the UMD name for package
--username, -u <name>    # Initialize the username
--type, -t <type>        # Initialize the js/ts selection
--manager, -m <manager>  # Select the package management method

Usage Examples:

# Interactive creation (prompts for all options)
npx @js-lib/cli new my-lib

# Create with specific options
npx @js-lib/cli new my-lib --type js --username johndoe --manager npm

# Force overwrite existing directory
npx @js-lib/cli new existing-project --force

# Create only configuration file in current directory
npx @js-lib/cli new --config --type ts

Project Creation Process

The CLI handles project creation through the following internal process:

  1. Argument Processing: Combines command line options with interactive prompt responses
  2. Validation: Validates project name, NPM package name, and other inputs
  3. Template Selection: Chooses appropriate template (JavaScript or TypeScript)
  4. Directory Creation: Creates project directory structure
  5. File Generation: Copies and processes template files
  6. Configuration: Creates project configuration files
  7. Dependency Installation: Optionally runs package manager installation

Template Types

The CLI supports two complete project templates:

JavaScript Template (module-js)

  • ES6+ source code structure
  • Rollup build configuration
  • Mocha testing framework
  • ESLint + Prettier code formatting
  • GitHub Actions CI/CD
  • Browser and Node.js compatibility

TypeScript Template (module-ts)

  • TypeScript source code structure
  • Type declaration generation
  • Same tooling as JavaScript template
  • Full type safety throughout build pipeline

Project Structure

Generated projects include:

my-project/
├── src/              # Source code directory
├── test/             # Unit tests  
├── demo/             # Usage examples
├── dist/             # Compiled output
├── doc/              # Documentation
├── .github/          # GitHub Actions workflows
├── package.json      # NPM package configuration
├── rollup.config.js  # Build configuration
├── .eslintrc.js      # Linting rules
├── .prettierrc.json  # Code formatting
└── jslib.json        # Project metadata for updates

Error Handling

The creation process includes validation and error handling:

  • Project exists: Prevents overwriting unless --force is used
  • Invalid NPM names: Validates package names using validate-npm-package-name
  • Missing parameters: Prompts for required information interactively
  • File system errors: Graceful handling of permission and disk space issues

Configuration-Only Mode

The --config flag allows initializing only the jslib.json configuration file in the current directory, useful for existing projects that want to enable update functionality.

# Initialize config in existing project
cd existing-project
npx @js-lib/cli new --config --type js

docs

file-utilities.md

index.md

interactive-configuration.md

project-creation.md

project-updates.md

template-system.md

tile.json