Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ jobs:
env:
SLS_AWS_SDK_V3: '1'

windowsNode16:
name: '[Windows] Node 16: Unit tests'
windowsNode18:
name: '[Windows] Node 18: Unit tests'
runs-on: windows-latest
steps:
- name: Checkout repository
Expand All @@ -83,13 +83,13 @@ jobs:
path: |
~/.npm
node_modules
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v16-${{ runner.os }}-${{ github.ref }}-
key: npm-v18-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v18-${{ runner.os }}-${{ github.ref }}-

- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
Expand All @@ -99,8 +99,8 @@ jobs:
- name: Unit tests
run: npm test -- -b

linuxNode16:
name: '[Linux] Node 16: Isolated unit tests'
linuxNode18:
name: '[Linux] Node 18: Isolated unit tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -113,13 +113,13 @@ jobs:
path: |
~/.npm
node_modules
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v16-${{ runner.os }}-${{ github.ref }}-
key: npm-v18-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v18-${{ runner.os }}-${{ github.ref }}-

- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
Expand All @@ -134,7 +134,7 @@ jobs:
integrate:
name: Integrate
runs-on: ubuntu-latest
needs: [linuxNode22, windowsNode16, linuxNode16]
needs: [linuxNode22, windowsNode18, linuxNode18]
timeout-minutes: 30 # Default is 360
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ jobs:
env:
SLS_AWS_SDK_V3: '1'

windowsNode16:
name: '[Windows] Node 16: Unit tests'
windowsNode18:
name: '[Windows] Node 18: Unit tests'
runs-on: windows-latest
steps:
- name: Checkout repository
Expand All @@ -96,15 +96,15 @@ jobs:
path: |
~/.npm
node_modules
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
key: npm-v18-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v16-${{ runner.os }}-${{ github.ref }}-
npm-v16-${{ runner.os }}-refs/heads/main-
npm-v18-${{ runner.os }}-${{ github.ref }}-
npm-v18-${{ runner.os }}-refs/heads/main-

- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
Expand All @@ -114,8 +114,8 @@ jobs:
- name: Unit tests
run: npm test -- -b

linuxNode16:
name: '[Linux] Node 16: Isolated unit tests'
linuxNode18:
name: '[Linux] Node 18: Isolated unit tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -128,15 +128,15 @@ jobs:
path: |
~/.npm
node_modules
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
key: npm-v18-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v16-${{ runner.os }}-${{ github.ref }}-
npm-v16-${{ runner.os }}-refs/heads/main-
npm-v18-${{ runner.os }}-${{ github.ref }}-
npm-v18-${{ runner.os }}-refs/heads/main-

- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
Expand Down
27 changes: 17 additions & 10 deletions lib/classes/yaml-parser.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
'use strict';

const $RefParser = require('@apidevtools/json-schema-ref-parser');
const yaml = require('js-yaml');
const resolve = require('json-refs').resolveRefs;
const cloudformationSchema = require('@serverless/utils/cloudformation-schema');

class YamlParser {
constructor(serverless) {
this.serverless = serverless;
}

async parse(yamlFilePath) {
const root = this.serverless.utils.readFileSync(yamlFilePath);
const options = {
filter: ['relative', 'remote'],
loaderOptions: {
processContent: (res, callback) => {
callback(null, yaml.load(res.text));
return $RefParser.dereference(yamlFilePath, {
parse: {
yaml: {
parse(file) {
const contents = file.data.toString();
try {
return yaml.load(contents, {
filename: file.url,
schema: cloudformationSchema,
});
} catch (err) {
return yaml.load(contents, { filename: file.url });
}
},
},
},
location: yamlFilePath,
};
return resolve(root, options).then((res) => res.resolved);
});
}
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"osls": "./bin/serverless.js"
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^14.2.1",
"@aws-sdk/client-api-gateway": "^3.588.0",
"@aws-sdk/client-apigatewayv2": "^3.588.0",
"@aws-sdk/client-cloudformation": "^3.588.0",
Expand All @@ -41,9 +42,9 @@
"@aws-sdk/client-sqs": "^3.588.0",
"@aws-sdk/client-ssm": "^3.588.0",
"@aws-sdk/client-sts": "^3.588.0",
"@aws-sdk/credential-providers": "^3.588.0",
"@aws-sdk/lib-dynamodb": "^3.588.0",
"@aws-sdk/lib-storage": "^3.588.0",
"@aws-sdk/credential-providers": "^3.588.0",
"@serverless/utils": "^6.13.1",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
Expand Down Expand Up @@ -72,7 +73,6 @@
"is-docker": "^2.2.1",
"js-yaml": "^4.1.0",
"json-cycle": "^1.5.0",
"json-refs": "^3.0.15",
"lodash": "^4.17.21",
"memoizee": "^0.4.15",
"micromatch": "^4.0.5",
Expand Down Expand Up @@ -206,7 +206,7 @@
"test:isolated": "mocha-isolated \"test/unit/**/*.test.js\""
},
"engines": {
"node": ">=12.0"
"node": ">=18.0"
},
"license": "MIT"
}
2 changes: 1 addition & 1 deletion scripts/pkg/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const spawnOptions = { cwd: serverlessPath, stdio: 'inherit' };
'-c',
'scripts/pkg/config.js',
'--targets',
'node16-linux-x64,node16-mac-x64,node16-win-x64',
'node18-linux-x64,node18-mac-x64,node18-win-x64',
'--out-path',
'dist',
'bin/serverless.js',
Expand Down
Loading