6
6
const path = require ( 'path' ) ;
7
7
const { execSync } = require ( 'child_process' ) ;
8
8
const BasePlugin = require ( 'ember-cli-deploy-plugin' ) ;
9
+ const packageJson = require ( "./package.json" ) ;
9
10
10
11
module . exports = {
11
- name : require ( './package' ) . name ,
12
+ name : packageJson . name ,
12
13
13
14
createDeployPlugin ( options ) {
14
15
const DeployPlugin = BasePlugin . extend ( {
15
16
name : options . name ,
16
17
17
18
defaultConfig : {
18
19
assetsDir ( context ) {
19
- return path . join ( context . distDir , ' assets' ) ;
20
+ return path . join ( context . distDir , " assets" ) ;
20
21
} ,
21
22
22
23
revisionKey ( context ) {
@@ -27,70 +28,83 @@ module.exports = {
27
28
return context . deployTarget ;
28
29
} ,
29
30
30
- url : '' ,
31
+ url : "" ,
31
32
} ,
32
33
33
- requiredConfig : [ ' appName' , ' orgName' , ' authToken' ] ,
34
+ requiredConfig : [ " appName" , " orgName" , " authToken" ] ,
34
35
35
36
didPrepare ( ) {
36
- const releaseName = `${ this . readConfig ( 'appName' ) } @${ this . readConfig ( 'revisionKey' ) } ` ;
37
- const assetsDir = this . readConfig ( 'assetsDir' ) ;
38
- const urlPrefix = this . readConfig ( 'urlPrefix' ) ? `--url-prefix ${ this . readConfig ( 'urlPrefix' ) } ` : '' ;
39
-
40
- this . log ( 'SENTRY: Creating release...' ) ;
41
- this . sentryCliExec ( 'releases' , `new ${ releaseName } ` ) ;
42
-
43
- this . log ( 'SENTRY: Assigning commits...' ) ;
44
- this . sentryCliExec ( 'releases' , `set-commits ${ releaseName } --auto --ignore-missing` ) ;
37
+ const releaseName = `${ this . readConfig ( "appName" ) } @${ this . readConfig (
38
+ "revisionKey"
39
+ ) } `;
40
+ const assetsDir = this . readConfig ( "assetsDir" ) ;
41
+ const urlPrefix = this . readConfig ( "urlPrefix" )
42
+ ? `--url-prefix ${ this . readConfig ( "urlPrefix" ) } `
43
+ : "" ;
44
+
45
+ this . log ( "SENTRY: Creating release..." ) ;
46
+ this . sentryCliExec ( "releases" , `new ${ releaseName } ` ) ;
47
+
48
+ this . log ( "SENTRY: Assigning commits..." ) ;
49
+ this . sentryCliExec (
50
+ "releases" ,
51
+ `set-commits ${ releaseName } --auto --ignore-missing`
52
+ ) ;
45
53
46
- this . log ( 'SENTRY: Uploading source maps...' ) ;
47
- this . sentryCliExec ( 'releases' , `files ${ releaseName } upload-sourcemaps --rewrite ${ assetsDir } ${ urlPrefix } ` ) ;
54
+ this . log ( "SENTRY: Uploading source maps..." ) ;
55
+ this . sentryCliExec (
56
+ "releases" ,
57
+ `files ${ releaseName } upload-sourcemaps --rewrite ${ assetsDir } ${ urlPrefix } `
58
+ ) ;
48
59
49
- this . log ( ' SENTRY: Finalizing release...' ) ;
50
- this . sentryCliExec ( ' releases' , `finalize ${ releaseName } ` ) ;
60
+ this . log ( " SENTRY: Finalizing release..." ) ;
61
+ this . sentryCliExec ( " releases" , `finalize ${ releaseName } ` ) ;
51
62
52
- this . log ( ' SENTRY: Release published!...' ) ;
63
+ this . log ( " SENTRY: Release published!..." ) ;
53
64
} ,
54
65
55
66
didDeploy ( ) {
56
- const appName = this . readConfig ( 'appName' ) ;
57
- const releaseName = `${ appName } @${ this . readConfig ( 'revisionKey' ) } ` ;
58
- const environment = this . readConfig ( 'environment' ) ;
59
-
60
- this . log ( 'SENTRY: Deploying release...' ) ;
61
- this . sentryCliExec ( 'releases' , `deploys ${ releaseName } new -e ${ environment } ` ) ;
62
- this . log ( 'SENTRY: Deployed!' ) ;
67
+ const appName = this . readConfig ( "appName" ) ;
68
+ const releaseName = `${ appName } @${ this . readConfig ( "revisionKey" ) } ` ;
69
+ const environment = this . readConfig ( "environment" ) ;
70
+
71
+ this . log ( "SENTRY: Deploying release..." ) ;
72
+ this . sentryCliExec (
73
+ "releases" ,
74
+ `deploys ${ releaseName } new -e ${ environment } `
75
+ ) ;
76
+ this . log ( "SENTRY: Deployed!" ) ;
63
77
} ,
64
78
65
79
didFail ( ) {
66
- const appName = this . readConfig ( ' appName' ) ;
67
- const releaseName = `${ appName } @${ this . readConfig ( ' revisionKey' ) } ` ;
80
+ const appName = this . readConfig ( " appName" ) ;
81
+ const releaseName = `${ appName } @${ this . readConfig ( " revisionKey" ) } ` ;
68
82
69
- this . log ( ' SENTRY: Deleting release...' ) ;
70
- this . sentryCliExec ( ' releases' , `delete ${ releaseName } ` ) ;
71
- this . log ( ' SENTRY: Release deleted!' ) ;
83
+ this . log ( " SENTRY: Deleting release..." ) ;
84
+ this . sentryCliExec ( " releases" , `delete ${ releaseName } ` ) ;
85
+ this . log ( " SENTRY: Release deleted!" ) ;
72
86
} ,
73
87
74
88
sentryCliExec ( command , subCommand ) {
75
- const authToken = this . readConfig ( ' authToken' ) ;
76
- const orgName = this . readConfig ( ' orgName' ) ;
77
- const appName = this . readConfig ( ' appName' ) ;
78
- const url = this . readConfig ( ' url' ) ;
89
+ const authToken = this . readConfig ( " authToken" ) ;
90
+ const orgName = this . readConfig ( " orgName" ) ;
91
+ const appName = this . readConfig ( " appName" ) ;
92
+ const url = this . readConfig ( " url" ) ;
79
93
80
94
return this . _exec (
81
95
[
82
- path . join ( ' node_modules' , ' .bin' , ' sentry-cli' ) ,
83
- url ? `--url ${ url } ` : '' ,
96
+ path . join ( " node_modules" , " .bin" , " sentry-cli" ) ,
97
+ url ? `--url ${ url } ` : "" ,
84
98
`--auth-token ${ authToken } ` ,
85
99
command ,
86
100
`--org ${ orgName } ` ,
87
101
`--project ${ appName } ` ,
88
102
subCommand ,
89
- ] . join ( ' ' )
103
+ ] . join ( " " )
90
104
) ;
91
105
} ,
92
106
93
- _exec ( command = '' ) {
107
+ _exec ( command = "" ) {
94
108
return execSync ( command , { cwd : this . project . root } ) ;
95
109
} ,
96
110
} ) ;
0 commit comments