-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
341 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const config = { | ||
target: 'node16', | ||
output: { | ||
path: 'dist', | ||
module: true, | ||
}, | ||
entry: { | ||
cli: './lib/bin.mjs', | ||
sub: './lib/cmd.mjs', | ||
}, | ||
externals: { | ||
yargs: 'yargs', | ||
'@sentry/cli': '@sentry/cli', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# @bring-it/sentry | ||
|
||
Update sentry artifacts. | ||
|
||
[![npm][npm-badge]][npm-url] | ||
[![github][github-badge]][github-url] | ||
![node][node-badge] | ||
|
||
[npm-url]: https://www.npmjs.com/package/@bring-it/sentry | ||
[npm-badge]: https://img.shields.io/npm/v/@bring-it/sentry.svg?style=flat-square&logo=npm | ||
[github-url]: https://github.com/airkro/bring-it/tree/master/packages/sentry | ||
[github-badge]: https://img.shields.io/npm/l/@bring-it/sentry.svg?style=flat-square&colorB=blue&logo=github | ||
[node-badge]: https://img.shields.io/node/v/@bring-it/sentry.svg?style=flat-square&colorB=green&logo=node.js | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @bring-it/sentry @sentry/cli -g | ||
``` | ||
|
||
## Usage | ||
|
||
```bash | ||
npm x bring-it sentry | ||
``` | ||
|
||
## Config | ||
|
||
```jsonc | ||
// .bring-it/sentry.config.json | ||
{ | ||
"*": {} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as pack from '@bring-it/utils/cmd/pack.mjs'; | ||
import { Cheetor } from 'cheetor'; | ||
|
||
import * as main from './cmd.mjs'; | ||
|
||
new Cheetor('../package.json', import.meta.url) | ||
.command(pack) | ||
.command(main) | ||
.commandSafe('@bring-it/npm/dist/sub.mjs') | ||
.commandSafe('@bring-it/sample/dist/sub.mjs') | ||
.commandSafe('@bring-it/sftp/dist/sub.mjs') | ||
.config((cli) => cli.wrap(null)) | ||
.setup(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { action } from './utils.mjs'; | ||
|
||
export const command = 'sentry'; | ||
|
||
export const describe = 'Update sentry artifacts'; | ||
|
||
export function builder(cli) { | ||
cli | ||
.option('config', { | ||
describe: 'Config file path', | ||
default: '.bring-it/sentry.config.json', | ||
type: 'string', | ||
}) | ||
.option('mode', { | ||
describe: 'deploy mode', | ||
default: 'development', | ||
type: 'string', | ||
}); | ||
} | ||
|
||
export function handler(io) { | ||
action(io).catch(console.error); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { execFileSync } from 'node:child_process'; | ||
import { readFile } from 'node:fs/promises'; | ||
|
||
import { Logger } from '@bring-it/utils'; | ||
|
||
const logger = new Logger('sentry'); | ||
|
||
function commitHash() { | ||
return execFileSync('git', ['rev-parse', '--short', 'HEAD'], { | ||
encoding: 'utf8', | ||
}).trim(); | ||
} | ||
|
||
function readConfig(configName) { | ||
return readFile(configName, 'utf8') | ||
.then((text) => JSON.parse(text)) | ||
.catch((error) => { | ||
logger.warn(error.message); | ||
logger.info('Fallback to default configuration'); | ||
|
||
return {}; | ||
}); | ||
} | ||
|
||
export async function action({ config, mode }) { | ||
const { '*': all, [mode]: current } = await readConfig(config); | ||
|
||
const { url, org, project, authToken, globs } = { ...all, ...current }; | ||
|
||
const io = { | ||
url, | ||
org, | ||
project, | ||
authToken, | ||
globs, | ||
release: { | ||
name: commitHash(), | ||
deploy: { | ||
env: mode, | ||
}, | ||
}, | ||
}; | ||
|
||
console.log(io); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"private": true, | ||
"name": "@bring-it/sentry", | ||
"version": "0.0.0-beta", | ||
"description": "Update sentry artifacts", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Eric Chen", | ||
"email": "[email protected]" | ||
}, | ||
"keywords": [ | ||
"bring-it", | ||
"ci", | ||
"cli", | ||
"code", | ||
"sentry", | ||
"sourcemap", | ||
"sourcemaps" | ||
], | ||
"homepage": "https://github.com/airkro/bring-it/tree/master/packages/sentry", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/airkro/bring-it.git", | ||
"directory": "packages/sentry" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/airkro/bring-it/issues" | ||
}, | ||
"bin": { | ||
"bring-it": "dist/cli.mjs" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"scripts": { | ||
"build": "best-shot prod", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"dependencies": { | ||
"yargs": "^17.7.2" | ||
}, | ||
"devDependencies": { | ||
"@bring-it/utils": "*", | ||
"cheetor": "^0.13.0", | ||
"globby": "^13.2.2" | ||
}, | ||
"peerDependencies": { | ||
"@sentry/cli": "^2.21.2" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@sentry/cli": { | ||
"optional": true | ||
} | ||
}, | ||
"engines": { | ||
"node": "^16.15.0 || ^18.0.0", | ||
"npm": ">=9.4.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters