Git Product home page Git Product logo

ant-design-pro-cli's Introduction

Cli for Ant Design Pro

Install

npm i @ant-design/pro-cli
# or
yarn add @ant-design/pro-cli

Commands

  • screenshot 对区块进行截图
  • i18n-remove 从项目中移除国际化
  • fetch-blocks 下载 pro 所有的官方区块
  • pro-components-codemod 自动更新 @ant-design/pro-components 的 import 方式

Options for the screenshot command

  • --path 区块的路径,可以用于只截图一个
  • --mobile 使用手机大小的屏幕进行截图

Options for the i18n-remove command

  • --locale 设置语言
  • --write 是否写入文件

Options for the pro-components-codemod command

  • --writePkg 是否自动更新 package.json 中的 dependencies 的添加/删除,默认开启
  • --cleanup 是否开启 cleanup 模式,默认开启
  • --path 需要更新文件的目录,默认 src 目录下的文件

debug

bash

DEBUG=pro-cli pro XXX

PowerShell

$env:DEBUG="pro-cli"
pro xxx

CMD

set DEBUG=pro-cli
pro xxx

Examples

pro

pro -h

screenshot

  • pro screenshot 对所有区块进行截图
  • pro screenshot --path DashboardWorkplace 对单个区块进行截图
  • pro screenshot --mobile 对所有区块进行截图
  • pro screenshot --dumi 使用 dumi 构建的资产,支持手机模式

i18n-remove

  • pro i18n-remove --write

  • pro i18n-remove --locale en-US --write

fetch-blocks

  • pro fetch-blocks

pro-components-codemod

  • pro pro-components-codemod 自动更新 package.json 中的 dependencies 的添加/删除,并将导入模块全部合并到一条 import 语句导入
  • pro pro-components-codemod --writePkg 0 不处理 package.json 中的 dependencies 的添加/删除,只进行 import 导入方式的更新
  • pro pro-components-codemod --path packages 处理 packages 目录下的文件
  • pro pro-components-codemod --cleanup 0 只更新子包的名称为 @ant-design/pro-components,保留旧项目的 import 方式

ant-design-pro-cli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ant-design-pro-cli's Issues

pro init is not working

npm install ant-design-pro-cli -g
mkdir my-project && cd my-project
pro init
pro -V
0.2.0

There are pro new and pro generate with same function, are they duplicated?

install gets JSON error

I used ant-design-pro-cli many times. Recently I couldn't install it again. This is what I tried and the errors I've got:
npm install ant-design-pro-cli
npm ERR! Unexpected end of JSON input while parsing near '...hasum":"2cb9efb834cb0'

npm install @ant-design/pro-cli
npm ERR! Unexpected end of JSON input while parsing near '...7.4.3","@babel/parser'

Environment:
China, no VPN
Windows7 (64-bit)
node 10.16.3 (tried with 8.11.4 too)
nvm
npm 6.11.3

默认生成 umi 4 项目

umi 4 距正式发布( 2022.06.21 )已经有一年多了,已经很久了。

由于 umi 3 不再迭代(非重大安全问题、紧急问题不会修复),随着社区上游依赖的变老和过时,旧时代依赖逐渐被淘汰,使用 umi 3 会遇到越来越多的问题,造成巨大的历史技术债,所以不再推荐继续提供 umi 3 项目模板选项了,应默认即自动生成 umi 4 的项目。

Todo

ant-design/antd-sketchapp#60

参考 vue-cliangular-cli,确定了 pro-cli 的定位。基于 Ant Design Pro 脚手架 的辅助配套工具。README

  • pro init:初始化 Ant Design Pro 脚手架
  • pro new:添加 页面、组件、model 模板
    • 因为已经是 antd-pro 的脚手架基础,所以这里的页面和组件以及 model 都不是 antd pro 里面的,而是简介的代码模板,详见:https://github.com/ant-design/test2-cli/tree/master/boilerplate ,后续会加上无依赖简化版的页面、组件模板,如:卡片布局(antd pro 里面 dashboard 的页面抽象)、表单页(antd pro 里面 表单页的抽象)等

todo

  • init
  • model template
  • page template
    • blank
    • BasicForm
    • BasicList
    • CardList
  • component
    • smart component(standard)
    • dumb component(stateless)
  • service template

ant-design-pro-cli安装失败

node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ant-design-pro-cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64'
gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean"
gyp ERR! cwd /usr/local/lib/node_modules/ant-design-pro-cli/node_modules/fsevents
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/ant-design-pro-cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:947:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/ant-design-pro-cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/ant-design-pro-cli/node_modules/fsevents
node-pre-gyp ERR! node -v v10.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.9.1
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)

pro create 报错

