Skip to content

Commit

Permalink
fix: fix warnings by removing useless methods, fix method names
Browse files Browse the repository at this point in the history
  • Loading branch information
ghusse committed Oct 16, 2020
1 parent fab50d5 commit 65572e5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
"version": "0.0.0-development",
"description": "A plugin for semantic-release, to automatically deprecate old versions on npm, based on a custom configuration",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"prepare" : "npm run build",
"prepublishOnly" : "npm test && npm run lint",
"lint": "eslint src --ext .js,.ts",
"semantic-release": "semantic-release"
},
Expand Down
47 changes: 32 additions & 15 deletions src/old-version-deprecier.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
import { Context } from "semantic-release";
import { Config, Context } from "semantic-release";
import { PluginConfig } from "./plugin-config";

interface Plugin {
verify(pluginConfig: PluginConfig, context: Context): void;
verifyConditions(pluginConfig: PluginConfig, context: Context): void;
analyzeCommits(pluginConfig: PluginConfig, context: Context): void;
prepare(pluginConfig: PluginConfig, context: Context): void;
publish(pluginConfig: PluginConfig, context: Context): void;
success(pluginConfig: PluginConfig, context: Context): void;
fail(pluginConfig: PluginConfig, context: Context): void;
}

export function createOldVersionDeprecier(): Plugin {
function verify(pluginConfig: PluginConfig, context: Context): void {
console.log("verify", context);
function verifyConditions(
pluginConfig: PluginConfig,
context: Context & Config
): void {
const { logger } = context;
logger.log("using default configuration");
console.log(context);
}

function prepare(pluginConfig: PluginConfig, context: Context): void {}

function publish(pluginConfig: PluginConfig, context: Context): void {
console.log("PUBLISH", context);
function analyzeCommits(
pluginConfig: PluginConfig,
context: Context & Config
): void {
const { logger } = context;
logger.log("analyzeCommits");
}

function success(pluginConfig: PluginConfig, context: Context): void {}
function prepare(
pluginConfig: PluginConfig,
context: Context & Config
): void {
const { logger } = context;
logger.log("prepare");
}

function fail(pluginConfig: PluginConfig, context: Context): void {}
function publish(
pluginConfig: PluginConfig,
context: Context & Config
): void {
const { logger } = context;
logger.log("publish");
}

return {
verify,
verifyConditions,
analyzeCommits,
prepare,
publish,
success,
fail,
};
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
Expand Down

0 comments on commit 65572e5

Please sign in to comment.