Skip to content

feat: full TypeScript library scaffold for mdz-core-js#1

Draft
kylemwhite with Copilot wants to merge 2 commits into
mainfrom
copilot/initialize-project-structure
Draft

feat: full TypeScript library scaffold for mdz-core-js#1
kylemwhite with Copilot wants to merge 2 commits into
mainfrom
copilot/initialize-project-structure

Conversation

Copilot AI commented Mar 15, 2026

Copy link
Copy Markdown

Bootstraps mdz-core-js from an empty repo into a publishable TypeScript library with dual ESM/CJS output, CI/CD, and full repo health infrastructure.

Core library (src/)

  • types.ts — public interfaces: MdzManifest, MdzEntry, MdzArchive, RenderOptions, RenderResult
  • parser.tsparseManifest(json) with strict validation; createArchive(manifest, entries?) returning a readable MdzArchive
  • renderer.tsrender(archive, options?) placeholder: headings, paragraphs, Markdown image syntax → HTML with baseUrl resolution and HTML escaping
  • index.ts — single-entry barrel; consumers import only from here
import { parseManifest, createArchive, render } from 'mdz-core-js';

const manifest = parseManifest(JSON.stringify({
  version: '1', title: 'My Doc',
  entries: [{ path: 'index.md', mimeType: 'text/markdown' }],
}));
const archive = createArchive(manifest, new Map([
  ['index.md', new TextEncoder().encode('# Hello')],
]));
const { html } = render(archive, { baseUrl: 'https://cdn.example.com' });
// → <h1>Hello</h1>

Build & toolchain

  • tsup — ESM + CJS dual output, .d.ts declarations, sourcemaps, "sideEffects": false
  • package.jsonexports map (typesimportrequire), files whitelist, prepublishOnly guard
  • tsconfig.json — strict mode, noUncheckedIndexedAccess, exactOptionalPropertyTypes
  • ESLint flat config with typescript-eslint strictTypeChecked + Prettier; separate tsconfig.lint.json covers tests/
  • Vitest with @vitest/coverage-v8; 80% coverage thresholds; 24 tests across parser, renderer, and barrel

CI/CD (.github/workflows/)

  • ci.yml — Node 18/20/22 matrix: format → lint → typecheck → test+coverage → build; separate npm pack --dry-run job on every PR
  • release.yml — fires on v*.*.* tags; full quality gate → npm publish --provenance → GitHub Release
  • changeset-release.yml — Changesets automation: opens Version PR on merge to main, then publishes on Version PR merge

Repo health

  • RELEASING.md — step-by-step release flow + table of required manual secrets/settings (NPM_TOKEN, branch protection, optional OIDC)
  • ROADMAP.md — migration notes from existing repo, near-term goals (zip extraction, full Markdown pipeline), longer-term Angular/React split
  • CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, issue templates (bug/feature), PR template
  • MIT LICENSE (replaced Apache 2.0), .editorconfig, .gitignore
Original prompt

Create a new GitHub repository named mdz-core-js for a TypeScript library that will be published to npm and used to read/render .mdz archives.

Context:

Most core code already exists in another repo (we will copy it in).
This task is mainly project scaffolding, packaging, CI/CD, and release workflow.
Target audience is web/Node consumers and future framework wrappers (Angular component depends on this core).
Please do the following:

Initialize project structure
TypeScript library layout (src/, tests/, dist/ output).
ESM-first build (with CJS compatibility if reasonable).
Public API barrel (src/index.ts).
Strict TS config and clean lint/format setup.
Add .editorconfig, .gitignore, MIT license, and solid README.md.
npm package setup
package.json configured for library publishing:
name: mdz-core-js
proper exports, types, main/module (or ESM-only with clear docs)
files whitelist for publish
scripts: build, dev, test, typecheck, lint, clean, prepublishOnly
Include source maps and declaration files.
Ensure package is tree-shake friendly.
Testing and quality gates
Add a test framework and baseline tests.
Add coverage support.
Add CI checks so PRs run: install, lint, typecheck, test, build.
GitHub Actions workflows
ci.yml for PRs/pushes.
release.yml for tagged releases.
npm publish workflow (trusted publishing/OIDC preferred).
Optional dry-run publish check on PR.
Release/versioning
Set up Changesets (or semantic-release) for versioning/changelog automation.
Document release process in CONTRIBUTING.md and/or RELEASING.md.
Repo health/community files
Add issue templates (bug/feature), PR template.
Add CODE_OF_CONDUCT.md, CONTRIBUTING.md, and security policy.
Add badges in README (CI, npm version once available).
Migration placeholder
Create a MIGRATION_NOTES.md or ROADMAP.md noting:
code is being moved from existing project
near-term goals: unpacking/manifest/path resolution + rendering helpers
longer-term: Angular service/component split
Deliverables:

Complete scaffold committed in logical commits.
Clear README with install/use examples and development commands.
A final checklist of what still requires manual secrets/settings in GitHub (npm token or OIDC config, branch protection, etc.).


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Co-authored-by: kylemwhite <4984480+kylemwhite@users.noreply.github.com>
Copilot AI changed the title [WIP] Add project scaffolding for mdz-core-js library feat: full TypeScript library scaffold for mdz-core-js Mar 15, 2026
Copilot AI requested a review from kylemwhite March 15, 2026 03:16

@kylemwhite kylemwhite left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants