Skip to content

Commit

Permalink
fix: improved resilience
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Jul 25, 2023
1 parent 4c2adcc commit 2d042b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-routify",
"version": "1.4.1",
"version": "1.4.2",
"description": "A powerful cli for super-powering your routify development experience",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -32,7 +32,7 @@
"url": "https://github.com/roxiness/create-routify/issues"
},
"dependencies": {
"@roxi/routify": "^3.0.0-next",
"@roxi/routify": "^3.0.0-next.172",
"kleur": "^4.1.5",
"log-symbols": "^5.1.0",
"minimist": "^1.2.7",
Expand Down
27 changes: 19 additions & 8 deletions src/versions/three/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,32 @@ async function getExampleDir() {
let dirNames = await readdir(routifyExamplesDir);
const projects = await Promise.all(
dirNames
.map((name) => join(routifyExamplesDir, name))
.filter((dir) => existsSync(join(dir, 'manifest.js')))
.map((dir) =>
import(pathToFileURL(join(dir, 'manifest.js')).pathname).then(
(m) => ({ dir, manifest: m.default }),
),
),
.map((name) => ({ name, dir: join(routifyExamplesDir, name) }))
.filter(({ dir }) => existsSync(join(dir, 'manifest.js')))
.map(async ({ dir, name }) => {
try {
return await import(
pathToFileURL(join(dir, 'manifest.js')).pathname
).then((m) => ({ dir, name, manifest: m.default }));
} catch (err) {
return {
dir,
name,
manifest: {
name,
description: 'Could not read template info',
},
};
}
}),
);

const { project } = await prompts(
{
message: 'Please select a starter template',
name: 'project',
type: 'select',
choices: projects.map((value) => ({
choices: projects.filter(Boolean).map((value) => ({
title: value.manifest.name,
description: value.manifest.description,
value,
Expand Down

0 comments on commit 2d042b9

Please sign in to comment.