create-renoun 2.0.2 → 2.0.4

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 souporserious LLC
3
+ Copyright (c) 2025 souporserious LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/dist/index.mjs CHANGED
@@ -10,10 +10,10 @@ import { pipeline } from 'node:stream/promises';
10
10
  import { homedir } from 'node:os';
11
11
  import __node_cjsUrl from 'node:url';
12
12
 
13
- const __filename$1 = __node_cjsUrl.fileURLToPath(import.meta.url);
14
- const __dirname$1 = __node_cjsPath.dirname(__filename$1);
13
+ const __filename$2 = __node_cjsUrl.fileURLToPath(import.meta.url);
14
+ const __dirname$2 = __node_cjsPath.dirname(__filename$2);
15
15
 
16
- const packageJsonPath$1 = resolve(__dirname$1, '../package.json');
16
+ const packageJsonPath$1 = resolve(__dirname$2, '../package.json');
17
17
  const packageJson$1 = JSON.parse(readFileSync(packageJsonPath$1, 'utf-8'));
18
18
  const cacheDirectory = resolve(homedir(), '.config', 'create-renoun');
19
19
  const cacheFilePath = resolve(cacheDirectory, 'version.json');
@@ -244,14 +244,6 @@ 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
- }
255
247
  // Replace "workspace:*" and "catalog:" with the latest versions of the package
256
248
  for (const [packageName, version] of Object.entries(packageJson.dependencies)){
257
249
  if (version === 'catalog:' || version === 'workspace:*') {
@@ -263,10 +255,24 @@ const downloadFile = async (url, filePath)=>{
263
255
  writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');
264
256
  }
265
257
 
266
- const __filename = __node_cjsUrl.fileURLToPath(import.meta.url);
267
- const __dirname = __node_cjsPath.dirname(__filename);
258
+ /** Derive the examples list from the GitHub repository at runtime. */ async function getExampleOptions() {
259
+ const response = await fetch('https://api.github.com/repos/souporserious/renoun/contents/examples?ref=main');
260
+ if (!response.ok) {
261
+ throw new Error(`Failed to list examples: ${response.status} ${response.statusText}`);
262
+ }
263
+ const items = await response.json();
264
+ const slugs = items.filter((item)=>item.type === 'dir').map((item)=>item.name);
265
+ const toTitle = (slug)=>slug.split('-').map((string)=>string ? string[0].toUpperCase() + string.slice(1) : string).join(' ');
266
+ return slugs.map((slug)=>({
267
+ value: slug,
268
+ label: toTitle(slug)
269
+ }));
270
+ }
271
+
272
+ const __filename$1 = __node_cjsUrl.fileURLToPath(import.meta.url);
273
+ const __dirname$1 = __node_cjsPath.dirname(__filename$1);
268
274
 
269
- const packageJsonPath = resolve(__dirname, '../package.json');
275
+ const packageJsonPath = resolve(__dirname$1, '../package.json');
270
276
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
271
277
  /** Compares two simple semvar versions and returns true if the first version is less than the second. */ function isVersionLessThan(v1, v2) {
272
278
  const parts1 = v1.split('.').map(Number);
@@ -366,13 +372,10 @@ async function start() {
366
372
  * - After fetching, go directly to SUCCESS_STATE.
367
373
  */
368
374
  case states.PICK_EXAMPLE: {
375
+ const exampleOptions = await getExampleOptions();
369
376
  const example = await select({
370
377
  message: 'Choose an example below to get started:',
371
- options: [
372
- { value: 'blog', label: 'Blog' },
373
- { value: 'docs', label: 'Documentation' },
374
- { value: 'design-system', label: 'Design System' },
375
- ],
378
+ options: exampleOptions,
376
379
  });
377
380
 
378
381
  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.2",
4
+ "version": "2.0.4",
5
5
  "author": {
6
6
  "name": "souporserious",
7
7
  "email": "support@souporserious.com"
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "bin": "./dist/index.mjs",
21
21
  "devDependencies": {
22
- "bunchee": "6.6.0"
22
+ "bunchee": "6.6.2"
23
23
  },
24
24
  "dependencies": {
25
25
  "@antfu/install-pkg": "1.1.0",