devfast 1.0.1 → 1.1.1

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/README.md CHANGED
@@ -1,9 +1,29 @@
1
- # devfast CLI
2
-
3
- A fast scaffolding tool to generate projects from the devfast platform.
4
-
5
- ## Usage
6
-
7
- ```bash
8
- npx devfast create <template-id>
9
- ```
1
+ # devfast
2
+
3
+ A fast scaffolding CLI to generate projects from the **devfast platform**.
4
+
5
+ Instead of starting from scratch and cleaning up boilerplate, devfast lets you create projects from ready-to-use templates.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ npx devfast create <template-id>
11
+ ````
12
+
13
+ Example:
14
+
15
+ ```bash
16
+ npx devfast create vite-react-js
17
+ ```
18
+
19
+ ## Website
20
+
21
+ [https://devfastv1.vercel.app](https://devfastv1.vercel.app)
22
+
23
+ ## Contributing
24
+
25
+ devfast is in an early stage and the template ecosystem is just getting started.
26
+
27
+ If you'd like to contribute templates or improvements, feel free to open an issue or submit a pull request on GitHub.
28
+
29
+ [https://github.com/qubydev/devfast](https://github.com/qubydev/devfast)
package/dist/src/api.js CHANGED
@@ -11,8 +11,9 @@ export async function fetchTemplate(id) {
11
11
  }
12
12
  catch (err) {
13
13
  return {
14
- status: err.response?.status || 500,
15
- error: err.response?.data?.message || 'Server unreachable'
14
+ repository: null,
15
+ error: err.response?.data?.error || 'Server unreachable',
16
+ message: err.response?.data?.message || 'An error occurred while fetching the template.'
16
17
  };
17
18
  }
18
19
  }
@@ -7,8 +7,12 @@ import { fetchTemplate } from '../api.js';
7
7
  import { isValidProjectPath, isValidFolderName, isDirEmpty, formatMessage } from '../utils.js';
8
8
  export async function createAction(templateId) {
9
9
  const template = await fetchTemplate(templateId);
10
- if (template.status !== 200 || !template.data) {
11
- console.error(chalk.red(`Error: ${template.error || 'Invalid template ID'}`));
10
+ if (template.error) {
11
+ console.error(chalk.red(template.message || template.error));
12
+ process.exit(1);
13
+ }
14
+ if (!template.repository) {
15
+ console.error(chalk.red('Template repository not found.'));
12
16
  process.exit(1);
13
17
  }
14
18
  const response = await prompts({
@@ -39,15 +43,16 @@ export async function createAction(templateId) {
39
43
  console.log(chalk.green(`\nšŸš€ Setting up ${appName} with devfast...`));
40
44
  const spinner = ora('Setting up project...').start();
41
45
  try {
42
- const emitter = degit(template.data.repository, { force: true });
46
+ const emitter = degit(template.repository, { force: true });
43
47
  await emitter.clone(targetDir);
44
- spinner.succeed(chalk.green('Done!'));
45
- console.log(`\n${chalk.bold('Next steps:')}`);
46
- console.log(formatMessage(template.data.nextSteps, templateData));
48
+ if (template.nextSteps) {
49
+ console.log(formatMessage(template.nextSteps, templateData));
50
+ }
47
51
  process.exit(0);
48
52
  }
49
53
  catch (err) {
50
54
  spinner.fail(chalk.red('Setup failed.'));
55
+ console.error(chalk.red(err instanceof Error ? err.message : 'An unexpected error has occurred.'));
51
56
  process.exit(1);
52
57
  }
53
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devfast",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Devfast template setup library",
5
5
  "type": "module",
6
6
  "main": "dist/src/api.js",