Skip to content

Commit

Permalink
feat(notify): bin
Browse files Browse the repository at this point in the history
  • Loading branch information
Airkro committed Dec 22, 2023
1 parent b690954 commit 3cc34c1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/bring-it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,3 @@ jobs:
with:
npm-token: ${{ secrets.NPM_TOKEN }}
publish-command: npx -p @bring-it/npm@latest bring-it npm
custom-command: |
cd packages
mkdir -p cli/dist
touch $_/cli.mjs
1 change: 1 addition & 0 deletions packages/notify/.best-shot/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const config = {
path: 'dist',
module: true,
},
copy: ['./lib/bin.mjs'],
entry: {
sub: './lib/cmd.mjs',
},
Expand Down
3 changes: 1 addition & 2 deletions packages/notify/lib/action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export async function action({ mode }) {
for (const { DingTalkRobotToken: token, levels: lv } of all.subscribe) {
if (
token &&
lv?.length &&
levels.some((level) => lv.includes(level))
(!lv || (lv?.length && levels.some((level) => lv.includes(level))))
) {
dingtalk({ markdown, token });
}
Expand Down
4 changes: 4 additions & 0 deletions packages/notify/lib/bin.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

/* eslint-disable n/shebang */
import '@bring-it/cli/dist/cli.mjs';
5 changes: 4 additions & 1 deletion packages/notify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/notify",
"version": "0.2.9",
"version": "0.2.10",
"description": "Send releases notifications",
"license": "MIT",
"author": {
Expand All @@ -27,6 +27,9 @@
"bugs": {
"url": "https://github.com/airkro/bring-it/issues"
},
"bin": {
"bring-it": "dist/bin.mjs"
},
"main": "dist/sub.mjs",
"files": [
"dist"
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function readJSON(configName, logger) {
if (BRANCH_NAME) {
const { branches, ...rest } = json;

return { ...rest, ...branches[BRANCH_NAME] };
return { ...rest, ...branches?.[BRANCH_NAME] };
}

return json;
Expand Down

0 comments on commit 3cc34c1

Please sign in to comment.