Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps #75

Merged
merged 4 commits into from
Apr 29, 2024
Merged

Deps #75

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: 0 additions & 2 deletions .eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

To maintain a high standard of quality in our releases, before merging every pull request we ask that you've completed the following:

- [ ] Forked the repo and created your branch from `master`
- [ ] Forked the repo and created your branch from `main`
- [ ] Made sure tests pass (run `npm it` from the repo root)
- [ ] Expanded test coverage related to your changes:
- [ ] Added and/or updated unit tests (if appropriate)
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
# Go
steps:
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -41,7 +41,14 @@ jobs:
- name: Install
run: npm install

- name: Test (Node.js <= 16.x)
if: matrix.node-version <= '16.x'
run: npm run test:nolint
env:
CI: true

- name: Test
if: matrix.node-version > '16.x'
run: npm test
env:
CI: true
Expand All @@ -68,10 +75,10 @@ jobs:
# Go
steps:
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
Expand Down
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

---

## [4.0.5] 2024-04-29

### Changed

- Updated dependencies
- Updated `package.json` `engines.node` property to reflect changes from v4

---

## [4.0.4] 2024-03-25

### Changed
Expand Down
11 changes: 11 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const arc = require('@architect/eslint-config')

module.exports = [
...arc,
{
ignores: [
'scratch',
'test/mock/',
],
},
]
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "src/index.js",
"scripts": {
"test": "npm run lint && npm run test:integration && npm run coverage",
"test:nolint": "npm run test:integration && npm run coverage",
"test:unit": "cross-env tape 'test/unit/**/*-test.js' | tap-arc",
"test:integration": "cross-env tape 'test/integration/**/*-test.js' | tap-arc",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
Expand All @@ -13,27 +14,27 @@
"vendor": "scripts/vendor"
},
"engines": {
"node": ">=14"
"node": ">=16"
},
"repository": {
"type": "git",
"url": "git+https://github.com/architect/inventory.git"
},
"license": "Apache-2.0",
"dependencies": {
"@architect/asap": "~7.0.8",
"@architect/parser": "~6.0.3",
"@architect/utils": "~4.0.4",
"@aws-lite/client": "^0.20.0",
"@architect/asap": "~7.0.10",
"@architect/parser": "~7.0.1",
"@architect/utils": "~4.0.6",
"@aws-lite/client": "^0.21.1",
"@aws-lite/ssm": "^0.2.3",
"lambda-runtimes": "~2.0.2"
},
"devDependencies": {
"@architect/eslint-config": "~2.1.2",
"@architect/eslint-config": "~3.0.0",
"cross-env": "~7.0.3",
"dotenv": "~16.4.5",
"eslint": "~8.57.0",
"mock-tmp": "~0.0.3",
"eslint": "~9.1.1",
"mock-tmp": "~0.0.4",
"nyc": "~15.1.0",
"proxyquire": "~2.1.3",
"tap-arc": "^1.2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = function configureHTTP ({ arc, inventory, errors }) {
arcStaticAssetProxy: true,
pragma: 'http',
method: 'get',
path: '/*'
path: '/*',
}
asap.config.shared = false
asap.config.views = false
Expand Down
1 change: 0 additions & 1 deletion src/config/pragmas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let { all: allPragmas } = pragmas
// Get all pragmas except special cases
let isSpecial = p => [ 'plugins', 'shared', 'views' ].includes(p)
let visitors = allPragmas.map(p => {
// eslint-disable-next-line
if (!isSpecial(p)) return require(`./${p}`)
}).filter(Boolean)

Expand Down
2 changes: 0 additions & 2 deletions src/config/pragmas/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ module.exports = async function getPluginModules ({ arc, inventory, errors }) {
/* istanbul ignore next: idk why but for some reason nyc isn't picking up the catches; all cases are covered in tests, though! */
if (type === 'plugin') {
try {
// eslint-disable-next-line
plugins[name] = require(pluginPath)
}
catch (err) {
Expand All @@ -69,7 +68,6 @@ module.exports = async function getPluginModules ({ arc, inventory, errors }) {
}
// Remap @macros to deploy.start
if (type === 'macro') {
// eslint-disable-next-line
plugins[name] = { deploy: { start: require(pluginPath) } }
}
// Walk each plugin and build the method tree
Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/populate-lambda/_scheduled.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let get = {
dayOfWeek: bits[4],
year: bits[5],
}
}
},
}

module.exports = function populateScheduled (params) {
Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/populate-lambda/get-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function getExt ({ runtime, src, errors }) {
}
}

