初始化上传
Some checks failed
Run mypy_primer on push / Run mypy_primer on push (push) Has been cancelled
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled
Some checks failed
Run mypy_primer on push / Run mypy_primer on push (push) Has been cancelled
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled
This commit is contained in:
20
packages/vscode-pyright/build/checkPackage.js
Normal file
20
packages/vscode-pyright/build/checkPackage.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
//@ts-check
|
||||
|
||||
const { promises: fsAsync } = require('fs');
|
||||
const chalk = require('chalk').default;
|
||||
|
||||
async function main() {
|
||||
const packageJson = await fsAsync.readFile('package.json', 'utf-8');
|
||||
const obj = JSON.parse(packageJson);
|
||||
|
||||
const name = obj.name;
|
||||
if (name !== 'pyright') {
|
||||
console.error(chalk.red(`Extension name must be "pyright", but is currently set to "${name}".`));
|
||||
console.error(chalk.red('Please package by running "npm run package" to ensure the name is set correctly.'));
|
||||
console.error();
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
37
packages/vscode-pyright/build/renamePackage.js
Normal file
37
packages/vscode-pyright/build/renamePackage.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
//@ts-check
|
||||
|
||||
const { promises: fsAsync } = require('fs');
|
||||
|
||||
/**
|
||||
* @param {string} filepath
|
||||
* @param {(obj: any) => void} modifier
|
||||
*/
|
||||
async function modifyJsonInPlace(filepath, modifier) {
|
||||
const input = await fsAsync.readFile(filepath, 'utf-8');
|
||||
const obj = JSON.parse(input);
|
||||
|
||||
modifier(obj);
|
||||
|
||||
// Always 4 spaces for indent.
|
||||
let output = JSON.stringify(obj, null, 4);
|
||||
|
||||
if (input.endsWith('\n')) {
|
||||
output += '\n';
|
||||
}
|
||||
|
||||
if (input.indexOf('\r\n') !== -1) {
|
||||
output = output.replace(/\n/g, '\r\n');
|
||||
}
|
||||
|
||||
await fsAsync.writeFile(filepath, output, 'utf-8');
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const name = process.argv[2];
|
||||
await modifyJsonInPlace('package.json', (obj) => {
|
||||
obj.name = name;
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user