diff --git a/.copyeditorrc b/.copyeditorrc deleted file mode 100644 index bd9d717..0000000 --- a/.copyeditorrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "dictionary": "local.dic" -} diff --git a/.npmignore b/.npmignore index f5e96db..fc082f2 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,2 @@ -venv \ No newline at end of file +venv +node_modules/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0cea83e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: -- 14 -- 16 -before_install: -- pyenv install 3.7.9 -- pyenv global 3.7.9 -- pip install aws-sam-cli==1.59.0 -- pip install cfn-lint==0.60.0 diff --git a/LICENSE.txt b/LICENSE.txt index 0168c06..c428474 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,7 +1,6 @@ - ISC License -Copyright (c) 2017, Mapbox +Copyright (c) 2017, Mapbox, 2024 Nick Ingalls Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/readme.md b/README.md similarity index 100% rename from readme.md rename to README.md diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..d85f4a4 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,38 @@ +import js from "@eslint/js"; +import nodePlugin from "eslint-plugin-n"; + +export default [ + js.configs.recommended, + nodePlugin.configs["flat/recommended-module"], + { + "rules": { + "no-console": 0, + "arrow-parens": [ "error", "always" ], + "no-var": "error", + "prefer-const": "error", + "array-bracket-spacing": [ "error", "never" ], + "comma-dangle": [ "error", "never" ], + "computed-property-spacing": [ "error", "never" ], + "eol-last": "error", + "eqeqeq": [ "error", "smart" ], + "indent": [ "error", 4, { "SwitchCase": 1 } ], + "no-confusing-arrow": [ "error", { "allowParens": false } ], + "no-extend-native": "error", + "no-mixed-spaces-and-tabs": "error", + "func-call-spacing": [ "error", "never" ], + "no-trailing-spaces": "error", + "no-unused-vars": "error", + "no-use-before-define": [ "error", "nofunc" ], + "object-curly-spacing": [ "error", "always" ], + "prefer-arrow-callback": "error", + "quotes": [ "error", "single", "avoid-escape" ], + "semi": [ "error", "always" ], + "space-infix-ops": "error", + "spaced-comment": [ "error", "always" ], + "keyword-spacing": [ "error", { "before": true, "after": true } ], + "template-curly-spacing": [ "error", "never" ], + "semi-spacing": "error", + "strict": "error", + } + } +] diff --git a/local.dic b/local.dic deleted file mode 100644 index ac555d1..0000000 --- a/local.dic +++ /dev/null @@ -1,26 +0,0 @@ -ARN -CloudWatch -CrossAccountRole -ECS -EventLambda -GlueDatabase -GlueJsonTable -GlueOrcTable -GlueParquetTable -GluePrestoView -GlueSparkView -GlueTable -hookshot -IAM -KinesisFirehoseBase -LogGroup -LogSubscriptionLambda -QueueLambda -RoleArn -S3KinesisFirehose -ScheduledLambda -ServiceRole -SNS -SQS -StreamLambda -webhooks diff --git a/package-lock.json b/package-lock.json index 2c1c2ce..be8e5e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,20 +11,16 @@ "dependencies": { "minimist": "^1.2.6" }, - "bin": { - "build-template": "bin/build-template.js", - "validate-template": "bin/validate-template.js" - }, "devDependencies": { "eslint": "^9.0.0", "eslint-plugin-n": "^17.10.2", "nyc": "^17.0.0", "opener": "^1.4.1", "tap-spec": "^5.0.0", - "tape": "^5.0.0" + "tape": "^5.8.1" }, "engines": { - "node": ">=14" + "node": ">=20" } }, "node_modules/@ampproject/remapping": { @@ -103,6 +99,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/generator": { "version": "7.25.6", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.6.tgz", @@ -136,6 +142,16 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/helper-module-imports": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", @@ -412,6 +428,19 @@ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/@eslint-community/regexpp": { "version": "4.11.0", "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", @@ -1667,19 +1696,6 @@ "eslint": ">=6.0.0" } }, - "node_modules/eslint-compat-utils/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-plugin-es-x": { "version": "7.8.0", "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz", @@ -1767,19 +1783,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/eslint-plugin-n/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-scope": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", @@ -1798,19 +1801,6 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", @@ -1841,19 +1831,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", - "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2427,16 +2404,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/hasha/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", @@ -2982,19 +2949,6 @@ "node": ">=10" } }, - "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/istanbul-lib-processinfo": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz", @@ -3044,19 +2998,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/istanbul-lib-report/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/istanbul-lib-source-maps": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", @@ -3240,6 +3181,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -3925,6 +3876,24 @@ "dev": true, "license": "ISC" }, + "node_modules/resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -4049,13 +4018,16 @@ } }, "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/set-blocking": { @@ -4502,24 +4474,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tape/node_modules/resolve": { - "version": "2.0.0-next.5", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", - "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -4623,6 +4577,16 @@ "node": ">= 0.8.0" } }, + "node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, "node_modules/typed-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", diff --git a/package.json b/package.json index 85b53ac..8db0a9d 100644 --- a/package.json +++ b/package.json @@ -5,17 +5,12 @@ "description": "Helper functions for assembling CloudFormation templates in JavaScript", "main": "index.js", "engines": { - "node": ">=14" + "node": ">=20" }, "scripts": { - "lint": "eslint index.js test lib bin", + "lint": "eslint index.js test lib", "test": "nyc tape test/*.test.js | tap-spec", - "coverage": "nyc --reporter html tape test/*.test.js && opener coverage/index.html", - "build-ci-template": "bin/build-template.js cloudformation/ci.template.js > cloudformation/ci.template.json" - }, - "bin": { - "build-template": "bin/build-template.js", - "validate-template": "bin/validate-template.js" + "coverage": "nyc --reporter html tape test/*.test.js && opener coverage/index.html" }, "repository": { "type": "git", @@ -37,9 +32,6 @@ "nyc": "^17.0.0", "opener": "^1.4.1", "tap-spec": "^5.0.0", - "tape": "^5.0.0" - }, - "dependencies": { - "minimist": "^1.2.6" + "tape": "^5.8.1" } } diff --git a/test/index.test.js b/test/index.test.js index b9500e5..a86a47a 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -1,10 +1,5 @@ import test from 'tape'; import cloudfriend from '../index.js'; -import path from 'node:path'; -import fs from 'node:fs'; - -const expectedTemplate = JSON.parse(fs.readFileSync(new URL('./fixtures/static.json', import.meta.url))); -const fixtures = new URL('./fixtures', import.meta.url).pathname; test('intrinsic functions', (assert) => { assert.deepEqual(cloudfriend.base64('secret'), { 'Fn::Base64': 'secret' }, 'base64');