Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Create-SJMCL-Extension CLI

create-sjmcl-extension scaffolds an SJMCL extension project with a local build pipeline for src/ tree and npm dependencies.

Install

npm install -g create-sjmcl-extension@latest

Usage

npx create-sjmcl-extension

CLI Options

Base 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-extension

Generated Project

The generated project includes a small build pipeline and three project scripts:

npm run dev

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-output

npm run build

Builds the extension package from the local source tree.

Build characteristics:

  • Source entry: src/index.ts or src/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=off

Build output files:

  • dist/<identifier>/
  • dist/<identifier>-<version>.sjmclx

The build script also copies these files into the packaged output when present:

  • sjmcl.ext.json
  • icon.png
  • assets/
  • data/

npm run bump -- <semver>

Updates both package.json and sjmcl.ext.json to the exact version you provide.

Host-Provided Singleton Packages

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

References

About

npm i -g create-sjmcl-extension

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages