@iapetos/angular-packager
Builds and packages libraries into the Angular Package Format.
Installation
yarn add @iapetos/angular-packager
Usage example
The iapetos packager only exposes a node API, there's no builtin CLI.
const {build} = require('@iapetos/angular-packager');
build({
primaryEntryPoint: './package.json',
secondaryEntryPoints: [
'./testing/package.json',
],
});
The available options are:
interface BuildOptions {
/**
* Path to the manifest (package.json) for the package's main entry point
*/
primaryEntryPoint: string;
/**
* Path to the manifests (package.json) for the package's secondary entry points, if any
*/
secondaryEntryPoints?: string[];
/**
* Path to the target folder, defaults to `$(dirname primaryEntryPoint)/dist`
*/
targetFolder?: string;
/**
* Path to a tsconfig to use, if any
*/
tsConfigPath?: string;
/**
* Extra mapping of package name to global name to use when building UMD modules
*
* By default a package will map using the algorithm angular uses to define their globals:
*
* 1. strip the leading `@` of the scope name (if the package is scoped)
* 2. split the package name by `/`
* 3. map every part from `kebab-case` to `lowerCamelCase`
* 4. join the parts using a `.`
*
* For example, if the fictional `@iapetus-component/fancy-button` package would map to
* `iapetusComponent.fancyButton`
*/
extraGlobals?: Record<string, string>;
/**
* Extra package names to mark as external when building flat ESM bundles and UMD bundles
*
* This should never be needed. The externals are computed from the package manifest: all
* `dependencies` and `peerDependencies` become externals, apart from those listed in
* `bundledDependencies`.
*/
extraExternals?: string[];
}