Add Prettier (#7637)
This commit is contained in:
Родитель
14543d35a8
Коммит
bff55c492b
|
@ -88,9 +88,9 @@
|
|||
}
|
||||
},
|
||||
"@azure/rest-api-specs-scripts": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@azure/rest-api-specs-scripts/-/rest-api-specs-scripts-0.5.1.tgz",
|
||||
"integrity": "sha512-Nwi4jsHMVG1Pd3hJAh5D8JxTlx6PaDpYNfDrQSG3QAvVwE5n+MK9SmHL47akDfhKJQibuPompKwgw55Gy23Reg==",
|
||||
"version": "0.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@azure/rest-api-specs-scripts/-/rest-api-specs-scripts-0.5.7.tgz",
|
||||
"integrity": "sha512-KbhwZzENz5pB9Me9PxhhuqL7Lru8bmpSOWQ291buvxEYQ+ZwzvHyA0cA8yL5raXZX2IJhslc7ThtcPhAqC0hFw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@azure/avocado": "^0.4.1",
|
||||
|
@ -100,7 +100,7 @@
|
|||
"fs-extra": "^7.0.1",
|
||||
"glob": "^7.1.3",
|
||||
"js-yaml": "^3.13.1",
|
||||
"oav": "^0.19.6",
|
||||
"oav": "0.19.6",
|
||||
"request": "^2.88.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -151,23 +151,25 @@
|
|||
"dev": true
|
||||
},
|
||||
"@octokit/endpoint": {
|
||||
"version": "5.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.5.tgz",
|
||||
"integrity": "sha512-f8KqzIrnzPLiezDsZZPB+K8v8YSv6aKFl7eOu59O46lmlW4HagWl1U6NWl6LmT8d1w7NsKBI3paVtzcnRGO1gw==",
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.5.0.tgz",
|
||||
"integrity": "sha512-TXYS6zXeBImNB9BVj+LneMDqXX+H0exkOpyXobvp92O3B1348QsKnNioISFKgOMsb3ibZvQGwCdpiwQd3KAjIA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/types": "^1.0.0",
|
||||
"is-plain-object": "^3.0.0",
|
||||
"universal-user-agent": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/request": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.1.0.tgz",
|
||||
"integrity": "sha512-I15T9PwjFs4tbWyhtFU2Kq7WDPidYMvRB7spmxoQRZfxSmiqullG+Nz+KbSmpkfnlvHwTr1e31R5WReFRKMXjg==",
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.0.tgz",
|
||||
"integrity": "sha512-mMIeNrtYyNEIYNsKivDyUAukBkw0M5ckyJX56xoFRXSasDPCloIXaQOnaKNopzQ8dIOvpdq1ma8gmrS+h6O2OQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/endpoint": "^5.1.0",
|
||||
"@octokit/endpoint": "^5.5.0",
|
||||
"@octokit/request-error": "^1.0.1",
|
||||
"@octokit/types": "^1.0.0",
|
||||
"deprecation": "^2.0.0",
|
||||
"is-plain-object": "^3.0.0",
|
||||
"node-fetch": "^2.3.0",
|
||||
|
@ -186,12 +188,12 @@
|
|||
}
|
||||
},
|
||||
"@octokit/rest": {
|
||||
"version": "16.28.9",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.28.9.tgz",
|
||||
"integrity": "sha512-IKGnX+Tvzt7XHhs8f4ajqxyJvYAMNX5nWfoJm4CQj8LZToMiaJgutf5KxxpxoC3y5w7JTJpW5rnWnF4TsIvCLA==",
|
||||
"version": "16.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.34.0.tgz",
|
||||
"integrity": "sha512-EBe5qMQQOZRuezahWCXCnSe0J6tAqrW2hrEH9U8esXzKor1+HUDf8jgImaZf5lkTyWCQA296x9kAH5c0pxEgVQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/request": "^5.0.0",
|
||||
"@octokit/request": "^5.2.0",
|
||||
"@octokit/request-error": "^1.0.2",
|
||||
"atob-lite": "^2.0.0",
|
||||
"before-after-hook": "^2.0.0",
|
||||
|
@ -205,6 +207,23 @@
|
|||
"universal-user-agent": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-1.0.0.tgz",
|
||||
"integrity": "sha512-u51RhPTdCJgZQnU4TuKiqHcAxINsvIkQDZdbF4wSJy3g+DH7X/SmYp1kJE6INRD8hh2wEeFmRke7h1j6Ed3e+w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "^12.11.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.11.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.7.tgz",
|
||||
"integrity": "sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@ts-common/add-position": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@ts-common/add-position/-/add-position-0.0.2.tgz",
|
||||
|
@ -403,6 +422,12 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/prettier": {
|
||||
"version": "1.18.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.18.3.tgz",
|
||||
"integrity": "sha512-48rnerQdcZ26odp+HOvDGX8IcUkYOCuMc2BodWYTe956MqkHlOGAG4oFQ83cjZ0a4GAgj7mb4GUClxYd2Hlodg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/retry": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",
|
||||
|
@ -410,9 +435,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"abab": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.1.tgz",
|
||||
"integrity": "sha512-1zSbbCuoIjafKZ3mblY5ikvAb0ODUbqBnFuUb7f6uLeQhhGJ0vEV4ntmtxKLT2WgXCO94E07BjunsIw1jOMPZw==",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.2.tgz",
|
||||
"integrity": "sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg==",
|
||||
"dev": true
|
||||
},
|
||||
"abbrev": {
|
||||
|
@ -428,9 +453,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"acorn-globals": {
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.3.tgz",
|
||||
"integrity": "sha512-vkR40VwS2SYO98AIeFvzWWh+xyc2qi9s7OoXSFEGIP/rOJKzjnhykaZJNnHdoq4BL2gGxI5EZOU16z896EYnOQ==",
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz",
|
||||
"integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"acorn": "^6.0.1",
|
||||
|
@ -1039,9 +1064,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"core-js": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz",
|
||||
"integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==",
|
||||
"version": "2.6.10",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.10.tgz",
|
||||
"integrity": "sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA==",
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
|
@ -1070,16 +1095,16 @@
|
|||
"dev": true
|
||||
},
|
||||
"cspell": {
|
||||
"version": "4.0.28",
|
||||
"resolved": "https://registry.npmjs.org/cspell/-/cspell-4.0.28.tgz",
|
||||
"integrity": "sha512-2YH8pOUnaGCjHHKKUC2K247nAKx2/ah/JsyMYgSe0U3R1Lokl6+HwTsU2+I01o8u5GbM5sLjxsQRPzceYQkzLg==",
|
||||
"version": "4.0.30",
|
||||
"resolved": "https://registry.npmjs.org/cspell/-/cspell-4.0.30.tgz",
|
||||
"integrity": "sha512-dazX00rCgRSL8TAphqFSw7D9p3QdBGh09J8/bFH+hLpz01Yry/XzXjDiyKPlAXFkeFH5Sikgq0Cy/t3cHaLBeQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.4.2",
|
||||
"commander": "^2.20.0",
|
||||
"comment-json": "^1.1.3",
|
||||
"cspell-glob": "^0.1.11",
|
||||
"cspell-lib": "^4.0.25",
|
||||
"cspell-lib": "^4.1.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"gensequence": "^2.1.2",
|
||||
"get-stdin": "^7.0.0",
|
||||
|
@ -1107,9 +1132,9 @@
|
|||
}
|
||||
},
|
||||
"cspell-dict-companies": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/cspell-dict-companies/-/cspell-dict-companies-1.0.14.tgz",
|
||||
"integrity": "sha512-q4Xfe/vNteOs57r+YeEYzVsoQe2YGsi3uVMv06w0CkMa9y8llDXpBv7UJniLZVyW19491jlxIORkHx4i39MBUw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/cspell-dict-companies/-/cspell-dict-companies-1.0.15.tgz",
|
||||
"integrity": "sha512-IS3rnqkkZhgyKVsure5g+88q3PyLpgZw3xRB3Fo2W30NgoNW2Zpbh4/H6NR839f94IX2/qUvM/zanQy0B7ogMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"configstore": "^5.0.0"
|
||||
|
@ -1161,9 +1186,9 @@
|
|||
}
|
||||
},
|
||||
"cspell-dict-fullstack": {
|
||||
"version": "1.0.17",
|
||||
"resolved": "https://registry.npmjs.org/cspell-dict-fullstack/-/cspell-dict-fullstack-1.0.17.tgz",
|
||||
"integrity": "sha512-XmFyvt5r9JXcIjnycFfZfc/82dmMBUSowL4Oa/Mubx0Tm66bKOTmhrDatXl96qo6J0cIoyoPXitsfj5YaDV17g==",
|
||||
"version": "1.0.18",
|
||||
"resolved": "https://registry.npmjs.org/cspell-dict-fullstack/-/cspell-dict-fullstack-1.0.18.tgz",
|
||||
"integrity": "sha512-vEVf+ppML1PP9vdfkXnydABIYNyDORVN28sniBo0ILLhqFjCJvs1SNQuZxWhak5sgSZ9z4xiHU9TqCEUqhf1jw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"configstore": "^5.0.0"
|
||||
|
@ -1233,9 +1258,9 @@
|
|||
}
|
||||
},
|
||||
"cspell-dict-powershell": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/cspell-dict-powershell/-/cspell-dict-powershell-1.0.2.tgz",
|
||||
"integrity": "sha512-BW2Bdpet0yRQKB+7HjA75O0aJnh1VjdnMLNYb1SLvow73uCsC8GpvYLtvFyDm0Q717FYKoPzuZiSrXhyHerNAw==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cspell-dict-powershell/-/cspell-dict-powershell-1.0.3.tgz",
|
||||
"integrity": "sha512-YHVe8NkjtZmBvdclXev7dkoTODxweiq8H/Z8N0H5jc8pW1IJGBIXIFxlk1AjRW3bS19D5OZIx13J8ims6i5s8w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"configstore": "^5.0.0"
|
||||
|
@ -1323,9 +1348,9 @@
|
|||
}
|
||||
},
|
||||
"cspell-io": {
|
||||
"version": "4.0.17",
|
||||
"resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-4.0.17.tgz",
|
||||
"integrity": "sha512-srJnvfTm9QdrAGPx7OIR6MIZeXJPgwWupderhy4ywDQKgds4Yj1w3f10JWzHgsfWAwExAaEs3GZ4fEMUeWhnAA==",
|
||||
"version": "4.0.18",
|
||||
"resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-4.0.18.tgz",
|
||||
"integrity": "sha512-gE3C9bzE8+1W0ThLZ5xeYY5/xqbvUTtnEdsSGQ4VStNyAzcMTzfvWDTtL478z4luAiOxiyNPtQ4clWLGAugSJQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"iconv-lite": "^0.4.24",
|
||||
|
@ -1333,9 +1358,9 @@
|
|||
}
|
||||
},
|
||||
"cspell-lib": {
|
||||
"version": "4.0.25",
|
||||
"resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-4.0.25.tgz",
|
||||
"integrity": "sha512-EltUo+BBx15gCCYuDQ2V/pSPu1xIje9mdzCaEDoTJXIl1J5QVONmc91sukXLNEoymG4cdoZlnd2xg4fV/orynQ==",
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-4.1.0.tgz",
|
||||
"integrity": "sha512-2ems0LpIONO51TIQRSiLvECR8RLT8dE2kcEtJS1TVAbh3VQMB2KnAWLLcbBCgqqmCRnYZ/hDrRScd5ZJ+9uZxQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"comment-json": "^1.1.3",
|
||||
|
@ -1358,8 +1383,8 @@
|
|||
"cspell-dict-python": "^1.0.14",
|
||||
"cspell-dict-rust": "^1.0.10",
|
||||
"cspell-dict-scala": "^1.0.9",
|
||||
"cspell-io": "^4.0.17",
|
||||
"cspell-trie-lib": "^4.0.15",
|
||||
"cspell-io": "^4.0.18",
|
||||
"cspell-trie-lib": "^4.1.0",
|
||||
"cspell-util-bundle": "^4.0.5",
|
||||
"fs-extra": "^8.1.0",
|
||||
"gensequence": "^2.1.2",
|
||||
|
@ -1380,9 +1405,9 @@
|
|||
}
|
||||
},
|
||||
"cspell-trie-lib": {
|
||||
"version": "4.0.15",
|
||||
"resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-4.0.15.tgz",
|
||||
"integrity": "sha512-k3P03msJJh6Fhic9db7kva3+VodhvywvxxB5Q8Y7qF1xCu9zL2Zeoi+gA8ziL1QtUFqAqpzbDNPfiHhz6BaJsQ==",
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-4.1.0.tgz",
|
||||
"integrity": "sha512-R7omOBBhiz1yu0Wp1an1Vcv+upNREQEel8c4XcUp3kJFpQIP39T4KQc4+oJ4D1g5To3flB0567vVuLAY9orMdg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"gensequence": "^2.1.2",
|
||||
|
@ -1437,9 +1462,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"whatwg-url": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz",
|
||||
"integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==",
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz",
|
||||
"integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash.sortby": "^4.7.0",
|
||||
|
@ -1963,9 +1988,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"fast-safe-stringify": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz",
|
||||
"integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg==",
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz",
|
||||
"integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==",
|
||||
"dev": true
|
||||
},
|
||||
"fecha": {
|
||||
|
@ -2226,9 +2251,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"handlebars": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.2.0.tgz",
|
||||
"integrity": "sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw==",
|
||||
"version": "4.4.5",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.5.tgz",
|
||||
"integrity": "sha512-0Ce31oWVB7YidkaTq33ZxEbN+UDxMMgThvCe8ptgQViymL5DPis9uLdTA13MiRPhgvqyxIegugrP97iK3JeBHg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"neo-async": "^2.6.0",
|
||||
|
@ -2329,9 +2354,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz",
|
||||
"integrity": "sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==",
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
|
||||
"integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
|
||||
"dev": true
|
||||
},
|
||||
"html-encoding-sniffer": {
|
||||
|
@ -2803,13 +2828,13 @@
|
|||
"dev": true
|
||||
},
|
||||
"json-schema-faker": {
|
||||
"version": "0.5.0-rc17",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-faker/-/json-schema-faker-0.5.0-rc17.tgz",
|
||||
"integrity": "sha512-ZQSLPpnsGiMBuPOHi09cAzhsiIeOcs5im2GAQ2P6XKyWOuetO8eYdYCP/kW7VVU891Ucan0/dl8GYbRA6pf9gw==",
|
||||
"version": "0.5.0-rc22",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-faker/-/json-schema-faker-0.5.0-rc22.tgz",
|
||||
"integrity": "sha512-I4uHXHapmR9qLJtzZSEHhhri1LMsaFsw3PycmFq0lBCR2Q1oIRm0OTPJbSbmIyPLJgN4+8+WRgR3AF0qmU1XDw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"json-schema-ref-parser": "^6.0.2",
|
||||
"jsonpath": "^1.0.1",
|
||||
"json-schema-ref-parser": "^6.1.0",
|
||||
"jsonpath-plus": "^1.0.0",
|
||||
"randexp": "^0.5.3"
|
||||
}
|
||||
},
|
||||
|
@ -2864,6 +2889,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"jsonpath-plus": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-1.1.0.tgz",
|
||||
"integrity": "sha512-ydqTBOuLcFCUr9e7AxJlKCFgxzEQ03HjnIim0hJSdk2NxD8MOsaMOrRgP6XWEm5q3VuDY5+cRT1DM9vLlGo/qA==",
|
||||
"dev": true
|
||||
},
|
||||
"jsonschema": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.4.tgz",
|
||||
|
@ -2929,9 +2960,9 @@
|
|||
}
|
||||
},
|
||||
"linq": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/linq/-/linq-3.2.0.tgz",
|
||||
"integrity": "sha512-rdmaLOf2tSCzZ75scdjjN/LVHGZzRu48ql9LdxppQec/pKpPtf8jlMDlPBX3rQnLMcGPtAx8Lel6YbF7jND70g==",
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/linq/-/linq-3.2.1.tgz",
|
||||
"integrity": "sha512-BEhjQpbvrKPWlg5m/+PXTHsQoXzzR0UWCvgI8Hm+WtUMtTwPvw9Tay5CWfqsWSVk81wqbHNDFpFXyqBmm4/dqA==",
|
||||
"dev": true
|
||||
},
|
||||
"load-json-file": {
|
||||
|
@ -3024,9 +3055,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"colors": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz",
|
||||
"integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
||||
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
@ -3108,9 +3139,9 @@
|
|||
}
|
||||
},
|
||||
"merge2": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.4.tgz",
|
||||
"integrity": "sha512-FYE8xI+6pjFOhokZu0We3S5NKCirLbCzSh2Usf3qEyr4X8U+0jNg9P8RZ4qz+V2UoECLVwSyzU3LxXBaLGtD3A==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz",
|
||||
"integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==",
|
||||
"dev": true
|
||||
},
|
||||
"methods": {
|
||||
|
@ -4164,6 +4195,12 @@
|
|||
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.18.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
|
||||
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
|
||||
"dev": true
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
|
@ -4193,9 +4230,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.8.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.8.0.tgz",
|
||||
"integrity": "sha512-tPSkj8y92PfZVbinY1n84i1Qdx75lZjMQYx9WZhnkofyxzw2r7Ho39G3/aEvSUdebxpnnM4LZJCtvE/Aq3+s9w==",
|
||||
"version": "6.9.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.0.tgz",
|
||||
"integrity": "sha512-27RP4UotQORTpmNQDX8BHPukOnBP3p1uUJY5UnDhaJB+rMt9iMsok724XL+UHU23bEFOHRMQ2ZhI99qOWUMGFA==",
|
||||
"dev": true
|
||||
},
|
||||
"randexp": {
|
||||
|
@ -5107,20 +5144,20 @@
|
|||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
|
||||
"integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.4.tgz",
|
||||
"integrity": "sha512-9Yc2i881pF4BPGhjteCXQNaXx1DCwm3dtOyBaG2hitHjLWOczw/ki8vD1bqyT3u6K0Ms/FpCShkmfg+FtlOfYA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"commander": "~2.20.0",
|
||||
"commander": "~2.20.3",
|
||||
"source-map": "~0.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.20.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
|
||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
|
@ -5679,13 +5716,14 @@
|
|||
}
|
||||
},
|
||||
"yasway": {
|
||||
"version": "1.8.4",
|
||||
"resolved": "https://registry.npmjs.org/yasway/-/yasway-1.8.4.tgz",
|
||||
"integrity": "sha512-Oo6dFvmazhQU6ceazUm59BVraptSXTDhvpW2K14DcpgeyTAyUUpJjuE7HJ4qyF+Ci6blIaQq9mOVHj8pCFhEjQ==",
|
||||
"version": "1.8.5",
|
||||
"resolved": "https://registry.npmjs.org/yasway/-/yasway-1.8.5.tgz",
|
||||
"integrity": "sha512-aa1qTc/LZna6fO/hEIqEhLKBaZ7PkCUDT9Zp75DtB9DeX+htS37Zr9kah0uzwoh0E9XoLhk42aQWBnUFJnLH9Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@ts-common/json": "^0.3.0",
|
||||
"@ts-common/string-map": "^0.3.0",
|
||||
"@ts-common/z-schema": "^4.1.2",
|
||||
"debug": "^4.1.1",
|
||||
"faker": "^4.1.0",
|
||||
"istanbul": "^0.4.5",
|
||||
|
@ -5697,10 +5735,28 @@
|
|||
"native-promise-only": "^0.8.1",
|
||||
"path-to-regexp": "^1.7.0",
|
||||
"swagger-methods": "^1.0.8",
|
||||
"swagger-schema-official": "2.0.0-bab6bed",
|
||||
"z-schema": "^4.1.0"
|
||||
"swagger-schema-official": "2.0.0-bab6bed"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ts-common/z-schema": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@ts-common/z-schema/-/z-schema-4.1.2.tgz",
|
||||
"integrity": "sha512-PDMAza1jpnCpUUSSVf3LBtTyeo5s9xLQlD68gvW3B0j+RbnxYK9CHHCeLOZxBoKviBgr8+tps6ZVmUCcMSmiFw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.7.1",
|
||||
"core-js": "^3.2.1",
|
||||
"lodash.get": "^4.4.2",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"validator": "^11.0.0"
|
||||
}
|
||||
},
|
||||
"core-js": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.3.3.tgz",
|
||||
"integrity": "sha512-0xmD4vUJRY8nfLyV9zcpC17FtSie5STXzw+HyYw2t8IIvmDnbq7RJUULECCo+NstpJtwK9kx8S+898iyqgeUow==",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
|
@ -5709,6 +5765,12 @@
|
|||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/validator/-/validator-11.1.0.tgz",
|
||||
"integrity": "sha512-qiQ5ktdO7CD6C/5/mYV4jku/7qnqzjrxb3C/Q5wR3vGGinHTgJZN/TdFT3ZX4vXhX2R1PXx42fB1cn5W+uJ4lg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -5730,24 +5792,17 @@
|
|||
}
|
||||
},
|
||||
"z-schema": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/z-schema/-/z-schema-4.1.1.tgz",
|
||||
"integrity": "sha512-0aKvR9FgrghUXXndYNDmAEazl8jykuHSkqkmPw2ZSuTWuLcEscn1zUTbR3LEfyxHl5EEHpqqOpF+Sd7wZvuDxw==",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/z-schema/-/z-schema-4.2.1.tgz",
|
||||
"integrity": "sha512-UWhAk5QzeIhks51TjHa6d4WexEokzbbwT+Dzq9yOBOx9sNnALo4hpYz9CfJ6IUE2cmzB0vWW3KHePYOfw3L4gQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.7.1",
|
||||
"core-js": "^3.2.1",
|
||||
"lodash.get": "^4.4.2",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"validator": "^11.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz",
|
||||
"integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw==",
|
||||
"dev": true
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/validator/-/validator-11.1.0.tgz",
|
||||
|
|
|
@ -17,13 +17,15 @@
|
|||
"@ts-common/iterator": "^0.3.6",
|
||||
"@types/js-yaml": "^3.12.1",
|
||||
"@types/mocha": "^5.2.6",
|
||||
"cspell": "^4.0.12",
|
||||
"@types/prettier": "^1.18.3",
|
||||
"cspell": "^4.0.30",
|
||||
"js-yaml": "^3.13.1",
|
||||
"json-schema-ref-parser": "^6.1.0",
|
||||
"mocha": "*",
|
||||
"ts-node": "^8.1.0",
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": "3.5.3"
|
||||
"typescript": "3.5.3",
|
||||
"prettier": "^1.18.2"
|
||||
},
|
||||
"homepage": "https://github.com/azure/azure-rest-api-specs",
|
||||
"repository": {
|
||||
|
@ -36,6 +38,8 @@
|
|||
"scripts": {
|
||||
"test": "tsc && mocha -t 500000 --reporter min",
|
||||
"spellcheck": "ts-node ./scripts/spellcheck.ts",
|
||||
"prettier-check": "tsc && ts-node ./scripts/prettier-check.ts",
|
||||
"prettier": "prettier",
|
||||
"tsc": "tsc",
|
||||
"multiapi": "ts-node ./scripts/multiapi.ts"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
jobs:
|
||||
- job: "PrettierCheck"
|
||||
condition: "not(variables['PRIVATE'])"
|
||||
variables:
|
||||
NODE_OPTIONS: '--max-old-space-size=8192'
|
||||
pool:
|
||||
vmImage: 'Ubuntu 18.04'
|
||||
continueOnError: true
|
||||
steps:
|
||||
- task: Npm@1
|
||||
displayName: 'npm install'
|
||||
inputs:
|
||||
verbose: false
|
||||
- script: 'npm run prettier-check'
|
||||
displayName: 'Run Prettier Check'
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"plugins": ["./scripts/prettier-swagger-plugin"],
|
||||
"parser": "json-swagger",
|
||||
"printWidth": 20
|
||||
}
|
|
@ -400,6 +400,12 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/prettier": {
|
||||
"version": "1.18.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.18.3.tgz",
|
||||
"integrity": "sha512-48rnerQdcZ26odp+HOvDGX8IcUkYOCuMc2BodWYTe956MqkHlOGAG4oFQ83cjZ0a4GAgj7mb4GUClxYd2Hlodg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/retry": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",
|
||||
|
@ -4179,6 +4185,12 @@
|
|||
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.18.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
|
||||
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
|
||||
"dev": true
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"description": "Tests for Azure REST API Specifications",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/prettier": "^1.18.3",
|
||||
"@azure/avocado": "^0.6.0",
|
||||
"@azure/rest-api-specs-scripts": "^0.4.0",
|
||||
"@ts-common/commonmark-to-markdown": "^1.2.0",
|
||||
|
@ -23,7 +24,8 @@
|
|||
"mocha": "*",
|
||||
"ts-node": "^8.1.0",
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": "3.5.3"
|
||||
"typescript": "3.5.3",
|
||||
"prettier": "^1.18.2"
|
||||
},
|
||||
"homepage": "https://github.com/azure/azure-rest-api-specs",
|
||||
"repository": {
|
||||
|
@ -37,6 +39,8 @@
|
|||
"postinstall": "scripts/switch-to-preproduction.sh",
|
||||
"test": "tsc && mocha -t 500000 --reporter min",
|
||||
"spellcheck": "ts-node ./scripts/spellcheck.ts",
|
||||
"prettier-check": "tsc && ts-node ./scripts/prettier-check.ts",
|
||||
"prettier": "prettier",
|
||||
"tsc": "tsc",
|
||||
"multiapi": "ts-node ./scripts/multiapi.ts"
|
||||
}
|
||||
|
|
|
@ -16,3 +16,4 @@ jobs:
|
|||
- template: .azure-pipelines/BranchProtectionForPrivateRepo.yml
|
||||
- template: .azure-pipelines/BreakingChange.yml
|
||||
- template: .azure-pipelines/ModelValidation.yml
|
||||
- template: .azure-pipelines/PrettierCheck.yml
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import { runCheckOverChangedSpecFiles, logWarn, logError } from "./utils";
|
||||
|
||||
runCheckOverChangedSpecFiles({
|
||||
onCheckFile: (context, filePath) => {
|
||||
return context.exec(`prettier -c ${filePath}`);
|
||||
},
|
||||
|
||||
onExecError: async (result) => {
|
||||
if (result.stdout) {
|
||||
console.log(result.stdout);
|
||||
}
|
||||
},
|
||||
|
||||
onNotInCI: (context) => {
|
||||
logWarn("Not in CI environment. Run against all the spec json.");
|
||||
return context.exec(`prettier -c "specification/**/*.json"`);
|
||||
},
|
||||
|
||||
onFinalFailed: async () => {
|
||||
logError('Code style issues found in the above file(s). Please run `npm install && npm run prettier -- --write "specification/<service>/**/*.json"` to fix.')
|
||||
}
|
||||
})
|
|
@ -0,0 +1,92 @@
|
|||
import { ParserOptions, FastPath, Doc, doc, Plugin, AST } from 'prettier';
|
||||
import { parsers as bundledParsers } from 'prettier/parser-babylon';
|
||||
|
||||
const { concat, indent, hardline, join } = doc.builders;
|
||||
|
||||
// Modified from https://github.com/prettier/prettier/blob/master/src/language-js/printer-estree-json.js
|
||||
const print = (path: FastPath, _: ParserOptions, print: (path: FastPath) => Doc): Doc => {
|
||||
const node = path.getValue();
|
||||
switch (node.type) {
|
||||
case "JsonRoot":
|
||||
return concat([path.call(print, "node"), hardline]);
|
||||
case "ArrayExpression":
|
||||
return node.elements.length === 0
|
||||
? "[]"
|
||||
: concat([
|
||||
"[",
|
||||
indent(
|
||||
concat([
|
||||
hardline,
|
||||
join(concat([",", hardline]), path.map(print, "elements"))
|
||||
])
|
||||
),
|
||||
hardline,
|
||||
"]"
|
||||
]);
|
||||
case "ObjectExpression":
|
||||
return node.properties.length === 0
|
||||
? "{}"
|
||||
: concat([
|
||||
"{",
|
||||
indent(
|
||||
concat([
|
||||
hardline,
|
||||
join(concat([",", hardline]), path.map(print, "properties"))
|
||||
])
|
||||
),
|
||||
hardline,
|
||||
"}"
|
||||
]);
|
||||
case "ObjectProperty":
|
||||
return concat([path.call(print, "key"), ": ", path.call(print, "value")]);
|
||||
case "UnaryExpression":
|
||||
return concat([
|
||||
node.operator === "+" ? "" : node.operator,
|
||||
path.call(print, "argument")
|
||||
]);
|
||||
case "NullLiteral":
|
||||
return "null";
|
||||
case "BooleanLiteral":
|
||||
return node.value ? "true" : "false";
|
||||
case "StringLiteral":
|
||||
return JSON.stringify(node.value);
|
||||
case "NumericLiteral":
|
||||
// Modified: Keep numeric literal as-is
|
||||
return node.extra.raw;
|
||||
case "Identifier":
|
||||
return JSON.stringify(node.name);
|
||||
default:
|
||||
/* istanbul ignore next */
|
||||
throw new Error("unknown type: " + JSON.stringify(node.type));
|
||||
}
|
||||
}
|
||||
|
||||
const preprocess = (ast: AST, _: any): AST => {
|
||||
return Object.assign({}, ast, {
|
||||
type: "JsonRoot",
|
||||
node: ast,
|
||||
comments: []
|
||||
});
|
||||
}
|
||||
|
||||
export const languages: Plugin['languages'] = [
|
||||
{
|
||||
name: 'json-swagger',
|
||||
extensions: ['.json'],
|
||||
parsers: ['json-swagger']
|
||||
}
|
||||
]
|
||||
|
||||
export const parsers = {
|
||||
'json-swagger': {
|
||||
...bundledParsers['json-stringify'],
|
||||
astFormat: 'estree-swagger-customized'
|
||||
}
|
||||
};
|
||||
|
||||
export const printers = {
|
||||
'estree-swagger-customized': {
|
||||
preprocess,
|
||||
print
|
||||
}
|
||||
};
|
|
@ -1,68 +1,25 @@
|
|||
import { devOps, cli, childProcess } from '@azure/avocado';
|
||||
import { ExecOptions } from 'child_process';
|
||||
import { logError, logWarn, runCheckOverChangedSpecFiles } from './utils';
|
||||
|
||||
const logToAzureDevops = (msg: string, type: string) => {
|
||||
const lines = msg.split('\n');
|
||||
for (const line of lines) {
|
||||
console.log(`##vso[task.logissue type=${type}]${line}`);
|
||||
}
|
||||
}
|
||||
runCheckOverChangedSpecFiles({
|
||||
onCheckFile: (context, filePath) => {
|
||||
return context.exec(`cspell ${filePath}`);
|
||||
},
|
||||
|
||||
const logError = (msg: string) => logToAzureDevops(msg, 'error');
|
||||
const logWarn = (msg: string) => logToAzureDevops(msg, 'warning');
|
||||
|
||||
const verboseExec = async (commandLine: string, options: ExecOptions = {}) => {
|
||||
console.log(commandLine);
|
||||
let result: any = {};
|
||||
try {
|
||||
result = await childProcess.exec(commandLine, options);
|
||||
} catch (e) {
|
||||
result = e;
|
||||
}
|
||||
|
||||
if (!result.code) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (result.stdout) {
|
||||
logError(result.stdout);
|
||||
}
|
||||
if (result.stderr) {
|
||||
console.error(result.stderr);
|
||||
}
|
||||
return result.code;
|
||||
}
|
||||
|
||||
const main = async () => {
|
||||
const config = cli.defaultConfig();
|
||||
const pr = await devOps.createPullRequestProperties(config);
|
||||
if (pr === undefined) {
|
||||
logWarn("Not in CI environment. Run against all the spec json.");
|
||||
return verboseExec(`cspell "specification/**/*.json"`);
|
||||
}
|
||||
|
||||
const changedJsonFiles = await pr.structuralDiff()
|
||||
.filter(filePath => filePath.endsWith('.json') && filePath.startsWith('specification/'))
|
||||
.toArray();
|
||||
if (changedJsonFiles.length === 0) {
|
||||
logWarn("No changed spec json file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
let retCode = 0;
|
||||
for (const jsonFile of changedJsonFiles) {
|
||||
const code = await verboseExec(`cspell ${jsonFile}`);
|
||||
if (code !== 0) {
|
||||
retCode = code;
|
||||
onExecError: async (result) => {
|
||||
if (result.stdout) {
|
||||
logError(result.stdout);
|
||||
}
|
||||
}
|
||||
if (result.stderr) {
|
||||
console.error(result.stderr);
|
||||
}
|
||||
},
|
||||
|
||||
return retCode;
|
||||
}
|
||||
onNotInCI: (context) => {
|
||||
logWarn("Not in CI environment. Run against all the spec json.");
|
||||
return context.exec(`cspell "specification/**/*.json"`);
|
||||
},
|
||||
|
||||
main().then(retCode => {
|
||||
if (retCode !== 0) {
|
||||
onFinalFailed: async () => {
|
||||
logError('Please fix the error or add words to ./custom-words.txt');
|
||||
}
|
||||
process.exit(retCode);
|
||||
});
|
||||
})
|
|
@ -0,0 +1,80 @@
|
|||
import { ExecOptions } from 'child_process';
|
||||
import { childProcess, cli, devOps } from '@azure/avocado';
|
||||
|
||||
export const logToAzureDevops = (msg: string, type: string) => {
|
||||
const lines = msg.split('\n');
|
||||
for (const line of lines) {
|
||||
console.log(`##vso[task.logissue type=${type}]${line}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const logError = (msg: string) => logToAzureDevops(msg, 'error');
|
||||
export const logWarn = (msg: string) => logToAzureDevops(msg, 'warning');
|
||||
|
||||
export type Exec = (commandLine: string, options?: ExecOptions) => Promise<number>;
|
||||
export type CheckContext = {
|
||||
exec: Exec;
|
||||
};
|
||||
export type CheckOptions = {
|
||||
onExecError(result: childProcess.ExecResult): Promise<unknown>;
|
||||
onNotInCI(context: CheckContext): Promise<unknown>;
|
||||
onCheckFile(context: CheckContext, filePath: string): Promise<number>;
|
||||
onFinalFailed(context: CheckContext): Promise<unknown>;
|
||||
}
|
||||
|
||||
const internalCheck = async (checkOptions: CheckOptions) => {
|
||||
|
||||
const exec = async (commandLine: string, options: ExecOptions = {}) => {
|
||||
console.log(commandLine);
|
||||
let result: any = {};
|
||||
try {
|
||||
result = await childProcess.exec(commandLine, options);
|
||||
} catch (e) {
|
||||
result = e;
|
||||
}
|
||||
|
||||
if (!result.code) {
|
||||
return 0;
|
||||
}
|
||||
await checkOptions.onExecError(result);
|
||||
|
||||
return result.code;
|
||||
}
|
||||
const context: CheckContext = { exec };
|
||||
|
||||
const config = cli.defaultConfig();
|
||||
const pr = await devOps.createPullRequestProperties(config);
|
||||
if (pr === undefined) {
|
||||
return checkOptions.onNotInCI(context);
|
||||
}
|
||||
|
||||
const changedJsonFiles = (await pr.diff())
|
||||
.map(change => change.path)
|
||||
.filter(filePath => filePath.endsWith('.json') && filePath.startsWith('specification/'));
|
||||
if (changedJsonFiles.length === 0) {
|
||||
logWarn("No changed spec json file");
|
||||
return;
|
||||
}
|
||||
|
||||
let retCode = 0;
|
||||
for (const jsonFile of changedJsonFiles) {
|
||||
const code = await checkOptions.onCheckFile(context, jsonFile);
|
||||
if (code !== 0) {
|
||||
retCode = code;
|
||||
}
|
||||
}
|
||||
|
||||
if (retCode !== 0) {
|
||||
await checkOptions.onFinalFailed(context);
|
||||
}
|
||||
|
||||
process.exit(retCode);
|
||||
}
|
||||
|
||||
export const runCheckOverChangedSpecFiles = (options: CheckOptions) => {
|
||||
internalCheck(options).catch(e => {
|
||||
console.error(e);
|
||||
logError(`Fatal Error. Please report to adxsr@microsoft.com`);
|
||||
process.exit(-1);
|
||||
});
|
||||
}
|
Загрузка…
Ссылка в новой задаче