create-renoun 2.0.1 → 2.0.3

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.
Files changed (2) hide show
  1. package/dist/index.mjs +24 -5
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -244,6 +244,14 @@ const downloadFile = async (url, filePath)=>{
244
244
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
245
245
  // Remove "@examples/" prefix from package name
246
246
  packageJson.name = packageJson.name.replace('@examples/', '');
247
+ const cliPath = '../../packages/renoun/dist/cli/index.js';
248
+ if (packageJson.scripts) {
249
+ for (const [scriptName, scriptValue] of Object.entries(packageJson.scripts)){
250
+ if (typeof scriptValue === 'string') {
251
+ packageJson.scripts[scriptName] = scriptValue.replaceAll(cliPath, 'renoun');
252
+ }
253
+ }
254
+ }
247
255
  // Replace "workspace:*" and "catalog:" with the latest versions of the package
248
256
  for (const [packageName, version] of Object.entries(packageJson.dependencies)){
249
257
  if (version === 'catalog:' || version === 'workspace:*') {
@@ -255,6 +263,20 @@ const downloadFile = async (url, filePath)=>{
255
263
  writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');
256
264
  }
257
265
 
266
+ /** Derive the examples list from the GitHub repository at runtime. */ async function getExampleOptions() {
267
+ const response = await fetch('https://api.github.com/repos/souporserious/renoun/contents/examples?ref=main');
268
+ if (!response.ok) {
269
+ throw new Error(`Failed to list examples: ${response.status} ${response.statusText}`);
270
+ }
271
+ const items = await response.json();
272
+ const slugs = items.filter((item)=>item.type === 'dir').map((item)=>item.name);
273
+ const toTitle = (slug)=>slug.split('-').map((string)=>string ? string[0].toUpperCase() + string.slice(1) : string).join(' ');
274
+ return slugs.map((slug)=>({
275
+ value: slug,
276
+ label: toTitle(slug)
277
+ }));
278
+ }
279
+
258
280
  const __filename = __node_cjsUrl.fileURLToPath(import.meta.url);
259
281
  const __dirname = __node_cjsPath.dirname(__filename);
260
282
 
@@ -358,13 +380,10 @@ async function start() {
358
380
  * - After fetching, go directly to SUCCESS_STATE.
359
381
  */
360
382
  case states.PICK_EXAMPLE: {
383
+ const exampleOptions = await getExampleOptions();
361
384
  const example = await select({
362
385
  message: 'Choose an example below to get started:',
363
- options: [
364
- { value: 'blog', label: 'Blog' },
365
- { value: 'docs', label: 'Documentation' },
366
- { value: 'design-system', label: 'Design System' },
367
- ],
386
+ options: exampleOptions,
368
387
  });
369
388
 
370
389
  if (isCancel(example)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-renoun",
3
3
  "type": "module",
4
- "version": "2.0.1",
4
+ "version": "2.0.3",
5
5
  "author": {
6
6
  "name": "souporserious",
7
7
  "email": "support@souporserious.com"
@@ -9,7 +9,7 @@
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/souporserious/renoun",
12
+ "url": "git+https://github.com/souporserious/renoun.git",
13
13
  "directory": "packages/create-renoun"
14
14
  },
15
15
  "bugs": "https://github.com/souporserious/renoun/issues",
@@ -19,13 +19,13 @@
19
19
  ],
20
20
  "bin": "./dist/index.mjs",
21
21
  "devDependencies": {
22
- "bunchee": "^6.5.4"
22
+ "bunchee": "6.6.2"
23
23
  },
24
24
  "dependencies": {
25
- "@antfu/install-pkg": "^1.1.0",
26
- "@clack/prompts": "^0.11.0",
27
- "picocolors": "^1.1.1",
28
- "terminal-link": "^4.0.0"
25
+ "@antfu/install-pkg": "1.1.0",
26
+ "@clack/prompts": "0.11.0",
27
+ "picocolors": "1.1.1",
28
+ "terminal-link": "5.0.0"
29
29
  },
30
30
  "scripts": {
31
31
  "build": "bunchee",