jspm-types

Easy use of typings files included in JSPM files via a node module for use in npm scripts


Keywords
jspm, typescript, typescript-definitions, jspm-devtools, npm-scripts, typescript-compiler
License
GPL-3.0
Install
npm install jspm-types@1.0.4

Documentation

jspm-tasker

Easy use of typings files included in JSPM files via a node module for use in npm scripts.

Install

$ npm install jspm-tasker

Features

This package allows the typescript complier to see jspm packages through the following options:

  • Configurable destination folder with shortcut to node_modules
  • Copy an entire jspm package
  • Copy only an npm package.json file (with references to original)
  • Copy only the index typescript definition file, if present
  • Copy both npm package.json and index typescript definition file (with references to original)
  • Copy all typescript definition files
  • Ability to flatten file path
  • Supports cleaning via ability to remove copied packages

Usage

jspm-tasker [command] [configuration options]

# Copy package.json of jspm packages with typings defined to node_modules with debug output.
jspm-tasker copy --debug --node

# Shortcut for copying package.json of jspm packages with typings defined to node_modules with debug output.
jspm-tasker copy -d -n

# Copy type definition file of jspm packages with typings defined to node_modules as a dry run.
jspm-tasker copy --check --node --typings

# Remove jspm packages with typings defined from node_modules.
jspm-tasker remove --node

# Remove all contents of jspm packages with typings defined to node_modules.
jspm-tasker remove --all --node

# Copy index type definition file to jspm_packages/@types as index.d.ts for jspm packages.
jspm-tasker copy --typings --rename index

Commands

  • copy Copy files matching the search globs from the source directory to the destination directory.
  • remove Gets the list of files that would have been copied and removes them from destination directory instead. Intended for cleaning.

Configuration Options

You can set options by passing them into the command line.

jspm-tasker copy --debug --typings --packages --index --node --check
  • --debug, -d Enables debug output into the console.
  • --check, -c Simulates copying/removing without performing operations on the file system.
  • --force, -f Allows for the current operation to continue if jspm is not found.
  • --summarize, -s Summarizes the console output.
  • --no-warnings Turns off warnings in the console. Note: errors will continue to show.
  • --cwd Sets working directory. Defaults to node working directory.
  • --src Specifies an array of search paths, in glob format, for the current operation. Defaults to {jspm_packages}/**/package.json.
  • --dest Sets destination directory. Defaults to {jspm_packages}/@types.
  • --flatten Strips child directories out of destination file path, from right to left, stopping at destination. Defaults to false. Optionally, a number may be specified representing levels of nested directories to keep after destination directory. For example:
    • If set to 1, the following would occur: {cwd}{dest}/a/b/c/d.txt > {cwd}{dest}/a/d.txt
    • If set to 0 (default), the following would occur: {cwd}{dest}/a/b/c/d.txt > {cwd}{dest}/d.txt
  • --all, -a Copies all files within the module (a complete copy). Note: This is a shortcut for setting src to **/*
  • --packages, -p Copies all package.json files to the destination directory. Note: This is a shortcut for setting src to **/package.json
  • --typings, -t Copies all type definition files to the destination directory. Note: This is a shortcut for setting src to **/*.d.ts
  • --node, -n Sets output directory to node_modules.
  • --jspm, -j Prefixes each src entry with the jspm package directory. For example:
    • {jspm_packages}/**/*
    • {jspm_packages}/**/package.json
    • {jspm_packages}/**/*.d.ts
  • --rename The rename option aloows for a file to be renamed as it is being copied to the destination folder. The name of the renamer is required and values are as follows:
    • --rename index When processing package.json files, if typescript definition files are added to the destination directory, any typings files specified in the typings property will be renamed to index.d.ts. Will update the reference in the package.json if copied.
    • --rename none Prevents all renaming when copying files to the destination directory. Note: by default, the jspm directory source and version numbers are stripped from file paths. Example:
    • {jspm_packages}/npm/@angular/core@5.1.3/package.json > @angular/core/package.json
  • --processor The processor option changes how files are processed. The name of the processor is required and values are as follows:
    • --processor typings-prop When copying package.json files, this will only copy the files specified in the typings property to the destination directory and ignore the package.json.
    • --processor pkg+typings-prop When copying package.json files, this will add any typings files specified in the typings property to the destination directory.

API

Documentation coming soon...

License

GPLv3 © Killian Hale