diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b2eaafd..f6e4f3d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: test: strategy: matrix: - node-version: ['18.x', '20.x', '22.x'] + node-version: ['20.x', '22.x', '24.x'] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/bin/cli.js b/bin/cli.js index 5b5ca6b..61ef0a3 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -4,7 +4,6 @@ const exec = require('child_process').execSync; const path = require('path'); const _ = require('lodash'); const pathParse = require('path-parse'); -const yargs = require('yargs'); const include = require('../index'); const yaml = require('../lib/yaml'); @@ -12,11 +11,14 @@ const Client = require('../lib/cfnclient'); const pkg = require('../package.json'); const replaceEnv = require('../lib/replaceEnv'); -yargs.version(false); - const { env } = process; - -const opts = yargs + +(async () => { + const { default : yargs } = await import('yargs'); + const { hideBin } = await import('yargs/helpers'); + + const opts = yargs(hideBin(process.argv)) + .version(false) .command('$0 [path] [options]', pkg.description, (y) => y.positional('path', { positional: true, @@ -189,3 +191,5 @@ promise console.log(err.stack); process.exit(1); }); + +})(); diff --git a/lib/schema.js b/lib/schema.js index 0e93948..b8d2388 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -103,7 +103,7 @@ const BANG_AMAZON_FUNCS = [ const EXPLICIT_AMAZON_FUNCS = BANG_AMAZON_FUNCS.map((f) => `Fn::${f}`); -module.exports = yaml.Schema.create(tags); +module.exports = yaml.DEFAULT_SCHEMA.extend(tags); module.exports.EXPLICIT_AMAZON_FUNCS = EXPLICIT_AMAZON_FUNCS; module.exports.BANG_AMAZON_FUNCS = BANG_AMAZON_FUNCS; diff --git a/lib/yaml.js b/lib/yaml.js index f77400a..117280a 100644 --- a/lib/yaml.js +++ b/lib/yaml.js @@ -6,7 +6,7 @@ module.exports = { load: (res) => { let json; try { - json = yaml.safeLoad(res, { schema: yamlSchema }); + json = yaml.load(res, { schema: yamlSchema }); } catch (yamlErr) { try { json = JSON.parse(minify(res)); diff --git a/package.json b/package.json index 3cd58ab..d72bfcd 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "name": "Nicholas McCready", "email": "nemtcan@gmail.com" }, - "main": "index.js", "bin": { "cfn-include": "bin/cli.js" }, @@ -43,19 +42,19 @@ "dependencies": { "@aws-sdk/client-cloudformation": "^3.637.0", "@aws-sdk/client-s3": "^3.637.0", - "@znemz/cft-utils": "0.1.19", + "@znemz/cft-utils": "0.1.23", "@znemz/sort-object": "^3.0.4", "aws-sdk-v3-proxy": "2.2.0", "bluebird": "^3.7.2", "deepmerge": "^4.2.2", - "glob": "^11.0.1", + "glob": "^12.0.0", "jmespath": "^0.16.0", - "js-yaml": "^3.14.1", + "js-yaml": "^4.1.1", "jsonminify": "^0.4.1", "lodash": "^4.17.21", "path-parse": "~1.0.7", "proxy-agent": "6.5.0", - "yargs": "~17.7.2" + "yargs": "~18.0.0" }, "devDependencies": { "@commitlint/cli": "^20", @@ -67,7 +66,7 @@ "eslint-config-prettier": "10", "eslint-plugin-mocha": "11", "eslint-plugin-prettier": "5", - "mocha": "11.7.2", + "mocha": "11.7.5", "npm-run-all": "4.1.5", "prettier": "3", "serve": "14.2.5",