-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from beforeyoubid/feature/final-touches
Feature/final touches
- Loading branch information
Showing
16 changed files
with
165 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ functions: | |
|
||
custom: | ||
foo: FOO | ||
esbuild: | ||
plugins: plugins.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals'); | ||
const { default: graphqlLoaderPlugin } = require('@luckycatfactory/esbuild-graphql-loader'); | ||
|
||
module.exports = [nodeExternalsPlugin()]; | ||
module.exports = [nodeExternalsPlugin(), graphqlLoaderPlugin()]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.graphql' { | ||
const content: string; | ||
export default content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import _ from 'lodash'; | ||
import { APIGatewayProxyEvent, Context } from 'aws-lambda'; | ||
|
||
import schema from './schema.graphql'; | ||
|
||
const handler = (event: APIGatewayProxyEvent, context: Context) => { | ||
console.log('Event: %j', event); | ||
console.log('Event: %j', context); | ||
|
||
console.log(`Using lodash: ${_.range(10)}`); | ||
console.log(`GQL schema: ${schema}`); | ||
}; | ||
|
||
export default handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Query { | ||
someQuery: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"files": ["*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { log, error, warn, verbose, info, debug } from '../logger'; | ||
|
||
describe('logger', () => { | ||
beforeEach(() => { | ||
jest.spyOn(global.console, 'log').mockImplementation(); | ||
jest.spyOn(global.console, 'warn').mockImplementation(); | ||
jest.spyOn(global.console, 'error').mockImplementation(); | ||
}); | ||
afterEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
describe('log', () => { | ||
it('should call console.log', () => { | ||
const code = Math.random().toString(); | ||
log(code); | ||
expect(console.log).toBeCalledTimes(1); | ||
expect(console.log).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
}); | ||
describe('error', () => { | ||
it('should call console.error', () => { | ||
const code = Math.random().toString(); | ||
error(code); | ||
expect(console.error).toBeCalledTimes(1); | ||
expect(console.error).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
}); | ||
describe('warn', () => { | ||
it('should call console.warn', () => { | ||
const code = Math.random().toString(); | ||
warn(code); | ||
expect(console.warn).toBeCalledTimes(1); | ||
expect(console.warn).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
}); | ||
describe('debug', () => { | ||
it('should call console.log if log level = debug', () => { | ||
const code = Math.random().toString(); | ||
debug({ level: 'debug' }, code); | ||
expect(console.log).toBeCalledTimes(1); | ||
expect(console.log).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
it('should not call console.log if log level != verbose', () => { | ||
const code = Math.random().toString(); | ||
debug({ level: 'verbose' }, code); | ||
expect(console.log).toBeCalledTimes(0); | ||
expect(console.log).not.toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
it('should not call console.log if log level != debug', () => { | ||
const code = Math.random().toString(); | ||
debug({ level: 'info' }, code); | ||
expect(console.log).toBeCalledTimes(0); | ||
expect(console.log).not.toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
}); | ||
describe('verbose', () => { | ||
it('should call console.log if log level = debug', () => { | ||
const code = Math.random().toString(); | ||
verbose({ level: 'debug' }, code); | ||
expect(console.log).toBeCalledTimes(1); | ||
expect(console.log).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
it('should call console.log if log level = verbose', () => { | ||
const code = Math.random().toString(); | ||
verbose({ level: 'verbose' }, code); | ||
expect(console.log).toBeCalledTimes(1); | ||
expect(console.log).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
it('should not call console.log if log level != verbose', () => { | ||
const code = Math.random().toString(); | ||
verbose({ level: 'info' }, code); | ||
expect(console.log).toBeCalledTimes(0); | ||
expect(console.log).not.toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
}); | ||
describe('info', () => { | ||
it('should call console.log if log level = verbose', () => { | ||
const code = Math.random().toString(); | ||
info({ level: 'verbose' }, code); | ||
expect(console.log).toBeCalledTimes(1); | ||
expect(console.log).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
it('should call console.log if log level = debug', () => { | ||
const code = Math.random().toString(); | ||
info({ level: 'debug' }, code); | ||
expect(console.log).toBeCalledTimes(1); | ||
expect(console.log).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
it('should call console.log if log level = info', () => { | ||
const code = Math.random().toString(); | ||
info({ level: 'info' }, code); | ||
expect(console.log).toBeCalledTimes(1); | ||
expect(console.log).toBeCalledWith('[esbuild-layers]', code); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters