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 +29 -9
- package/dist/src/api.js +3 -2
- package/dist/src/commands/create.js +11 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
# devfast
|
|
2
|
-
|
|
3
|
-
A fast scaffolding
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
15
|
-
error: err.response?.data?.
|
|
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.
|
|
11
|
-
console.error(chalk.red(
|
|
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.
|
|
46
|
+
const emitter = degit(template.repository, { force: true });
|
|
43
47
|
await emitter.clone(targetDir);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
}
|