Skip to content

Add typespec-lib and typespec-emitter keywords to workspace packages#9872

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-keywords-to-package-json
Draft

Add typespec-lib and typespec-emitter keywords to workspace packages#9872
Copilot wants to merge 5 commits intomainfrom
copilot/add-keywords-to-package-json

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

Adds discoverable keywords to workspace package.json files so consumers and tooling can identify TypeSpec libraries and emitters via npm search/metadata.

Detection logic

  • typespec-lib — package has tspMain pointing to a .tsp file, or exports[x].typespec resolves to a .tsp file
  • typespec-emitter — package exports a $onEmit function, or package name contains emitter

Changes

  • Both tags (typespec-lib + typespec-emitter): json-schema, openapi3, protobuf, http-client-csharp
  • Library only (typespec-lib): compiler, events, http, http-client, openapi, rest, sse, spector, streams, versioning, xml
  • Emitter only (typespec-emitter): asset-emitter, emitter-framework, html-program-viewer, http-client-java, http-client-js, http-client-python, http-server-csharp, http-server-js

Existing keywords are preserved; new keywords are appended.

Original prompt

Goal: create a PR in microsoft/typespec that adds the correct keyword(s) to each workspace package's package.json.

Requirements

  • For each package that is a TypeSpec library, ensure its package.json contains the keyword: typespec:lib.
  • For each package that contains an emitter, ensure its package.json contains the keyword: typespec:emitter.
  • Preserve existing keywords; add to the existing keywords array.
  • If keywords is missing, create it.
  • Keep keywords sorted or at least stable/deterministic across packages.
  • Do not add these keywords to non-package package.json files that are not actual published/workspace packages (e.g., e2e fixtures, docs samples) unless they are part of the intended published packages.

How to detect

  • Treat a package as a TypeSpec library if its package.json includes tspMain or exports a .tsp entry (e.g., exports["."].typespec), or it has lib/**/*.tsp in files.
  • Treat a package as an emitter if it includes typical emitter signals such as a dependency on @typespec/compiler and contains an emitter entry point (common patterns in this repo), or package name includes emitter / *-emitter-*.
  • Use repository conventions to reliably identify emitters and libraries; prefer existing structure and any internal docs.

Scope

  • Apply to all packages under packages/*/package.json that represent actual packages.
  • Root package.json should generally not get these keywords.

Validation

  • After updates, ensure all modified package.json files remain valid JSON.
  • Run formatting if the repo uses a formatter for JSON (respect existing formatting).

Context

  • Repository: microsoft/typespec
  • Current date: 2026-03-02
  • Requesting user: timotheeguerin

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…kage.json files

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added compiler:core Issues for @typespec/compiler emitter-framework Issues for the emitter framework lib:http lib:openapi lib:rest lib:versioning emitter:client:js Issue for the JS client emitter: @typespec/http-client-js emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python emitter:json-schema emitter:protobuf The protobuf emitter emitter:openapi3 Issues for @typespec/openapi3 emitter ui:type-graph-viewer spector Issues related to spector and the spec sets labels Mar 2, 2026
Copilot AI changed the title [WIP] Add typespec keywords to workspace packages Add typespec:lib and typespec:emitter keywords to workspace packages Mar 2, 2026
@timotheeguerin
Copy link
Member

Adding this so we can have a search showing typespec packages on npm see #9876

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

All changed packages have been documented.

  • @typespec/asset-emitter
  • @typespec/compiler
  • @typespec/emitter-framework
  • @typespec/events
  • @typespec/html-program-viewer
  • @typespec/http-client-java
  • @typespec/http-client-js
  • @typespec/http-client-python
  • @typespec/http-client
  • @typespec/http-server-csharp
  • @typespec/http-server-js
  • @typespec/http
  • @typespec/json-schema
  • @typespec/openapi
  • @typespec/openapi3
  • @typespec/protobuf
  • @typespec/rest
  • @typespec/spector
  • @typespec/sse
  • @typespec/streams
  • @typespec/versioning
  • @typespec/xml
Show changes

@typespec/asset-emitter - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/compiler - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/emitter-framework - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/events - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/html-program-viewer - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/http-client-java - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/http-client-js - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/http-client-python - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/http-client - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/http-server-csharp - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/http-server-js - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/http - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/json-schema - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/openapi - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/openapi3 - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/protobuf - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/rest - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/spector - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/sse - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/streams - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/versioning - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@typespec/xml - internal ✏️

Add typespec:lib and typespec:emitter keywords to workspace packages

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 2, 2026

Open in StackBlitz

@typespec/asset-emitter

npm i https://pkg.pr.new/microsoft/typespec/@typespec/asset-emitter@9872

@typespec/compiler

npm i https://pkg.pr.new/microsoft/typespec/@typespec/compiler@9872

@typespec/emitter-framework

npm i https://pkg.pr.new/microsoft/typespec/@typespec/emitter-framework@9872

@typespec/events

npm i https://pkg.pr.new/microsoft/typespec/@typespec/events@9872

@typespec/html-program-viewer

npm i https://pkg.pr.new/microsoft/typespec/@typespec/html-program-viewer@9872

@typespec/http

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http@9872

@typespec/http-client

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client@9872

@typespec/http-client-csharp

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client-csharp@9872

@typespec/http-client-js

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client-js@9872

@typespec/http-client-python

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client-python@9872

@typespec/http-server-csharp

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-server-csharp@9872

@typespec/http-server-js

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-server-js@9872

@typespec/json-schema

npm i https://pkg.pr.new/microsoft/typespec/@typespec/json-schema@9872

@typespec/openapi

npm i https://pkg.pr.new/microsoft/typespec/@typespec/openapi@9872

@typespec/openapi3

npm i https://pkg.pr.new/microsoft/typespec/@typespec/openapi3@9872

@typespec/protobuf

npm i https://pkg.pr.new/microsoft/typespec/@typespec/protobuf@9872

@typespec/rest

npm i https://pkg.pr.new/microsoft/typespec/@typespec/rest@9872

@typespec/spector

npm i https://pkg.pr.new/microsoft/typespec/@typespec/spector@9872

@typespec/sse

npm i https://pkg.pr.new/microsoft/typespec/@typespec/sse@9872

@typespec/streams

npm i https://pkg.pr.new/microsoft/typespec/@typespec/streams@9872

@typespec/versioning

npm i https://pkg.pr.new/microsoft/typespec/@typespec/versioning@9872

@typespec/xml

npm i https://pkg.pr.new/microsoft/typespec/@typespec/xml@9872

commit: fba93ce

@timotheeguerin
Copy link
Member

@copilot : might be the wrong separator for npm keywords, would - be better or something else be better (replace)

…c-emitter)

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot : might be the wrong separator for npm keywords, would - be better or something else be better (replace)

Changed to use - as the separator: typespec-lib and typespec-emitter. This aligns better with npm keyword conventions. Done in 7fc5292.

Copilot AI changed the title Add typespec:lib and typespec:emitter keywords to workspace packages Add typespec-lib and typespec-emitter keywords to workspace packages Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:js Issue for the JS client emitter: @typespec/http-client-js emitter:client:python Issue for the Python client emitter: @typespec/http-client-python emitter:json-schema emitter:openapi3 Issues for @typespec/openapi3 emitter emitter:protobuf The protobuf emitter emitter-framework Issues for the emitter framework lib:http lib:openapi lib:rest lib:versioning spector Issues related to spector and the spec sets ui:type-graph-viewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants