create-popular-site 0.10.0 → 0.11.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
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
|
+
}
|
|
@@ -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
|
|
|
@@ -134,7 +133,7 @@ export const BRAND: Record<string, string> = {
|
|
|
134
133
|
textOnBrand: '#0A0E1A', // dark text on gold buttons, not white
|
|
135
134
|
borderSubtle: '#26304A',
|
|
136
135
|
fontSans: 'Inter, system-ui, sans-serif',
|
|
137
|
-
fontDisplay: '
|
|
136
|
+
fontDisplay: 'Quantico, Inter, sans-serif',
|
|
138
137
|
};
|
|
139
138
|
|
|
140
139
|
export const NAV: {
|