Skip to content

Commit

Permalink
Setup formatter for shellscript (#5809)
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin authored Jan 29, 2025
1 parent 43827aa commit f81fa45
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 25 deletions.
8 changes: 8 additions & 0 deletions .chronus/changes/sh-formatting-2025-0-29-19-46-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: internal
packages:
- "@typespec/compiler"
---

Setup formatter for shellscript
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:20

RUN corepack enable pnpm && \
echo 'alias pnpm="corepack pnpm"' >> /home/node/.bash_aliases
RUN corepack enable pnpm \
&& echo 'alias pnpm="corepack pnpm"' >> /home/node/.bash_aliases
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ venv.bak/
.mypy_cache/
node_modules/
package-lock.json
report.xml
report.xml
*.tgz

# Logs
Expand Down Expand Up @@ -201,7 +201,6 @@ developer/
*.zip
vite.config.ts.timestamp-*


# Astro
.astro/

Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ packages/http-client-csharp/generator/TestProjects/**/tspCodeModel.json
# auto generated api view properties files
packages/http-client-java/generator/http-client-generator-test/src/main/**/*.json
packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/**/*.json

.gitattributes
CODEOWNERS
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"plugins": [
"./packages/prettier-plugin-typespec/dist/index.js",
"./node_modules/prettier-plugin-organize-imports/index.js",
"prettier-plugin-astro"
"prettier-plugin-astro",
"prettier-plugin-sh"
],
"overrides": [
{
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"editor.detectIndentation": false,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json][[jsonc][yaml][typespec][markdown][css][astro][mdx]": {
"[json][[jsonc][yaml][typespec][markdown][css][astro][mdx][shellscript]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.insertSpaces": true,
Expand Down
10 changes: 5 additions & 5 deletions docker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ Tags:
```bash
docker run \
-v "${pwd}:/wd" --workdir="/wd" \
-t azsdkengsys.azurecr.io/typespec \
# ... TypeSpec args ...
-t azsdkengsys.azurecr.io/typespec
# ... TypeSpec args ...
```

**For usage in PowerShell replace `\` with `` ` ``**

### Install dependencies

```bash
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/typespec install
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/typespec install
```

### Compile

```bash
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/typespec compile .
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/typespec compile .
```

### Init a new project

```bash
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/typespec init
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/typespec init
```
2 changes: 0 additions & 2 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ basic-latest/package-lock.json
# This test is generated on the fly.
basic-current/package.json
basic-current/package-lock.json


1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"prettier": "~3.4.2",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-organize-imports": "~4.1.0",
"prettier-plugin-sh": "^0.14.0",
"rimraf": "~6.0.1",
"syncpack": "^13.0.0",
"tsx": "^4.19.2",
Expand Down
1 change: 0 additions & 1 deletion packages/compiler/test/server/workspace/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
!demo_yaml/
!**/package.json
!tspconfigtest0.yaml

3 changes: 1 addition & 2 deletions packages/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ This project has a collection of samples used to demonstrate and test various Ty
It is not published as an npm package.

```bash
npm run test # Check Samples match snapshots
npm run test # Check Samples match snapshots
npm run test:ci # run test same as CI


npm run test:regen -- -g "<sample-name>" # Regen of this name

npm run regen-samples # Regen all samples.
Expand Down
6 changes: 3 additions & 3 deletions packages/spector/docs/using-spector.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ tsp-spector server start ./path/to/scenarios # Takes the same arguments as serve
### Stop running server

```bash
tsp-spector server stop # Stop at the default port
tsp-spector server stop --port 1234 # If started the server at another port
tsp-spector server stop # Stop at the default port
tsp-spector server stop --port 1234 # If started the server at another port
```

### Validate and merge coverage
Expand Down Expand Up @@ -72,7 +72,7 @@ Upload the coverage. Upload from the `main` branch. DO NOT upload on PR this WIL
tsp-spector upload-coverage --generatorName typescript --version=0.1.0

# Specify Coverage file
tsp-spector upload-coverage --generatorName typescript --version=0.1.0 --coverageFile ./path/to/spector-final-coverage.json
tsp-spector upload-coverage --generatorName typescript --version=0.1.0 --coverageFile ./path/to/spector-final-coverage.json
```

Options:
Expand Down
28 changes: 28 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions website/src/content/docs/docs/extending-typespec/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ You can skip this step if you've used one of the templates above.
Run the following commands:

```bash
> mkdir myLibrary
> cd myLibrary
> npm init
mkdir myLibrary
cd myLibrary
npm init
```

After completing the wizard, you'll have a package.json file that defines your TypeSpec library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tsp compile . --trace import-resolution
If you want to log multiple areas, you can use the `--trace` option more than once.

```bash
tsp compile . --trace import-resolution --trace projection
tsp compile . --trace import-resolution --trace projection
```

To log everything, use `--trace *`. This might produce a lot of output, but you can [select specific trace areas to include](#selecting-trace-areas)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ We understand that change can be challenging, and we appreciate your patience an
An experimental migration tool has been introduced to take care of many of the manual migration steps. Just execute following command in your TypeSpec folder.

```bash
npx @typespec/migrate
npx @typespec/migrate
```

If you would like execute from a different folder or don't have a `package.json` that indicates compiler package versions, please see command line options:

```bash
npx @typespec/migrate --help
npx @typespec/migrate --help
```

The migration tool will perform following steps:
Expand Down

0 comments on commit f81fa45

Please sign in to comment.