{"id":11168,"library":"jsii-pacmak","title":"jsii-pacmak: jsii Package Maker","description":"jsii-pacmak is a critical component of the `jsii` project, an AWS-developed code generation framework. Its core function is to generate and build ready-to-publish, language-specific packages (e.g., for Java, Python, .NET, Go, C#) from a TypeScript-defined `jsii` module. This capability allows developers to author libraries once in TypeScript and then consume them consistently across multiple programming languages, facilitating polyglot development for cloud constructs, notably within the AWS Cloud Development Kit (CDK). The package is currently at version 1.128.0 and is part of an actively maintained ecosystem, characterized by frequent patch and minor releases, often on a weekly or bi-weekly cadence, as seen in its recent release history. Its primary differentiator is its robust ability to bridge TypeScript definitions to fully functional APIs in various target languages, ensuring a uniform developer experience across the polyglot landscape.","status":"active","version":"1.128.0","language":"javascript","source_language":"en","source_url":"https://github.com/aws/jsii","tags":["javascript","jsii","aws","typescript"],"install":[{"cmd":"npm install jsii-pacmak","lang":"bash","label":"npm"},{"cmd":"yarn add jsii-pacmak","lang":"bash","label":"yarn"},{"cmd":"pnpm add jsii-pacmak","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for generating documentation and translating TypeScript to other languages.","package":"jsii-rosetta","optional":false}],"imports":[{"note":"While primarily a CLI tool, the 'main' function is the programmatic entry point for direct integration, accepting an array of arguments similar to process.argv.","symbol":"main","correct":"import { main } from 'jsii-pacmak';\n// or\nconst { main } = require('jsii-pacmak');"},{"note":"jsii-pacmak is most commonly invoked as a command-line interface tool via `npx` or directly from `node_modules/.bin/jsii-pacmak`. There is no 'cli' symbol to import.","wrong":"import { cli } from 'jsii-pacmak'","symbol":"cli","correct":"npx jsii-pacmak [options]"}],"quickstart":{"code":"mkdir my-jsii-lib\ncd my-jsii-lib\nnpm init -y\nnpm install jsii\nnpm install -D typescript @types/node\n\ncat > tsconfig.json <<EOF\n{\n  \"compilerOptions\": {\n    \"alwaysStrict\": true,\n    \"declaration\": true,\n    \"experimentalDecorators\": true,\n    \"lib\": [\"es2018\"],\n    \"module\": \"commonjs\",\n    \"noEmitOnError\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noImplicitAny\": true,\n    \"noImplicitReturns\": true,\n    \"noImplicitThis\": true,\n    \"noPropertyAccessFromIndexSignature\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"resolveJsonModule\": true,\n    \"strict\": true,\n    \"strictBindCallApply\": true,\n    \"strictNullChecks\": true,\n    \"strictPropertyInitialization\": true,\n    \"stripInternal\": true,\n    \"target\": \"es2018\",\n    \"outDir\": \"lib\"\n  },\n  \"include\": [\"src/**/*.ts\"]\n}\nEOF\n\nmkdir src\ncat > src/index.ts <<EOF\nexport interface MyProps {\n  readonly message: string;\n}\n\nexport class Greeter {\n  public readonly greeting: string;\n\n  constructor(props: MyProps) {\n    this.greeting = `Hello, ${props.message} from jsii!`;\n  }\n\n  public sayHello(): string {\n    return this.greeting;\n  }\n}\nEOF\n\n# Configure package.json for jsii targets\nnode -e \"const pkg = require('./package.json'); pkg.jsii = { 'outdir': 'dist', 'targets': { 'java': { 'package': 'com.myorg.mylib', 'maven': { 'groupId': 'com.myorg', 'artifactId': 'mylib' } }, 'python': { 'distName': 'my-jsii-lib', 'module': 'my_jsii_lib' } } }; require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));\"\n\nnpx jsii\nnpx jsii-pacmak","lang":"typescript","description":"This quickstart demonstrates how to set up a basic `jsii` project, define a simple TypeScript class, and then use `jsii-pacmak` to generate language-specific packages (Java and Python in this example) ready for publishing."},"warnings":[{"fix":"Upgrade your Node.js installation to version 14.17.0 or higher. Use a Node.js version manager like `nvm` to easily switch versions (`nvm install 18` then `nvm use 18`).","message":"jsii-pacmak requires Node.js version 14.17.0 or newer. Running with older Node.js versions will result in an error or unexpected behavior.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Ensure `jsii-rosetta` is installed in your project: `npm install jsii-rosetta` or `yarn add jsii-rosetta`. Check your `package.json` for compatible versions.","message":"The `jsii-rosetta` peer dependency must be installed and meet the specified version requirements (currently `>=5.9.0`). Failure to do so can lead to issues with documentation generation or type translation, even if `jsii-pacmak` itself runs.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If your Go builds now fail due to sumdb issues, you may need to explicitly set `GOSUMDB=off` or configure `GOPRIVATE` and `GONOPROXY` environment variables in your build pipeline when invoking Go tools.","message":"When targeting Go, `jsii-pacmak` previously added `GOSUMDB=off` to the Go target environment. This has been removed in v1.127.0, which might affect build environments relying on this behavior, particularly those behind firewalls or in air-gapped networks.","severity":"breaking","affected_versions":">=1.127.0"},{"fix":"Ensure you are using `jsii-pacmak` version 1.123.0 or newer. If issues persist, verify your Maven settings and consider adjusting dependency resolution strategies or using fixed versions where possible.","message":"Using older Maven versions or specific configurations can lead to 'dependency ranges make Maven download too many files' issues, causing slow builds or network strain. This was addressed in v1.122.0 and v1.123.0 for `jsii-pacmak` and `java-runtime` respectively.","severity":"gotcha","affected_versions":"<1.123.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Upgrade your Node.js environment to version 14.17.0 or newer using `nvm install 18 && nvm use 18` or similar tools.","cause":"Attempting to run `jsii-pacmak` with an unsupported Node.js version.","error":"Error: Node.js version 12.x.y is not supported. Please use >= 14.17.0."},{"fix":"Ensure `jsii-pacmak` is installed (`npm install jsii-pacmak`) and either run it with `npx jsii-pacmak` from your project root or add `$(npm bin)` to your PATH.","cause":"The `jsii-pacmak` executable is not in your system's PATH or `npx` cannot locate it.","error":"`jsii-pacmak` command not found"},{"fix":"Install the correct version of `jsii-rosetta`: `npm install jsii-rosetta@^5.9.0` (adjust version as needed per `jsii-pacmak`'s `package.json`).","cause":"The `jsii-rosetta` package, a required peer dependency, is not installed or its version does not satisfy `jsii-pacmak`'s requirements.","error":"Peer dependency 'jsii-rosetta' is missing or incompatible."},{"fix":"Verify your `tsconfig.json` paths, `include` array, and ensure all dependencies are installed. Run `npx jsii` separately to compile the TypeScript code before running `jsii-pacmak`.","cause":"The TypeScript compilation of your jsii module failed because required modules are not found or paths are incorrect.","error":"error TS2307: Cannot find module 'my-jsii-lib' or its corresponding type declarations."}],"ecosystem":"npm"}