mapbox / cloudfriend

Helper functions for assembling CloudFormation templates in JavaScript
ISC License
69 stars 9 forks source link

Add node 6 as supported engine version #9

Closed bjacobel closed 7 years ago

bjacobel commented 8 years ago

Currently Cloudfriend's package.json specifies the following:

  "engines": {
    "node": "^4.4.7"
  },

Under this rule, Node 6 (which is due to become the current LTS Node version on 10/18/2016) is not a supported engine.

This becomes an issue when trying to install Cloudfriend on Node 6 using npm with the engine-strict config parameter, or with a node package manager like Yarn that checks engine versions more strictly than NPM does by default.

npm with engine-strict example

$> npm config set engine-strict true && npm install ./
cloudfriend@1.6.0 /Users/bjacobel/code/cloudfriend
└── d@0.1.1  extraneous

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "./"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.8
npm ERR! code ENOTSUP

npm ERR! notsup Unsupported engine for cloudfriend@1.6.0: wanted: {"node":"^4.4.7"} (current: {"node":"6.7.0","npm":"3.10.8"})
npm ERR! notsup Not compatible with your version of node/npm: cloudfriend@1.6.0
npm ERR! notsup Not compatible with your version of node/npm: cloudfriend@1.6.0
npm ERR! notsup Required: {"node":"^4.4.7"}
npm ERR! notsup Actual:   {"npm":"3.10.8","node":"6.7.0"}

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/bjacobel/code/cloudfriend/npm-debug.log

yarn example

$> yarn install
yarn install v0.15.1
info No lockfile found.
[1/4] 🔍  Resolving packages...
...
[2/4] 🚚  Fetching packages...
error cloudfriend@1.6.0: The engine "node" is incompatible with this module. Expected version "^4.4.7".
error Found incompatible module

This PR adds changes the package.json engine setting to accept any Node version greater than 4.4.7, and adds Node 6 to the Travis build matrix.

bjacobel commented 8 years ago

Hm. The test failure I'm getting for both node 4 and 6 on Travis on this branch is reproducible locally on master on node 4.

