Skip to content
Permalink
Browse files

Modify files necessary to start outputting TS declarations in main pr…

…oject (#442)

We were missing some imports and type definitions here and there in order for TypeScript to allow us to turn on the "declaration: true" flag.

This change adds those and modifies the tsconfig file to start outputting TypeScript declaration files for all the packages in the repository.

Resolves #418
  • Loading branch information...
David Woodruff
David Woodruff committed Jun 30, 2018
1 parent a337838 commit fc84b39fafcb3af75ca48a0a6d5b43855f07d0ec
@@ -19,7 +19,6 @@ import { EC2 } from 'aws-sdk';
/***********************************
* Types for the Extension contract
***********************************/

export interface Extension {
loadHandelExtension(context: ExtensionContext): void | Promise<void>;
}
@@ -1,10 +1,9 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"outDir": "dist",
"declaration": true
"outDir": "dist"
},
"include": [
"extension-api.ts"
]
}
}
@@ -1,9 +1,7 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"outDir": "dist",
"allowJs": false,
"declaration": true
"outDir": "dist"
},
"include": [
"src/**/*"
@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';

@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';

@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import { AccountConfig } from 'handel-extension-api';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';
@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import * as uuid from 'uuid';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
import * as winston from 'winston';
import * as AWS from 'aws-sdk';
import awsWrapper from './aws-wrapper';

export function listHostedZones(): Promise<AWS.Route53.HostedZone[]> {
@@ -14,11 +14,9 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import * as childProcess from 'child_process';
import * as fs from 'fs';
import { ServiceEventType } from 'handel-extension-api';
import { awsCalls } from 'handel-extension-support';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';

/**
@@ -14,12 +14,12 @@
* limitations under the License.
*
*/
import * as SES from 'aws-sdk/clients/ses';
import * as AWS from 'aws-sdk';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';

export async function verifyEmailAddress(address: string) {
const ses = new SES({ apiVersion: '2010-12-01' });
const ses = new AWS.SES({ apiVersion: '2010-12-01' });
winston.verbose(`Verifying ${address} if needed`);

const response = await awsWrapper.ses.getIdentityVerificationAttributes({ Identities: [address] });
@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';

@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import * as winston from 'winston';
import awsWrapper from './aws-wrapper';

@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import awsWrapper from './aws-wrapper';

export async function getAccountId(): Promise<string|null> {
@@ -29,7 +29,7 @@ import {
import { CliNpmClient, NpmClient } from './npm';
import { ExtensionLoader } from './types';

class NpmLoader implements ExtensionLoader {
export class NpmLoader implements ExtensionLoader {

constructor(private readonly client: NpmClient, private readonly importer: ModuleImporter) {
}
@@ -21,7 +21,7 @@ import { loadStandardLib } from '../services/stdlib';
import { initNpmLoader } from './npm-loader';
import { ExtensionLoader } from './types';

type StandardLibLoader = () => Promise<LoadedExtension>;
export type StandardLibLoader = () => Promise<LoadedExtension>;

export async function resolveExtensions(
definitions: ExtensionDefinition[],
@@ -274,7 +274,7 @@ function getScalingConfig(config: ThroughputCapacity,
);
}

class ThroughputCapacity {
export class ThroughputCapacity {

public target!: number;

@@ -292,7 +292,7 @@ class ThroughputCapacity {
}
}

class AutoscalingDefinition {
export class AutoscalingDefinition {

public dependsOn!: string;
public readonly min: number;
@@ -23,7 +23,8 @@ import {
ServiceConfig,
ServiceContext,
ServiceEventConsumer,
ServiceEventType
ServiceEventType,
UnDeployContext
} from 'handel-extension-api';
import { awsCalls, deletePhases, deployPhase, handlebars, tagging } from 'handel-extension-support';
import * as winston from 'winston';
@@ -327,7 +328,7 @@ export async function produceEvents(ownServiceContext: ServiceContext<DynamoDBCo
return new ProduceEventsContext(ownServiceContext, consumerServiceContext);
}

export async function unDeploy(ownServiceContext: ServiceContext<DynamoDBConfig>) {
export async function unDeploy(ownServiceContext: ServiceContext<DynamoDBConfig>): Promise<UnDeployContext> {
await autoscaling.undeployAutoscaling(ownServiceContext);
return deletePhases.unDeployService(ownServiceContext, SERVICE_NAME);
}
@@ -19,7 +19,9 @@ import {
DeployOutputType,
PreDeployContext,
ServiceConfig,
ServiceContext
ServiceContext,
UnDeployContext,
UnPreDeployContext
} from 'handel-extension-api';
import { deletePhases, deployPhase, handlebars, preDeployPhase, tagging } from 'handel-extension-support';
import * as winston from 'winston';
@@ -148,11 +150,11 @@ export async function deploy(ownServiceContext: ServiceContext<FargateServiceCon
return new DeployContext(ownServiceContext);
}

export async function unPreDeploy(ownServiceContext: ServiceContext<FargateServiceConfig>) {
export async function unPreDeploy(ownServiceContext: ServiceContext<FargateServiceConfig>): Promise<UnPreDeployContext> {
return deletePhases.unPreDeploySecurityGroup(ownServiceContext, SERVICE_NAME);
}

export async function unDeploy(ownServiceContext: ServiceContext<FargateServiceConfig>) {
export async function unDeploy(ownServiceContext: ServiceContext<FargateServiceConfig>): Promise<UnDeployContext> {
return deletePhases.unDeployService(ownServiceContext, SERVICE_NAME);
}

@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import { ServiceContext } from 'handel-extension-api';
import * as winston from 'winston';
import * as autoScalingCalls from '../../aws/auto-scaling-calls';
@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
import * as AWS from 'aws-sdk';
import { AccountConfig } from 'handel-extension-api';
import { awsCalls, deployPhase, handlebars } from 'handel-extension-support';
import * as winston from 'winston';
@@ -99,7 +100,7 @@ const EC2_INSTANCE_MEMORY_MAP: Ec2InstanceMemoryMap = {
* The code for the auto-scaling Lambda can be found in the "cluster-scaling-lambda" directory inside
* the ECS service deployer directory.
*/
export async function createAutoScalingLambdaIfNotExists(accountConfig: AccountConfig) {
export async function createAutoScalingLambdaIfNotExists(accountConfig: AccountConfig): Promise<AWS.CloudFormation.Stack> {
const stackName = 'HandelEcsAutoScalingLambda';
const stack = await awsCalls.cloudFormation.getStack(stackName);
if (!stack) {
@@ -123,7 +124,7 @@ export async function createAutoScalingLambdaIfNotExists(accountConfig: AccountC
* The code for the draining Lambda can be found in the "cluster-draining-lambda" directory inside
* the ECS service deployer directory.
*/
export async function createDrainingLambdaIfNotExists(accountConfig: AccountConfig) {
export async function createDrainingLambdaIfNotExists(accountConfig: AccountConfig): Promise<AWS.CloudFormation.Stack> {
const stackName = 'HandelEcsDrainingLambda';
const stack = await awsCalls.cloudFormation.getStack(stackName);
if (!stack) {
@@ -19,7 +19,9 @@ import {
DeployOutputType,
PreDeployContext,
ServiceConfig,
ServiceContext
ServiceContext,
UnDeployContext,
UnPreDeployContext
} from 'handel-extension-api';
import { deletePhases, deployPhase, handlebars, preDeployPhase, tagging } from 'handel-extension-support';
import * as winston from 'winston';
@@ -172,11 +174,11 @@ export async function deploy(ownServiceContext: ServiceContext<EcsServiceConfig>
return new DeployContext(ownServiceContext);
}

export async function unPreDeploy(ownServiceContext: ServiceContext<EcsServiceConfig>) {
export async function unPreDeploy(ownServiceContext: ServiceContext<EcsServiceConfig>): Promise<UnPreDeployContext> {
return deletePhases.unPreDeploySecurityGroup(ownServiceContext, SERVICE_NAME);
}

export async function unDeploy(ownServiceContext: ServiceContext<EcsServiceConfig>) {
export async function unDeploy(ownServiceContext: ServiceContext<EcsServiceConfig>): Promise<UnDeployContext> {
return deletePhases.unDeployService(ownServiceContext, SERVICE_NAME);
}

@@ -1,7 +1,7 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"allowJs": true
"outDir": "dist"
},
"include": [
"src/**/*"
@@ -1,9 +1,9 @@
{
"lerna": "2.8.0",
"packages": [
"handel",
"extension-api",
"extension-support"
"extension-support",
"handel"
],
"version": "0.26.9"
}
@@ -7,6 +7,8 @@
"removeComments": false,
"strict": true,
"strictNullChecks": true,
"allowJs": false,
"declaration": true,
"moduleResolution": "node",
"lib": [
"es7", "es2017.object"

0 comments on commit fc84b39

Please sign in to comment.
You can’t perform that action at this time.