Skip to content

Commit 7491bfc

Browse files
authored
[tsp] Adding empty project for the TypeSpec library. (#318)
This pull request introduces the initial setup for the new `@alloy-js/typespec` package, including its configuration, dependencies, and build/test scripts. The changes ensure the package is ready for development, testing, and documentation generation, and integrate it into the project’s monorepo structure. **New package setup and configuration:** * Added `packages/typespec/package.json` to define the package name, exports/imports, scripts, dependencies, and devDependencies for `@alloy-js/typespec`. * Added `packages/typespec/tsconfig.json` to configure TypeScript compilation settings, declaration output, project references, and file inclusions/exclusions. * Added `packages/typespec/api-extractor.json` to configure API Extractor for documentation generation. * Added `packages/typespec/vitest.config.ts` to set up Vitest testing configuration and integrate the Alloy rollup plugin. **Monorepo integration:** * Updated `pnpm-lock.yaml` to register `@alloy-js/typespec` and its dependencies in the workspace, ensuring proper package management and linking.
1 parent a283f12 commit 7491bfc

File tree

7 files changed

+120
-1
lines changed

7 files changed

+120
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ packages/*/tsdoc-metadata.json
142142
packages/docs/src/content/docs/reference
143143
packages/docs/dist-build
144144

145-
alloy-output/
145+
alloy-output/
146+
.pnpm-store/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"extends": "../../api-extractor.base.json"
4+
}

packages/typespec/package.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "@alloy-js/typespec",
3+
"version": "0.1.0",
4+
"description": "",
5+
"exports": {
6+
".": {
7+
"development": "./src/index.ts",
8+
"import": "./dist/src/index.js"
9+
},
10+
"./stc": {
11+
"development": "./src/components/stc/index.ts",
12+
"import": "./dist/src/components/stc/index.js"
13+
},
14+
"./testing": {
15+
"development": "./testing/index.ts",
16+
"import": "./dist/testing/index.js"
17+
}
18+
},
19+
"imports": {
20+
"#components/*": {
21+
"development": "./src/components/*",
22+
"default": "./dist/src/components/*"
23+
}
24+
},
25+
"scripts": {
26+
"generate-docs": "api-extractor run",
27+
"build": "alloy build && pnpm run generate-docs",
28+
"clean": "rimraf dist/ .temp/",
29+
"test:watch": "vitest -w",
30+
"watch": "alloy build --watch",
31+
"test": "vitest run",
32+
"prepack": "node ../../scripts/strip-dev-exports.js"
33+
},
34+
"keywords": [],
35+
"license": "MIT",
36+
"dependencies": {
37+
"@alloy-js/core": "workspace:~",
38+
"change-case": "catalog:",
39+
"pathe": "catalog:"
40+
},
41+
"devDependencies": {
42+
"@alloy-js/cli": "workspace:~",
43+
"@alloy-js/rollup-plugin": "workspace:~",
44+
"@microsoft/api-extractor": "catalog:",
45+
"@rollup/plugin-typescript": "catalog:",
46+
"concurrently": "catalog:",
47+
"typescript": "catalog:",
48+
"vitest": "catalog:"
49+
},
50+
"type": "module"
51+
}

packages/typespec/src/index.ts

Whitespace-only changes.

packages/typespec/tsconfig.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"emitDeclarationOnly": true,
5+
"declaration": true,
6+
"outDir": "dist",
7+
"types": ["@alloy-js/core/testing/matchers"]
8+
},
9+
"references": [{ "path": "../core" }],
10+
"include": [
11+
"src/**/*.ts",
12+
"src/**/*.tsx",
13+
"test/**/*.ts",
14+
"test/**/*.tsx",
15+
"testing/**/*.ts",
16+
"testing/**/*.tsx"
17+
],
18+
"exclude": ["node_modules", "dist"]
19+
}

packages/typespec/vitest.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import alloyPlugin from "@alloy-js/rollup-plugin";
2+
import { defineConfig } from "vitest/config";
3+
4+
export default defineConfig({
5+
esbuild: {
6+
jsx: "preserve",
7+
sourcemap: "both",
8+
},
9+
plugins: [alloyPlugin()],
10+
});

pnpm-lock.yaml

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)