Skip to content

Commit

Permalink
chore: use serverless v3 option types (floydspace#284)
Browse files Browse the repository at this point in the history
* chore: bump @types/serverless from 3.0.0 to 3.0.1

* fix: use native serverless types for verbose
  • Loading branch information
fargito authored Feb 28, 2022
1 parent e9b1196 commit 135aed3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/node": "^12.12.38",
"@types/ramda": "0.27.40",
"@types/semver": "^7.3.8",
"@types/serverless": "^3.0.0",
"@types/serverless": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"esbuild": "^0.14.2",
Expand Down
12 changes: 3 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ import { preOffline } from './pre-offline';
import { preLocal } from './pre-local';
import { trimExtension } from './utils';
import { BUILD_FOLDER, ONLY_PREFIX, SERVERLESS_FOLDER, WORK_FOLDER } from './constants';
import {
Configuration,
FunctionBuildResult,
OptionsExtended,
Plugins,
ReturnPluginsFn,
} from './types';
import { Configuration, FunctionBuildResult, Plugins, ReturnPluginsFn } from './types';

const DEFAULT_BUILD_OPTIONS: Partial<Configuration> = {
bundle: true,
Expand All @@ -51,7 +45,7 @@ class EsbuildServerlessPlugin implements ServerlessPlugin {
log: ServerlessPlugin.Logging['log'];

serverless: Serverless;
options: OptionsExtended;
options: Serverless.Options;
hooks: ServerlessPlugin.Hooks;
buildResults: FunctionBuildResult[];
packExternalModules: () => Promise<void>;
Expand All @@ -61,7 +55,7 @@ class EsbuildServerlessPlugin implements ServerlessPlugin {

constructor(
serverless: Serverless,
options: OptionsExtended,
options: Serverless.Options,
logging?: ServerlessPlugin.Logging
) {
this.serverless = serverless;
Expand Down
3 changes: 1 addition & 2 deletions src/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Serverless from 'serverless';
import Service from 'serverless/classes/Service';
import EsbuildServerlessPlugin from '../index';
import { OptionsExtended } from '../types';

import fs from 'fs-extra';

Expand Down Expand Up @@ -59,7 +58,7 @@ const mockServerlessConfig = (serviceOverride?: Partial<Service>): Serverless =>
} as Partial<Serverless> as Serverless;
};

const mockOptions: OptionsExtended = {
const mockOptions: Serverless.Options = {
region: 'us-east-1',
stage: 'dev',
};
Expand Down
4 changes: 0 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import Serverless from 'serverless';
export type Plugins = Plugin[];
export type ReturnPluginsFn = (sls: Serverless) => Plugins;

export interface OptionsExtended extends Serverless.Options {
verbose?: boolean;
}

export interface WatchConfiguration {
pattern?: string[] | string;
ignore?: string[] | string;
Expand Down

0 comments on commit 135aed3

Please sign in to comment.