AT LEAST IT BUILDS

Doesn't run -- dependency isn't actually available
This commit is contained in:
Nathan Shively-Sanders
2020-04-29 12:02:40 -07:00
parent 4a4f578b9c
commit c4f8bafc98
6 changed files with 1434 additions and 11 deletions

View File

@@ -663,7 +663,7 @@
"json-stable-stringify": "^1.0.1",
"strip-json-comments": "^2.0.1",
"tslint": "5.14.0",
"typescript": "^3.9.0-dev.20200414",
"typescript": "^4.0.0-dev.20200429",
"yargs": "^15.1.0"
},
"dependencies": {
@@ -5083,9 +5083,9 @@
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
},
"typescript": {
"version": "3.9.0-dev.20200414",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.0-dev.20200414.tgz",
"integrity": "sha512-wqAPcJUX4SPnySVpP58Vh09b4ncxxHdwP9HaPP9YTaOGHS3PyychJcbvMBqlKVXdvBvhHoacVDSB0Agn2zu4hA=="
"version": "4.0.0-dev.20200429",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.0-dev.20200429.tgz",
"integrity": "sha512-r5LFE13k+4K3Zw2YNa30McHp4EtQzGTibFBib7yQWkO6oNftBlwEzgHcX2+KBA1S1FI0uZEoUOuo6l82R5sYgA=="
},
"underscore": {
"version": "1.10.2",

View File

@@ -1,7 +1,58 @@
'use strict';
const yargs = require("yargs");
const process = require('process')
module.exports = retag;
const {
withNpmCache, NpmPublishClient, UncachedNpmInfoClient,
consoleLogger, logUncaughtErrors, loggerWithErrors, Registry,
nAtATime, } = require("@definitelytyped/utils");
const {
AllPackages, parseDefinitions, getDefinitelyTyped,
} = require("@definitelytyped/definitions-parser");
const {
parseNProcesses,
updateLatestTag, updateTypeScriptVersionTags, getLatestTypingVersion
} = require("@definitelytyped/publisher");
function retag() {
// TODO
logUncaughtErrors(tag(!!yargs.argv.dry, /** @type {string=} */(yargs.argv.name)));
/**
* Refreshes the tags on every package.
* This needs to be run whenever a new version of Typescript is released.
*
* It can also refresh the tags on a single package, which can un-wedge types-publisher in certain cases.
* This shouldn't normally need to run, since we run `tagSingle` whenever we publish a package.
* But this should be run if the way we calculate tags changes (e.g. when a new release is allowed to be tagged "latest").
* @param {boolean} dry
* @param {string} [name]
* @return {Promise<void>}
*/
async function tag(dry, name) {
const log = loggerWithErrors()[0];
const options = { definitelyTypedPath: "../DefinitelyTyped", progress: true, parseInParallel: true };
await parseDefinitions(
await getDefinitelyTyped(options, log),
// TODO: Going to have to move DT-tools to ~ probably
{ nProcesses: parseNProcesses(), definitelyTypedPath: "../DefinitelyTyped" },
log);
const registryName = !!true ? Registry.NPM : Registry.Github;
const token = /** @type {string} */(registryName === Registry.Github ? process.env.GH_API_TOKEN : process.env.NPM_TOKEN);
const publishClient = await NpmPublishClient.create(token, {}, Registry.Github);
await withNpmCache(new UncachedNpmInfoClient(), async infoClient => {
if (name) {
const pkg = await AllPackages.readSingle(name);
const version = await getLatestTypingVersion(pkg, infoClient);
await updateTypeScriptVersionTags(pkg, version, publishClient, consoleLogger.info, dry);
await updateLatestTag(pkg.fullNpmName, version, publishClient, consoleLogger.info, dry);
} else {
await nAtATime(10, await AllPackages.readLatestTypings(), async pkg => {
// Only update tags for the latest version of the package.
const version = await getLatestTypingVersion(pkg, infoClient);
await updateTypeScriptVersionTags(pkg, version, publishClient, consoleLogger.info, dry);
await updateLatestTag(pkg.fullNpmName, version, publishClient, consoleLogger.info, dry);
});
}
});
// Don't tag notNeeded packages
}

1343
packages/retag/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -25,5 +25,16 @@
},
"bugs": {
"url": "https://github.com/microsoft/DefinitelyTyped-tools/issues"
}
},
"dependencies": {
"@definitelytyped/definitions-parser": "^0.0.30-next.0",
"@definitelytyped/publisher": "^0.0.30-next.0",
"@definitelytyped/utils": "^0.0.30-next.0",
"yargs": "^12.0.5"
},
"devDependencies": {
"@types/node": "^10.17.21",
"@types/yargs": "^12.0.8"
},
"private": true
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"noEmit": true,
"target": "esnext",
"module": "commonjs",
"resolveJsonModule": true,
"esModuleInterop": true,
"strict": true
},
"references": [
{ "path": "../definitions-parser" },
{ "path": "../publisher" },
{ "path": "../utils" }
]
}

View File

@@ -7,6 +7,7 @@
{ "path": "packages/perf" },
{ "path": "packages/publisher" },
{ "path": "packages/typescript-versions" },
{ "path": "packages/utils" }
{ "path": "packages/utils" },
{ "path": "packages/retag" }
]
}
}