Code Monkey home page Code Monkey logo

create-blocklet's Introduction


Features

A tool helps you to quickly setup a blocklet for Blocklet Server, with:

  • Out of the box to use
  • Plenty of templates
  • Seamless integration with Blocklet Server

View more details on Create Blocklet

Check docs in here

Docs

Our docs site is generate by Create Blocklet itself.

We use Blocklet Page to write our docs

check more details on

plugins

TBD

Install deps

pnpm install

create-blocklet's People

Contributors

dependabot[bot] avatar donotlb avatar firetable avatar frmachao avatar kirakiray avatar lancelotlewis avatar li-yechao avatar linchen1987 avatar naterobinson avatar pd4d10 avatar polunzh avatar skypesky avatar vmcodes avatar wangshijun avatar ymzuiku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

create-blocklet's Issues

产生出来的project的readme 能不能也是模版产生

产生出来的project的readme 能不能也是模版产生, 可以其中一段是介绍create-blocklet的,但不要照抄create-blocklet自己的。

现在如果用户用这个创建后不修改,容易造成错觉就是create-blocklet.

初始化之后 blocklet 启动并不是用的 blocklet dev?

这个需要想办法 enforce,不然 auth-service 没法用,思路如下:

  • 把 abtnode cli 作为生成项目的 dev dependency
  • abtnode 已经支持在任意路径下初始化启动,比如 abtnode start -a
  • 启动 blocklet 之前确保 node 已经起来了,可以看看 start-server-and-test

Unable to generate Blocklet

The init create blocklet command fails on ABTNode 1.4.6 docker image.

$ docker run  -p 80:80 -p 443:443  -v "$(pwd)":/data/abtnode -it  arcblock/abtnode:1.4.6 bash
arcblock@460effcae987:/data/abtnode$ npm init blocklet@latest demo1
npx: installed 117 in 9.243s
file:///home/arcblock/.npm/_npx/10/lib/node_modules/create-blocklet/lib/npm.js:5
  return conf?.[key] || '';
              ^

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)
arcblock@460effcae987:/data/abtnode$ $?
bash: 1: command not found

The above command failed without generating the blocklet.

arcblock@460effcae987:/data/abtnode$ ls
'Untitled Diagram (3).png'   abt-node-arch-overview-en.png   abtnode-docs   create-blocklet   lts.gif   lts.mov   node-password-token.md

Unable to start the generated Blocklet

When working with node :16 the blocket causes the following errors :

  • The generation reports an error but still generated the blocklet code.
TypeError: Cannot read property 'replace' of undefined
    at getDid (file:///root/.npm/_npx/4daa8ae53dba528c/node_modules/create-blocklet/index.js:353:24)
    at file:///root/.npm/_npx/4daa8ae53dba528c/node_modules/create-blocklet/index.js:284:17
    at init (file:///root/.npm/_npx/4daa8ae53dba528c/node_modules/create-blocklet/index.js:295:5)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
  • ABT Node initialization fails to find nginx routing service.
root@12cfd7537d70:/data/abtnode# abtnode init --mode=debug
abtnode init v1.4.6
? Are you sure to initialize a ABT Node instance in the current directory(/data/abtnode) Yes
✖ No supported routing engine found, please install a supported routing engine first.
⚠ Supported routing engines are: nginx

PFA the output.log

create blocklet 是否能帮助用户检查一下ABT Node的环境

create blocklet 是否能帮助用户配置和检查一下ABT Node的环境,这样让下面开发和运行更流畅。

注意可以是本地有abt node, 也可以是配置使用远程的abt node, 或docker里的。

几种情况:

  • 没有配置可用的abt node
  • abt node没有安装
  • abt node 没有运行
  • abt node版本太低不兼容
  • 设置不正确 (如果能检查出来)
  • 没有权限部署

理想中能支持本地安装的abt node, 远程 的 abt node, docker里的abtnode等 (这些情况可能是有交集的)

建议添加一个仅含后端代码的 Blocklet 模板

两个场景:

  1. Node.js 服务端的 Coding Test 只要求实现 API, 现在的模板可能会给面试者带来麻烦
  2. 我们自己有几个没有前端的 Blocklet: IP Echo DNS, DID DNS,所以后面可能会有需求

Bug bash: 20210802

在没有任何外界指导的情况下,通过文档去了解怎么使用该工具,以及使用该工具创建了项目之后,通过创建的项目中的文档去了解怎么去开发、打包、部署、发布该项目
Docs: https://github.com/blocklet/create-blocklet
Issues: Link to this one, New issue

  • dapp → react → none service @wangshijun
  • dapp → react → auth service @NateRobinson @LancelotLewis
  • static → react → none service @PaperHS
  • static → react → auth service @donotlb
  • 本地开发成功
  • 本地打包成功
  • 本地部署成功
  • 本地发布成功(可以在本地部署一个 registry,再进行后续的操作)

Bug Bash 20210930

测试目标:

  • 使用 create-blocklet 生成不同的项目后,不同的 blocklet 默认的 logo.png 是不同的

  • 使用 create-blocklet 生成项目中的 npm scripts 包含 "upload" 命令

  • 通过自带的 upload 命令可以将 blocklet 上传到 test registry (需要设置 bn config registry https://test.registry.arcblock.io/)

  • yarn create blocklet demo-name

dev 模式下接口异常

通过 dapp no-service 参数创建的 blocklet,在dev模式中有个接口异常

image

将 blocklet 打包并发布到 production 环境后运行是正常的

#8

[hold] bundle:client 中去掉 PUBLIC_URL

在支持了 ip-dns-domain endpoint 后

  • 普通 blocklet build 时不需要指定 PUBLIC_URL
  • 只有 component blocklet build 时才需要 PUBLIC_URL='/.blocklet/proxy/xxxxx,

建议:

  • 增加一个选项:是否是 component blocklet,默认 false
  • 是component blocklet 时,在package.json 中 bundle:client 和现在保持一致,不是 component blocklet 时,在package.json 中 bundle:client 不指定 PUBLIC_URL

优先级低

dapp blocklet 初始化结果的一些建议

  • @testing-library 这组依赖应该是 devDependency?
  • 出来的项目没有个很好的 readme,参考 create-react-app 出来的 readme,关于下面这些话题可以都写上:
  • package.json scripts 里面很多地方用到了 yarn,不能假设用户那边有 yarn,建议都是用 npm
  • blocklet author 信息建议从环境里面读取,可以参考下 https://github.com/ArcBlock/abt-node/blob/master/core/cli/lib/commands/blocklet/init.js#L119
  • arcblock eslint config 的包名得改下
  • pre-start 里面有个 lint 错误,并且关于 是不是 childComponent 的判断可以直接使用 env,代码更可读
  • 前端项目里面最好能包含 react-router-dom?并且帮他把 blocklet 配成 pathPrefix 自适应的
  • public/index.html 里面的页面 title 也应该展示用户设置的应用名字?

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.