-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'autorestv3' of https://github.com/Azure/autorest.python …
…into inherit_customization * 'autorestv3' of https://github.com/Azure/autorest.python: Update package.json Update ChangeLog.md default optional const parameter to none (#1171) add storage to ci checks (#1176) fail on regeneration diff (#1173) Drop Python 2.7 (#1175)
- Loading branch information
Showing
80 changed files
with
683 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// @ts-check | ||
|
||
const { run } = require("./helpers.js"); | ||
|
||
const proc = run("git", ["status", "--porcelain"], { | ||
encoding: "utf-8", | ||
stdio: [null, "pipe", "pipe"], | ||
}); | ||
|
||
if (proc.stdout) { | ||
console.log(proc.stdout); | ||
} | ||
|
||
if (proc.stderr) { | ||
console.error(proc.stderr); | ||
} | ||
|
||
if (proc.stdout || proc.stderr) { | ||
console.error( | ||
`ERROR: There are diffs in regeneration. Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, | ||
); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// @ts-check | ||
const { spawn, spawnSync } = require("child_process"); | ||
const { resolve } = require("path"); | ||
|
||
const repoRoot = resolve(__dirname, "../.."); | ||
const prettier = resolve( | ||
repoRoot, | ||
"packages/extensions/core/node_modules/.bin/prettier" | ||
); | ||
const tsc = resolve(repoRoot, "packages/extensions/core/node_modules/.bin/tsc"); | ||
|
||
const isCmdOnWindows = ["rush", "npm", "code", "code-insiders", tsc, prettier]; | ||
|
||
function run(command, args, options) { | ||
console.log(); | ||
console.log(`> ${command} ${args.join(" ")}`); | ||
|
||
options = { | ||
stdio: "inherit", | ||
sync: true, | ||
throwOnNonZeroExit: true, | ||
...options, | ||
}; | ||
|
||
if (process.platform === "win32" && isCmdOnWindows.includes(command)) { | ||
command += ".cmd"; | ||
} | ||
|
||
const proc = (options.sync ? spawnSync : spawn)(command, args, options); | ||
if (proc.error) { | ||
if (options.ignoreCommandNotFound && proc.error.code === "ENOENT") { | ||
console.log(`Skipped: Command \`${command}\` not found.`); | ||
} else { | ||
throw proc.error; | ||
} | ||
} else if ( | ||
options.throwOnNonZeroExit && | ||
proc.status !== undefined && | ||
proc.status !== 0 | ||
) { | ||
throw new CommandFailedError( | ||
`Command \`${command} ${args.join(" ")}\` failed with exit code ${ | ||
proc.status | ||
}`, | ||
proc | ||
); | ||
} | ||
|
||
return proc; | ||
} | ||
|
||
class CommandFailedError extends Error { | ||
constructor(msg, proc) { | ||
super(msg); | ||
this.proc = proc; | ||
} | ||
} | ||
|
||
function runPrettier(...args) { | ||
run( | ||
prettier, | ||
[ | ||
...args, | ||
"--config", | ||
".prettierrc.yml", | ||
"--ignore-path", | ||
".prettierignore", | ||
"**/*.{ts,js,cjs,mjs,json,yml,yaml,cadl,md}", | ||
], | ||
{ | ||
cwd: repoRoot, | ||
} | ||
); | ||
} | ||
|
||
module.exports = { | ||
repoRoot, | ||
prettier, | ||
tsc, | ||
run, | ||
runPrettier, | ||
CommandFailedError, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.