Skip to content

Commit d178a17

Browse files
authored
Merge pull request #10 from jaystack/update-node
Update default node version to 'nodejs12.x'
2 parents e88ef35 + a335a31 commit d178a17

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# functionly
22

3-
The `functionly library` lets you build `serverless` nodejs applications in an innovative, functional, and fun by abstraction way.
4-
Use the JavaScript language and the JSON syntax to describe infrastructure and entities, service dependencies, and to implement service code. Deploy your solution to cloud providers, or run containerized on your onprem servers, or locally during development time using the `functionly CLI`.
3+
The `functionly library` lets you build `serverless` nodejs applications in an innovative, functional, and fun by abstraction way.
4+
Use the JavaScript language and the JSON syntax to describe infrastructure and entities, service dependencies, and to implement service code. Deploy your solution to cloud providers, or run containerized on your onprem servers, or locally during development time using the `functionly CLI`.
55

66
Defining a rest service which listens on `/hello-world`:
77
```js
@@ -114,7 +114,7 @@ Define a [description]() for the `HelloWorld`, which will make it easier to find
114114
```js
115115
@description('hello world service')
116116
```
117-
Now we have to create the business logic.
117+
Now we have to create the business logic.
118118
```js
119119
import { FunctionalService, rest, description } from 'functionly'
120120

@@ -151,12 +151,12 @@ Define a base class for FunctionalService to set basic Lambda settings in the AW
151151
```js
152152
import { FunctionalService, aws } from 'functionly'
153153

154-
@aws({ type: 'nodejs10.x', memorySize: 512, timeout: 3 })
154+
@aws({ type: 'nodejs12.x', memorySize: 512, timeout: 3 })
155155
export class TodoService extends FunctionalService { }
156156
```
157157

158158
### Create a dynamo table
159-
We need a DynamoTable, called `TodoTable` because we want to store todo items.
159+
We need a DynamoTable, called `TodoTable` because we want to store todo items.
160160
```js
161161
import { DynamoTable, dynamoTable, injectable } from 'functionly'
162162

@@ -181,7 +181,7 @@ Define a [description]() for the `TodoService`, which will make it easier to fin
181181
```js
182182
@description('get all Todo service')
183183
```
184-
Now we have to create the business logic. We want to read the todo items, so we need to inject the `TodoTable`. Get the items from it and return from our service.
184+
Now we have to create the business logic. We want to read the todo items, so we need to inject the `TodoTable`. Get the items from it and return from our service.
185185
```js
186186
import { rest, description, inject } from 'functionly'
187187

