feat: support deno create for project initialization (#3706)
## Summary - Add a `./create` export to `@fresh/init` so users can scaffold projects with `deno create @fresh/init` (Deno 2.7+) - The old `deno run -Ar jsr:@fresh/init` continues to work but now shows a deprecation warning **New way (Deno 2.7+):** ```sh deno create @fresh/init ``` **Old way (still works, with warning):** ```sh deno run -Ar jsr:@fresh/init ``` Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
214975d90d
commit
b790c804ee
@@ -2,7 +2,10 @@
|
||||
"name": "@fresh/init",
|
||||
"version": "2.3.0",
|
||||
"license": "MIT",
|
||||
"exports": "./src/mod.ts",
|
||||
"exports": {
|
||||
".": "./src/mod.ts",
|
||||
"./create": "./src/create.ts"
|
||||
},
|
||||
"exclude": ["**/tmp/*"],
|
||||
"publish": {
|
||||
"include": [
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { parseArgs } from "@std/cli/parse-args";
|
||||
import { initProject } from "./init.ts";
|
||||
import { InitError } from "./init.ts";
|
||||
|
||||
const flags = parseArgs(Deno.args, {
|
||||
boolean: ["force", "tailwind", "vscode", "docker", "help", "builder"],
|
||||
default: {
|
||||
force: null,
|
||||
tailwind: null,
|
||||
vscode: null,
|
||||
docker: null,
|
||||
builder: null,
|
||||
},
|
||||
alias: {
|
||||
help: "h",
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
await initProject(Deno.cwd(), flags._, flags);
|
||||
} catch (err) {
|
||||
if (err instanceof InitError) {
|
||||
Deno.exit(1);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
@@ -2,6 +2,12 @@ import { parseArgs } from "@std/cli/parse-args";
|
||||
import { initProject } from "./init.ts";
|
||||
import { InitError } from "./init.ts";
|
||||
|
||||
// deno-lint-ignore no-console
|
||||
console.warn(
|
||||
"\x1b[33m%s\x1b[0m",
|
||||
`Warning: "deno run -Ar jsr:@fresh/init" is deprecated. Use "deno create @fresh/init" instead.`,
|
||||
);
|
||||
|
||||
const flags = parseArgs(Deno.args, {
|
||||
boolean: ["force", "tailwind", "vscode", "docker", "help", "builder"],
|
||||
default: {
|
||||
|
||||
Reference in New Issue
Block a user