typescript-cp

Copy non-typescript files to outDir

Showing:

Popularity

Downloads/wk

101

GitHub Stars

6

Maintenance

Last Commit

13d ago

Contributors

1

Package

Dependencies

9

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Typescript-cp

npm version dependencies Status devDependencies Status peerDependencies Status

Copy non-typescript files to outDir

Installation

$ npm install typescript-cp -D

CLI

# Copy
$ tscp

# Copy for TS project references
$ tscp -b

# Watcher
$ tscp -w

# Watcher for TS project references
$ tscp -b -w

# Custom compiler settings
$ tscp -p tsconfig.production.json

# Help
$ tscp -h

Example

package.json

{
  //...
  "scripts": {
    "start": "tsc -w & tscp -w",
    "build": "tsc && tscp"
  },
  //...
}

Configuration

.tscprc

{
  "ignored_files": ['**/an_ignored_file.ext'], // files not to copy (defaults to `['node_modules']`)
  "compiled_files": [], // files compiled by TS (these also get ignored) (defaults to `['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx']`)
  "use_ts_exclude": true, // ignore files that are listed in the tsconfig `exclude` array (defaults to `true`)
}

Loaders

You can attach basic loader rules to the files. Loaders accept the actual content of the given file as the first parameter, and must return the content of the output file.

.tscprc.js

const path = require('path');

/**
 * @type {import('typescript-cp/dist/types').Config}
 */
module.exports = {
  rules: [
    {
      test: /\.(scss|sass)$/,
      include: [
        path.resolve('./file-to-include.css'),
      ],
      exclude: (source_path) => {
        return source_path.indexOf('file-to-include.sass') > -1;
      },
      use: [
        {
          loader: (content, meta) => {
            // Do something with `content`

            return content;
          },
        },
      ],
    },
  ],
};

See Config and Rule types in src/types.ts for the complete reference.

Contribution

$ npm run build


Sponsored by: SRG Group Kft.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100