whereto-bike 0.0.5 → 0.0.7
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 +1 -1
- package/packages/create-bike-blog/templates/github/workflows/ci.yml.tpl +1 -1
- package/packages/create-bike-blog/templates/github/workflows/deploy.yml.tpl +2 -2
- package/packages/create-bike-blog/templates/package.json.tpl +2 -1
- package/packages/create-bike-blog/templates/scripts/setup.js +1 -1
- package/src/views/routes/routes-index.json.ts +4 -2
- package/sync.js +17 -0
package/package.json
CHANGED
|
@@ -56,7 +56,7 @@ jobs:
|
|
|
56
56
|
uses: actions/cache@v5
|
|
57
57
|
with:
|
|
58
58
|
path: .astro
|
|
59
|
-
key: astro-${{
|
|
59
|
+
key: astro-${{ github.run_id }}
|
|
60
60
|
restore-keys: astro-
|
|
61
61
|
|
|
62
62
|
- name: Restore dist cache
|
|
@@ -130,7 +130,7 @@ jobs:
|
|
|
130
130
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
131
131
|
|
|
132
132
|
deploy-lambda:
|
|
133
|
-
if: vars.VIDEO_PREFIX != ''
|
|
133
|
+
if: vars.VIDEO_PREFIX != '' && vars.SKIP_LAMBDA_DEPLOY != 'true'
|
|
134
134
|
runs-on: ubuntu-latest
|
|
135
135
|
environment: production
|
|
136
136
|
steps:
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"build": "astro build",
|
|
8
8
|
"preview": "astro preview",
|
|
9
9
|
"setup": "node scripts/setup.js",
|
|
10
|
-
"sync": "node node_modules/whereto-bike/sync.js"
|
|
10
|
+
"sync": "node node_modules/whereto-bike/sync.js",
|
|
11
|
+
"postinstall": "node node_modules/whereto-bike/scripts/patch-astro-renderers.js"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"@astrojs/cloudflare": "^13.0.0-beta.11",
|
|
@@ -7,7 +7,9 @@ import { routeShape } from '../../lib/route-insights';
|
|
|
7
7
|
import { difficultyLabel, scoreRoute } from '../../lib/difficulty';
|
|
8
8
|
import { paths, routeSlug } from '../../lib/paths';
|
|
9
9
|
import { defaultLocale } from '../../lib/i18n/locale-utils';
|
|
10
|
-
|
|
10
|
+
// NOTE: This is a single-output endpoint (not parameterized), so it must NOT
|
|
11
|
+
// use filterByBuildPlan — doing so would produce a partial index in incremental
|
|
12
|
+
// mode, overwriting the full one from the previous build.
|
|
11
13
|
|
|
12
14
|
export const prerender = true;
|
|
13
15
|
|
|
@@ -21,7 +23,7 @@ export const GET: APIRoute = async ({ currentLocale }) => {
|
|
|
21
23
|
const config = getCityConfig();
|
|
22
24
|
const locale = currentLocale || defaultLocale();
|
|
23
25
|
const allRoutes = await getCollection('routes');
|
|
24
|
-
const published =
|
|
26
|
+
const published = allRoutes.filter(isPublished);
|
|
25
27
|
|
|
26
28
|
const allScores = published
|
|
27
29
|
.map(r => scoreRoute(r))
|
package/sync.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - scripts/setup.js — interactive setup helper
|
|
12
12
|
* - astro.config.mjs — Astro config
|
|
13
13
|
* - tsconfig.json — TypeScript config
|
|
14
|
+
* - package.json — scripts only (merged, preserving name/deps)
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import fs from 'node:fs';
|
|
@@ -101,6 +102,22 @@ for (const rel of sourceFiles) {
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
// --- Sync package.json scripts from template ---
|
|
106
|
+
const templatePkgPath = path.join(templateRoot, 'package.json.tpl');
|
|
107
|
+
if (fs.existsSync(templatePkgPath)) {
|
|
108
|
+
const templatePkg = JSON.parse(renderTemplate(fs.readFileSync(templatePkgPath, 'utf-8'), vars));
|
|
109
|
+
const blogPkgPath = path.join(cwd, 'package.json');
|
|
110
|
+
const blogPkg = JSON.parse(fs.readFileSync(blogPkgPath, 'utf-8'));
|
|
111
|
+
|
|
112
|
+
const before = JSON.stringify(blogPkg.scripts);
|
|
113
|
+
blogPkg.scripts = { ...blogPkg.scripts, ...templatePkg.scripts };
|
|
114
|
+
if (JSON.stringify(blogPkg.scripts) !== before) {
|
|
115
|
+
fs.writeFileSync(blogPkgPath, JSON.stringify(blogPkg, null, 2) + '\n');
|
|
116
|
+
console.log(' updated package.json (scripts)');
|
|
117
|
+
updated++;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
104
121
|
// --- Summary ---
|
|
105
122
|
if (updated === 0) {
|
|
106
123
|
console.log(' Everything is up to date.');
|