Skip to content

Commit c7330ec

Browse files
mikeharderharryli0108
authored andcommitted
[TypeSpec CI] Fail if spec folder contains package.json (Azure#24377)
- Fixes Azure#24365
1 parent 7de2aa2 commit c7330ec

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

eng/pipelines/templates/steps/typespec-ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ parameters:
66

77
steps:
88
- script: |
9+
RED='\033[0;31m'
10+
exit_code=0
11+
expected_npm_prefix=$(pwd)
12+
913
# Log commands before running
1014
set -x
1115
12-
exit_code=0
13-
1416
pushd ${{parameters.Folder}}
1517
18+
actual_npm_prefix=$(npm prefix)
19+
20+
if [ "$expected_npm_prefix" != "$actual_npm_prefix" ]; then
21+
echo -e "\n${RED}ERROR: TypeSpec folders MUST NOT contain a package.json, and instead MUST rely on the package.json at repo root."
22+
echo -e "${RED}Expected npm prefix: $expected_npm_prefix\n${RED}Actual npm prefix: $actual_npm_prefix\n"
23+
exit_code=1
24+
fi
25+
1626
# Pass "--no" to ensure npx does not install anything (TypeSpec compiler should already be installed)
1727
1828
if test -f main.tsp; then

0 commit comments

Comments
 (0)