@@ -292,10 +292,10 @@ import { rest, description, param, inject } from 'functionly'
292292
@rest({ path: '/createTodo', methods: ['post'] })
293293
@description('create Todo service')
294294
export class CreateTodo extends TodoService {
295-
static async handle(
296-
@param name,
297-
@param description,
298-
@param status,
295+
static async handle(
296+
@param name,
297+
@param description,
298+
@param status,
299299
@inject(ValidateTodo) validateTodo,
300300
@inject(PersistTodo) persistTodo
301301
) {
@@ -317,7 +317,7 @@ npm install
317317
```
318318

319319
# Run and Deploy with CLI
320-
The CLI helps you to deploy and run the application.
320+
The CLI helps you to deploy and run the application.
321321
1. CLI install
322322
```sh
323323
npm install functionly -g

src/annotations/classes/aws/aws.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CLASS_AWSMEMORYSIZEKEY, CLASS_AWSTIMEOUTKEY, CLASS_AWSRUNTIMEKEY } from
22
import { defineMetadata } from '../../metadata'
33

44
export const aws = (config: {
5-
type?: 'nodejs8.10'|'nodejs10.x',
5+
type?: 'nodejs8.10'|'nodejs12.x',
66
memorySize?: number,
77
timeout?: number
88
}) => (target: Function) => {
@@ -15,4 +15,4 @@ export const aws = (config: {
1515
if (typeof config.timeout === 'number') {
1616
defineMetadata(CLASS_AWSTIMEOUTKEY, config.timeout, target);
1717
}
18-
}
18+
}

src/cli/commands/serverless.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default (api) => {
9393

9494
const def = serverless.functions[functionName] = {
9595
handler: `${nameKey}.${serviceDefinition.exportName}`,
96-
runtime: getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs10.x"
96+
runtime: getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs12.x"
9797
}
9898

9999
await executor({ context, name: 'funtionEnvironments', method: funtionEnvironments })

src/cli/providers/cloudFormation/context/resources.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export const lambdaResource = async (context) => {
284284
Handler: serviceDefinition.handler,
285285
MemorySize: serviceDefinition[CLASS_AWSMEMORYSIZEKEY] || getMetadata(CLASS_AWSMEMORYSIZEKEY, serviceDefinition.service),
286286
Role: serviceDefinition[CLASS_ROLEKEY] || getMetadata(CLASS_ROLEKEY, serviceDefinition.service),
287-
Runtime: serviceDefinition[CLASS_AWSRUNTIMEKEY] || getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs10.x",
287+
Runtime: serviceDefinition[CLASS_AWSRUNTIMEKEY] || getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs12.x",
288288
Timeout: serviceDefinition[CLASS_AWSTIMEOUTKEY] || getMetadata(CLASS_AWSTIMEOUTKEY, serviceDefinition.service),
289289
Environment: {
290290
Variables: serviceDefinition[CLASS_ENVIRONMENTKEY] || getMetadata(CLASS_ENVIRONMENTKEY, serviceDefinition.service)
@@ -361,4 +361,4 @@ const updateEnvironmentVariable = async ({ environments, stage }) => {
361361
}
362362
}
363363
}
364-
}
364+
}

src/cli/utilities/aws/lambda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const createLambdaFunction = ExecuteStep.register('CreateLambdaFunction',
3434
MemorySize: getMetadata(constants.CLASS_AWSMEMORYSIZEKEY, context.serviceDefinition.service),
3535
Publish: true,
3636
Role: getMetadata(constants.CLASS_ROLEKEY, context.serviceDefinition.service),
37-
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs10.x",
37+
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs12.x",
3838
Timeout: getMetadata(constants.CLASS_AWSTIMEOUTKEY, context.serviceDefinition.service),
3939
Environment: {
4040
Variables: getMetadata(constants.CLASS_ENVIRONMENTKEY, context.serviceDefinition.service)
@@ -118,7 +118,7 @@ export const updateLambdaFunctionConfiguration = ExecuteStep.register('UpdateLam
118118
Handler: context.serviceDefinition.handler,
119119
MemorySize: getMetadata(constants.CLASS_AWSMEMORYSIZEKEY, context.serviceDefinition.service),
120120
Role: getMetadata(constants.CLASS_ROLEKEY, context.serviceDefinition.service),
121-
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs10.x",
121+
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs12.x",
122122
Timeout: getMetadata(constants.CLASS_AWSTIMEOUTKEY, context.serviceDefinition.service),
123123
VpcConfig: {
124124
}

test/annotation.tests.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,14 +1269,14 @@ describe('annotations', () => {
12691269
})
12701270
describe("aws", () => {
12711271
it("type", () => {
1272-
@aws({ type: 'nodejs10.x' })
1272+
@aws({ type: 'nodejs12.x' })
12731273
class RuntimeTestClass { }
12741274

12751275
const runtimeValue = getMetadata(CLASS_AWSRUNTIMEKEY, RuntimeTestClass)
12761276
const memoryValue = getMetadata(CLASS_AWSMEMORYSIZEKEY, RuntimeTestClass)
12771277
const timeoutValue = getMetadata(CLASS_AWSTIMEOUTKEY, RuntimeTestClass)
12781278

1279-
expect(runtimeValue).to.equal('nodejs10.x')
1279+
expect(runtimeValue).to.equal('nodejs12.x')
12801280
expect(memoryValue).to.undefined
12811281
expect(timeoutValue).to.undefined
12821282
})
@@ -1305,14 +1305,14 @@ describe('annotations', () => {
13051305
expect(timeoutValue).to.equal(3)
13061306
})
13071307
it("all", () => {
1308-
@aws({ type: 'nodejs10.x', memorySize: 100, timeout: 3 })
1308+
@aws({ type: 'nodejs12.x', memorySize: 100, timeout: 3 })
13091309
class RuntimeTestClass { }
13101310

13111311
const runtimeValue = getMetadata(CLASS_AWSRUNTIMEKEY, RuntimeTestClass)
13121312
const memoryValue = getMetadata(CLASS_AWSMEMORYSIZEKEY, RuntimeTestClass)
13131313
const timeoutValue = getMetadata(CLASS_AWSTIMEOUTKEY, RuntimeTestClass)
13141314

1315-
expect(runtimeValue).to.equal('nodejs10.x')
1315+
expect(runtimeValue).to.equal('nodejs12.x')
13161316
expect(memoryValue).to.equal(100)
13171317
expect(timeoutValue).to.equal(3)
13181318
})
@@ -1530,14 +1530,14 @@ describe('annotations', () => {
15301530
it("overrided class constructor no inject", () => {
15311531
@injectable()
15321532
class ATestClass { }
1533-
1533+
15341534
class BaseBTestClass {
15351535
constructor( @inject(ATestClass) p1, @inject(ATestClass) p2) { }
15361536
}
15371537
class BTestClass extends BaseBTestClass {
15381538
constructor() { super(null, null) }
15391539
}
1540-
1540+
15411541
const value = getOverridableMetadata(PARAMETER_PARAMKEY, BTestClass, undefined)
15421542
// pass the base class params if there is not defined inject in the new ctor
15431543
// expect(value).to.undefined
@@ -1997,15 +1997,15 @@ describe('annotations', () => {
19971997

19981998

19991999
it("overrided class constructor no param", () => {
2000-
2000+
20012001
class BaseParamClass {
20022002
constructor( @param p1, @param p2) { }
20032003
}
2004-
2004+
20052005
class ParamClass extends BaseParamClass {
20062006
constructor() { super(null, null) }
20072007
}
2008-
2008+
20092009
const value = getOverridableMetadata(PARAMETER_PARAMKEY, ParamClass, undefined)
20102010
// pass the base class params if there is not defined inject in the new ctor
20112011
// expect(value).to.undefined
@@ -2339,4 +2339,4 @@ describe('annotations', () => {
23392339
})
23402340
})
23412341
})
2342-
})
2342+
})

0 commit comments

Comments
 (0)