fix(cli): write registry config in scaffolds
This commit is contained in:
parent
211d36ac5f
commit
4817d604cf
@ -88,24 +88,19 @@ repo surface.
|
|||||||
Run from the repository root:
|
Run from the repository root:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm prove:cli-uat
|
pnpm prove:cli
|
||||||
|
pnpm prove:fresh-samples
|
||||||
pnpm prove
|
pnpm prove
|
||||||
```
|
```
|
||||||
|
|
||||||
Expected:
|
Expected:
|
||||||
|
|
||||||
- `prove:cli-uat` reports `ok: true`.
|
- `prove:cli` builds/tests the SDK CLI and runs the standalone greeter demo.
|
||||||
- `legacyMonorepoPathReferences` is `false`.
|
- `prove:fresh-samples` proves the fresh server and browser demos.
|
||||||
- `managedHostProof` is skipped unless `MATRIX_SDK_RUNTIME_HOST_BIN` is supplied.
|
|
||||||
- `prove` builds, tests, type-checks, and packs all workspace packages.
|
- `prove` builds, tests, type-checks, and packs all workspace packages.
|
||||||
|
|
||||||
Demo checks:
|
Demo checks:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm demo:standalone
|
pnpm demo:standalone
|
||||||
pnpm demo:hivecast-login -- --check
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`demo:hivecast-login -- --check` proves the demo wiring without requiring a
|
|
||||||
secret. A real HiveCast proof requires `MATRIX_API_KEY`, `MATRIX_CLOUD`, and
|
|
||||||
`MATRIX_SPACE` from the user.
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/browser-host",
|
"name": "@open-matrix/browser-host",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"description": "Browser host shell for Matrix custom elements (extracted from @open-matrix/core during core-decontamination).",
|
"description": "Browser host shell for Matrix custom elements (extracted from @open-matrix/core during core-decontamination).",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/browser-kit",
|
"name": "@open-matrix/browser-kit",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"description": "Shared browser infrastructure for Matrix webapps — shims, theme tokens, vite config factory, app shell",
|
"description": "Shared browser infrastructure for Matrix webapps — shims, theme tokens, vite config factory, app shell",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/cli",
|
"name": "@open-matrix/cli",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Matrix package-author CLI.",
|
"description": "Matrix package-author CLI.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@ -7,7 +7,15 @@
|
|||||||
|
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import { toKebabCase, toPascalCase, validateMatrixManifest, writeJsonFile, generatePackageJson, generateTsconfig } from '../utils/scaffold.js';
|
import {
|
||||||
|
generatePackageJson,
|
||||||
|
generateTsconfig,
|
||||||
|
toKebabCase,
|
||||||
|
toPascalCase,
|
||||||
|
validateMatrixManifest,
|
||||||
|
writeJsonFile,
|
||||||
|
writeScaffoldNpmrc,
|
||||||
|
} from '../utils/scaffold.js';
|
||||||
|
|
||||||
export interface IActorCommandOptions {
|
export interface IActorCommandOptions {
|
||||||
readonly cwd?: string;
|
readonly cwd?: string;
|
||||||
@ -205,6 +213,7 @@ export async function actorCommand(name: string, options: IActorCommandOptions =
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeJsonFile(path.join(rootDir, 'matrix.json'), manifest);
|
writeJsonFile(path.join(rootDir, 'matrix.json'), manifest);
|
||||||
|
writeScaffoldNpmrc(rootDir);
|
||||||
writeJsonFile(path.join(rootDir, 'package.json'), generatePackageJson(normalizedName, { service: true }));
|
writeJsonFile(path.join(rootDir, 'package.json'), generatePackageJson(normalizedName, { service: true }));
|
||||||
writeJsonFile(path.join(rootDir, 'tsconfig.json'), generateTsconfig({ service: true }));
|
writeJsonFile(path.join(rootDir, 'tsconfig.json'), generateTsconfig({ service: true }));
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
|
|||||||
@ -13,8 +13,13 @@
|
|||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import {
|
import {
|
||||||
toKebabCase, toPascalCase, validateMatrixManifest, writeJsonFile,
|
generatePackageJson,
|
||||||
generatePackageJson, generateTsconfig,
|
generateTsconfig,
|
||||||
|
toKebabCase,
|
||||||
|
toPascalCase,
|
||||||
|
validateMatrixManifest,
|
||||||
|
writeJsonFile,
|
||||||
|
writeScaffoldNpmrc,
|
||||||
} from '../utils/scaffold.js';
|
} from '../utils/scaffold.js';
|
||||||
|
|
||||||
export interface IWebappCommandOptions {
|
export interface IWebappCommandOptions {
|
||||||
@ -517,6 +522,7 @@ export async function webappCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeJsonFile(path.join(rootDir, 'matrix.json'), manifest);
|
writeJsonFile(path.join(rootDir, 'matrix.json'), manifest);
|
||||||
|
writeScaffoldNpmrc(rootDir);
|
||||||
writeJsonFile(path.join(rootDir, 'package.json'), generatePackageJson(normalizedName, { webapp: true }));
|
writeJsonFile(path.join(rootDir, 'package.json'), generatePackageJson(normalizedName, { webapp: true }));
|
||||||
writeJsonFile(path.join(rootDir, 'tsconfig.json'), generateTsconfig({ webapp: true }));
|
writeJsonFile(path.join(rootDir, 'tsconfig.json'), generateTsconfig({ webapp: true }));
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ export function createProgram(): Command {
|
|||||||
program
|
program
|
||||||
.name('matrix')
|
.name('matrix')
|
||||||
.description('Matrix SDK CLI for package authors')
|
.description('Matrix SDK CLI for package authors')
|
||||||
.version('0.1.5');
|
.version('0.1.6');
|
||||||
|
|
||||||
const broker = program
|
const broker = program
|
||||||
.command('broker')
|
.command('broker')
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
|
import { MATRIX_NPM_REGISTRY_SCOPES } from './npm-registry-client.js';
|
||||||
import { validateManifestForMxCli } from './manifestValidator.js';
|
import { validateManifestForMxCli } from './manifestValidator.js';
|
||||||
|
|
||||||
export interface ScaffoldOptions {
|
export interface ScaffoldOptions {
|
||||||
@ -70,6 +71,22 @@ export function writeJsonFile(filePath: string, value: unknown): void {
|
|||||||
fs.writeFileSync(filePath, JSON.stringify(value, null, 2) + '\n', 'utf8');
|
fs.writeFileSync(filePath, JSON.stringify(value, null, 2) + '\n', 'utf8');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_SCAFFOLD_MATRIX_REGISTRY = 'https://registry.hivecast.ai/api/packages/open-matrix/npm/';
|
||||||
|
|
||||||
|
export function scaffoldNpmrcLines(
|
||||||
|
registry = DEFAULT_SCAFFOLD_MATRIX_REGISTRY,
|
||||||
|
): readonly string[] {
|
||||||
|
return [
|
||||||
|
'registry=https://registry.npmjs.org/',
|
||||||
|
...MATRIX_NPM_REGISTRY_SCOPES.map((scope) => `${scope}:registry=${registry}`),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function writeScaffoldNpmrc(rootDir: string, registry?: string): void {
|
||||||
|
fs.mkdirSync(rootDir, { recursive: true });
|
||||||
|
fs.writeFileSync(path.join(rootDir, '.npmrc'), `${scaffoldNpmrcLines(registry).join('\n')}\n`, 'utf8');
|
||||||
|
}
|
||||||
|
|
||||||
export function validateMatrixManifest(manifest: unknown): { valid: boolean; errors: string[] } {
|
export function validateMatrixManifest(manifest: unknown): { valid: boolean; errors: string[] } {
|
||||||
const result = validateManifestForMxCli(manifest);
|
const result = validateManifestForMxCli(manifest);
|
||||||
return { valid: result.valid, errors: result.errors };
|
return { valid: result.valid, errors: result.errors };
|
||||||
|
|||||||
@ -60,6 +60,7 @@ describe('developer lifecycle: scaffold + validate + install', () => {
|
|||||||
|
|
||||||
// All expected files
|
// All expected files
|
||||||
const expectedFiles = [
|
const expectedFiles = [
|
||||||
|
'.npmrc',
|
||||||
'matrix.json',
|
'matrix.json',
|
||||||
'package.json',
|
'package.json',
|
||||||
'tsconfig.json',
|
'tsconfig.json',
|
||||||
@ -95,6 +96,12 @@ describe('developer lifecycle: scaffold + validate + install', () => {
|
|||||||
assert.ok(pkg.dependencies?.['@open-matrix/core']);
|
assert.ok(pkg.dependencies?.['@open-matrix/core']);
|
||||||
assert.equal(pkg.devDependencies?.['@open-matrix/core'], undefined);
|
assert.equal(pkg.devDependencies?.['@open-matrix/core'], undefined);
|
||||||
|
|
||||||
|
const npmrc = fs.readFileSync(path.join(actorDir, '.npmrc'), 'utf8');
|
||||||
|
assert.ok(npmrc.includes('registry=https://registry.npmjs.org/'));
|
||||||
|
assert.ok(npmrc.includes('@open-matrix:registry=https://registry.hivecast.ai/api/packages/open-matrix/npm/'));
|
||||||
|
assert.ok(npmrc.includes('@matrix:registry=https://registry.hivecast.ai/api/packages/open-matrix/npm/'));
|
||||||
|
assert.ok(npmrc.includes('@omega:registry=https://registry.hivecast.ai/api/packages/open-matrix/npm/'));
|
||||||
|
|
||||||
// tsconfig.json
|
// tsconfig.json
|
||||||
const tsconfig = JSON.parse(fs.readFileSync(path.join(actorDir, 'tsconfig.json'), 'utf8'));
|
const tsconfig = JSON.parse(fs.readFileSync(path.join(actorDir, 'tsconfig.json'), 'utf8'));
|
||||||
assert.equal(tsconfig.compilerOptions.target, 'ES2022');
|
assert.equal(tsconfig.compilerOptions.target, 'ES2022');
|
||||||
@ -168,6 +175,7 @@ describe('developer lifecycle: scaffold + validate + install', () => {
|
|||||||
|
|
||||||
// All expected webapp files
|
// All expected webapp files
|
||||||
const expectedFiles = [
|
const expectedFiles = [
|
||||||
|
'.npmrc',
|
||||||
'matrix.json',
|
'matrix.json',
|
||||||
'package.json',
|
'package.json',
|
||||||
'tsconfig.json',
|
'tsconfig.json',
|
||||||
@ -202,6 +210,9 @@ describe('developer lifecycle: scaffold + validate + install', () => {
|
|||||||
assert.ok(pkg.devDependencies?.['@open-matrix/core']);
|
assert.ok(pkg.devDependencies?.['@open-matrix/core']);
|
||||||
assert.ok(pkg.devDependencies?.['@open-matrix/federation']);
|
assert.ok(pkg.devDependencies?.['@open-matrix/federation']);
|
||||||
|
|
||||||
|
const npmrc = fs.readFileSync(path.join(appDir, '.npmrc'), 'utf8');
|
||||||
|
assert.ok(npmrc.includes('@open-matrix:registry=https://registry.hivecast.ai/api/packages/open-matrix/npm/'));
|
||||||
|
|
||||||
// tsconfig.json — DOM libs, noEmit
|
// tsconfig.json — DOM libs, noEmit
|
||||||
const tsconfig = JSON.parse(fs.readFileSync(path.join(appDir, 'tsconfig.json'), 'utf8'));
|
const tsconfig = JSON.parse(fs.readFileSync(path.join(appDir, 'tsconfig.json'), 'utf8'));
|
||||||
assert.ok(tsconfig.compilerOptions.lib?.includes('DOM'));
|
assert.ok(tsconfig.compilerOptions.lib?.includes('DOM'));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/contracts",
|
"name": "@open-matrix/contracts",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"description": "Type contracts for Matrix substrate (placement, service registry, runtime presence). Almost zero runtime — one pure function (decideMatrixPlacementBind) plus pure types. Zero @open-matrix/core dependency. Extracted from @open-matrix/core during core-decontamination Phase 2 so schema evolution doesn't rebuild the actor kernel.",
|
"description": "Type contracts for Matrix substrate (placement, service registry, runtime presence). Almost zero runtime — one pure function (decideMatrixPlacementBind) plus pure types. Zero @open-matrix/core dependency. Extracted from @open-matrix/core during core-decontamination Phase 2 so schema evolution doesn't rebuild the actor kernel.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/core",
|
"name": "@open-matrix/core",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"description": "Matrix runtime SDK \u2014 actors, Web Components, transports, serialization, and LISP-on-Protocol",
|
"description": "Matrix runtime SDK \u2014 actors, Web Components, transports, serialization, and LISP-on-Protocol",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -25,6 +25,7 @@
|
|||||||
"import": "./dist/src/index.js",
|
"import": "./dist/src/index.js",
|
||||||
"default": "./dist/src/index.js"
|
"default": "./dist/src/index.js"
|
||||||
},
|
},
|
||||||
|
"./package.json": "./package.json",
|
||||||
"./_node-compat": {
|
"./_node-compat": {
|
||||||
"types": "./dist/src/_node-compat.d.ts",
|
"types": "./dist/src/_node-compat.d.ts",
|
||||||
"import": "./dist/src/_node-compat.js",
|
"import": "./dist/src/_node-compat.js",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/federation",
|
"name": "@open-matrix/federation",
|
||||||
"version": "0.2.3",
|
"version": "0.2.4",
|
||||||
"description": "Matrix federation layer: mailbox-based cross-realm messaging with legacy (matrix3) and modern (mxenv1) wire format support and security guardrails.",
|
"description": "Matrix federation layer: mailbox-based cross-realm messaging with legacy (matrix3) and modern (mxenv1) wire format support and security guardrails.",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -16,6 +16,7 @@
|
|||||||
"require": "./dist/src/index.js",
|
"require": "./dist/src/index.js",
|
||||||
"default": "./dist/src/index.js"
|
"default": "./dist/src/index.js"
|
||||||
},
|
},
|
||||||
|
"./package.json": "./package.json",
|
||||||
"./*": {
|
"./*": {
|
||||||
"types": "./dist/src/*.d.ts",
|
"types": "./dist/src/*.d.ts",
|
||||||
"import": "./dist/src/*.js",
|
"import": "./dist/src/*.js",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/omega-core",
|
"name": "@open-matrix/omega-core",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Narrow Omega core/interpreter facade for Matrix membrane consumers",
|
"description": "Narrow Omega core/interpreter facade for Matrix membrane consumers",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
@ -13,7 +13,8 @@
|
|||||||
},
|
},
|
||||||
"types": "./dist/packages/omega-core/src/index.d.ts",
|
"types": "./dist/packages/omega-core/src/index.d.ts",
|
||||||
"import": "./dist/index.js"
|
"import": "./dist/index.js"
|
||||||
}
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/sdk",
|
"name": "@open-matrix/sdk",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"description": "Public Matrix actor SDK facade for package authors.",
|
"description": "Public Matrix actor SDK facade for package authors.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user