feat(init): make directory argument optional (#1263)
This commit is contained in:
@@ -28,10 +28,10 @@ The [documentation](https://fresh.deno.dev/docs/) is available on
|
|||||||
Install [Deno CLI](https://deno.land/) version 1.25.0 or higher.
|
Install [Deno CLI](https://deno.land/) version 1.25.0 or higher.
|
||||||
|
|
||||||
You can scaffold a new project by running the Fresh init script. To scaffold a
|
You can scaffold a new project by running the Fresh init script. To scaffold a
|
||||||
project in the `deno-fresh-demo` folder, run the following:
|
project run the following:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
deno run -A -r https://fresh.deno.dev deno-fresh-demo
|
deno run -A -r https://fresh.deno.dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Then navigate to the newly created project folder:
|
Then navigate to the newly created project folder:
|
||||||
@@ -90,7 +90,12 @@ preferably with source code on GitHub, but not required.
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<a href="https://fresh.deno.dev">
|
<a href="https://fresh.deno.dev">
|
||||||
<img width="197" height="37" src="https://fresh.deno.dev/fresh-badge.svg" alt="Made with Fresh" />
|
<img
|
||||||
|
width="197"
|
||||||
|
height="37"
|
||||||
|
src="https://fresh.deno.dev/fresh-badge.svg"
|
||||||
|
alt="Made with Fresh"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -102,6 +107,11 @@ preferably with source code on GitHub, but not required.
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<a href="https://fresh.deno.dev">
|
<a href="https://fresh.deno.dev">
|
||||||
<img width="197" height="37" src="https://fresh.deno.dev/fresh-badge-dark.svg" alt="Made with Fresh" />
|
<img
|
||||||
|
width="197"
|
||||||
|
height="37"
|
||||||
|
src="https://fresh.deno.dev/fresh-badge-dark.svg"
|
||||||
|
alt="Made with Fresh"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ will scaffold out a new project with some example files to get you started.
|
|||||||
To create a new project, run:
|
To create a new project, run:
|
||||||
|
|
||||||
```
|
```
|
||||||
deno run -A -r https://fresh.deno.dev deno-fresh-demo
|
deno run -A -r https://fresh.deno.dev
|
||||||
cd deno-fresh-demo
|
cd fresh-project
|
||||||
deno task start
|
deno task start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ To generate a project in the current directory:
|
|||||||
fresh-init .
|
fresh-init .
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
fresh-init <DIRECTORY>
|
fresh-init [DIRECTORY]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--force Overwrite existing files
|
--force Overwrite existing files
|
||||||
@@ -42,17 +42,22 @@ const flags = parse(Deno.args, {
|
|||||||
default: { "force": null, "twind": null, "vscode": null },
|
default: { "force": null, "twind": null, "vscode": null },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (flags._.length !== 1) {
|
|
||||||
error(help);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`\n%c 🍋 Fresh: the next-gen web framework. %c\n`,
|
`\n%c 🍋 Fresh: the next-gen web framework. %c\n`,
|
||||||
"background-color: #86efac; color: black; font-weight: bold",
|
"background-color: #86efac; color: black; font-weight: bold",
|
||||||
"",
|
"",
|
||||||
);
|
);
|
||||||
|
|
||||||
const unresolvedDirectory = Deno.args[0];
|
let unresolvedDirectory = Deno.args[0];
|
||||||
|
if (flags._.length !== 1) {
|
||||||
|
const userInput = prompt("Projet Name", "fresh-project");
|
||||||
|
if (!userInput) {
|
||||||
|
error(help);
|
||||||
|
}
|
||||||
|
|
||||||
|
unresolvedDirectory = userInput;
|
||||||
|
}
|
||||||
|
|
||||||
const resolvedDirectory = resolve(unresolvedDirectory);
|
const resolvedDirectory = resolve(unresolvedDirectory);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ function GettingStarted(props: { origin: string }) {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<CopyArea>
|
<CopyArea>
|
||||||
{`deno run -A -r ${props.origin} deno-fresh-demo`}
|
{`deno run -A -r ${props.origin}`}
|
||||||
</CopyArea>
|
</CopyArea>
|
||||||
|
|
||||||
<p class="text-gray-600">
|
<p class="text-gray-600">
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ function GettingStarted(props: { origin: string }) {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<CopyArea>
|
<CopyArea>
|
||||||
{`deno run -A -r ${props.origin} deno-fresh-demo`}
|
{`deno run -A -r ${props.origin}`}
|
||||||
</CopyArea>
|
</CopyArea>
|
||||||
|
|
||||||
<p class="text-gray-600">
|
<p class="text-gray-600">
|
||||||
|
|||||||
Reference in New Issue
Block a user