基于区块链的毕业设计Create a JavaScript Action – 创建JavaScript操作

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Create a JavaScript Action – 创建JavaScript操作 是一篇很好的国外资料

Create a JavaScript Action

Create a JavaScript Action - 创建JavaScript操作

Use this template to bootstrap the creation of a JavaScript action.?

This template includes tests, linting, a validation workflow, publishing, and versioning guidance.

If you are new, there’s also a simpler introduction. See the Hello World JavaScript Action

Create an action from this template

Click the Use this Template and provide the new repo details for your action

Code in Main

Install the dependencies

npm install

Run the tests ✔️

$ npm test   PASS  ./index.test.js   ✓ throws invalid number (3ms)   ✓ wait 500 ms (504ms)   ✓ test runs (95ms) ...

Change action.yml

The action.yml defines the inputs and output for your action.

Update the action.yml with your name, description, inputs and outputs for your action.

See the documentation

Change the Code

Most toolkit and CI/CD operations involve async operations so the action is run in an async function.

const core = require('@actions/core'); ...  async function run() {   try {       ...   }   catch (error) {     core.setFailed(error.message);   } }  run()

See the toolkit documentation for the various packages.

Package for distribution

GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.

Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.

Run prepare

npm run prepare

Since the packaged index.js is run from the dist folder.

git add dist

Create a release branch

Users shouldn’t consume the action from master since that would be latest code and actions can break compatibility between major versions.

Checkin to the v1 release branch

git checkout -b v1 git commit -a -m "v1 release"
git push origin v1

Note: We recommend using the --license option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! ?

See the versioning documentation

Usage

You can now consume the action by referencing the v1 branch

uses: actions/[email protected] with:   milliseconds: 1000

See the actions tab for runs of this action! ?

Initial commit


创建JavaScript操作

Create a JavaScript Action - 创建JavaScript操作

使用此模板引导JavaScript操作的创建。?

此模板包括测试、linting、验证工作流、发布和版本控制指导

如果你是新来的,这里还有一个简单的介绍。查看helloworld JavaScript操作

根据此模板创建操作

单击使用此模板并提供操作的新repo详细信息

Main中的代码

安装依赖项

npm install

运行测试✔️

$ npm test   PASS  ./index.test.js   ✓ throws invalid number (3ms)   ✓ wait 500 ms (504ms)   ✓ test runs (95ms) ...

更改操作.yml

action.yml定义操作的输入和输出

用您的姓名、描述、操作的输入和输出更新action.yml

请参阅文档

更改代码

大多数工具箱和CI/CD操作都涉及异步操作,因此操作在异步函数中运行

const core = require('@actions/core'); ...  async function run() {   try {       ...   }   catch (error) {     core.setFailed(error.message);   } }  run()

有关各种软件包,请参阅工具箱文档

分发包

GitHub操作将从action.yml运行入口点。打包将代码组装到一个可以签入Git的文件中,从而实现快速可靠的执行,并避免签入nodeu模块

操作从GitHub repos运行。打包操作将在dist文件夹中创建打包的操作

运行prepare

npm run prepare

,因为打包的index.js是从dist文件夹运行的

git add dist

创建发布分支

用户不应该使用master的操作,因为这是最新的代码,操作会破坏主要版本之间的兼容性

签入v1发行版分支

git checkout -b v1 git commit -a -m "v1 release"
git push origin v1

注意:我们建议对ncc使用–license选项,它将为项目中使用的所有生产节点模块创建一个许可证文件

您的操作现在已发布!?

请参阅版本控制文档

用法

您现在可以通过引用v1分支来使用操作

uses: actions/[email protected] with:   milliseconds: 1000

请参阅操作选项卡以运行此操作!?

Initial commit

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/22853.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Create a JavaScript Action – 创建JavaScript操作

提供最优质的资源集合

立即查看 了解详情