Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 18.x, 20.x, 22.x ]
node-version: [ 20.x, 22.x, 24.x ]
os: [ windows-latest, ubuntu-latest, macOS-latest ]

# Go
Expand Down
27 changes: 11 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@architect/env",
"version": "4.0.5",
"version": "4.0.6-RC.0",
"description": "Manage your Architect app's environment variables",
"main": "src/index.js",
"bin": {
Expand All @@ -9,13 +9,13 @@
"scripts": {
"test": "npm run lint && npm run coverage",
"test:nolint": "npm run coverage",
"test:unit": "cross-env tape 'test/**/*-tests.js' | tap-arc",
"test:unit": "cross-env tape 'test/**/*-tests.js'",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
"lint": "eslint . --fix",
"rc": "npm version prerelease --preid RC"
},
"engines": {
"node": ">=16"
"node": ">=20"
},
"repository": {
"type": "git",
Expand All @@ -31,25 +31,20 @@
"src/*"
],
"dependencies": {
"@architect/inventory": "~4.0.5",
"@architect/parser": "~7.0.1",
"@architect/utils": "~4.0.6",
"@aws-lite/client": "^0.21.1",
"@architect/inventory": "~5.0.0",
"@architect/parser": "~8.0.1",
"@architect/utils": "~5.0.0",
"@aws-lite/client": "~0.23.2",
"@aws-lite/ssm": "^0.2.3",
"chalk": "4.1.2",
"dotenv": "~16.4.5",
"minimist": "~1.2.8",
"run-series": "~1.1.9",
"run-waterfall": "~1.1.7",
"yesno": "~0.4.0"
"dotenv": "17.2.2"
},
"devDependencies": {
"@architect/eslint-config": "~3.0.0",
"cross-env": "~7.0.3",
"cross-env": "~10.0.0",
"eslint": "^9.1.1",
"nyc": "^15.1.0",
"nyc": "~17.1.0",
"proxyquire": "~2.1.3",
"sinon": "^17.0.1",
"sinon": "~21.0.0",
"tap-arc": "^1.2.2",
"tape": "^5.7.5"
}
Expand Down
2 changes: 1 addition & 1 deletion src/_print.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let chalk = require('chalk')
let chalk = require('@architect/utils/chalk')

module.exports = function printer (err, { envVars, update, prints }) {
if (err) update.error(err)
Expand Down
4 changes: 3 additions & 1 deletion src/_write/prefs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
let parser = require('@architect/parser')
let waterfall = require('@architect/utils/run-waterfall')

let fs = require('fs')
let { existsSync, readFileSync } = fs
let { join } = require('path')
let waterfall = require('run-waterfall')

let prompt = require('./prompt')

module.exports = function write ({ envVars, update }, callback) {
Expand Down
2 changes: 1 addition & 1 deletion src/_write/prompt.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let yesno = require('yesno')
let yesno = require('./yesno')

module.exports = function prompt (update, callback) {
let defaultValue = true
Expand Down
26 changes: 26 additions & 0 deletions src/_write/yesno/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BSD 2-Clause License

Copyright (c) 2018, Tim Channell
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

57 changes: 57 additions & 0 deletions src/_write/yesno/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
'use strict'

const readline = require('readline')


const options = {
yes: [ 'yes', 'y' ],
no: [ 'no', 'n' ],
}


function defaultInvalidHandler ({ /* question, defaultValue,*/ yesValues, noValues }) {
var yValues = (yesValues || options.yes)
var nValues = (noValues || options.no)

process.stdout.write('\nInvalid Response.\n')
process.stdout.write('Answer either yes : (' + yValues.join(', ') + ') \n')
process.stdout.write('Or no: (' + nValues.join(', ') + ') \n\n')
}


async function ask ({ question, defaultValue, yesValues, noValues, invalid }) {
if (!invalid || typeof invalid !== 'function')
invalid = defaultInvalidHandler

var yValues = (yesValues || options.yes).map((v) => v.toLowerCase())
var nValues = (noValues || options.no).map((v) => v.toLowerCase())

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})

return new Promise(function (resolve/* , reject*/) {
rl.question(question + ' ', async function (answer) {
rl.close()

const cleaned = answer.trim().toLowerCase()

if (cleaned == '' && defaultValue != null)
return resolve(defaultValue)

if (yValues.indexOf(cleaned) >= 0)
return resolve(true)

if (nValues.indexOf(cleaned) >= 0)
return resolve(false)

invalid({ question, defaultValue, yesValues, noValues })
const result = await ask({ question, defaultValue, yesValues, noValues, invalid })
resolve(result)
})
})
}


module.exports = ask
3 changes: 1 addition & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env node
let minimist = require('minimist')
let _inventory = require('@architect/inventory')
let { banner, updater } = require('@architect/utils')
let { banner, updater, minimist } = require('@architect/utils')
let { version } = require('../package.json')

let env = require('.')
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
let series = require('run-series')
let { updater } = require('@architect/utils')
let { updater, series } = require('@architect/utils')
let awsLite = require('@aws-lite/client')

let addRemove = require('./_add-remove')
Expand Down
3 changes: 1 addition & 2 deletions test/_add-remove-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ let AWS = require('aws-sdk')
let aws = require('aws-sdk-mock')
aws.setSDKInstance(AWS)
let addRemove = require('../src/_add-remove')
let series = require('run-series')
let { updater } = require('@architect/utils')
let { updater, series } = require('@architect/utils')

let update = updater('Env')
let params = { inventory: { inv: {
Expand Down
Loading