create-popular-site 0.10.0 → 0.12.0
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/index.mjs +28 -34
- package/package.json +1 -1
- package/templates/_shared/astro.config.package.mjs.tmpl +14 -0
- package/templates/_shared/content.config.ts.tmpl +3 -0
- package/templates/_shared/package.json.tmpl +15 -0
- package/templates/aquarium/popular.config.ts +1 -0
- package/templates/foodie/popular.config.ts +1 -0
- package/templates/kdrama/popular.config.ts +1 -0
- package/templates/kdrama/src/content/events/step-into-the-light.md +1 -0
- package/templates/starter/popular.config.ts +1 -0
- package/templates/superfan/popular.config.ts +2 -2
package/index.mjs
CHANGED
|
@@ -93,37 +93,21 @@ function splitSiteBase(url) {
|
|
|
93
93
|
return { site: parsed.origin, base: path === '' ? '/' : path };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
and
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const packageJson = (name) => `${JSON.stringify({
|
|
112
|
-
name,
|
|
113
|
-
private: true,
|
|
114
|
-
type: 'module',
|
|
115
|
-
scripts: { dev: 'astro dev', build: 'astro build', preview: 'astro preview' },
|
|
116
|
-
dependencies: {
|
|
117
|
-
'@astrojs/mdx': '^7.0.2',
|
|
118
|
-
astro: '^7.0.6',
|
|
119
|
-
'astro-theme-popular': `^${VERSION}`,
|
|
120
|
-
},
|
|
121
|
-
}, null, 2)}\n`;
|
|
122
|
-
|
|
123
|
-
const CONTENT_CONFIG = `// The theme package owns the content model; this file just adopts it.
|
|
124
|
-
// Add your own collections here if you need them.
|
|
125
|
-
export { collections } from 'astro-theme-popular/schemas';
|
|
126
|
-
`;
|
|
96
|
+
/* The project files come from scripts/templates/, the same files
|
|
97
|
+
scripts/setup.py renders, collected into templates/_shared/ at pack time.
|
|
98
|
+
Two generators writing the same file two ways is how they drift.
|
|
99
|
+
|
|
100
|
+
Those templates support conditional blocks and a social-links expansion for
|
|
101
|
+
the wizard's richer answer set; the three used here are placeholder-only,
|
|
102
|
+
so `${key|default}` substitution is the whole contract. Matches setup.py's
|
|
103
|
+
PLACEHOLDER_RE and its "unanswered falls back to the default" rule. */
|
|
104
|
+
const PLACEHOLDER_RE = /\$\{(\w+)(?:\|([^}]*))?\}/g;
|
|
105
|
+
|
|
106
|
+
const renderTemplate = (name, answers) =>
|
|
107
|
+
readFileSync(join(TEMPLATE_DIR, '_shared', name), 'utf8').replace(
|
|
108
|
+
PLACEHOLDER_RE,
|
|
109
|
+
(_match, key, fallback = '') => (answers[key] ?? fallback),
|
|
110
|
+
);
|
|
127
111
|
|
|
128
112
|
const GITIGNORE = `dist/
|
|
129
113
|
node_modules/
|
|
@@ -203,9 +187,19 @@ async function main() {
|
|
|
203
187
|
mkdirSync(target, { recursive: true });
|
|
204
188
|
cpSync(from, target, { recursive: true });
|
|
205
189
|
mkdirSync(join(target, 'src'), { recursive: true });
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
190
|
+
const { site: astroSite, base } = splitSiteBase(siteUrl);
|
|
191
|
+
const answers = {
|
|
192
|
+
__astro_site: astroSite,
|
|
193
|
+
__astro_base: base,
|
|
194
|
+
__repo_name: name,
|
|
195
|
+
__theme_version: VERSION,
|
|
196
|
+
};
|
|
197
|
+
writeFileSync(join(target, 'src', 'content.config.ts'),
|
|
198
|
+
renderTemplate('content.config.ts.tmpl', answers));
|
|
199
|
+
writeFileSync(join(target, 'astro.config.mjs'),
|
|
200
|
+
renderTemplate('astro.config.package.mjs.tmpl', answers));
|
|
201
|
+
writeFileSync(join(target, 'package.json'),
|
|
202
|
+
renderTemplate('package.json.tmpl', answers));
|
|
209
203
|
writeFileSync(join(target, '.gitignore'), GITIGNORE);
|
|
210
204
|
writeFileSync(join(target, 'README.md'), readme(name, template));
|
|
211
205
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'astro/config';
|
|
2
|
+
import mdx from '@astrojs/mdx';
|
|
3
|
+
import popular from 'astro-theme-popular';
|
|
4
|
+
|
|
5
|
+
/* `site` is your origin and `base` is the path your site is served from.
|
|
6
|
+
A GitHub project page lives at you.github.io/my-community/, so its base is
|
|
7
|
+
'/my-community'; leave it '/' for a site at a domain root. Every link, image
|
|
8
|
+
and feed URL the theme writes follows both, markdown bodies included.
|
|
9
|
+
Written for you when this site was created. */
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
site: '${__astro_site|https://example.com}',
|
|
12
|
+
base: '${__astro_base|/}',
|
|
13
|
+
integrations: [mdx(), popular()],
|
|
14
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "${__repo_name|my-community}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "astro dev",
|
|
7
|
+
"build": "astro build",
|
|
8
|
+
"preview": "astro preview"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@astrojs/mdx": "^7.0.2",
|
|
12
|
+
"astro": "^7.0.6",
|
|
13
|
+
"astro-theme-popular": "^${__theme_version|0.9.1}"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -40,6 +40,7 @@ export const STRINGS: Record<string, string> = {
|
|
|
40
40
|
lookingBack: 'Looking back',
|
|
41
41
|
pastEvents: 'Past events',
|
|
42
42
|
venueWanted: 'Venue wanted',
|
|
43
|
+
eventPlanning: 'Planning',
|
|
43
44
|
confirmed: 'Confirmed',
|
|
44
45
|
fromTheBlog: 'From the blog',
|
|
45
46
|
latestFromCommunity: 'Latest from our community',
|
|
@@ -35,6 +35,7 @@ export const STRINGS: Record<string, string> = {
|
|
|
35
35
|
lookingBack: 'Looking back',
|
|
36
36
|
pastEvents: 'Past events',
|
|
37
37
|
venueWanted: 'Venue wanted',
|
|
38
|
+
eventPlanning: 'Planning',
|
|
38
39
|
confirmed: 'Confirmed',
|
|
39
40
|
fromTheBlog: 'From the blog',
|
|
40
41
|
latestFromCommunity: 'Latest from our community',
|
|
@@ -40,6 +40,7 @@ export const STRINGS: Record<string, string> = {
|
|
|
40
40
|
lookingBack: 'Looking back',
|
|
41
41
|
pastEvents: 'Past events',
|
|
42
42
|
venueWanted: 'Venue wanted',
|
|
43
|
+
eventPlanning: 'Planning',
|
|
43
44
|
confirmed: 'Confirmed',
|
|
44
45
|
fromTheBlog: 'From the blog',
|
|
45
46
|
latestFromCommunity: 'Latest from our community',
|
|
@@ -9,6 +9,7 @@ venue: "Half Moon Café"
|
|
|
9
9
|
address: "88 Sidestreet, (fictional)"
|
|
10
10
|
speaker: "No homework, no spoilers, name tags provided"
|
|
11
11
|
rsvp: "https://example.com/rsvp"
|
|
12
|
+
planning: true
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
Been lurking in the group chat? This one's for you: a low-pressure evening to meet the club, share your gateway drama, and claim a seat on the couch.
|
|
@@ -48,6 +48,7 @@ export const STRINGS: Record<string, string> = {
|
|
|
48
48
|
lookingBack: 'Looking back',
|
|
49
49
|
pastEvents: 'Past events',
|
|
50
50
|
venueWanted: 'Venue wanted',
|
|
51
|
+
eventPlanning: 'Planning',
|
|
51
52
|
confirmed: 'Confirmed',
|
|
52
53
|
fromTheBlog: 'From the blog',
|
|
53
54
|
latestFromCommunity: 'Latest from our community',
|
|
@@ -14,7 +14,6 @@ export const SITE = {
|
|
|
14
14
|
favicon: '/images/logo.svg',
|
|
15
15
|
ogImage: '/images/hero.svg',
|
|
16
16
|
locale: 'en-US',
|
|
17
|
-
customCSS: ['https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=Cinzel:wght@700&display=swap'],
|
|
18
17
|
landAcknowledgement: "Fan-made and gloriously unofficial: this site is a love letter, not affiliated with anyone it adores.",
|
|
19
18
|
};
|
|
20
19
|
|
|
@@ -41,6 +40,7 @@ export const STRINGS: Record<string, string> = {
|
|
|
41
40
|
lookingBack: 'Looking back',
|
|
42
41
|
pastEvents: 'Past appearances',
|
|
43
42
|
venueWanted: 'Venue wanted',
|
|
43
|
+
eventPlanning: 'Planning',
|
|
44
44
|
confirmed: 'Confirmed',
|
|
45
45
|
fromTheBlog: 'From the blog',
|
|
46
46
|
latestFromCommunity: 'Latest news & obsessions',
|
|
@@ -134,7 +134,7 @@ export const BRAND: Record<string, string> = {
|
|
|
134
134
|
textOnBrand: '#0A0E1A', // dark text on gold buttons, not white
|
|
135
135
|
borderSubtle: '#26304A',
|
|
136
136
|
fontSans: 'Inter, system-ui, sans-serif',
|
|
137
|
-
fontDisplay: '
|
|
137
|
+
fontDisplay: 'Quantico, Inter, sans-serif',
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
export const NAV: {
|