Giter Club home page Giter Club logo

easy-issue's Introduction

easy-issue

一个根据本地 markdown 文件(需要指定)生成 github issue,并推送到个人仓库(需要指定)的小工具。

头都要笑飞的背景

之前我打算用 GitHub issue 当博客(希望这种想法不要被打),当进入New issue时,我看到那个界面有些“不好看”,然后就想着在本地用 markdown 写博客,然后通过脚本将文件内容自动生成指定仓库的 issue。

说干就干!

等我写完这个小工具之后,再次进入New issue时,突然看到那个界面不是之前看到的那样,那个编辑器界面还挺好看的。

然后就想到那晚应该是网络不好,那个编辑器界面没刷新出来。

使用

安装

npm i easy-issues -D

安装完成之后,执行:

npx issue init

这个命令执行后,easy-issue会将issue命令添加到 package.json 的 scripts 里面,然后在根目录下创建issue.config.jseditor.md文件。当然,你也可以不需要执行这个命令,直接在根目录下创建issue.config.jseditor.md文件。

你在editor.md里面写完你的内容之后,在终端执行

npm run issue

或者

npx issue

easy-issue就会解析editor.md,生成 GitHub issue,然后上传到指定仓库。

issue.config.js

module.exports = {
  owner: '用户名',
  repo: '指定仓库',
  accessToken: 'personal access token',
  editor: 'issue内容的markdown文件名(可选,默认是根目录下的editor.md)',
};

editor 文件

格式必须如下:

---
title: 'issue名称'
labels:
  - label1
  - ...
---
你的issue内容

需要注意的是labels所指定的 issue label 必须是存在仓库里面。

Node API

姑且弄了 node api,使用方法如下:

const easyIssue = require('easy-issue');

// 相当于 npx issue init
easyIssue.init(context, editor);

// 相当于 npx issue
easyIssue.post(context, config);

init()方法需要提供当前的根目录路径contexteditor默认值是当前根目录下的editor.md文件

post()方法的参数contextinit方法一样,而参数config的内容就是issue.config.js。在这种情况下,你可以将 markdown 内容直接传入config.editor,它内部会以/\.md$/来判断是否将config.editor提供的内容作为 issue 的原始内容。

easy-issue's People

Contributors

baiyusoup avatar

Watchers

 avatar  avatar

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.