From 6f17c84c098ddce5d082ede1f1871d028d874ba6 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Sat, 15 May 2021 14:34:20 +0200 Subject: [PATCH 1/5] Update changelog --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c25e9e5..bde3168 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,10 @@ console.log(getenv('RANDOM')); ## Changelog +### v1.1.0 + +- Add separator option to `env.array()` (#19) + ### v1.0.0 - Drop support for Node.js older than 6. From 966217bb5fb974618186792b07e3dbc36388b62e Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Sat, 15 May 2021 14:32:00 +0200 Subject: [PATCH 2/5] Upgrade prettier And also run prettier as part of the automated tests --- README.md | 4 +- index.js | 25 +++---- package.json | 7 +- test/disableErrors.js | 8 +-- test/fallbacks.js | 6 +- test/getenv.js | 156 +++++++++++++++++++++--------------------- 6 files changed, 104 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index bde3168..a152049 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,12 @@ if (Math.random() < abTestRatio) { } const keywords = getenv.array('KEYWORDS'); -keywords.forEach(function(keyword) { +keywords.forEach(function (keyword) { // console.log(keyword); }); const primes = getenv.array('PRIMES', 'int'); -primes.forEach(function(prime) { +primes.forEach(function (prime) { // console.log(prime, typeof prime); }); ``` diff --git a/index.js b/index.js index c452f13..e9e607e 100644 --- a/index.js +++ b/index.js @@ -28,10 +28,10 @@ function _value(varName, fallback) { } const convert = { - string: function(value) { + string: function (value) { return '' + value; }, - int: function(value) { + int: function (value) { const isInt = value.match(/^-?\d+$/); if (!isInt) { throw new Error('GetEnv.NoInteger: ' + value + ' is not an integer.'); @@ -39,7 +39,7 @@ const convert = { return +value; }, - float: function(value) { + float: function (value) { const isInfinity = +value === Infinity || +value === -Infinity; if (isInfinity) { throw new Error('GetEnv.Infinity: ' + value + ' is set to +/-Infinity.'); @@ -52,15 +52,16 @@ const convert = { return +value; }, - bool: function(value) { - const isBool = (value || '').toLowerCase() === 'true' || (value || '').toLowerCase() === 'false'; + bool: function (value) { + const isBool = + (value || '').toLowerCase() === 'true' || (value || '').toLowerCase() === 'false'; if (!isBool) { throw new Error('GetEnv.NoBoolean: ' + value + ' is not a boolean.'); } return (value || '').toLowerCase() === 'true'; }, - boolish: function(value) { + boolish: function (value) { try { return convert.bool(value); } catch (err) { @@ -76,7 +77,7 @@ const convert = { }; function converter(type) { - return function(varName, fallback) { + return function (varName, fallback) { if (typeof varName == 'string') { // default const value = _value(varName, fallback); @@ -90,7 +91,7 @@ function converter(type) { const getenv = converter('string'); -Object.keys(convert).forEach(function(type) { +Object.keys(convert).forEach(function (type) { getenv[type] = converter(type); }); @@ -131,19 +132,19 @@ getenv.multi = function multi(spec) { return result; }; -getenv.disableFallbacks = function() { +getenv.disableFallbacks = function () { fallbacksDisabled = true; }; -getenv.enableFallbacks = function() { +getenv.enableFallbacks = function () { fallbacksDisabled = false; }; -getenv.disableErrors = function() { +getenv.disableErrors = function () { throwError = false; }; -getenv.enableErrors = function() { +getenv.enableErrors = function () { throwError = true; }; diff --git a/package.json b/package.json index af84300..df91d0a 100644 --- a/package.json +++ b/package.json @@ -18,15 +18,16 @@ }, "main": "index.js", "scripts": { - "prettier": "prettier --write *.{js,md} **/*.js", - "test": "bash -ec 'for F in test/*.js; do echo \"$F\": ; node $F; done;'" + "prettier": "prettier --check .", + "unit": "bash -ec 'for F in test/*.js; do echo \"$F\": ; node $F; done;'", + "test": "npm run prettier && npm run unit" }, "engines": { "node": ">=6" }, "dependencies": {}, "devDependencies": { - "prettier": "^1.18.2" + "prettier": "^3.5.3" }, "keywords": [ "env", diff --git a/test/disableErrors.js b/test/disableErrors.js index 337dea3..cf85520 100644 --- a/test/disableErrors.js +++ b/test/disableErrors.js @@ -4,21 +4,21 @@ const getenv = require('../index'); const tests = {}; -tests['getenv.disableErrors() should disable any errors'] = function() { +tests['getenv.disableErrors() should disable any errors'] = function () { getenv.disableErrors(); assert.strictEqual(getenv.string('url', 'http://localhost'), 'http://localhost'); assert(getenv.string('url'), undefined); }; -tests['getenv.enableErrors() should enable errors'] = function() { +tests['getenv.enableErrors() should enable errors'] = function () { getenv.enableErrors(); - assert.throws(function() { + assert.throws(function () { getenv.string('url'); }); assert.strictEqual(getenv.string('url', 'http://localhost'), 'http://localhost'); }; -Object.keys(tests).forEach(function(key) { +Object.keys(tests).forEach(function (key) { console.log('Test: %s', key); tests[key](); }); diff --git a/test/fallbacks.js b/test/fallbacks.js index dad92d4..951318d 100644 --- a/test/fallbacks.js +++ b/test/fallbacks.js @@ -5,15 +5,15 @@ const getenv = require('../index'); const tests = {}; // order dependent test -tests['getenv.disableFallbacks() makes relying on fallbacks an error'] = function() { +tests['getenv.disableFallbacks() makes relying on fallbacks an error'] = function () { getenv.disableFallbacks(); - assert.throws(function() { + assert.throws(function () { getenv.string('url', 'http://localhost'); }); getenv.enableFallbacks(); }; -Object.keys(tests).forEach(function(key) { +Object.keys(tests).forEach(function (key) { console.log('Test: %s', key); tests[key](); }); diff --git a/test/getenv.js b/test/getenv.js index bb2416f..8896b9d 100644 --- a/test/getenv.js +++ b/test/getenv.js @@ -47,7 +47,7 @@ process.env.TEST_GETENV_URL_3 = 'http://192.162.22.11:2993'; const tests = {}; -tests['getenv() same as getenv.string()'] = function() { +tests['getenv() same as getenv.string()'] = function () { const data = [ { varName: 'TEST_GETENV_STRING', @@ -59,14 +59,14 @@ tests['getenv() same as getenv.string()'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const stringVar1 = getenv(item.varName); const stringVar2 = getenv.string(item.varName); assert.strictEqual(stringVar1, stringVar2); }); }; -tests['getenv.string() valid input'] = function() { +tests['getenv.string() valid input'] = function () { const data = [ { varName: 'TEST_GETENV_STRING', @@ -78,22 +78,22 @@ tests['getenv.string() valid input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const stringVar = getenv.string(item.varName); assert.strictEqual(stringVar, item.expected); }); }; -tests['getenv.string() nonexistent variable'] = function() { - assert.throws(function() { +tests['getenv.string() nonexistent variable'] = function () { + assert.throws(function () { getenv('TEST_GETENV_NONEXISTENT'); }); - assert.throws(function() { + assert.throws(function () { getenv.string('TEST_GETENV_NONEXISTENT'); }); }; -tests['getenv.string() nonexistent variable with fallback'] = function() { +tests['getenv.string() nonexistent variable with fallback'] = function () { const expect = 'fallback'; let stringVar = getenv.string('TEST_GETENV_NONEXISTENT', expect); assert.strictEqual(stringVar, expect); @@ -101,7 +101,7 @@ tests['getenv.string() nonexistent variable with fallback'] = function() { assert.strictEqual(stringVar, expect); }; -tests['getenv.int() valid input'] = function() { +tests['getenv.int() valid input'] = function () { const data = [ { varName: 'TEST_GETENV_INT1', @@ -119,13 +119,13 @@ tests['getenv.int() valid input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const intVar = getenv.int(item.varName); assert.strictEqual(intVar, item.expected); }); }; -tests['getenv.int() invalid input'] = function() { +tests['getenv.int() invalid input'] = function () { const data = [ { varName: 'TEST_GETENV_FLOAT' }, { varName: 'TEST_GETENV_WRONG_NUMBER_INPUT' }, @@ -134,26 +134,26 @@ tests['getenv.int() invalid input'] = function() { { varName: 'TEST_GETENV_INFINITY2' }, ]; - data.forEach(function(item) { - assert.throws(function() { + data.forEach(function (item) { + assert.throws(function () { const intVar = getenv.int(item.varName); }); }); }; -tests['getenv.int() nonexistent variable'] = function() { - assert.throws(function() { +tests['getenv.int() nonexistent variable'] = function () { + assert.throws(function () { getenv.int('TEST_GETENV_NONEXISTENT'); }); }; -tests['getenv.int() nonexistent variable with fallback'] = function() { +tests['getenv.int() nonexistent variable with fallback'] = function () { const expect = 10; const intVar = getenv.int('TEST_GETENV_NONEXISTENT', expect); assert.strictEqual(intVar, expect); }; -tests['getenv.float() valid input'] = function() { +tests['getenv.float() valid input'] = function () { const data = [ { varName: 'TEST_GETENV_FLOAT1', @@ -165,13 +165,13 @@ tests['getenv.float() valid input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const floatVar = getenv.float(item.varName); assert.strictEqual(floatVar, item.expected); }); }; -tests['getenv.float() invalid input'] = function() { +tests['getenv.float() invalid input'] = function () { const data = [ { varName: 'TEST_GETENV_WRONG_NUMBER_INPUT' }, { varName: 'TEST_GETENV_EMPTY_STRING' }, @@ -179,26 +179,26 @@ tests['getenv.float() invalid input'] = function() { { varName: 'TEST_GETENV_INFINITY2' }, ]; - data.forEach(function(item) { - assert.throws(function() { + data.forEach(function (item) { + assert.throws(function () { const floatVar = getenv.float(item.varName); }); }); }; -tests['getenv.float() nonexistent variable'] = function() { - assert.throws(function() { +tests['getenv.float() nonexistent variable'] = function () { + assert.throws(function () { getenv.float('TEST_GETENV_NONEXISTENT'); }); }; -tests['getenv.float() nonexistent variable with fallback'] = function() { +tests['getenv.float() nonexistent variable with fallback'] = function () { const expect = 2.2; const floatVar = getenv.float('TEST_GETENV_NONEXISTENT', expect); assert.strictEqual(floatVar, expect); }; -tests['getenv.bool() valid input'] = function() { +tests['getenv.bool() valid input'] = function () { const data = [ { varName: 'TEST_GETENV_FALSE', @@ -218,13 +218,13 @@ tests['getenv.bool() valid input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const boolVar = getenv.bool(item.varName); assert.strictEqual(boolVar, item.expected); }); }; -tests['getenv.bool() invalid input'] = function() { +tests['getenv.bool() invalid input'] = function () { const data = [ { varName: 'TEST_GETENV_STRING' }, { varName: 'TEST_GETENV_EMPTY_STRING' }, @@ -232,14 +232,14 @@ tests['getenv.bool() invalid input'] = function() { { varName: 'TEST_GETENV_NOT_REALLY_FALSE' }, ]; - data.forEach(function(item) { - assert.throws(function() { + data.forEach(function (item) { + assert.throws(function () { const boolVar = getenv.bool(item.varName); }); }); }; -tests['getenv.boolish() valid input'] = function() { +tests['getenv.boolish() valid input'] = function () { const data = [ { varName: 'TEST_GETENV_FALSE', @@ -259,35 +259,35 @@ tests['getenv.boolish() valid input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const boolVar = getenv.boolish(item.varName); assert.strictEqual(boolVar, item.expected); }); }; -tests['getenv.boolish() invalid input'] = function() { +tests['getenv.boolish() invalid input'] = function () { const data = [{ varName: 'TEST_GETENV_STRING' }, { varName: 'TEST_GETENV_EMPTY_STRING' }]; - data.forEach(function(item) { - assert.throws(function() { + data.forEach(function (item) { + assert.throws(function () { const boolVar = getenv.boolish(item.varName); }); }); }; -tests['getenv.bool() nonexistent variable'] = function() { - assert.throws(function() { +tests['getenv.bool() nonexistent variable'] = function () { + assert.throws(function () { getenv.bool('TEST_GETENV_NONEXISTENT'); }); }; -tests['getenv.bool() nonexistent variable with fallback'] = function() { +tests['getenv.bool() nonexistent variable with fallback'] = function () { const expect = true; const boolVar = getenv.bool('TEST_GETENV_NONEXISTENT', expect); assert.strictEqual(boolVar, expect); }; -tests['getenv.array() valid string (default) input'] = function() { +tests['getenv.array() valid string (default) input'] = function () { const data = [ { varName: 'TEST_GETENV_EMPTY_STRING', @@ -315,13 +315,13 @@ tests['getenv.array() valid string (default) input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const arrayVar = getenv.array(item.varName); assert.deepStrictEqual(arrayVar, item.expected); }); }; -tests['getenv.array() valid inputs split by separator'] = function() { +tests['getenv.array() valid inputs split by separator'] = function () { const data = [ { varName: 'TEST_GETENV_STRING_ARRAY6', @@ -345,13 +345,13 @@ tests['getenv.array() valid inputs split by separator'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const arrayVar = getenv.array(item.varName, item.type, [], /\s+/); assert.deepStrictEqual(arrayVar, item.expected); }); }; -tests['getenv.array() valid integer input'] = function() { +tests['getenv.array() valid integer input'] = function () { const data = [ { varName: 'TEST_GETENV_INT_ARRAY', @@ -359,7 +359,7 @@ tests['getenv.array() valid integer input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const arrayVar = getenv.array(item.varName, 'int'); // @TODO Something like https://github.com/joyent/node/issues/594 would be // handy. @@ -370,21 +370,21 @@ tests['getenv.array() valid integer input'] = function() { }); }; -tests['getenv.array() invalid integer input'] = function() { +tests['getenv.array() invalid integer input'] = function () { const data = [ { varName: 'TEST_GETENV_INT_ARRAY_INVALID1' }, { varName: 'TEST_GETENV_INT_ARRAY_INVALID2' }, { varName: 'TEST_GETENV_INT_ARRAY_INVALID3' }, ]; - data.forEach(function(item) { - assert.throws(function() { + data.forEach(function (item) { + assert.throws(function () { const data = getenv.array(item.varName, 'int'); }); }); }; -tests['getenv.array() valid float input'] = function() { +tests['getenv.array() valid float input'] = function () { const data = [ { varName: 'TEST_GETENV_FLOAT_ARRAY', @@ -392,7 +392,7 @@ tests['getenv.array() valid float input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const arrayVar = getenv.array(item.varName, 'float'); assert.strictEqual(arrayVar.length, item.expected.length); for (let i = 0; i < item.expected.length; i++) { @@ -401,21 +401,21 @@ tests['getenv.array() valid float input'] = function() { }); }; -tests['getenv.array() invalid float input'] = function() { +tests['getenv.array() invalid float input'] = function () { const data = [ { varName: 'TEST_GETENV_FLOAT_ARRAY_INVALID1' }, { varName: 'TEST_GETENV_FLOAT_ARRAY_INVALID2' }, { varName: 'TEST_GETENV_FLOAT_ARRAY_INVALID3' }, ]; - data.forEach(function(item) { - assert.throws(function() { + data.forEach(function (item) { + assert.throws(function () { const data = getenv.array(item.varName, 'float'); }); }); }; -tests['getenv.array() valid bool input'] = function() { +tests['getenv.array() valid bool input'] = function () { const data = [ { varName: 'TEST_GETENV_BOOL_ARRAY', @@ -423,7 +423,7 @@ tests['getenv.array() valid bool input'] = function() { }, ]; - data.forEach(function(item) { + data.forEach(function (item) { const arrayVar = getenv.array(item.varName, 'bool'); assert.strictEqual(arrayVar.length, item.expected.length); for (let i = 0; i < item.expected.length; i++) { @@ -432,39 +432,39 @@ tests['getenv.array() valid bool input'] = function() { }); }; -tests['getenv.array() invalid bool input'] = function() { +tests['getenv.array() invalid bool input'] = function () { const data = [ { varName: 'TEST_GETENV_BOOL_ARRAY_INVALID1' }, { varName: 'TEST_GETENV_BOOL_ARRAY_INVALID2' }, { varName: 'TEST_GETENV_BOOL_ARRAY_INVALID3' }, ]; - data.forEach(function(item) { - assert.throws(function() { + data.forEach(function (item) { + assert.throws(function () { const data = getenv.array(item.varName, 'bool'); }); }); }; -tests['getenv.array() nonexistent variable'] = function() { - assert.throws(function() { +tests['getenv.array() nonexistent variable'] = function () { + assert.throws(function () { getenv.array('TEST_GETENV_NONEXISTENT'); }); }; -tests['getenv.array() nonexistent variable with fallback'] = function() { +tests['getenv.array() nonexistent variable with fallback'] = function () { const expect = ['A', 'B', 'C']; const arrayVar = getenv.array('TEST_GETENV_NONEXISTENT', 'string', expect); assert.deepStrictEqual(arrayVar, expect); }; -tests['getenv.array() nonexistent type'] = function() { - assert.throws(function() { +tests['getenv.array() nonexistent type'] = function () { + assert.throws(function () { getenv.array('TEST_GETENV_STRING_ARRAY1', 'unknown'); }); }; -tests['getenv.multi([string]) multiple env vars'] = function() { +tests['getenv.multi([string]) multiple env vars'] = function () { const spec = { foo: 'TEST_GETENV_STRING', // throws when nonexistant }; @@ -475,7 +475,7 @@ tests['getenv.multi([string]) multiple env vars'] = function() { assert.deepStrictEqual(expect, config); }; -tests['getenv([string]) multiple env vars shortcut'] = function() { +tests['getenv([string]) multiple env vars shortcut'] = function () { const spec = { foo: 'TEST_GETENV_STRING', // throws when nonexistant }; @@ -486,16 +486,16 @@ tests['getenv([string]) multiple env vars shortcut'] = function() { assert.deepStrictEqual(expect, config); }; -tests['getenv.multi([string/throw]) multiple env vars'] = function() { +tests['getenv.multi([string/throw]) multiple env vars'] = function () { const spec = { foo: 'TEST_GETENV_NONEXISTENT', // throws when nonexistant }; - assert.throws(function() { + assert.throws(function () { const config = getenv.multi(spec); }); }; -tests['getenv.multi([string/typecast]) multiple env vars'] = function() { +tests['getenv.multi([string/typecast]) multiple env vars'] = function () { const spec = { foo: ['TEST_GETENV_STRING', undefined, 'string'], }; @@ -506,7 +506,7 @@ tests['getenv.multi([string/typecast]) multiple env vars'] = function() { assert.deepStrictEqual(expect, config); }; -tests['getenv.multi([string/typecast/defaultval]) multiple env vars'] = function() { +tests['getenv.multi([string/typecast/defaultval]) multiple env vars'] = function () { const spec = { foo: ['TEST_GETENV_NONEXISTENT', 'default', 'string'], // throws when nonexistant }; @@ -517,16 +517,16 @@ tests['getenv.multi([string/typecast/defaultval]) multiple env vars'] = function assert.deepStrictEqual(expect, config); }; -tests['getenv.multi([string/typecast/throw]) multiple env vars'] = function() { +tests['getenv.multi([string/typecast/throw]) multiple env vars'] = function () { const spec = { foo: ['TEST_GETENV_NONEXISTENT', undefined, 'string'], // throws when nonexistant }; - assert.throws(function() { + assert.throws(function () { const config = getenv.multi(spec); }); }; -tests['getenv.multi([string/defaultval]) multiple env vars'] = function() { +tests['getenv.multi([string/defaultval]) multiple env vars'] = function () { const spec = { foo: ['TEST_GETENV_STRING', 'default'], // throws when nonexistant }; @@ -537,7 +537,7 @@ tests['getenv.multi([string/defaultval]) multiple env vars'] = function() { assert.deepStrictEqual(expect, config); }; -tests['getenv.multi([string/defaultval/throw]) multiple env vars'] = function() { +tests['getenv.multi([string/defaultval/throw]) multiple env vars'] = function () { const spec = { foo: ['TEST_GETENV_NONEXISTENT', 'default'], // throws when nonexistant }; @@ -548,7 +548,7 @@ tests['getenv.multi([string/defaultval/throw]) multiple env vars'] = function() assert.deepStrictEqual(expect, config); }; -tests['getenv.multi([string/single]) multiple env vars'] = function() { +tests['getenv.multi([string/single]) multiple env vars'] = function () { const spec = { foo: ['TEST_GETENV_STRING'], // throws when nonexistant }; @@ -559,16 +559,16 @@ tests['getenv.multi([string/single]) multiple env vars'] = function() { assert.deepStrictEqual(expect, config); }; -tests['getenv.multi([string/single/throw]) multiple env vars'] = function() { +tests['getenv.multi([string/single/throw]) multiple env vars'] = function () { const spec = { foo: ['TEST_GETENV_NONEXISTENT'], // throws when nonexistant }; - assert.throws(function() { + assert.throws(function () { const config = getenv.multi(spec); }); }; -tests['getenv.url() valid input'] = function() { +tests['getenv.url() valid input'] = function () { const expected = [ { hostname: 'localhost', port: '80', protocol: 'tcp:' }, { hostname: 'localhost', port: '2993', protocol: 'tcp:' }, @@ -577,9 +577,9 @@ tests['getenv.url() valid input'] = function() { const prefix = 'TEST_GETENV_URL_'; - expected.forEach(function(expectation, i) { + expected.forEach(function (expectation, i) { const parsed = getenv.url(prefix + (i + 1)); - const actual = Object.keys(expectation).reduce(function(h, key) { + const actual = Object.keys(expectation).reduce(function (h, key) { h[key] = parsed[key]; return h; }, {}); @@ -587,7 +587,7 @@ tests['getenv.url() valid input'] = function() { }); }; -Object.keys(tests).forEach(function(key) { +Object.keys(tests).forEach(function (key) { console.log('Test: %s', key); tests[key](); }); From 56274153ef3ee6a20ce5b7fb7770d510971a12e8 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Tue, 6 May 2025 23:00:13 +0200 Subject: [PATCH 3/5] Commit package-lock.json --- package-lock.json | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..1989080 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,35 @@ +{ + "name": "getenv", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "getenv", + "version": "1.0.0", + "license": "MIT", + "devDependencies": { + "prettier": "^3.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/prettier": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + } +} From 62a0267fcf11cc634d945fe195bcd904c7abb4d4 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Tue, 6 May 2025 22:55:27 +0200 Subject: [PATCH 4/5] Create node.js.yml --- .github/workflows/node.js.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..16538d8 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: ['master'] + pull_request: + branches: ['master'] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test From 107212f9f2e8678613ed8d8c54d03f571e0c9ae8 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Tue, 6 May 2025 22:59:16 +0200 Subject: [PATCH 5/5] Remove travis config --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6f866af..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js - -node_js: - - 6 - - 8 - - 10 - - 12