Registry / aws / cdkx
library1.0.12jsnpmunverified

cdkx is a specialized command-line interface (CLI) tool designed to bundle assets for AWS Cloud Development Kit (CDK) applications. Primarily utilizing `esbuild` for its high performance, it streamlines the process of preparing CDK-managed code and assets for deployment. The current stable version is 1.0.12. This package aims to provide an efficient bundling solution for TypeScript-based AWS CDK projects, making it easier to manage dependencies and optimize deployment artifacts. Its key differentiator lies in its focused approach to integrating `esbuild` directly into the CDK development workflow, offering a simpler alternative for asset bundling compared to configuring `esbuild` manually or relying on broader build tools. While not an official AWS CDK tool, it integrates with `@aws-cdk/core` to provide a tailored bundling experience for CDK constructs.

npm install cdkx
INSTALL
IMPORT
SIG · CDKX
C
cdkx
awsjavascriptv1.0.12
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cdkx
npx cdkx bundle [options]
import { cdkx } from 'cdkx'
Primary interaction is via the `cdkx` CLI command. Direct programmatic imports are not the common pattern for this package.
bundle
cdkx bundle src/my-lambda.ts --out-dir dist
The `bundle` command is the main function exposed by the CLI for processing assets.
Node.js API (hypothetical)
import { bundleAsset } from 'cdkx'; // Usage example (API might not be officially exposed or documented for direct use)
While `cdkx` has an `index.js` as its `main` entry, its primary intended use is through the CLI. A direct programmatic Node.js API is not explicitly documented for public consumption in the provided context, but a library could potentially import internal functions.

Demonstrates how to use the `cdkx` CLI to bundle a TypeScript Lambda function, specifying common `esbuild` options and an output directory for CDK assets.

npx cdkx bundle src/lambda/my-function.ts \ --platform=node \ --target=es2020 \ --format=cjs \ --sourcemap \ --bundle \ --out-dir=./cdk.out/assets \ --external:aws-sdk console.log("CDK asset bundled successfully to cdk.out/assets"); // In a CDK stack: // import * as lambda from 'aws-cdk-lib/aws-lambda'; // import * as path from 'path'; // new lambda.Function(this, 'MyLambdaFunction', { // runtime: lambda.Runtime.NODEJS_18_X, // handler: 'my-function.handler', // code: lambda.Code.fromAsset(path.join(__dirname, '../../cdk.out/assets')) // });
cdkx --version
Debug
Known issues
gotchaWhen publishing your package, ensure `private` is set to `false` in `package.json`. If `cdkx` is part of a larger `lerna` monorepo where it's typically marked `private` during development, this step is critical before running `npm publish`.
fix
Before `npm publish`, update `package.json`: `"private": false`. After publishing, revert to `"private": true` if it's an internal package within a monorepo managed by `lerna`.
affects: >=1.0.0
gotchaThe `cdkx` tool wraps `esbuild`. For advanced `esbuild` configurations not directly exposed by `cdkx` options, you might need to use `esbuild` directly or contribute features to `cdkx`.
fix
Consult `esbuild` documentation for advanced features. If `cdkx` doesn't provide a passthrough or specific option, consider using `esbuild` directly for those assets or contributing to `cdkx`.
affects: >=1.0.0
Errors
Common errors & fixes
Error: This package is private and cannot be published. (code EPRIVATE)
Attempting to `npm publish` a package with `"private": true` in its `package.json`.
fix
Before publishing, set `"private": false` in `package.json`. Remember to revert it if `cdkx` is part of a monorepo that requires it to be private during local development.
Cannot find module 'esbuild'
The `esbuild` dependency is not correctly installed, or the Node.js environment cannot locate it.
fix
Ensure `esbuild` is listed in your project's `dependencies` and run `npm install` or `yarn install`.
Upgrade
Version history
1.0.12latest on npm
Audit
Dependencies
esbuildrequiredCore bundler engine for optimizing CDK assets.
typescriptrequiredUsed for compiling TypeScript source files before bundling. A dev dependency for most projects, but listed here as a primary tool.
@aws-cdk/corerequiredProvides core AWS CDK constructs and types that the bundler interacts with.
Agent activity
27 hits · last 30 days
node
24
Amazon
1
Resources
cdkx — npm install cdkx · libregistry