`kenny@kennydeMBP test % pro create test
? 🐂 使用 umi@4 还是 umi@3 ? umi@4
🧎🏻全量区块暂时不支持 umi@4
Cloning into 'test'...
fatal: unable to access 'https://github.com/ant-design/ant-design-pro/': Failed to connect to github.com port 443 after 3 ms: Connection refused
/usr/local/lib/node_modules/@ant-design/pro-cli/node_modules/execa/lib/error.js:60
error = new Error(message);
^

Error: Command failed with exit code 128: git clone https://github.com/ant-design/ant-design-pro --depth=1 test
at makeError (/usr/local/lib/node_modules/@ant-design/pro-cli/node_modules/execa/lib/error.js:60:11)
at handlePromise (/usr/local/lib/node_modules/@ant-design/pro-cli/node_modules/execa/index.js:118:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async AntDesignProGenerator.writing (/usr/local/lib/node_modules/@ant-design/pro-cli/src/create/generators/ant-design-pro/index.js:108:5) {
shortMessage: 'Command failed with exit code 128: git clone https://github.com/ant-design/ant-design-pro --depth=1 test',
command: 'git clone https://github.com/ant-design/ant-design-pro --depth=1 test',
escapedCommand: 'git clone "https://github.com/ant-design/ant-design-pro" "--depth=1" test',
exitCode: 128,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
`

脚手架中会从gitee拉取代码

脚手架中getGithubUrl方法,返回gitee地址的时候,会导致clone下来的代码不是最新的,因为gitee仓库同步的不及时

fetch blocks 日志优化

  1. 把源地址 + 具体下载路径打出来,install 改成 Installing from xxx/xxx/xx

  2. 成功状态换行了,应该是要直接代替 install 那行吧。

image

win下pro g無法選擇選項

pro g 后選擇page
之後就選擇不了了 説是要使用Use arrow keys 我嘗試很多按鍵都無效 連回車也不起作用

RequestError: self signed certificate in certificate chain

执行pro new时报“Failed to download repo https://github.com/ant-design/ant-design-pro#master RequestError: self signed certificate in certificate chain”
···
PS D:\Develop\my-project-cli> pro new
? input project name: my-ant-design-pro
? which directory do you want to init to ? (default is current directory ./):
Failed to download repo https://github.com/ant-design/ant-design-pro#master RequestError: self signed certificate in certificate chain
···
npm和yarn的·strict-ssl=false·都已经设置了
image

还有其他那里需要设置有问题??

After creating a new project using `pro init`, run` npm install react-quill --save` in the project and install the unsuccessful other external modules.

After creating a new project using pro init, run npm install react-quill --save in the project and install the unsuccessful other external modules.

Operating environment:

  1. Windows10
  2. node: v8.8.1
  3. ant-design-pro-cli: v0.1.5

Specific information is as follows:

npm ERR! path D:\test\js\1102\pro-demo\ant-design-pro\node_modules\ajv-keywordsnpm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'D:\test\js\1102\pro-demo\ant-design-pro\node_modules\ajv-
keywords'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

throw error when src/[models|services] directory does not exist

fs.writeFileSync(`${target}/${name}.js`, template.model({ name: name }), 'utf8');

在没有使用pro init 初始化的新项目下执行 pro new 创建 models 或者 services时, 假如项目目录下尚未创建 [models|services] 父目录, 则会抛出 ENOENT: no such file or directory 异常。

是否可以在该行前添加一个判断,假如父目录不存在,就先创建父目录:

 fs.ensureDir(`${target}`);

补充一下为什么不使用 pro init 初始化项目的原因, 从ant-design-pro 中拷贝过来太多内容, 并不完全是我们的项目想用的内容, 一点点删也很麻烦。用 pro new 创建需要的模块进行增量式开发是我们目前比较期待的参考方式。

npm run build报错

fatal - [esbuildHelperChecker] Found conflicts in esbuild helpers: Jt (749.ea5c6f3f.async.js, 980.ed6d7f93.async.js), please set esbuildMinifyIIFE: true in your config file.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

uglify failed when building

Error Message:
Failed to minify the bundle. Error: index.fdfaf320.js from UglifyJs. Unexpected token: name(staticTag)

npm run start都正常工作

参考了一些网上的资料,不知道靠谱靠谱
webpack/webpack#2972

求指导

求增强版生成模板的思路

【需求描述】

cms系统的基本框架:

广州芦苇信息科技有限公司

弹框录入信息↓
广州芦苇信息科技有限公司

如上图,我们的cms系统基本上都是上面的结构(搜索 + table列表 + modal弹框输入)

现在的想法是根据一份配置文件直接生成 modelsroutesservices

广州芦苇信息科技有限公司

配置文件中写Table列表中每一列的名字以及后台的字段名,Form的输入Item同样(并且向根据不同的类型给不同的组件,例如 InputDatePicker之类的)

相当于说将 routes 中Table的columns以及 FormFormItem 都通过配置文件自动生成:

广州芦苇信息科技有限公司
广州芦苇信息科技有限公司

从而代替人工一个个替换,一个个添加的苦力活。

【问题】

  1. yeoman,应该只能初始化项目的目录结构(不知道我说的对不对),想生成项目中的模板文件,可能不太合适
  2. 目前觉得这个需求跟 ng-cli 或者是 vue-cli 挺像的,也知道 ant-design-pro-cli 也有提供类似的功能,但还没有完成实现以上需求。
  3. 所以现在的想法是想试试改一下 ant-design-pro-cli 的源码,看能否实现需求。
  4. 不知自己的这个思路有没有问题,或者有没有其它更快去做这些基本上都是固定格式的cms模块(基本上确实都只是简单的苦力活,想解放生产力o(╥﹏╥)o)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.