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

ASAP fixes #189

Merged
merged 2 commits into from
Apr 8, 2024
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
9 changes: 9 additions & 0 deletions src/actions/autoinstall/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ module.exports = function autoinstaller (params) {
let { dirs, inventory, update, verbose } = params
if (!dirs.length) return []

let asap = inventory.inv.http?.find(l => l.arcStaticAssetProxy)
if (asap) {
dirs.push(asap.src)
}

update.start('Finding dependencies')

// Generated manifests to be hydrated later (if there are no parsing failures)
Expand Down Expand Up @@ -68,6 +73,10 @@ module.exports = function autoinstaller (params) {
function getRuntimeDirs (dirs, inventory, runtimeName) {
let runtimeDirs = dirs.filter(dir => {
let lambda = inventory.inv.lambdasBySrcDir[dir]
if (!lambda) {
lambda = inventory.inv.http?.find(l => l.arcStaticAssetProxy)
if (!lambda) throw ReferenceError(`Cannot find Lambda at: ${dir}`)
}
if (Array.isArray(lambda)) lambda = lambda[0] // Multi-tenant Lambda check
let { runtime, hydrate } = lambda.config
return runtime.startsWith(runtimeName) && hydrate !== false
Expand Down
4 changes: 4 additions & 0 deletions src/actions/autoinstall/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ module.exports = function treeshakeNode (nodeDirs, params) {
nodeDirs.forEach(dir => {
projectDirs++
let lambda = inventory.inv.lambdasBySrcDir[dir]
if (!lambda) {
lambda = inventory.inv.http?.find(l => l.arcStaticAssetProxy)
if (!lambda) throw ReferenceError(`Cannot find Lambda at: ${dir}`)
}
if (Array.isArray(lambda)) lambda = lambda[0] // Multi-tenant Lambda check
let { config, name, pragma } = lambda
let { runtime } = config
Expand Down
17 changes: 15 additions & 2 deletions src/actions/install-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,25 @@ module.exports = function hydrator (params, callback) {
}
else if (isPnpm) {
prodFlag = isRoot ? '' : '--prod'
let localPnpm = exists(join(cwd, 'node_modules', 'pnpm'))
let localPnpm
try {
// eslint-disable-next-line
require.resolve('pnpm')
localPnpm = true
}
catch { /* noop */ }
let cmd = localPnpm ? `npx pnpm i ${prodFlag}` : `pnpm i ${prodFlag}`
exec(cmd, options, callback)
}
else if (isYarn) {
let localYarn = exists(join(cwd, 'node_modules', 'yarn'))
let localYarn
try {
// eslint-disable-next-line
require.resolve('yarn')
localYarn = true
}
catch { /* noop */ }
localYarn = true
let cmd = localYarn ? `npx yarn ${prodFlag}` : `yarn ${prodFlag}`
exec(cmd, options, callback)
}
Expand Down
Loading