hps-dev-kits is a Hps Dev Kits plugin in the Hub Base group.hps-dev-kits provides Hps Dev Kits plugin capabilities for Hub Base. Shared open libraries, utilities, and testing foundations. It is especially useful for core workflows.
CoreVendure Plugins
Specifications
Technical details and package information for this product.
Package
@hyperse-hub/hps-dev-kits
Support languages
TypeScript, JavaScript, Prolog, Shell
Last published
July 02, 2026
@hyperse-hub/hps-dev-kits
Developer toolkit for Hyperse HPS (Evolve) projects. It provides two categories of capabilities:
- CLI tools:
hps_build (build + optional deploy + generate manifest), hps_tsc (TypeScript compilation enhancements)
- Programmable APIs: build/dev/manifest assembly around HPS Evolve, static page scanning, menu extension merging, Rspack plugins, etc.
Requirements & Installation
- Node.js: >= 20
- Package manager: any (examples use
yarn)
Install as a dev dependency:
yarn add -D @hyperse-hub/hps-dev-kits
Or add it as a workspace dependency in your monorepo.
Quick Start
1) Build and generate hps.manifest.json
Run in your project root:
By default it will:
- Run
hps build evolve and assemble manifest data for both production and development
- Use default
target=aliyun and default deployment prefix prefix=webapps
- Generate
hps.manifest.json (written to the project root by default)
If you only want to generate the manifest and do not want to deploy:
2) Compile TypeScript with hps_tsc (clean, copy dashboard, minify)
Run in your project root:
By default it will:
- Clean
dist/
- Generate a temporary
tsconfig.temp.json, then run npx tsc --project tsconfig.temp.json
- If
src/dashboard exists, copy it to dist/dashboard
- Minify
.js/.mjs under dist/ (via terser, keeping function/class names to reduce runtime reflection risk)
CLI: hps_build
Purpose
For HPS Evolve builds, optionally triggering deploy when needed, and generating hps.manifest.json for downstream consumers.
Command
What it does (default behavior)
When you run hps_build with no flags, it performs the following steps:
- Build (Evolve): runs
hps build evolve --projectCwd=<projectCwd>
- Deploy: runs
hps deploy with defaults (unless --noDeploy is provided)
- Assemble manifest: scans files under
<projectCwd>/public and generates hps.manifest.json
- Always includes
**/*.html in addition to your --match patterns
- Uses
REMOTE_CDN_BASE_URL (if set) to prefix URLs in the manifest
Options (full matrix)
-
-p, --projectCwd <path>
- Type:
string
- Default:
process.cwd()
- Use when: run build/deploy/manifest generation against a different project root (e.g. a package in a monorepo)
-
--target <name>
- Type:
string
- Default:
aliyun
- Use when: select the deployment target supported by your
@hyperse/hps setup
-
--prefix <prefix>
Environment variables
REMOTE_CDN_BASE_URL
- Use when: you want
styles/scripts/main in the manifest to be resolvable CDN URLs
- Example:
REMOTE_CDN_BASE_URL="https://cdn.example.com"
How file collection works (important details)
After deploy (or when assembling the manifest), hps_build collects files for each entry and writes them into hps.manifest.json:
- Lookup directory:
<projectCwd>/public (this is controlled by the underlying build API default relativePath: 'public')
- Included patterns:
- Your
--match patterns (or the defaults)
- Plus
**/*.html is always included to ensure templates/pages are captured
- Built-in ignores during file walking include:
**/__MACOSX/**, **/*.DS_Store, **/node_modules/**, **/.git/**
- Per-entry mapping:
styles: .css files
main: first bundle*.js (heuristic: the first JS that starts with bundle)
Scenarios (copy/paste recipes)
Tips & pitfalls
--match/--ignore are passed to deploy and also affect manifest collection (HTML is always included additionally).
- Manifest collection reads from
public/. If your build outputs to a different directory, you must use the programmable API (createHpsBuild) with relativePath changed (the CLI currently does not expose relativePath).
main selection is heuristic (bundle*.js). If your naming differs, the manifest may place your actual entry into scripts instead of main.
CLI: hps_tsc
Purpose
Run TypeScript compilation with common engineering enhancements (clean dist, copy dashboard, minify).
Command
What it does (default behavior)
When you run hps_tsc with no flags, it performs the following steps:
- Clean: deletes
dist/ (enabled by default via --clean)
- Compile: generates
tsconfig.temp.json and runs npx tsc --project tsconfig.temp.json
- Copy dashboard: if
src/dashboard exists, it copies it to dist/dashboard (enabled by default via --copy-dashboard)
- Minify: minifies
.js / .mjs files under dist/ (enabled by default via --minify)
Notes
- The temporary config always emits declarations and outputs to
dist/.
- It excludes
src/dashboard/** from compilation and copies it as static files instead.
Options (full matrix)
Temporary tsconfig.temp.json (important details)
hps_tsc creates a temporary config with these notable settings:
rootDir: ./src
outDir: ./dist
declaration: true
sourceMap: false
moduleResolution: nodenext
exclude includes:
src/dashboard/** (copied separately when --copy-dashboard is enabled)
src/gql/**
Scenarios (copy/paste recipes)
Tips & pitfalls
--includes is for the TypeScript include list, not for runtime copying. It won’t affect copying src/dashboard.
src/dashboard/** is excluded from compilation by design. If you want it compiled by tsc, you must change the tool or your folder layout (because the temp config excludes it).
--minify only touches .js/.mjs under dist/. It won’t minify CSS/HTML/assets.
Output: hps.manifest.json
Shape
The on-disk manifest file format is HpsManifestJson. It contains metadata plus an extensions registration table. Each extension row may include a builtAssetManifest with production / development asset URLs.
How hps_build populates these fields
schemaVersion/generatedAt: added at write time.
extensions.*Extensions: collected from the Evolve entryMap (entries that define options.adminExtension).
builtAssetManifest.*: built from files under <projectCwd>/<relativePath> (default public/), matching --match/--ignore plus **/*.html.
styles/scripts/main are remote URLs (prefers REMOTE_CDN_BASE_URL; otherwise derives from htmlPlugin.htmlCdn).
html is the read from the built under each entry.
Note: the return value of createHpsBuild is the raw per-entry asset map (Record<entryName, HpsManifestEntry>). The written file is the HpsManifestJson wrapper above, because downstream consumers load extensions from manifest.extensions.
Programmable APIs (by feature)
Examples below use ESM imports (this package is type=module).
Build & manifest
createHpsBuild(options, noDeploy?)
Triggers an HPS Evolve build, optionally deploys, then writes hps.manifest.json.
writeManifestToFile(manifest, { projectCwd, manifestPath? })
Writes a HpsManifestJson to disk (supports relative/absolute paths).
prepareUploadFiles({ lookupCwd, matchPatterns, ignorePatterns? })
Collects files using glob patterns (built-in ignore patterns: __MACOSX, .DS_Store, node_modules, .git).
Dev server & (development) manifest
createHpsServer({ projectCwd?, devPort?, manifestPath?, isMonorepo? })
Starts hps serve evolve, then fetches runtime/manifest.json from the dev server and assembles it into hps.manifest.json (primarily development-side assets).
- Normal project: writes a single manifest under
projectCwd
- Monorepo (
isMonorepo=true): splits the manifest based on cached entryMap and writes it back to each package's manifestPath
Note: for HTTPS dev servers, it disables certificate verification (rejectUnauthorized=false) to support local self-signed certificates.
Config loading (Evolve config)
loadEvolveConfig(projectCwd, configEnv, configLoaderOptions?)
Loads hps config (e.g. hps.config.ts or similar conventions) and returns a partial HpsEvolveOptions.
createEvolveOptions(env, mode, options)
Async helper that produces full HpsEvolveOptions for Evolve serve/build: dev server defaults, Rspack resolution, and a PostCSS pipeline (@tailwindcss/postcss plus plugin CSS scoping). It expands your entryMap (CustomEntryMap: each key is an entry name, each value has type: 'page' | 'plugin' and optional entry, menu metadata, etc.) into the shape Evolve expects. The sections below describe the default / layout and how plugin styles interact with Tailwind preflight.
Evolve entry layout: ui/pages & ui/plugins (createEvolveOptions)
When you build options with createEvolveOptions, each entryMap row has a type of either page or plugin. Default entry paths (relative to projectCwd) are:
type | Default entry glob | On-disk convention |
|---|
page | ./ui/pages/<entryName>/index | ui/pages/<entryName>/index.* |
plugin | ./ui/plugins/<entryName>/index | ui/plugins/<entryName>/index.* |
<entryName> is the key in entryMap (e.g. entryMap.home → ui/plugins/home/ or ui/pages/home/ depending on type).
entry override: each row may set entry: ['./path/to/index']. The default PostCSS plugin (below) resolves plugin vs page CSS using both these defaults and any custom entry paths.
Plugin CSS, Tailwind preflight, and the host shell
Remote plugins mount inside the main admin shell. The shell already applies global baseline styles, so plugin bundles should not ship a second Tailwind preflight (reset), or rules will fight the host.
With createEvolveOptions, the default Rspack PostCSS stack includes createPluginCssScopePostcssPlugin (this package). For stylesheets that belong to an entryMap item with type: 'plugin' it:
- Removes
@layer base — Tailwind v4 emits preflight in that layer, so this effectively disables preflight for plugin CSS at build time.
- Scopes selectors under
[data-plugin-var="<projectVirtualPath>/<entryName>"], and maps :root to that container so CSS variables stay per-plugin.
type: 'page' entries do not get preflight stripped by this plugin (full-page modules own their document context).
Optional (plugin.css or your plugin entry stylesheet): if you keep a dedicated stylesheet for a plugin (e.g. plugin.css imported from ./ui/plugins/<name>/index), you can also turn off Tailwind preflight in that file per Tailwind’s docs when you are not on the default stack—or as an extra safeguard. With the default createEvolveOptions PostCSS setup, the automatic @layer base removal for plugin entries is usually sufficient.
Static pages
getStaticPages(packageNameOrAbsPath, folderName='templates')
Scans the static page templates directory (default: templates) under a package (monorepo package or a package in node_modules) and returns:
entryName: directory name relative to templates
htmlPath: absolute path of index.html
routePath: /${entryName}
Useful for registering static templates as routes/pages in batch.
Versioning & releases (Changesets)
getReleaseVersion(projectCwd)
Reads the Changesets release plan of the repo containing the current package, returning the package newVersion (or null if not found).
Load admin extensions from manifest (HPS plugin-admin registration)
loadHpsAdminExtensionsFromManifest({ projectRoot, manifestPath?, mode? })
Reads local hps.manifest.json (including extensions.menuExtensions / extensions.moduleExtensions written by hps_build), merges each entry’s builtAssetManifest URLs for the requested environment into the extension template, and returns an array of admin extension objects for registerAdminExtensions. The current package version is applied when merging.
mode: uses builtAssetManifest.development or builtAssetManifest.production (default: production)
- Internally computes both development/production and caches them into
menuExtensionsCache
Rspack plugin
AliasResolveRspackPlugin
During Rspack module resolution, it resolves requests via HpsSpecifierLoader (commonly used to make aliases/path mappings work during bundling).
Common workflows
Workflow A: build + deploy + generate manifest for backend/registry
REMOTE_CDN_BASE_URL="https://cdn.example.com" npx hps_build
Feed the generated hps.manifest.json into your downstream flows (extension registration / menu merge / release pipeline).
Workflow B: generate development manifest after local serve
Start the dev server and write the development manifest (useful for local extension integration testing):
FAQ
How should I write hps_build --match/--ignore?
They affect both deploy matching and asset collection into hps.manifest.json (internally **/*.html is also included to ensure templates are picked up).
Start from the static outputs under public/ and iteratively tighten the patterns.
Why do manifest URLs include REMOTE_CDN_BASE_URL?
So downstream consumers can directly use a resolvable CDN URL. If the env var is not set, URLs may only include relative paths or the computed prefix.
Default: webappsUse when: you want the deployed remote paths and manifest URLs to live under a different prefix
--match <glob> (repeatable)
- Type:
string[]
- Default: auto-generated when omitted
- Use when: you want to explicitly control what gets deployed/collected
- Notes:
- You can pass it multiple times:
--match "<a>" --match "<b>"
- If omitted, the deploy step defaults to matching:
${projectVirtualPath}/**/*.{png,jpg,jpeg,gif,svg,js,css}
--ignore <glob> (repeatable)
- Type:
string[]
- Default:
[]
- Use when: you need to exclude files from deploy/collection (e.g.
**/*.map, **/*.test.*)
--manifestPath <path>
- Type:
string
- Default:
hps.manifest.json
- Use when: write the manifest to a custom location (supports relative or absolute path)
--noDeploy
- Type:
boolean
- Default:
false
- Use when: you only want to run build and generate the manifest, without running the deploy step
-h, --help
- Type:
boolean
- Default:
false
- Use when: print CLI help
scripts: other .js files (excluding main)html: contents of .html file (if found)
npx hps_build
npx hps_build --projectCwd ./my-project --target aliyun --prefix webapps
npx hps_build --match "**/*.{js,css,svg,png,jpg,jpeg,gif}" --ignore "**/*.map"
npx hps_build --noDeploy
npx hps_build --ignore "**/*.map" --ignore "**/*.test.*"
npx hps_build --manifestPath "artifacts/hps.manifest.json"
npx hps_build --manifestPath "/tmp/hps.manifest.json"
REMOTE_CDN_BASE_URL="https://cdn.example.com" npx hps_build
projectCwd
Use when: your base tsconfig is not at the default location (relative or absolute path)
-w, --watch
- Type:
boolean
- Default:
false
- Use when: local development watch mode
--clean / --no-clean
- Type:
boolean
- Default:
true
- Use when:
--no-clean for faster iteration; --clean for reproducible CI builds
--minify
- Type:
boolean
- Default:
true
- Use when: disable for easier debugging, or when a bundler/minifier will run later
--copyDashboard
- Type:
boolean
- Default:
true
- Use when: disable if you don’t have
src/dashboard, or you manage asset copying elsewhere
-h, --help
- Type:
boolean
- Default:
false
- Use when: print CLI help
**/node_modules, **/dist, **/build, **/.*/vite.*.*ts
npx hps_tsc
npx hps_tsc --includes "src/**/*,index.ts,lib/**/*"
npx hps_tsc --watch --includes "src/**/*"
npx hps_tsc --no-clean --watch
npx hps_tsc --clean
npx hps_tsc --no-clean --minify=false
npx hps_tsc --copy-dashboard=false
npx hps_tsc --projectCwd packages/my-package
npx hps_tsc --tsconfigPath ./tsconfig.json
npx hps_tsc --tsconfigPath "/abs/path/to/tsconfig.base.json"
type HpsManifestAssets = {
styles?: string[];
scripts?: string[];
main?: string;
html?: string;
};
type HpsManifestEntry = {
production?: HpsManifestAssets;
development?: HpsManifestAssets;
};
type HpsManifestJson = {
schemaVersion?: number;
generatedAt?: string;
extensions?: {
menuExtensions: Record<
string,
{
builtAssetManifest?: HpsManifestEntry & { extensionVar?: string };
}
>;
moduleExtensions: Record<
string,
{
builtAssetManifest?: HpsManifestEntry & { extensionVar?: string };
}
>;
};
};
inline HTML content
index.html
extensionVar is taken from the extension template (or carried through if present).import { createHpsBuild } from '@hyperse-hub/hps-dev-kits';
await createHpsBuild(
{
projectCwd: process.cwd(),
target: 'aliyun',
prefix: 'webapps',
manifestPath: 'hps.manifest.json',
match: ['**/*.{png,jpg,jpeg,gif,svg,js,css}'],
ignore: ['**/*.map'],
},
false
);
ui/pages
ui/plugins
import { createHpsServer } from '@hyperse-hub/hps-dev-kits';
await createHpsServer({
projectCwd: process.cwd(),
devPort: 3000,
manifestPath: 'hps.manifest.json',
isMonorepo: false,
});