function findHandler (arr, src){
function findHandler (arr, src) {
for (let handler of arr) {
if (existsSync(join(src, handler))) {
let bits = handler.split('.')
Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function configureShared ({ arc, pragmas, inventory, errors })
let src = join(projSrc, 'shared')
let shared = {
src: null,
shared: []
shared: [],
}

let foundPluginSrc, foundArcSrc, required = false
Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/tables-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function configureTablesIndexes ({ arc, inventory, errors }) {
plugins: indexesSetters,
inventory,
type: 'indexes',
valid: { name: 'string' }
valid: { name: 'string' },
})
if (plugins) indexes.push(...plugins)

Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function configureTables ({ arc, inventory, errors }) {
plugins: tablesSetters,
inventory,
type: 'tables',
valid: { name: 'string' }
valid: { name: 'string' },
})
if (plugins) tables.push(...plugins)

Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/validate/_proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function validateProxy (proxy, errors) {
errors.push(`Invalid @proxy protocol: ${url}`)
}
}
catch (e) {
catch {
errors.push(`Invalid @proxy URL: ${url}`)
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/config/pragmas/validate/_tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function validateTablesAndIndexes (pragma, pragmaName, errors)
deepStrictEqual(index, expect)
return true
}
catch (err) {
catch {
return false
}
})
Expand Down
3 changes: 1 addition & 2 deletions src/config/pragmas/validate/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable global-require */
module.exports = {
// Pragmas and project validation
aws: require('./_aws'),
Expand All @@ -15,5 +14,5 @@ module.exports = {
websockets: require('./_websockets'),

// Misc
validate: require('./_lib')
validate: require('./_lib'),
}
2 changes: 1 addition & 1 deletion src/config/pragmas/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function configureViews ({ arc, pragmas, inventory, errors }) {
let src = join(projSrc, 'views')
let views = {
src: null,
views: []
views: [],
}

let foundPluginSrc, foundArcSrc, required = false
Expand Down
2 changes: 1 addition & 1 deletion src/config/project/prefs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ module.exports = function getPrefs ({ scope, inventory, errors }) {
_arc: prefs.arc,
_raw: prefs.raw,
},
preferencesFile: prefs.filepath
preferencesFile: prefs.filepath,
}
}
5 changes: 2 additions & 3 deletions src/env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ module.exports = function env (params, inventory, callback) {
let name = inventory.app
let { profile, region } = inventory.aws
let result = []
// eslint-disable-next-line
let awsLite = require('@aws-lite/client')
/* istanbul ignore next */ // eslint-disable-next-line
/* istanbul ignore next */
awsLite({ profile, region, plugins: [ import('@aws-lite/ssm') ] }).then(_aws => {
aws = _aws

Expand All @@ -24,7 +23,7 @@ module.exports = function env (params, inventory, callback) {
Recursive: true,
MaxResults: 10,
WithDecryption: true,
paginate: true
paginate: true,
}
aws.ssm.GetParametersByPath(params).then(data => {
// Tidy up the response
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module.exports = function architectInventory (params = {}, callback) {
// Userland: fill out the pragmas, starting with @plugins
inventory = {
...inventory,
...config.pragmas(project)
...config.pragmas(project),
}

// End here if first-pass validation failed
Expand All @@ -107,7 +107,7 @@ module.exports = function architectInventory (params = {}, callback) {
else {
callback(null, {
inv: inventory,
get: get(inventory)
get: get(inventory),
})
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pragmas.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ module.exports = {
'jsonapi',
'text',
'xml',
]
],
}
2 changes: 1 addition & 1 deletion src/read/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let functionConfig = {

// Local preferences
let preferences = {
arc: [ 'preferences.arc', 'prefs.arc', '.preferences.arc', '.prefs.arc', ],
arc: [ 'preferences.arc', 'prefs.arc', '.preferences.arc', '.prefs.arc' ],
// TODO add json, yaml later if folks want it?
}

Expand Down
2 changes: 1 addition & 1 deletion src/validate/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function validateARN ({ layers, region, config }) {
if (region !== layerRegion) {
badRegions.push(
` - Layer ARN: ${arn}\n` +
` - Layer region: ${layerRegion}`
` - Layer region: ${layerRegion}`,
)
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/validate/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function checkFilePaths (inventory, errors) {
if (proj.build && !ascii.test(proj.build)) return err('Build')

let { lambdasBySrcDir } = inventory
if (lambdasBySrcDir){
if (lambdasBySrcDir) {
Object.values(lambdasBySrcDir).forEach(lambdae => {
if (!Array.isArray(lambdae)) lambdae = [ lambdae ] // Normalize possible multi-tenant Lambdas
lambdae.forEach(lambda => {
Expand Down
18 changes: 9 additions & 9 deletions test/integration/preferences-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ testing
env_var_2 bar
`
let tmp = mockTmp({
[globalPrefsFile]: prefsText
[globalPrefsFile]: prefsText,
})
overrideHomedir(tmp)
inv({ cwd }, (err, result) => {
Expand Down Expand Up @@ -113,7 +113,7 @@ test('Get local preferences', t => {
env: {
testing: { 'env_var_1': 'foo', 'env_var_2': 'bar' },
staging: { 'env_var_1': 'fiz', 'env_var_2': 'buz' },
production: { 'env_var_1': 'qix qix', 'env_var_2': 'qux qux' }
production: { 'env_var_1': 'qix qix', 'env_var_2': 'qux qux' },
},
}
inv({ cwd }, (err, result) => {
Expand Down Expand Up @@ -159,42 +159,42 @@ testing
let globalPrefs = {
sandbox: {
environment: 'testing',
quiet: true
quiet: true,
},
deploy: false,
env: {
testing: { 'env_var_1': 'foo', 'env_var_2': 'bar' },
staging: null,
production: null,
}
},
}
let localPrefs = {
sandbox: {
environment: 'staging',
},
create: {
autocreate: true
autocreate: true,
},
env: {
testing: { 'env_var_2': 'bar' },
staging: { 'env_var_3': 'fiz' },
production: null,
}
},
}
let prefs = {
sandbox: {
environment: 'staging',
quiet: true
quiet: true,
},
deploy: false,
create: {
autocreate: true
autocreate: true,
},
env: {
testing: { 'env_var_2': 'bar' },
staging: { 'env_var_3': 'fiz' },
production: null,
}
},
}
let tmp = mockTmp({
[globalPrefsFile]: globalPrefsText,
Expand Down
Loading