create-sjmcl-extension scaffolds an SJMCL extension project with a local build pipeline for src/ tree and npm dependencies.
npm install -g create-sjmcl-extension@latestnpx create-sjmcl-extensionBase command: create-sjmcl-extension
| Command | Value | Default | Description |
|---|---|---|---|
[project-directory] |
path | my-sjmcl-extension |
Scaffold a new extension project. |
sync-types [project-directory] |
path | current directory | Regenerate only src/types/host.ts in an existing project from the latest scaffold template. |
--help |
none | off | Show the CLI help screen. |
It will interactively prompt for the new extenion's metadata.
npx create-sjmcl-extension
npx create-sjmcl-extension my-extension
npx create-sjmcl-extension sync-types .
npx create-sjmcl-extension sync-types ./existing-extensionThe generated project includes a small build pipeline and three project scripts:
Starts a development server that watches source files, rebuilds on change, and writes output directly to SJMCL's installed extension directory. A sjmcl://reload-extension?id=<identifier> deeplink is fired after each build so the launcher reloads the extension automatically.
The extension must be manually enabled in Settings → Extensions first. Use the refresh button if it doesn't appear.
npm run dev
npm run dev -- --mode production
npm run dev -- --compress
npm run dev -- --no-reload
npm run dev -- --path ./custom-outputBuilds the extension package from the local source tree.
Build characteristics:
- Source entry:
src/index.tsorsrc/index.tsx - JSX transform:
React.createElement(...) - Default output: minified production bundle
Build options:
| Flag | Value | Default | Effect |
|---|---|---|---|
--mode |
production, development |
production |
Selects the overall build profile and sets process.env.NODE_ENV. production enables syntax and whitespace minification for a compact release bundle; development keeps the output more readable for inspection and debugging. |
--obfuscate |
none or boolean (true, false, 1, 0, yes, no, on, off) |
on in production, off in development | Controls identifier minification only. It renames local symbols to shorter names, but it does not switch build mode or enable syntax/whitespace minification by itself. |
In short: --mode chooses the overall output style, while --obfuscate only toggles identifier mangling.
npm run build
npm run build -- --mode development
npm run build -- --obfuscate
npm run build -- --obfuscate=off
npm run build -- --mode development --obfuscate=offBuild output files:
dist/<identifier>/dist/<identifier>-<version>.sjmclx
The build script also copies these files into the packaged output when present:
sjmcl.ext.jsonicon.pngassets/data/
Updates both package.json and sjmcl.ext.json to the exact version you provide.
Direct imports from these packages are rejected at build time:
| Package | Use Instead |
|---|---|
react |
api.React |
@chakra-ui/react |
api.ChakraUI |
If a third-party dependency bundles them transitively, the build still succeeds and emits warnings that include:
- the bundled singleton package name
- the byte contribution in the final output
- one or more dependency chains from project source to the bundled package