Skip to content

Commit

Permalink
1/3 TypeSpec: Find/Replace Content
Browse files Browse the repository at this point in the history
  • Loading branch information
allenjzhang committed Feb 16, 2023
1 parent bc230ad commit 064161d
Show file tree
Hide file tree
Showing 575 changed files with 5,807 additions and 5,807 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/format-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# Create PR
pr_commented:
name: Format comment
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/cadleng format') }}
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/tspeng format') }}
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
Expand Down Expand Up @@ -48,14 +48,14 @@ jobs:
run: npx @microsoft/rush update

- name: Build necessary packages
run: npx @microsoft/rush build --to @cadl-lang/prettier-plugin-cadl
run: npx @microsoft/rush build --to @typespec/prettier-plugin-typespec

- name: Format
run: npx @microsoft/rush format

- name: Commit
run: |
git config --global user.name 'Cadl Eng Bot'
git config --global user.name 'TypeSpec Eng Bot'
git config --global user.email '[email protected]'
git commit -am "Format"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tryit-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
body: [
`Changes in this PR will be published to the following url to try(check status of Cadl Pull Request Try It pipeline for publish status):`,
`Playground: https://cadlplayground.z22.web.core.windows.net/prs/${prNumber}/`,
`Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status):`,
`Playground: https://typespecplayground.z22.web.core.windows.net/prs/${prNumber}/`,
"",
`Website: https://cadlwebsite.z1.web.core.windows.net/prs/${prNumber}/`,
`Website: https://typespecwebsite.z1.web.core.windows.net/prs/${prNumber}/`,
].join("\n")
})
6 changes: 3 additions & 3 deletions .github/workflows/website-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Cadl Website to github pages
name: Deploy TypeSpec Website to github pages

on:
# Allows you to run this workflow manually from the Actions tab
Expand Down Expand Up @@ -35,9 +35,9 @@ jobs:
run: npx @microsoft/rush update

- name: Build
run: npx @microsoft/rush build --to @cadl-lang/website
run: npx @microsoft/rush build --to @typespec/website
env:
CADL_WEBSITE_BASE_PATH: "/cadl/"
TYPESPEC_WEBSITE_BASE_PATH: "/typespec/"

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ temp
common/temp/**
package-deps.json

# Default Cadl output
cadl-output/
# Default TypeSpec output
typespec-output/

# Visual Studio / C#
bin/
Expand Down
8 changes: 4 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ CODE_OF_CONDUCT.md
# These are auto-generated by rush
**/CHANGELOG.md

# Don't format compiler test cadl files.
packages/compiler/test/formatter/**/*.cadl
# Don't format compiler test.tsp files.
packages/compiler/test/formatter/**/*.tsp

# That is an example with error and can't be formatted
packages/samples/local-cadl/test.cadl
packages/samples/local.tsp/test.tsp
packages/website/build/
packages/website/versioned_sidebars/
packages/website/versions.json
Expand All @@ -35,5 +35,5 @@ spec.emu.html
docs/**/reference/
packages/website/versioned_docs/**/reference/

