Skip to content

Commit c494e85

Browse files
committed
Init
0 parents  commit c494e85

13 files changed

+4437
-0
lines changed

.editorconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
indent_style = space
14+
indent_size = 2
15+
16+
[*.hbs]
17+
insert_final_newline = false
18+
19+
[*.{diff,md}]
20+
trim_trailing_whitespace = false

.eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# dependencies
2+
/bower_components/
3+
/node_modules/
4+
5+
# misc
6+
!.*

.eslintrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
root: true,
3+
4+
plugins: [
5+
'@paycertify'
6+
],
7+
8+
extends: [
9+
'plugin:@paycertify/recommended',
10+
'plugin:@paycertify/node'
11+
],
12+
13+
env: {
14+
mocha: true
15+
}
16+
};

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist/
5+
/tmp/
6+
7+
# dependencies
8+
/bower_components/
9+
/node_modules/
10+
11+
# misc
12+
/.env*
13+
/.pnp*
14+
/.sass-cache
15+
/connect.lock
16+
/coverage/
17+
/libpeerconnection.log
18+
/npm-debug.log*
19+
/testem.log
20+
/yarn-error.log
21+
22+
# ember-try
23+
/.node_modules.ember-try/
24+
/bower.json.ember-try
25+
/package.json.ember-try

.npmignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# dependencies
2+
/bower_components/
3+
4+
# misc
5+
/.bowerrc
6+
/.editorconfig
7+
/.env*
8+
/.eslintignore
9+
/.eslintrc.js
10+
/.gitignore
11+
/.travis.yml
12+
/bower.json
13+
/CONTRIBUTING.md
14+
/tests/
15+
/yarn.lock
16+
.gitkeep

.travis.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
language: node_js
3+
node_js:
4+
- "8"
5+
6+
sudo: false
7+
dist: trusty
8+
9+
cache:
10+
directories:
11+
- $HOME/.npm
12+
13+
env:
14+
global:
15+
# See https://git.io/vdao3 for details.
16+
- JOBS=1
17+
18+
script:
19+
- npm run lint
20+
- npm test

LICENSE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ember-cli-deploy-sentry-cli
2+
3+
Integrate your deploy pipeline with Sentry. Upload sourcemaps, assign related commits and manage releases.
4+
5+
6+
# Compatibility
7+
8+
* ember-cli-deploy v1.0 or above
9+
* Node.js v8 or above
10+
11+
12+
## Installation
13+
14+
```
15+
ember install ember-cli-deploy-sentry-cli
16+
```
17+
18+
19+
## Usage
20+
21+
Add plugin config to your `config/deploy.js`:
22+
```js
23+
{
24+
'sentry-cli': {
25+
appName: 'sentry-app-name',
26+
orgName: 'sentry-org-name',
27+
authToken: process.env.SENTRY_AUTH_TOKEN
28+
}
29+
}
30+
```
31+
32+
Optionaly set revision type to `version-commit` to have unified versioning pattern:
33+
```js
34+
{
35+
'revision-data': {
36+
type: 'version-commit'
37+
}
38+
}
39+
```
40+
41+
Leave the rest for sentry-cli ;) Deploy! 🚀✌️
42+
43+
## FAQ & Possible errors
44+
45+
#### 1. `You do not have permission to perform this action`
46+
Your `authToken` needs to have following scopes: `org:read` and `project:releases`
47+
48+
#### 2. `Could not determine any commits to be associated automatically.`
49+
Your application repository needs to be connected on Sentry to your ogranization account and connected with the project.
50+
51+
## License
52+
53+
This project is licensed under the [MIT License](LICENSE.md).

index.js

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/* eslint-disable max-len, max-lines-per-function */
2+
'use strict';
3+
4+
const path = require('path');
5+
const { execSync } = require('child_process');
6+
const BasePlugin = require('ember-cli-deploy-plugin');
7+
8+
module.exports = {
9+
name: require('./package').name,
10+
11+
createDeployPlugin(options) {
12+
const DeployPlugin = BasePlugin.extend({
13+
name: options.name,
14+
15+
defaultConfig: {
16+
assetsDir(context) {
17+
return path.join(context.distDir, 'assets');
18+
},
19+
20+
revisionKey(context) {
21+
return context.revisionData && context.revisionData.revisionKey;
22+
},
23+
24+
environment(context) {
25+
return context.deployTarget;
26+
}
27+
},
28+
29+
requiredConfig: ['appName', 'orgName', 'authToken'],
30+
31+
didPrepare() {
32+
const releaseName = `${this.readConfig('appName')}@${this.readConfig('revisionKey')}`;
33+
const assetsDir = this.readConfig('assetsDir');
34+
35+
this.log('SENTRY: Creating release...');
36+
this.sentryCliExec(`releases new ${releaseName}`);
37+
38+
this.log('SENTRY: Assigning commits...');
39+
this.sentryCliExec(`releases set-commits --auto ${releaseName}`);
40+
41+
this.log('SENTRY: Uploading source maps...');
42+
this.sentryCliExec(`releases files ${releaseName} upload-sourcemaps --rewrite ${assetsDir}`);
43+
44+
this.log('SENTRY: Finalizing release...');
45+
this.sentryCliExec(`releases finalize ${releaseName}`);
46+
47+
this.log('SENTRY: Release published!...');
48+
},
49+
50+
didDeploy() {
51+
const appName = this.readConfig('appName');
52+
const releaseName = `${appName}@${this.readConfig('revisionKey')}`;
53+
const environment = this.readConfig('environment');
54+
55+
this.log('SENTRY: Deploying release...');
56+
this.sentryCliExec(`releases deploys ${releaseName} new -e ${environment}`);
57+
this.log('SENTRY: Deployed!');
58+
},
59+
60+
didFail() {
61+
const appName = this.readConfig('appName');
62+
const releaseName = `${appName}@${this.readConfig('revisionKey')}`;
63+
64+
this.log('SENTRY: Deleting release...');
65+
this.sentryCliExec(`releases delete ${releaseName}`);
66+
this.log('SENTRY: Release deleted!');
67+
},
68+
69+
sentryCliExec(command) {
70+
const authToken = this.readConfig('authToken');
71+
const orgName = this.readConfig('orgName');
72+
const appName = this.readConfig('appName');
73+
74+
return this._exec(
75+
`SENTRY_ORG=${orgName} ` +
76+
`SENTRY_AUTH_TOKEN=${authToken} ` +
77+
`SENTRY_PROJECT=${appName} ` +
78+
`node_modules/.bin/sentry-cli ${command}`
79+
);
80+
},
81+
82+
_exec(command = '') {
83+
return execSync(command, { cwd: this.project.root });
84+
}
85+
});
86+
87+
return new DeployPlugin();
88+
}
89+
};

0 commit comments

Comments
 (0)