Misc fixes

This commit is contained in:
Ryan Cavanaugh
2016-05-18 15:56:00 -07:00
committed by Andrew Branch
parent ed5c192450
commit 8e23d27647
7 changed files with 19 additions and 7 deletions

View File

@@ -6,7 +6,9 @@
"bin": {
"publish-typings": "createSearchIndex.js"
},
"dependencies": {},
"dependencies": {
"rmdir": "^1.2.0"
},
"devDependencies": {
"typescript": "^1.9.0-dev.20160331"
},

View File

@@ -5,8 +5,10 @@ var rmdir = require('rmdir');
var outputPath = path.join(__dirname, '..', 'output');
console.log('Clean ' + outputPath);
fs.readdir(outputPath, function(err, dirs) {
dirs.forEach(function (dir) {
var p = path.join(outputPath, dir);
rmdir(p);
});
if(dirs) {
dirs.forEach(function (dir) {
var p = path.join(outputPath, dir);
rmdir(p);
});
}
});

View File

@@ -2,6 +2,7 @@
"scopeName": "types",
"outputPath": "./output",
"definitelyTypedPath": "../DefinitelyTyped",
"sourceBranch": "types-2.0",
"prereleaseTag": "alpha",
"tag": "latest"
}

View File

@@ -20,6 +20,8 @@ export interface TypingsData {
// e.g. https://github.com/DefinitelyTyped
sourceRepoURL: string;
// e.g. 'master'
sourceBranch: string;
// The name of the primary definition file, e.g. 'jquery.d.ts'
definitionFilename: string;

View File

@@ -2,7 +2,7 @@ import * as ts from 'typescript';
import * as fs from 'fs';
import * as path from 'path';
import { TypingsData, DefinitionFileKind, RejectionReason, TypingParseSucceedResult, TypingParseFailResult, computeHash } from './common';
import { TypingsData, DefinitionFileKind, RejectionReason, TypingParseSucceedResult, TypingParseFailResult, computeHash, settings } from './common';
function stripQuotes(s: string) {
return s.substr(1, s.length - 2);
@@ -349,6 +349,7 @@ export function getTypingInfo(directory: string): TypingParseFailResult | Typing
typingsPackageName: folderName.toLowerCase(),
projectName,
sourceRepoURL,
sourceBranch: settings.sourceBranch,
kind: DefinitionFileKind[fileKind],
globals: Object.keys(globalSymbols).filter(k => !!(globalSymbols[k] & DeclarationFlags.Value)),
declaredModules,

View File

@@ -40,6 +40,7 @@ export function generatePackage(typing: TypingsData): { log: string[] } {
const outputPath = getOutputPath(typing);
log.push(`Create output path ${outputPath}`);
mkdir(path.dirname(outputPath));
mkdir(outputPath);
log.push(`Clear out old files`);
@@ -130,7 +131,7 @@ function createReadme(typing: TypingsData) {
lines.push('');
lines.push('# Details');
lines.push(`Typings were exported from ${typing.sourceRepoURL} in the ${typing.typingsPackageName} directory.`);
lines.push(`Typings were exported from ${typing.sourceRepoURL}/tree/${typing.sourceBranch}/${typing.typingsPackageName}`);
lines.push('');
lines.push(`Additional Details`)

View File

@@ -7,6 +7,9 @@ interface PublishSettings {
// e.g. '../DefinitelyTyped'
definitelyTypedPath: string;
// The branch that DefinitelyTyped is sourced from
sourceBranch: string;
// e.g. 'alpha'
prereleaseTag?: string;