feat(typings): add semantic-release interfaces

This commit is contained in:
Leonardo Gatica
2019-01-30 16:35:27 -03:00
parent f1eed296d2
commit bdfc3ebeb5
4 changed files with 88 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
// Type definitions for semantic-release 15.13
// Project: https://github.com/semantic-release/semantic-release#readme
// Definitions by: Leonardo Gatica <https://github.com/lgaticaq>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* The semantic release configuration itself.
*/
export interface GlobalConfig {
/** The full prepare step configuration. */
prepare?: any;
/** The branch on which releases should happen. */
branch: string;
/** The Git repository URL, in any supported format. */
repositoryUrl: string;
/** The Git tag format used by semantic-release to identify releases. */
tagFormat: string;
}
export interface LastRelease {
/** The version name of the release */
version: string;
/** The Git tag of the release. */
gitTag: string;
/** The Git checksum of the last commit of the release. */
gitHead: string;
}
export interface NextRelease extends LastRelease {
/** The release notes of the next release. */
notes: string;
}
export interface Context {
/** The semantic release configuration itself. */
options?: GlobalConfig;
/** The previous release details. */
lastRelease?: LastRelease;
/** The next release details. */
nextRelease?: NextRelease;
/** The shared logger instance of semantic release. */
logger: {
log: (message: string, ...vars: any[]) => void,
error: (message: string, ...vars: any[]) => void,
};
}
@@ -0,0 +1,17 @@
import * as lib from 'semantic-release';
function publish(pluginConfig: any, context: lib.Context) {
const version = context.nextRelease && context.nextRelease.version;
context.logger.log(`New version ${version}`);
}
const context = {
nextRelease: {
version: '1.0.0',
gitTag: '1.0.0',
gitHead: 'f1eed296d2ffe184fb15f52b1c5ad778f5c87645',
notes: 'New release'
},
logger: console
};
publish({}, context);
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"semantic-release-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }