@kirkelliott/zap 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/cli.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -258,3 +258,7 @@ curl -X POST https://your-endpoint/live \
|
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
Deploy `live.zap` once. Then POST JavaScript directly — no S3, no CLI, no deploy step. The runtime running inside itself.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
**[visitors →](https://zn2qgaqlofvauxmoncf36m4ynq0pfarj.lambda-url.us-east-1.on.aws/demo/visitors)**
|
package/dist/cli.js
CHANGED
|
@@ -71,7 +71,7 @@ async function walkZap(dir, prefix = '') {
|
|
|
71
71
|
}
|
|
72
72
|
return results;
|
|
73
73
|
}
|
|
74
|
-
async function deployFile(b, filePath, key) {
|
|
74
|
+
async function deployFile(b, filePath, key, baseUrl) {
|
|
75
75
|
const source = await (0, promises_1.readFile)(filePath, 'utf8');
|
|
76
76
|
await s3.send(new client_s3_1.PutObjectCommand({ Bucket: b, Key: key, Body: source, ContentType: 'application/javascript' }));
|
|
77
77
|
const name = key.replace(/\.zap$/, '');
|
|
@@ -86,7 +86,8 @@ async function deployFile(b, filePath, key) {
|
|
|
86
86
|
console.log(`+ ${name} ↻ ${cronExpr}`);
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
|
-
|
|
89
|
+
const url = baseUrl ? ` → ${baseUrl.replace(/\/$/, '')}/${name}` : '';
|
|
90
|
+
console.log(`+ ${name}${url}`);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
const program = new commander_1.Command()
|
|
@@ -148,9 +149,10 @@ program
|
|
|
148
149
|
.option('-b, --bucket <bucket>', 'S3 bucket (or set ZAP_BUCKET)')
|
|
149
150
|
.action(async (opts) => {
|
|
150
151
|
const b = bucket(opts);
|
|
152
|
+
const { url } = readConfig();
|
|
151
153
|
const demoDir = (0, node_path_1.resolve)(__dirname, '..', 'demo');
|
|
152
154
|
const files = await walkZap(demoDir, 'demo');
|
|
153
|
-
await Promise.all(files.map(({ filePath, key }) => deployFile(b, filePath, key)));
|
|
155
|
+
await Promise.all(files.map(({ filePath, key }) => deployFile(b, filePath, key, url)));
|
|
154
156
|
});
|
|
155
157
|
program
|
|
156
158
|
.command('debug')
|