使用 heredocs 自动执行 create-next-app 不起作用,为什么?

Automating create-next-app with heredocs doesn't work, why?

提问人:LittleTeemo 提问时间:9/3/2023 更新时间:9/3/2023 访问量:22

问:

端子输出

> npx create-next-app@latest <<EOF
app1
No
Yes
Yes
Yes
Yes
Yes
@/*
EOF
? What is your project named? › app1NoYesYesYesYesYes@/*% 

为什么这不会创建一个 nextjs 应用程序?

这是使用 create-next-app 的正常流程。只是为了让你知道输出。

> npx create-next-app@latest
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y
✔ What is your project named? … my-app
✔ Would you like to use TypeScript? … No / Yes
✔ Would you like to use ESLint? … No / Yes
✔ Would you like to use Tailwind CSS? … No / Yes
✔ Would you like to use `src/` directory? … No / Yes
✔ Would you like to use App Router? (recommended) … No / Yes
✔ Would you like to customize the default import alias? … No / Yes
✔ What import alias would you like configured? … @/*
Creating a new Next.js app in /Users/zequn/Desktop/t4/my-app.

...
Success! Created my-app at /path/to/project
壳牌 heredoc

评论

1赞 Aaron 9/3/2023
仅供参考,该命令可以以非交互式方式使用,如下所述:nextjs.org/docs/pages/api-reference/...
1赞 David C. Rankin 9/3/2023
数据流的期望是什么?只是读书吗?它是一个脚本吗?,可执行的吗?如果它读起来,heredoc 很好,但脚本也可能是你要找的。npxstdinstdinexpect

答: 暂无答案