diff --git a/.gitignore b/.gitignore index e8f3fe7e9..4f858bc49 100644 --- a/.gitignore +++ b/.gitignore @@ -173,7 +173,7 @@ common/temp/** package-deps.json # Default TypeSpec output -typespec-output/ +tsp-output/ # Visual Studio / C# bin/ diff --git a/README.md b/README.md index b7bcd3b42..8968580e6 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ If you do not wish to install the compiler globally with `-g` flag, you will nee tsp compile . ``` - This will compile the TypeSpec files in the project folder into one output file: `.\typespec-output\openapi.json`. + This will compile the TypeSpec files in the project folder into one output file: `.\tsp-output\openapi.json`. ## Troubleshooting @@ -119,7 +119,7 @@ You can compile it to OpenAPI 3.0 by using the following command: tsp compile sample.tsp --emit @typespec/openapi3 ``` -Once it compiles, you can find the emitted OpenAPI document in `./typespec-output/openapi.json. +Once it compiles, you can find the emitted OpenAPI document in `./tsp-output/openapi.json. You can also pass in a directory instead of a file to `tsp compile`. That's equivalent to passing `main.tsp` in that directory. diff --git a/common/changes/@typespec/compiler/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/compiler/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..3f4c4ed06 --- /dev/null +++ b/common/changes/@typespec/compiler/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/compiler", + "comment": "Updating default output to tsp-output and package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/compiler" +} \ No newline at end of file diff --git a/common/changes/@typespec/html-program-viewer/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/html-program-viewer/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..ec721fb9b --- /dev/null +++ b/common/changes/@typespec/html-program-viewer/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/html-program-viewer", + "comment": "Update package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/html-program-viewer" +} diff --git a/common/changes/@typespec/library-linter/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/library-linter/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..82a70f3e5 --- /dev/null +++ b/common/changes/@typespec/library-linter/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/library-linter", + "comment": "Update package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/library-linter" +} \ No newline at end of file diff --git a/common/changes/@typespec/lint/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/lint/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..732f2add2 --- /dev/null +++ b/common/changes/@typespec/lint/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/lint", + "comment": "Update package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/lint" +} \ No newline at end of file diff --git a/common/changes/@typespec/openapi/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/openapi/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..4b5b349e2 --- /dev/null +++ b/common/changes/@typespec/openapi/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/openapi", + "comment": "Update package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/openapi" +} \ No newline at end of file diff --git a/common/changes/@typespec/openapi3/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/openapi3/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..4e5eede75 --- /dev/null +++ b/common/changes/@typespec/openapi3/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/openapi3", + "comment": "Update package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/openapi3" +} \ No newline at end of file diff --git a/common/changes/@typespec/rest/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/rest/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..0d6249bbe --- /dev/null +++ b/common/changes/@typespec/rest/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/rest", + "comment": "Update package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/rest" +} \ No newline at end of file diff --git a/common/changes/@typespec/versioning/tspOutput-tspMain_2023-02-18-08-56.json b/common/changes/@typespec/versioning/tspOutput-tspMain_2023-02-18-08-56.json new file mode 100644 index 000000000..b55965373 --- /dev/null +++ b/common/changes/@typespec/versioning/tspOutput-tspMain_2023-02-18-08-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@typespec/versioning", + "comment": "Update package.json entrypoint to tspMain", + "type": "none" + } + ], + "packageName": "@typespec/versioning" +} \ No newline at end of file diff --git a/docs/extending-typespec/basics.md b/docs/extending-typespec/basics.md index 4dfa2543e..568d6405c 100644 --- a/docs/extending-typespec/basics.md +++ b/docs/extending-typespec/basics.md @@ -59,7 +59,7 @@ Your package.json needs to refer to two main files: your node module main file, ```json "main": "dist/index.js", - "typespecMain": "lib/main.tsp" + "tspMain": "lib/main.tsp" ``` ### 3. Install and initialize TypeScript diff --git a/docs/extending-typespec/emitters-basics.md b/docs/extending-typespec/emitters-basics.md index 482c9753e..b0e9575fc 100644 --- a/docs/extending-typespec/emitters-basics.md +++ b/docs/extending-typespec/emitters-basics.md @@ -185,4 +185,4 @@ Since an emitter is a node library, you could use standard `fs` APIs to write fi Instead, use the compiler [`host` interface](#todo) to access the file system. The API is equivalent to the node API but works in a wider range of scenarios. -In order to know where to emit files, the emitter context has a `emitterOutputDir` property that is automatically resolved using the `emitter-output-dir` built-in emitter options. This is set to `{cwd}/typespec-output/{emitter-name}` by default, but can be overridden by the user. Do not use the `compilerOptions.outputDir` +In order to know where to emit files, the emitter context has a `emitterOutputDir` property that is automatically resolved using the `emitter-output-dir` built-in emitter options. This is set to `{cwd}/tsp-output/{emitter-name}` by default, but can be overridden by the user. Do not use the `compilerOptions.outputDir` diff --git a/docs/language-basics/imports.md b/docs/language-basics/imports.md index b420f9e51..211891673 100644 --- a/docs/language-basics/imports.md +++ b/docs/language-basics/imports.md @@ -23,7 +23,7 @@ import "./decorators.js"; ## Import a library -The import value can be name one of the package dependencies. In that case typespec will lookup for the `package.json` file and check the `typespecMain` entry (or default to `main` if absent) to decide what is the library entrypoint to load. +The import value can be name one of the package dependencies. In that case typespec will lookup for the `package.json` file and check the `tspMain` entry (or default to `main` if absent) to decide what is the library entrypoint to load. ```typespec import "@typespec/rest"; @@ -32,7 +32,7 @@ import "@typespec/rest"; ```json // ./node_modules/@typespec/rest/package.json { - "typespecMain": "./lib/main.tsp" + "tspMain": "./lib/main.tsp" } ``` @@ -47,5 +47,5 @@ import "./models"; // same as `import "./models/main.tsp"; ``` ```typespec -import "./path/to/local/module"; // Assuming this path is a typespec package, it will load it using the typespecMain file. +import "./path/to/local/module"; // Assuming this path is a typespec package, it will load it using the tspMain file. ``` diff --git a/e2e/e2e-tests.js b/e2e/e2e-tests.js index 59c97e53c..b52b9be0f 100644 --- a/e2e/e2e-tests.js +++ b/e2e/e2e-tests.js @@ -63,7 +63,7 @@ function runTypeSpec(compilerTgz, args, options) { function testBasicLatest(packages) { const basicLatestDir = join(e2eTestDir, "basic-latest"); - const outputDir = join(basicLatestDir, "typespec-output"); + const outputDir = join(basicLatestDir, "tsp-output"); console.log("Clearing basic-latest output"); rmSync(outputDir, { recursive: true, force: true }); console.log("Cleared basic-latest output"); @@ -87,7 +87,7 @@ function testBasicLatest(packages) { function testBasicCurrentTgz(packages) { const basicCurrentDir = join(e2eTestDir, "basic-current"); - const outputDir = join(basicCurrentDir, "typespec-output"); + const outputDir = join(basicCurrentDir, "tsp-output"); console.log("Clearing basic-current"); rmSync(outputDir, { recursive: true, force: true }); console.log("Cleared basic-current"); diff --git a/packages/bundler/package.json b/packages/bundler/package.json index 49a8d8859..c19bb1230 100644 --- a/packages/bundler/package.json +++ b/packages/bundler/package.json @@ -18,7 +18,7 @@ ], "type": "module", "main": "dist/src/index.js", - "typespecMain": "dist/src/index.js", + "tspMain": "dist/src/index.js", "engines": { "node": ">=16.0.0" }, diff --git a/packages/bundler/src/bundler.ts b/packages/bundler/src/bundler.ts index 5cbe9399b..4cecdd6ba 100644 --- a/packages/bundler/src/bundler.ts +++ b/packages/bundler/src/bundler.ts @@ -42,7 +42,7 @@ export interface TypeSpecBundleFile { interface PackageJson { name: string; main: string; - typespecMain?: string; + tspMain?: string; peerDependencies: string[]; dependencies: string[]; exports?: Record; diff --git a/packages/compiler/config/config-loader.ts b/packages/compiler/config/config-loader.ts index f33666b24..406bccdb8 100644 --- a/packages/compiler/config/config-loader.ts +++ b/packages/compiler/config/config-loader.ts @@ -10,7 +10,7 @@ import { TypeSpecConfig, TypeSpecRawConfig } from "./types.js"; export const TypeSpecConfigFilename = "tspconfig.yaml"; export const defaultConfig = deepFreeze({ - outputDir: "{cwd}/typespec-output", + outputDir: "{cwd}/tsp-output", diagnostics: [] as Diagnostic[], }); @@ -147,7 +147,7 @@ async function loadConfigFile( extends: data.extends, environmentVariables: data["environment-variables"], parameters: data.parameters, - outputDir: data["output-dir"] ?? "{cwd}/typespec-output", + outputDir: data["output-dir"] ?? "{cwd}/tsp-output", warnAsError: data["warn-as-error"], imports: data.imports, trace: typeof data.trace === "string" ? [data.trace] : data.trace, diff --git a/packages/compiler/core/messages.ts b/packages/compiler/core/messages.ts index 4030f6c14..9e727f18b 100644 --- a/packages/compiler/core/messages.ts +++ b/packages/compiler/core/messages.ts @@ -528,7 +528,7 @@ const diagnostics = { "library-invalid": { severity: "error", messages: { - typespecMain: paramMessage`Library "${"path"}" has an invalid typespecMain file.`, + tspMain: paramMessage`Library "${"path"}" has an invalid tspMain file.`, default: paramMessage`Library "${"path"}" has an invalid main file.`, }, }, diff --git a/packages/compiler/core/module-resolver.ts b/packages/compiler/core/module-resolver.ts index 4f963f4e6..45dbe304d 100644 --- a/packages/compiler/core/module-resolver.ts +++ b/packages/compiler/core/module-resolver.ts @@ -41,7 +41,7 @@ export interface NodePackage { type?: "module" | "commonjs"; main?: string; version: string; - typespecMain?: string; + tspMain?: string; homepage?: string; bugs?: { url?: string; diff --git a/packages/compiler/core/options.ts b/packages/compiler/core/options.ts index 0472b237f..a61220329 100644 --- a/packages/compiler/core/options.ts +++ b/packages/compiler/core/options.ts @@ -6,7 +6,7 @@ export interface CompilerOptions { /** * Default output directory used by emitters. * - * @default ./typespec-output + * @default ./tsp-output */ outputDir?: string; diff --git a/packages/compiler/core/program.ts b/packages/compiler/core/program.ts index d54435e5d..f805e5874 100644 --- a/packages/compiler/core/program.ts +++ b/packages/compiler/core/program.ts @@ -799,8 +799,8 @@ export async function compile( directoryIndexFiles: ["main.tsp", "index.mjs", "index.js"], resolveMain(pkg) { // this lets us follow node resolve semantics more-or-less exactly - // but using typespecMain instead of main. - return pkg.typespecMain ?? pkg.main; + // but using tspMain instead of main. + return pkg.tspMain ?? pkg.main; }, }); } catch (e: any) { @@ -814,7 +814,7 @@ export async function compile( createDiagnostic({ code: "library-invalid", format: { path: specifier }, - messageId: "typespecMain", + messageId: "tspMain", target, }) ); @@ -899,10 +899,7 @@ export async function compile( const [pkg] = await loadFile(host, pkgJsonPath, JSON.parse, program.reportDiagnostic, { allowFileNotFound: true, }); - const mainFile = resolvePath( - dir, - typeof pkg?.typespecMain === "string" ? pkg.typespecMain : "main.tsp" - ); + const mainFile = resolvePath(dir, typeof pkg?.tspMain === "string" ? pkg.tspMain : "main.tsp"); return mainFile; } diff --git a/packages/compiler/package.json b/packages/compiler/package.json index cc3667274..e32da2643 100644 --- a/packages/compiler/package.json +++ b/packages/compiler/package.json @@ -19,7 +19,7 @@ ], "type": "module", "main": "dist/core/index.js", - "typespecMain": "lib/main.tsp", + "tspMain": "lib/main.tsp", "exports": { ".": "./dist/core/index.js", "./testing": "./dist/testing/index.js", diff --git a/packages/compiler/server/completion.ts b/packages/compiler/server/completion.ts index 980d32e43..10c6e009b 100644 --- a/packages/compiler/server/completion.ts +++ b/packages/compiler/server/completion.ts @@ -140,7 +140,7 @@ async function addLibraryImportCompletion( JSON.parse, program.reportDiagnostic ); - if (libPackageJson.typespecMain !== undefined) { + if (libPackageJson.tspMain !== undefined) { const range = { start: file.file.getLineAndCharacterOfPosition(node.pos + 1), end: file.file.getLineAndCharacterOfPosition(node.end - 1), diff --git a/packages/compiler/server/serverlib.ts b/packages/compiler/server/serverlib.ts index e92e7a37d..3d192d156 100644 --- a/packages/compiler/server/serverlib.ts +++ b/packages/compiler/server/serverlib.ts @@ -1100,7 +1100,7 @@ export function createServer(host: ServerHost): Server { * results can be obtained from compiling the same file with different entry * points. * - * Walk directory structure upwards looking for package.json with typespecMain or + * Walk directory structure upwards looking for package.json with tspMain or * main.tsp file. Stop search when reaching a workspace root. If a root is * reached without finding an entry point, use the given path as its own * entry point. @@ -1136,8 +1136,8 @@ export function createServer(host: ServerHost): Server { await fileSystemCache.setData(pkgPath, pkg ?? {}); } - if (typeof pkg?.typespecMain === "string") { - mainFile = pkg.typespecMain; + if (typeof pkg?.tspMain === "string") { + mainFile = pkg.tspMain; } const candidate = joinPaths(dir, mainFile); diff --git a/packages/compiler/test/checker/imports.test.ts b/packages/compiler/test/checker/imports.test.ts index 0abe7e3ab..0481a9c73 100644 --- a/packages/compiler/test/checker/imports.test.ts +++ b/packages/compiler/test/checker/imports.test.ts @@ -117,7 +117,7 @@ describe("compiler: imports", () => { host.addTypeSpecFile( "node_modules/my-lib/package.json", JSON.stringify({ - typespecMain: "./main.tsp", + tspMain: "./main.tsp", }) ); host.addTypeSpecFile( diff --git a/packages/compiler/test/cli.test.ts b/packages/compiler/test/cli.test.ts index f366393f7..8288b0b8e 100644 --- a/packages/compiler/test/cli.test.ts +++ b/packages/compiler/test/cli.test.ts @@ -26,10 +26,10 @@ describe("compiler: cli", () => { return options; } - it("no args and config: return empty options with output-dir at {cwd}/typespec-output", async () => { + it("no args and config: return empty options with output-dir at {cwd}/tsp-output", async () => { const options = await resolveCompilerOptions({}); deepStrictEqual(options, { - outputDir: `${cwd}/typespec-output`, + outputDir: `${cwd}/tsp-output`, options: {}, }); }); @@ -71,7 +71,7 @@ describe("compiler: cli", () => { strictEqual( options?.options?.["@typespec/openapi3"]?.["emitter-output-dir"], - `${cwd}/typespec-output/custom` + `${cwd}/tsp-output/custom` ); }); diff --git a/packages/compiler/test/config/config.test.ts b/packages/compiler/test/config/config.test.ts index eaecf032f..7110cab4a 100644 --- a/packages/compiler/test/config/config.test.ts +++ b/packages/compiler/test/config/config.test.ts @@ -25,7 +25,7 @@ describe("compiler: config file loading", () => { const config = await loadTestConfig("simple"); deepStrictEqual(config, { diagnostics: [], - outputDir: "{cwd}/typespec-output", + outputDir: "{cwd}/tsp-output", emit: ["openapi"], }); }); @@ -35,7 +35,7 @@ describe("compiler: config file loading", () => { deepStrictEqual(config, { diagnostics: [], extends: "./typespec-base.yaml", - outputDir: "{cwd}/typespec-output", + outputDir: "{cwd}/tsp-output", emit: ["openapi"], }); }); @@ -44,7 +44,7 @@ describe("compiler: config file loading", () => { const config = await loadTestConfig("empty"); deepStrictEqual(config, { diagnostics: [], - outputDir: "{cwd}/typespec-output", + outputDir: "{cwd}/tsp-output", }); }); @@ -53,7 +53,7 @@ describe("compiler: config file loading", () => { config = await loadTestConfig("empty"); deepStrictEqual(config, { diagnostics: [], - outputDir: "{cwd}/typespec-output", + outputDir: "{cwd}/tsp-output", }); }); @@ -63,7 +63,7 @@ describe("compiler: config file loading", () => { config = await loadTestConfig("simple"); deepStrictEqual(config, { diagnostics: [], - outputDir: "{cwd}/typespec-output", + outputDir: "{cwd}/tsp-output", emit: ["openapi"], }); }); diff --git a/packages/compiler/test/e2e/scenarios/emitter-require-import/node_modules/@typespec/my-lib/package.json b/packages/compiler/test/e2e/scenarios/emitter-require-import/node_modules/@typespec/my-lib/package.json index a5a72fe0f..a6690a3f1 100644 --- a/packages/compiler/test/e2e/scenarios/emitter-require-import/node_modules/@typespec/my-lib/package.json +++ b/packages/compiler/test/e2e/scenarios/emitter-require-import/node_modules/@typespec/my-lib/package.json @@ -1,5 +1,5 @@ { "name": "@typespec/my-lib", "type": "module", - "typespecMain": "main.tsp" + "tspMain": "main.tsp" } diff --git a/packages/compiler/test/e2e/scenarios/emitter-with-typespec/package.json b/packages/compiler/test/e2e/scenarios/emitter-with-typespec/package.json index 414642b82..b72fdbbd4 100644 --- a/packages/compiler/test/e2e/scenarios/emitter-with-typespec/package.json +++ b/packages/compiler/test/e2e/scenarios/emitter-with-typespec/package.json @@ -2,5 +2,5 @@ "name": "@typespec/test-emitter-with-typespec", "type": "module", "main": "lib.js", - "typespecMain": "lib.tsp" + "tspMain": "lib.tsp" } diff --git a/packages/compiler/test/e2e/scenarios/import-library-invalid/node_modules/my-lib/package.json b/packages/compiler/test/e2e/scenarios/import-library-invalid/node_modules/my-lib/package.json index 1defa6a4b..4e9fbb136 100644 --- a/packages/compiler/test/e2e/scenarios/import-library-invalid/node_modules/my-lib/package.json +++ b/packages/compiler/test/e2e/scenarios/import-library-invalid/node_modules/my-lib/package.json @@ -2,5 +2,5 @@ "name": "@typespec/my-lib", "type": "module", "main": "not-a-file.js", - "typespecMain": "not-a-file.tsp" + "tspMain": "not-a-file.tsp" } diff --git a/packages/compiler/test/e2e/scenarios/invalid-lib/package.json b/packages/compiler/test/e2e/scenarios/invalid-lib/package.json index e0f1b76ec..b8c62df33 100644 --- a/packages/compiler/test/e2e/scenarios/invalid-lib/package.json +++ b/packages/compiler/test/e2e/scenarios/invalid-lib/package.json @@ -2,5 +2,5 @@ "name": "@typespec/test-typespec-lib", "type": "module", "main": "lib.txt", - "typespecMain": "lib.txt" + "tspMain": "lib.txt" } diff --git a/packages/compiler/test/e2e/scenarios/js-lib/package.json b/packages/compiler/test/e2e/scenarios/js-lib/package.json index 5feda306b..7621d5a44 100644 --- a/packages/compiler/test/e2e/scenarios/js-lib/package.json +++ b/packages/compiler/test/e2e/scenarios/js-lib/package.json @@ -2,5 +2,5 @@ "name": "@typespec/test-js-lib", "type": "module", "main": "lib.js", - "typespecMain": "lib.js" + "tspMain": "lib.js" } diff --git a/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib1/package.json b/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib1/package.json index 3f41a1a32..1f7d226f7 100644 --- a/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib1/package.json +++ b/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib1/package.json @@ -3,5 +3,5 @@ "type": "module", "version": "1.0.0", "main": "emitter.js", - "typespecMain": "main.tsp" + "tspMain": "main.tsp" } diff --git a/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib2/package.json b/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib2/package.json index 4b5f62790..5fe529c4d 100644 --- a/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib2/package.json +++ b/packages/compiler/test/e2e/scenarios/same-library-diff-version/node_modules/@typespec/lib2/package.json @@ -3,5 +3,5 @@ "type": "module", "version": "2.0.0", "main": "emitter.js", - "typespecMain": "main.tsp" + "tspMain": "main.tsp" } diff --git a/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib1/package.json b/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib1/package.json index 3f41a1a32..1f7d226f7 100644 --- a/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib1/package.json +++ b/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib1/package.json @@ -3,5 +3,5 @@ "type": "module", "version": "1.0.0", "main": "emitter.js", - "typespecMain": "main.tsp" + "tspMain": "main.tsp" } diff --git a/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib2/package.json b/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib2/package.json index 3f41a1a32..1f7d226f7 100644 --- a/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib2/package.json +++ b/packages/compiler/test/e2e/scenarios/same-library-same-version/node_modules/@typespec/lib2/package.json @@ -3,5 +3,5 @@ "type": "module", "version": "1.0.0", "main": "emitter.js", - "typespecMain": "main.tsp" + "tspMain": "main.tsp" } diff --git a/packages/compiler/test/e2e/scenarios/scenarios.e2e.ts b/packages/compiler/test/e2e/scenarios/scenarios.e2e.ts index df7ad4a43..1b76c8511 100644 --- a/packages/compiler/test/e2e/scenarios/scenarios.e2e.ts +++ b/packages/compiler/test/e2e/scenarios/scenarios.e2e.ts @@ -47,7 +47,7 @@ describe("compiler: entrypoints", () => { }); expectDiagnostics(program.diagnostics, { code: "library-invalid", - message: `Library "my-lib" has an invalid typespecMain file.`, + message: `Library "my-lib" has an invalid tspMain file.`, }); }); diff --git a/packages/compiler/test/e2e/scenarios/typespec-lib/package.json b/packages/compiler/test/e2e/scenarios/typespec-lib/package.json index 562a72290..479566f87 100644 --- a/packages/compiler/test/e2e/scenarios/typespec-lib/package.json +++ b/packages/compiler/test/e2e/scenarios/typespec-lib/package.json @@ -2,5 +2,5 @@ "name": "@typespec/test-typespec-lib", "type": "module", "main": "lib.js", - "typespecMain": "lib.tsp" + "tspMain": "lib.tsp" } diff --git a/packages/compiler/test/emitter-framework/emitter.test.ts b/packages/compiler/test/emitter-framework/emitter.test.ts index 75e354a72..8ff87c2ac 100644 --- a/packages/compiler/test/emitter-framework/emitter.test.ts +++ b/packages/compiler/test/emitter-framework/emitter.test.ts @@ -88,7 +88,7 @@ class SingleFileEmitter extends TypeScriptInterfaceEmitter { async function emitTypeSpecToTs(code: string) { const emitter = await emitTypeSpec(SingleFileEmitter, code, {}, false); - const sf = await emitter.getProgram().host.readFile("./typespec-output/output.ts"); + const sf = await emitter.getProgram().host.readFile("./tsp-output/output.ts"); return sf.text; } @@ -265,9 +265,9 @@ describe("typescript emitter", () => { emitter.emitProgram(); await emitter.writeOutput(); - const files = await host.program.host.readDir("./typespec-output"); + const files = await host.program.host.readDir("./tsp-output"); assert.strictEqual(files.length, 1); - const contents = (await host.program.host.readFile("./typespec-output/output.ts")).text; + const contents = (await host.program.host.readFile("./tsp-output/output.ts")).text; // some light assertions assert.match(contents, /export interface Basic/); assert.match(contents, /export interface HasRef/); @@ -325,7 +325,7 @@ describe("typescript emitter", () => { await emitter.writeOutput(); - const files = new Set(await host.program.host.readDir("./typespec-output")); + const files = new Set(await host.program.host.readDir("./tsp-output")); [ "Basic.ts", "RefsOtherModel.ts", @@ -406,7 +406,7 @@ describe("typescript emitter", () => { } as any); emitter.emitProgram(); await emitter.writeOutput(); - const contents = (await host.compilerHost.readFile("typespec-output/output.ts")).text; + const contents = (await host.compilerHost.readFile("tsp-output/output.ts")).text; assert.match(contents, /namespace B/); assert.match(contents, /namespace R/); assert.match(contents, /namespace H/); @@ -434,7 +434,7 @@ describe("typescript emitter", () => { } as any); emitter.emitProgram(); await emitter.writeOutput(); - const contents = (await host.compilerHost.readFile("typespec-output/output.ts")).text; + const contents = (await host.compilerHost.readFile("tsp-output/output.ts")).text; assert.match(contents, /prop: Foo/); assert.match(contents, /prop: Baz/); }); @@ -676,9 +676,7 @@ describe("Object emitter", () => { } as any); assetEmitter.emitProgram(); await assetEmitter.writeOutput(); - const contents = JSON.parse( - (await host.compilerHost.readFile("typespec-output/test.json")!).text - ); + const contents = JSON.parse((await host.compilerHost.readFile("tsp-output/test.json")!).text); assert.strictEqual(contents.declarations.length, 2); }); }); diff --git a/packages/compiler/test/emitter-framework/host.ts b/packages/compiler/test/emitter-framework/host.ts index 76b86493e..22691a988 100644 --- a/packages/compiler/test/emitter-framework/host.ts +++ b/packages/compiler/test/emitter-framework/host.ts @@ -31,7 +31,7 @@ export async function getHostForTypeSpecFile(contents: string, decorators?: Reco } await host.addTypeSpecFile("main.tsp", contents); await host.compile("main.tsp", { - outputDir: "typespec-output", + outputDir: "tsp-output", }); return host; } @@ -44,7 +44,7 @@ export async function emitTypeSpec( ) { const host = await getHostForTypeSpecFile(code); const emitter = createAssetEmitter(host.program, Emitter, { - emitterOutputDir: "typespec-output", + emitterOutputDir: "tsp-output", options: {}, } as any); const spies = emitterSpies(Emitter); diff --git a/packages/compiler/test/libraries/library-dev/package.json b/packages/compiler/test/libraries/library-dev/package.json index ec1889b53..317963dff 100644 --- a/packages/compiler/test/libraries/library-dev/package.json +++ b/packages/compiler/test/libraries/library-dev/package.json @@ -1,5 +1,5 @@ { "name": "my-typespec-library", "type": "module", - "typespecMain": "./src/main.tsp" + "tspMain": "./src/main.tsp" } diff --git a/packages/compiler/test/libraries/simple/node_modules/CustomTypeSpecMain/package.json b/packages/compiler/test/libraries/simple/node_modules/CustomTypeSpecMain/package.json index b0c470529..9029ee674 100644 --- a/packages/compiler/test/libraries/simple/node_modules/CustomTypeSpecMain/package.json +++ b/packages/compiler/test/libraries/simple/node_modules/CustomTypeSpecMain/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "", "main": "index.js", - "typespecMain": "index.tsp", + "tspMain": "index.tsp", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/packages/compiler/test/libraries/simple/node_modules/MyLib/package.json b/packages/compiler/test/libraries/simple/node_modules/MyLib/package.json index b49bd3d5a..b07fcc1bf 100644 --- a/packages/compiler/test/libraries/simple/node_modules/MyLib/package.json +++ b/packages/compiler/test/libraries/simple/node_modules/MyLib/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "", "main": "index.js", - "typespecMain": "main.tsp", + "tspMain": "main.tsp", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/packages/compiler/test/server/completion.test.ts b/packages/compiler/test/server/completion.test.ts index fe7cbc329..17075d42a 100644 --- a/packages/compiler/test/server/completion.test.ts +++ b/packages/compiler/test/server/completion.test.ts @@ -56,11 +56,11 @@ describe("compiler: server: completion", () => { }, }), "test/node_modules/@typespec/library1/package.json": JSON.stringify({ - typespecMain: "./foo.js", + tspMain: "./foo.js", }), "test/node_modules/non-typespec-library/package.json": JSON.stringify({}), "test/node_modules/@typespec/library2/package.json": JSON.stringify({ - typespecMain: "./foo.js", + tspMain: "./foo.js", }), }); diff --git a/packages/compiler/tsconfig.json b/packages/compiler/tsconfig.json index ddbfbae06..21c10ced3 100644 --- a/packages/compiler/tsconfig.json +++ b/packages/compiler/tsconfig.json @@ -7,5 +7,5 @@ "types": ["node", "mocha"] }, "include": ["./**/*.ts"], - "exclude": ["dist", "node_modules", "temp", "typespec-output"] + "exclude": ["dist", "node_modules", "temp", "tsp-output"] } diff --git a/packages/html-program-viewer/package.json b/packages/html-program-viewer/package.json index e78c923e0..8e7dd761f 100644 --- a/packages/html-program-viewer/package.json +++ b/packages/html-program-viewer/package.json @@ -32,7 +32,7 @@ ] } }, - "typespecMain": "dist/src/index.js", + "tspMain": "dist/src/index.js", "engines": { "node": ">=14.0.0" }, diff --git a/packages/library-linter/package.json b/packages/library-linter/package.json index 1355dbe79..0ecf2e844 100644 --- a/packages/library-linter/package.json +++ b/packages/library-linter/package.json @@ -32,7 +32,7 @@ ] } }, - "typespecMain": "dist/src/index.js", + "tspMain": "dist/src/index.js", "engines": { "node": ">=14.0.0" }, diff --git a/packages/lint/package.json b/packages/lint/package.json index 65540d51a..14cf9f0c7 100644 --- a/packages/lint/package.json +++ b/packages/lint/package.json @@ -18,7 +18,7 @@ ], "type": "module", "main": "dist/src/index.js", - "typespecMain": "dist/src/index.js", + "tspMain": "dist/src/index.js", "exports": { ".": "./dist/src/index.js", "./testing": "./dist/src/testing/index.js" diff --git a/packages/openapi/package.json b/packages/openapi/package.json index bcf474f20..161edf149 100644 --- a/packages/openapi/package.json +++ b/packages/openapi/package.json @@ -18,7 +18,7 @@ ], "type": "module", "main": "dist/src/index.js", - "typespecMain": "lib/main.tsp", + "tspMain": "lib/main.tsp", "exports": { ".": "./dist/src/index.js", "./testing": "./dist/src/testing/index.js" diff --git a/packages/openapi3/package.json b/packages/openapi3/package.json index 213b0f9f7..34af888c7 100644 --- a/packages/openapi3/package.json +++ b/packages/openapi3/package.json @@ -32,7 +32,7 @@ ] } }, - "typespecMain": "dist/src/index.js", + "tspMain": "dist/src/index.js", "engines": { "node": ">=16.0.0" }, diff --git a/packages/playground/src/components/output-view.tsx b/packages/playground/src/components/output-view.tsx index 457a3c095..faf968799 100644 --- a/packages/playground/src/components/output-view.tsx +++ b/packages/playground/src/components/output-view.tsx @@ -46,7 +46,7 @@ const OutputViewInternal: FunctionComponent<{ compilationResult: CompileResult } }, [program, outputFiles]); async function loadOutputFile(path: string) { - const contents = await program.host.readFile("./typespec-output/" + path); + const contents = await program.host.readFile("./tsp-output/" + path); setViewSelection({ type: "file", filename: path, content: contents.text }); } diff --git a/packages/playground/src/components/playground.tsx b/packages/playground/src/components/playground.tsx index 3e48eb527..67c4870dd 100644 --- a/packages/playground/src/components/playground.tsx +++ b/packages/playground/src/components/playground.tsx @@ -149,7 +149,7 @@ const PlaygroundInternal: FunctionComponent = ({ ); }; -const outputDir = "./typespec-output"; +const outputDir = "./tsp-output"; async function compile( host: BrowserHost, @@ -162,13 +162,13 @@ async function compile( try { const typespecCompiler = await importTypeSpecCompiler(); const program = await typespecCompiler.compile(host, "main.tsp", { - outputDir: "typespec-output", + outputDir: "tsp-output", emit: [selectedEmitter], options: { ...emittersOptions, [selectedEmitter]: { ...emittersOptions[selectedEmitter], - "emitter-output-dir": "typespec-output", + "emitter-output-dir": "tsp-output", }, }, }); @@ -200,9 +200,9 @@ async function findOutputFiles(host: BrowserHost): Promise { async function emptyOutputDir(host: BrowserHost) { // empty output directory - const dirs = await host.readDir("./typespec-output"); + const dirs = await host.readDir("./tsp-output"); for (const file of dirs) { - const path = "./typespec-output/" + file; + const path = "./tsp-output/" + file; const uri = Uri.parse(host.pathToFileURL(path)); const model = editor.getModel(uri); if (model) { diff --git a/packages/ref-doc/package.json b/packages/ref-doc/package.json index b20725030..ba55c9944 100644 --- a/packages/ref-doc/package.json +++ b/packages/ref-doc/package.json @@ -28,7 +28,7 @@ ] } }, - "typespecMain": "dist/src/index.js", + "tspMain": "dist/src/index.js", "engines": { "node": ">=16.0.0" }, diff --git a/packages/ref-doc/src/experimental.ts b/packages/ref-doc/src/experimental.ts index f265640b9..339ab1e32 100644 --- a/packages/ref-doc/src/experimental.ts +++ b/packages/ref-doc/src/experimental.ts @@ -13,8 +13,8 @@ export async function generateLibraryDocs( outputDir: string ) { const pkgJson = await readPackageJson(libraryPath); - if (pkgJson.typespecMain) { - const main = joinPaths(libraryPath, pkgJson.typespecMain); + if (pkgJson.tspMain) { + const main = joinPaths(libraryPath, pkgJson.tspMain); const program = await compile(NodeHost, main, { parseOptions: { comments: true, docs: true }, }); diff --git a/packages/rest/package.json b/packages/rest/package.json index 2fbeb61e6..8a1de2b84 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -18,7 +18,7 @@ ], "type": "module", "main": "dist/src/index.js", - "typespecMain": "lib/rest.tsp", + "tspMain": "lib/rest.tsp", "exports": { ".": "./dist/src/index.js", "./http": "./dist/src/http/index.js", diff --git a/packages/samples/petstore/package.json b/packages/samples/petstore/package.json index d2fca46df..cf3e2df14 100644 --- a/packages/samples/petstore/package.json +++ b/packages/samples/petstore/package.json @@ -1,4 +1,4 @@ { - "typespecMain": "petstore.tsp", + "tspMain": "petstore.tsp", "type": "module" } diff --git a/packages/samples/rest/petstore/package.json b/packages/samples/rest/petstore/package.json index d2fca46df..cf3e2df14 100644 --- a/packages/samples/rest/petstore/package.json +++ b/packages/samples/rest/petstore/package.json @@ -1,4 +1,4 @@ { - "typespecMain": "petstore.tsp", + "tspMain": "petstore.tsp", "type": "module" } diff --git a/packages/versioning/package.json b/packages/versioning/package.json index 15b34e6bb..a4cb6bdd5 100644 --- a/packages/versioning/package.json +++ b/packages/versioning/package.json @@ -18,7 +18,7 @@ ], "type": "module", "main": "dist/src/index.js", - "typespecMain": "lib/versioning.tsp", + "tspMain": "lib/versioning.tsp", "exports": { ".": "./dist/src/index.js", "./testing": "./dist/src/testing/index.js"