Skip to content

Commit

Permalink
[TypeSpec CI] Fail if spec folder contains package.json (Azure#24377)
Browse files Browse the repository at this point in the history
- Fixes Azure#24365
  • Loading branch information
mikeharder authored Jun 9, 2023
1 parent a04dcf1 commit 1842aeb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions eng/pipelines/templates/steps/typespec-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ parameters:

steps:
- script: |
RED='\033[0;31m'
exit_code=0
expected_npm_prefix=$(pwd)
# Log commands before running
set -x
exit_code=0
pushd ${{parameters.Folder}}
actual_npm_prefix=$(npm prefix)
if [ "$expected_npm_prefix" != "$actual_npm_prefix" ]; then
echo -e "\n${RED}ERROR: TypeSpec folders MUST NOT contain a package.json, and instead MUST rely on the package.json at repo root."
echo -e "${RED}Expected npm prefix: $expected_npm_prefix\n${RED}Actual npm prefix: $actual_npm_prefix\n"
exit_code=1
fi
# Pass "--no" to ensure npx does not install anything (TypeSpec compiler should already be installed)
if test -f main.tsp; then
Expand Down

0 comments on commit 1842aeb

Please sign in to comment.