github.com/nektos/act@v0.2.63/pkg/runner/testdata/actions/node12/node_modules/@vercel/ncc/readme.md (about)

     1  # ncc
     2  
     3  [![CI Status](https://github.com/vercel/ncc/workflows/CI/badge.svg)](https://github.com/vercel/ncc/actions?workflow=CI)
     4  [![codecov](https://codecov.io/gh/vercel/ncc/branch/master/graph/badge.svg)](https://codecov.io/gh/vercel/ncc)
     5  
     6  Simple CLI for compiling a Node.js module into a single file,
     7  together with all its dependencies, gcc-style.
     8  
     9  ## Motivation
    10  
    11  - Publish minimal packages to npm
    12  - Only ship relevant app code to serverless environments
    13  - Don't waste time configuring bundlers
    14  - Generally faster bootup time and less I/O overhead
    15  - Compiled language-like experience (e.g.: `go`)
    16  
    17  ## Design goals
    18  
    19  - Zero configuration
    20  - TypeScript built-in
    21  - Only supports Node.js programs as input / output
    22  - Support all Node.js patterns and npm modules
    23  
    24  ## Usage
    25  
    26  ### Installation
    27  ```bash
    28  npm i -g @vercel/ncc
    29  ```
    30  
    31  ### Usage
    32  
    33  ```bash
    34  $ ncc <cmd> <opts>
    35  ```
    36  Eg:
    37  ```bash
    38  $ ncc build input.js -o dist
    39  ```
    40  
    41  Outputs the Node.js compact build of `input.js` into `dist/index.js`.
    42  
    43  > Note: If the input file is using a `.cjs` extension, then so will the corresponding output file.
    44  > This is useful for packages that want to use `.js` files as modules in native Node.js using
    45  > a `"type": "module"` in the package.json file.
    46  
    47  #### Commands:
    48  ```
    49    build <input-file> [opts]
    50    run <input-file> [opts]
    51    cache clean|dir|size
    52    help
    53    version
    54  ```
    55  
    56  #### Options:
    57  ```
    58    -o, --out [file]         Output directory for build (defaults to dist)
    59    -m, --minify             Minify output
    60    -C, --no-cache           Skip build cache population
    61    -s, --source-map         Generate source map
    62    --no-source-map-register Skip source-map-register source map support
    63    -e, --external [mod]     Skip bundling 'mod'. Can be used many times
    64    -q, --quiet              Disable build summaries / non-error outputs
    65    -w, --watch              Start a watched build
    66    --v8-cache               Emit a build using the v8 compile cache
    67    --license [file]         Adds a file containing licensing information to the output
    68    --stats-out [file]       Emit webpack stats as json to the specified output file
    69  ```
    70  
    71  ### Execution Testing
    72  
    73  For testing and debugging, a file can be built into a temporary directory and executed with full source maps support with the command:
    74  
    75  ```bash
    76  $ ncc run input.js
    77  ```
    78  
    79  ### With TypeScript
    80  
    81  The only requirement is to point `ncc` to `.ts` or `.tsx` files. A `tsconfig.json`
    82  file is necessary. Most likely you want to indicate `es2015` support:
    83  
    84  ```json
    85  {
    86    "compilerOptions": {
    87      "target": "es2015",
    88      "moduleResolution": "node"
    89    }
    90  }
    91  ```
    92  
    93  ### Package Support
    94  
    95  Some packages may need some extra options for ncc support in order to better work with the static analysis.
    96  
    97  See [package-support.md](package-support.md) for some common packages and their usage with ncc.
    98  
    99  ### Programmatically From Node.js
   100  
   101  ```js
   102  require('@vercel/ncc')('/path/to/input', {
   103    // provide a custom cache path or disable caching
   104    cache: "./custom/cache/path" | false,
   105    // externals to leave as requires of the build
   106    externals: ["externalpackage"],
   107    // directory outside of which never to emit assets
   108    filterAssetBase: process.cwd(), // default
   109    minify: false, // default
   110    sourceMap: false, // default
   111    sourceMapBasePrefix: '../', // default treats sources as output-relative
   112    // when outputting a sourcemap, automatically include
   113    // source-map-support in the output file (increases output by 32kB).
   114    sourceMapRegister: true, // default
   115    watch: false, // default
   116    license: '', // default does not generate a license file
   117    v8cache: false, // default
   118    quiet: false, // default
   119    debugLog: false // default
   120  }).then(({ code, map, assets }) => {
   121    console.log(code);
   122    // Assets is an object of asset file names to { source, permissions, symlinks }
   123    // expected relative to the output code (if any)
   124  })
   125  ```
   126  
   127  When `watch: true` is set, the build object is not a promise, but has the following signature:
   128  
   129  ```js
   130  {
   131    // handler re-run on each build completion
   132    // watch errors are reported on "err"
   133    handler (({ err, code, map, assets }) => { ... })
   134    // handler re-run on each rebuild start
   135    rebuild (() => {})
   136    // close the watcher
   137    void close ();
   138  }
   139  ```
   140  
   141  ## Caveats
   142  
   143  - Files / assets are relocated based on a [static evaluator](https://github.com/zeit/webpack-asset-relocator-loader#how-it-works). Dynamic non-statically analyzable asset loads may not work out correctly