``` wheatley > ~ > code > cloudfriend > master 1⇣ > $ > n 4.5.0 wheatley > ~ > code > cloudfriend > master 1⇣ > $ > npm --version 2.15.9 wheatley > ~ > code > cloudfriend > master 1⇣ > $ > rm -rf node_modules wheatley > ~ > code > cloudfriend > master 1⇣ > $ > npm install opener@1.4.2 node_modules/opener tape@4.6.2 node_modules/tape ├── inherits@2.0.3 ├── has@1.0.1 ├── defined@1.0.0 ├── resumer@0.0.0 ├── deep-equal@1.0.1 ├── function-bind@1.1.0 ├── through@2.3.8 ├── object-inspect@1.2.1 ├── minimist@1.2.0 ├── resolve@1.1.7 ├── glob@7.1.1 (path-is-absolute@1.0.1, fs.realpath@1.0.0, once@1.4.0, inflight@1.0.5, minimatch@3.0.3) └── string.prototype.trim@1.1.2 (define-properties@1.1.2, es-abstract@1.6.1) aws-sdk@2.6.7 node_modules/aws-sdk ├── sax@1.1.5 ├── xml2js@0.4.15 ├── querystring@0.2.0 ├── url@0.10.3 (punycode@1.3.2) ├── jmespath@0.15.0 ├── buffer@4.9.1 (ieee754@1.1.8, isarray@1.0.0, base64-js@1.2.0) ├── crypto-browserify@1.0.9 └── xmlbuilder@2.6.2 (lodash@3.5.0) eslint@3.7.1 node_modules/eslint ├── path-is-inside@1.0.2 ├── natural-compare@1.4.0 ├── strip-bom@3.0.0 ├── ignore@3.2.0 ├── pluralize@1.2.1 ├── imurmurhash@0.1.4 ├── globals@9.12.0 ├── estraverse@4.2.0 ├── strip-json-comments@1.0.4 ├── esutils@2.0.2 ├── progress@1.1.8 ├── text-table@0.2.0 ├── user-home@2.0.0 (os-homedir@1.0.2) ├── is-resolvable@1.0.0 (tryit@1.0.2) ├── levn@0.3.0 (type-check@0.3.2, prelude-ls@1.1.2) ├── optionator@0.8.2 (fast-levenshtein@2.0.5, type-check@0.3.2, wordwrap@1.0.0, deep-is@0.1.3, prelude-ls@1.1.2) ├── debug@2.2.0 (ms@0.7.1) ├── doctrine@1.4.0 (isarray@1.0.0) ├── require-uncached@1.0.2 (resolve-from@1.0.1, caller-path@0.1.0) ├── json-stable-stringify@1.0.1 (jsonify@0.0.0) ├── shelljs@0.6.1 ├── chalk@1.1.3 (escape-string-regexp@1.0.5, ansi-styles@2.2.1, supports-color@2.0.0, strip-ansi@3.0.1, has-ansi@2.0.0) ├── mkdirp@0.5.1 (minimist@0.0.8) ├── glob@7.1.1 (path-is-absolute@1.0.1, inherits@2.0.3, fs.realpath@1.0.0, inflight@1.0.5, once@1.4.0, minimatch@3.0.3) ├── concat-stream@1.5.2 (inherits@2.0.3, typedarray@0.0.6, readable-stream@2.0.6) ├── inquirer@0.12.0 (ansi-regex@2.0.0, strip-ansi@3.0.1, ansi-escapes@1.4.0, rx-lite@3.1.2, through@2.3.8, cli-width@2.1.0, figures@1.7.0, cli-cursor@1.0.2, run-async@0.1.0, readline2@1.0.1, string-width@1.0.2) ├── is-my-json-valid@2.15.0 (generate-function@2.0.0, jsonpointer@4.0.0, xtend@4.0.1, generate-object-property@1.2.0) ├── espree@3.3.2 (acorn@4.0.3, acorn-jsx@3.0.1) ├── js-yaml@3.6.1 (esprima@2.7.3, argparse@1.0.9) ├── file-entry-cache@2.0.0 (object-assign@4.1.0, flat-cache@1.2.1) ├── table@3.8.0 (slice-ansi@0.0.4, ajv-keywords@1.1.1, string-width@1.0.2, ajv@4.7.7) ├── escope@3.6.0 (esrecurse@4.1.0, es6-weak-map@2.0.1, es6-map@0.1.4) └── lodash@4.16.4 nyc@7.1.0 node_modules/nyc wheatley > ~ > code > cloudfriend > master 1⇣ > $ > npm test > cloudfriend@1.6.0 pretest /Users/bjacobel/code/cloudfriend > eslint index.js test lib bin cloudformation > cloudfriend@1.6.0 test /Users/bjacobel/code/cloudfriend > nyc tape test/*.test.js TAP version 13 # intrinsic functions ok 1 base64 ok 2 lookup ok 3 attr ok 4 azs (no value specified) ok 5 azs (value specified) ok 6 join (no delimeter specified) ok 7 join (delimeter specified) ok 8 ok 9 ref ok 10 userData ok 11 sub without variables ok 12 sub with variables ok 13 import value with string ok 14 import value with string # conditions ok 15 and ok 16 equal ok 17 if ok 18 not ok 19 or ok 20 notEqual # pseudo ok 21 account ok 22 notificationArns ok 23 noValue ok 24 region ok 25 stackId ok 26 stack # build ok 27 static.json ok 28 static.js ok 29 sync.js ok 30 async.js (success) ok 31 async.js (error) ok 32 passes args (sync) ok 33 passes args (async) ok 34 malformed JSON (error) # validate not ok 35 invalid --- operator: ok expected: true actual: false ... not ok 36 plan != count --- operator: fail expected: 2 actual: 1 at: processEmit [as emit] (/Users/bjacobel/code/cloudfriend/node_modules/nyc/node_modules/signal-exit/index.js:140:35) ... not ok 37 test exited without ending --- operator: fail at: processEmit [as emit] (/Users/bjacobel/code/cloudfriend/node_modules/nyc/node_modules/signal-exit/index.js:140:35) ... 1..37 # tests 37 # pass 34 # fail 3 -----------------|----------|----------|----------|----------|----------------| File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines | -----------------|----------|----------|----------|----------|----------------| All files | 63.64 | 42.86 | 77.42 | 68 | | cloudfriend | 100 | 100 | 100 | 100 | | index.js | 100 | 100 | 100 | 100 | | cloudfriend/lib | 60 | 42.86 | 75 | 64.29 | | build.js | 100 | 100 | 100 | 100 | | conditions.js | 100 | 100 | 100 | 100 | | intrinsic.js | 100 | 100 | 100 | 100 | | merge.js | 3.7 | 0 | 0 | 4.76 |... 90,93,94,98 | pseudo.js | 100 | 100 | 100 | 100 | | validate.js | 100 | 100 | 100 | 100 | | -----------------|----------|----------|----------|----------|----------------| npm ERR! Test failed. See above for more details. wheatley > ~ > code > cloudfriend > master 1⇣ > $ > ```
bjacobel commented 8 years ago

I think the reason this is failing is that:

Encrypted variables are not available to untrusted builds such as pull requests coming from another repository

(from the Travis env vars doc)

It looks like the tests depend on an AWS_SECRET_ACCESS_KEY and AWS_ACCESS_TOKEN_ID being available. They're set as encrypted secrets in this project's .travis.yml, but they're not made available to "untrusted builds", and as a result no build that's run on a PR from a fork can pass.

Can somebody from Mapbox help me get this resolved? It doesn't look like I'll be able to contribute to this repo the way things are currently configured.

tmcw commented 7 years ago

Tests pass for me with env set up, and they'll pass in master. Thanks @bjacobel!