ampproject / ampproject/amp-toolbox

toolbox-optimizer: cache location breaks Vercel pkg

Open
#947 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
459
Forks
242
PR merge metrics
No merged PRs in 30d

Description

I would like to embed the toolbox-optimizer in an application which I package with https://github.com/vercel/pkg.

The following code in https://github.com/ampproject/amp-toolbox/blob/main/packages/optimizer/lib/cache.js:

```javascript
// a shared cache implementation
const cache = FileSystemCache.create({
log,
baseDir: path.join(__dirname, '..', '.cache'),
});
```

breaks this possibility.

Could the cache location be made configurable?

Contributor guide

Open the contributing guide

Research direction

Start in packages/optimizer/lib/cache.js and inspect how FileSystemCache.create receives its baseDir. Make the cache location configurable while preserving the current default, then verify that the optimizer can use a cache location compatible with Vercel pkg.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.