0.0.18 • Published 7 months ago

@iicoding/release v0.0.18

Weekly downloads
-
License
-
Repository
github
Last release
7 months ago

npm release util

Setup

Install the dependencies:

pnpm install @iicoding/release

Get started

release your npm library:

pnpm run icd-release [暂未实现]

手动调用方式 1. 根目录下新建 script 文件夹 2. script 文件夹下新建 index.ts

 # 进入到根目录
mkdir script
touch index.ts

# or 手动新建
 ```
3. 从 @iicoding/release 中引入各个任务执行函数[每个函数被称为task]
```typescript
 import {
 eslint,
 gitPush,
 gitTag,
 executeEnd,
 publishAuth,
 publishAfter,
 publishBefore,
 updateVersion,
 publishing,
 getVersion,
 build,
 release,
 } from '@iicoding/release';

 const defaultTaskQueen = [
// 该函数需要在这里执行,传入指定的配置文件。默认为[eslint.config.mjs]
 eslint({ configFile: './eslint.config.mjs' }),
 build,
 getVersion,
 updateVersion,
 publishAuth,
// 发布之前的操作,提供了一个函数,返回 package 的配置项 如果需要求他操作,可以自定义 task
 publishBefore((record) => {
 const omitKeys = ['devDependencies', 'scripts'];
 const newRecord: Record<string, any> = {};
 
     Object.keys(record)
       .filter((key) => {
         return !omitKeys.includes(key);
       })
       .forEach((key) => {
         newRecord[key] = record[key];
       });
 
     return newRecord;
 }),
 publishing,
 publishAfter,
 gitPush,
 gitTag,
 executeEnd,
 ];
 
 const defaultTask = release(defaultTaskQueen);
 
 defaultTask();
 ```
4. 在 package.json 中 script 字段中 添加执行命令
 ```
"release": "ts-node script/index.ts"
  1. 自定义 task
    import { NextMethod, NextParams } from "@iicoding/release"; 
    export const customTaskName = (
      next: NextMethod,
      params: NextParams
    ) => {
    // doSomething
    // 期望的执行成功之后,
    next(params);
    // 或者执行失败
    // 执行失败,如果需要回退版本,则调用下方函数,其他逻辑可自行定制
    params.getRegisterProps('rollbackPackage')(
      `发布失败即将进入回退操作 ${error.message}`,
    );
    }
0.0.12

7 months ago

0.0.13

7 months ago

0.0.14

7 months ago

0.0.15

7 months ago

0.0.16

7 months ago

0.0.17

7 months ago

0.0.18

7 months ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago