Skip to content

Commit

Permalink
Linux dart-throwing (for once)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Oct 1, 2023
1 parent 89285e2 commit 0f7a381
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 14.x, 16.x, 18.x ]
os: [ windows-latest, ubuntu-latest, macOS-latest ]
node-version: [ 14.x] #, 16.x, 18.x ]
os: [ ubuntu-latest ] # windows-latest, ubuntu-latest, macOS-latest ]

# Go
steps:
Expand All @@ -41,6 +41,9 @@ jobs:
- name: Install
run: npm install

- name: Check node modules
run: ls -lah node_modules/\@aws-lite/

- name: Test
run: npm test
env:
Expand Down
16 changes: 16 additions & 0 deletions src/client-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,31 @@ module.exports = async function clientFactory (config, creds, region) {
if (autoloadPlugins) {
let nodeModulesDir = join(process.cwd(), 'node_modules')
let mods = await readdir(nodeModulesDir)
// TODO ↓ remove me! ↓
console.log(`found node modules:`, mods)

// Find first-party plugins
if (mods.includes('@aws-lite')) {
let knownPlugins = await readdir(join(nodeModulesDir, '@aws-lite'))
// TODO ↓ remove me! ↓
console.log(`knownPlugins:`, knownPlugins)
let filtered = knownPlugins.filter(p => !ignored.includes(p)).map(p => `@aws-lite/${p}`)
// TODO ↓ remove me! ↓
console.log(`filtered:`, filtered)
plugins.push(...filtered)
}
// Find correctly namespaced 3rd-party plugins
let findPlugins = mod => mod.startsWith('aws-lite-plugin-') && plugins.push(mod)
mods.forEach(findPlugins)
}

// TODO ↓ remove me! ↓
console.log(`plugins:`, plugins)

if (plugins.length) {
for (let pluginName of plugins) {
// TODO ↓ remove me! ↓
console.log(`pluginName:`, pluginName)
try {
let plugin
/* istanbul ignore next */
Expand All @@ -54,12 +66,16 @@ module.exports = async function clientFactory (config, creds, region) {
plugin = require(pluginName)
}
catch (err) {
// TODO ↓ remove me! ↓
console.log(`require err:`, err)
if (hasEsmError(err)) {
let path = pluginName
if (process.platform.startsWith('win')) {
try { path = 'file://' + require.resolve(path) }
catch { path = 'file://' + pluginName }
}
// TODO ↓ remove me! ↓
console.log(`importing path:`, path)
let mod = await import(path)
plugin = mod.default ? mod.default : mod
}
Expand Down

0 comments on commit 0f7a381

Please sign in to comment.