# Cadl init template
#.tsp init template
eng/feeds/
6 changes: 3 additions & 3 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"tabWidth": 2,
"pluginSearchDirs": ["./packages/compiler"],
"plugins": [
"./packages/prettier-plugin-cadl",
"./packages/prettier-plugin-typespec",
"./packages/compiler/node_modules/prettier-plugin-organize-imports"
],
"overrides": [
{
"files": "*.cadl",
"files": "*.tsp",
"options": {
"parser": "cadl"
"parser": "typespec"
}
}
]
Expand Down
18 changes: 9 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"compile",
"../samples/scratch",
"--output-dir=temp/scratch-output",
"--emit=@cadl-lang/openapi3"
"--emit=@typespec/openapi3"
],
"smartStep": true,
"sourceMaps": true,
Expand Down Expand Up @@ -106,9 +106,9 @@
{
"name": "Regenerate .tmlanguage",
"type": "node",
"program": "${workspaceFolder}/packages/cadl-vscode/scripts/generate-tmlanguage.js",
"program": "${workspaceFolder}/packages/typespec-vscode/scripts/generate-tmlanguage.js",
"request": "launch",
"cwd": "${workspaceFolder}/packages/cadl-vscode",
"cwd": "${workspaceFolder}/packages/typespec-vscode",
"presentation": {
"order": 999
}
Expand All @@ -117,20 +117,20 @@
"name": "VS Code Extension (Client)",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}/packages/cadl-vscode"],
"args": ["--extensionDevelopmentPath=${workspaceFolder}/packages/typespec-vscode"],
"env": {
// Log elapsed time for each call to server.
//"CADL_SERVER_LOG_TIMING": "true",
//"TYPESPEC_SERVER_LOG_TIMING": "true",

// Save .cpuprofile for last run of each server function here
// NOTE: This will add a lot of lag so don't trust logged timing if also enabled above.
//"CADL_SERVER_PROFILE_DIR": "${workspaceRoot}/temp",
//"TYPESPEC_SERVER_PROFILE_DIR": "${workspaceRoot}/temp",

// Use empty node options and don't debug while profiling to get the most accurate timing
//"CADL_SERVER_NODE_OPTIONS": "",
//"TYPESPEC_SERVER_NODE_OPTIONS": "",

"CADL_SERVER_NODE_OPTIONS": "--nolazy --inspect-brk=4242",
"CADL_DEVELOPMENT_MODE": "true"
"TYPESPEC_SERVER_NODE_OPTIONS": "--nolazy --inspect-brk=4242",
"TYPESPEC_DEVELOPMENT_MODE": "true"
},
"presentation": {
"hidden": true
Expand Down
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[cadl]": {
"[typespec]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.insertSpaces": true,
Expand Down Expand Up @@ -102,11 +102,11 @@
"mochaExplorer.require": "source-map-support/register",
"mochaExplorer.debuggerConfig": "Tests",
"mochaExplorer.env": {
"CADL_VERBOSE_TEST_OUTPUT": "true",
"TYPESPEC_VERBOSE_TEST_OUTPUT": "true",
"NODE_OPTIONS": "--stack-trace-limit=50"
},
"prettier.prettierPath": "./packages/compiler/node_modules/prettier",
"prettier.documentSelectors": ["**/*.cadl"],
"prettier.documentSelectors": ["**/*.tsp"],
"testExplorer.errorDecoration": false,
"cadl.cadl-server.path": "${workspaceFolder}/packages/compiler"
"typespec.tsp-server.path": "${workspaceFolder}/packages/compiler"
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"label": "test",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/packages/cadl"
"cwd": "${workspaceFolder}/packages/typespec"
},
"command": "npm test",
"group": {
Expand Down
46 changes: 23 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ rushx test

Tests sometimes log extra info using `logVerboseTestOutput` To see
this output on the command line, set environment variable
CADL_VERBOSE_TEST_OUTPUT=true.
TYPESPEC_VERBOSE_TEST_OUTPUT=true.

## Reformat source code

Expand Down Expand Up @@ -163,7 +163,7 @@ Always open the root of the repo as the workspace. Things are setup to
allow easy development across packages rather than opening one package
at a time in the IDE.

- File -> Open Workspace, select root folder where the Cadl repo was
- File -> Open Workspace, select root folder where the TypeSpec repo was
cloned
- Or run `code /path/to/repo/root` on the command line

Expand All @@ -180,7 +180,7 @@ Terminal pane will have three parallel watch tasks running:
- `watch-source`: tsc process that recompile on TypeScript changes
- `watch-spec`: process that regenerates spec.html when
spec.emu.html changes
- `watch-tmlanguage`: process that regenerates cadl.tmlanguage when
- `watch-tmlanguage`: process that regenerates typespec.tmlanguage when
tmlanguage.ts changes

## Testing
Expand All @@ -204,24 +204,24 @@ Debug icon on the sidebar, pick one from its down, and press F5 to
debug the last one you chose.

1. **VS Code Extension**: This will run and debug an experimental
instance of VS Code with the Cadl extension for VS Code and Cadl
instance of VS Code with the TypeSpec extension for VS Code and TypeSpec
language server running live with any of your changes. It will
attach to both the VS Code client process and the language server
process automatically.
2. **Compile Scratch**: Use this to debug compiling
`packages/cadl-samples/scratch/*.cadl`. The Cadl source code in that
folder is excluded from source control by design. Create Cadl files
`packages/typespec-samples/scratch/*.tsp`. The TypeSpec source code in that
folder is excluded from source control by design. Create TypeSpec files
there to experiment and debug how the compiler reacts.
3. **Compile Scratch (nostdlib)**: Same as above, but skips parsing
and evaluating the Cadl standard library. Sometimes it's easier to
and evaluating the TypeSpec standard library. Sometimes it's easier to
4. **Attach to Default Port**: Use this to attach to a manually run
`node --debug` command.
5. **Attach to Language Server**: Use this to attach to the language
server process of an already running client process. Useful if you
want to debug the language server in VS Code while debugging the VS
client in VS.
6. **Regenerate .tmlanguage**: This runs the code that produces the
cadl.tmlanguage file that provides syntax highlighting of Cadl in VS
typespec.tmlanguage file that provides syntax highlighting of TypeSpec in VS
and VS Code. Select this to debug its build process.

# Developing the Visual Studio Extension
Expand All @@ -245,7 +245,7 @@ extension.

## Build VS extension in VS

- Open packages/cadl-vs/Microsoft.Cadl.VisualStudio.sln in Visual Studio
- Open packages/typespec-vs/Microsoft.TypeSpec.VisualStudio.sln in Visual Studio
- Build -> Build solution (`Ctrl+Shift+B`)

Unlike TypeScript in VS Code above, this is not a watching build, but
Expand All @@ -257,8 +257,8 @@ changes after you make them.
- Click on the play icon in the toolbar or press `F5`

This will run and debug an experimental instance of VS with a version
of the Cadl extension for VS Code running live with any of your changes
to the extension or the Cadl language server.
of the TypeSpec extension for VS Code running live with any of your changes
to the extension or the TypeSpec language server.

The VS debugger will attach only to the VS client process. Use "Attach
to Language Server" described above to debug the language server in
Expand All @@ -270,45 +270,45 @@ VS Code.
rush dogfood
```

This will globally install the @cadl-lang/compiler package, putting your
build of `cadl` on PATH, and install the VS Code extension if VS Code
This will globally install the @typespec/compiler package, putting your
build of `typespec` on PATH, and install the VS Code extension if VS Code
is installed.

Note the important difference between this and the steps to run and
debug the VS Code extension above: the `dogfood` command installs the
Cadl extension with your changes in regular, non-experimental instance
TypeSpec extension with your changes in regular, non-experimental instance
of VS Code, meaning you will have it always, and not only when running
the debug steps above. This is exactly like using `cadl vscode install`,
the debug steps above. This is exactly like using `tsp vscode install`,
only instead of downloading the latest release, it uses a build with your
changes applied.

There is no automatic `dogfood` process for installing the VS
extension non-experimentally, but if you build the cadl-vs project from
extension non-experimentally, but if you build the typespec-vs project from
the command line following the steps above, or build its Release
configuration in Visual Studio, then you can install it by
double-clicking on packages/cadl-vs/Microsoft.Cadl.VisualStudio.vsix
double-clicking on packages/typespec-vs/Microsoft.TypeSpec.VisualStudio.vsix
that gets produced.

# Pull request

## Trigger Cadl Playground Try It build
## Trigger TypeSpec Playground Try It build

For contributors of the repo the build will trigger automatically but for other's forks it will need a manual trigger from a contributor.
As a contributor you can run the following command to trigger the build and create a cadl playground link for this PR.
As a contributor you can run the following command to trigger the build and create a typespec playground link for this PR.

```
/azp run Cadl Pull Request Try It
/azp run TypeSpec Pull Request Try It
```

## Run formatter

Trigger a workflow that will format the code, commit and push.

```
/cadleng format
/typespeceng format
```

# Cadl website
# TypeSpec website

## Run locally

Expand All @@ -324,5 +324,5 @@ The website on github.io should be published when releasing new packages.

To release:

- Go to https://github.com/microsoft/cadl/actions/workflows/website-gh-pages.yml
- Go to https://github.com/microsoft/typespec/actions/workflows/website-gh-pages.yml
- Click the `Run workflow` dropdown and select the `main` branch.
Loading

0 comments on commit 064161d

Please sign in to comment.