create-heresay 0.2.35 → 0.2.36
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-heresay",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"description": "Set up your own Heresay: in-app feedback that every report gets a hearing. Creates a Firebase project in your Google account and deploys the dashboard, API and SDK to it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/release/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.36
|
|
@@ -115,7 +115,16 @@ export async function agent(p, req, deps, body, prompt, createProject, toReporte
|
|
|
115
115
|
if (!token.last_used_at || now - Date.parse(token.last_used_at) > 3600_000) {
|
|
116
116
|
await deps.store.updateAgentToken(token.id, { last_used_at: at });
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
// A repo can hold several tokens (one per app it was connected to), but a machine keeps only
|
|
119
|
+
// the latest. Each one works for every app connected to its repo, so none goes missing.
|
|
120
|
+
const ids = new Set(token.app_ids);
|
|
121
|
+
if (token.repo) {
|
|
122
|
+
for (const t of await deps.store.listAgentTokens()) {
|
|
123
|
+
if (!t.revoked_at && t.repo === token.repo)
|
|
124
|
+
t.app_ids.forEach((id) => ids.add(id));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const apps = (await Promise.all([...ids].map((id) => deps.store.getProject(id)))).filter((x) => !!x);
|
|
119
128
|
if (p[0] === 'me' && req.method === 'GET') {
|
|
120
129
|
return json(200, { repo: token.repo, version: deps.version, apps: apps.map(appView) });
|
|
121
130
|
}
|
package/src/steps.mjs
CHANGED
|
@@ -146,8 +146,10 @@ export function prepareRelease(ctx) {
|
|
|
146
146
|
const cfg = JSON.parse(readFileSync(join(RELEASE, 'firebase.json'), 'utf8'));
|
|
147
147
|
delete cfg.emulators;
|
|
148
148
|
for (const fn of cfg.functions) delete fn.predeploy;
|
|
149
|
-
if (siteOf(ctx) !== ctx.id) cfg.hosting.site = siteOf(ctx);
|
|
150
149
|
for (const r of cfg.hosting.rewrites) if (r.function) r.function.region = ctx.region;
|
|
150
|
+
// On a named site, keep serving the project's default site too: apps already shipped with its
|
|
151
|
+
// address, and repos already connected to it, must keep working.
|
|
152
|
+
if (siteOf(ctx) !== ctx.id) cfg.hosting = [{ ...cfg.hosting, site: siteOf(ctx) }, { ...cfg.hosting, site: ctx.id }];
|
|
151
153
|
writeFileSync(join(dir, 'firebase.json'), JSON.stringify(cfg, null, 2) + '\n');
|
|
152
154
|
writeFileSync(join(dir, '.firebaserc'), JSON.stringify({ projects: { default: ctx.id } }, null, 2) + '\n');
|
|
153
155
|
writeFileSync(join(dir, 'functions', '.env'), `HERESAY_REGION=${ctx.region}\n`);
|