@@ -2,7 +2,7 @@ import { logging } from '@angular-devkit/core';
2
2
3
3
import { Schema } from '../deploy/schema' ;
4
4
const Heroku = require ( 'heroku-client' ) ;
5
- var url = require ( 'url' ) ;
5
+ import * as tar from 'tar' ;
6
6
const fetch = require ( "node-fetch" ) ;
7
7
8
8
// TODO: add your deployment code here!
@@ -17,28 +17,35 @@ export async function run(dir: string, options: Schema, logger: logging.LoggerAp
17
17
18
18
const slugResult = await heroku . post ( `/apps/${ site . name } /slugs` , {
19
19
body : {
20
- process_types : { "web" : "node-v0.10.20-linux-x64/bin/node index.js" }
20
+ process_types : { "web" : "node-v0.10.20-linux-x64/bin/node index.js" } ,
21
+ buildpack_provided_description : "heroku/nodejs"
21
22
}
22
23
}
23
24
) ;
24
25
25
26
// const upload
26
27
// console.log(site);
27
28
console . log ( slugResult ) ;
28
- const apiUrl = slugResult . blob . url . replace ( '%3D' , '=' ) ;
29
- console . log ( apiUrl ) ;
30
29
30
+ const tarResponse = await tar . c (
31
+ {
32
+ gzip : true ,
33
+ file : `${ dir } .tgz`
34
+ } ,
35
+ [ dir ]
36
+ ) ;
37
+
38
+ console . log ( `${ tarResponse } response` ) ;
31
39
32
40
const response = await fetch ( slugResult . blob . url , {
33
41
method : `${ slugResult . blob . method } ` , // or 'PUT'
34
42
// body: JSON.stringify(data), // data can be `string` or {object}!
35
- body : '@E:\ngx-deploy-heroku\ngx-deploy-sample\ngx-deploy-sample-0.0.0. tgz' ,
43
+ body : `@ ${ dir } . tgz` ,
36
44
headers : {
37
- 'Content-Type' : ''
45
+ 'Content-Type' : ``
38
46
}
39
47
} ) ;
40
48
console . log ( response ) ;
41
- console . log ( slugResult . id ) ;
42
49
43
50
const release = await heroku . post ( `/apps/${ site . name } /releases` , {
44
51
body : {
0 commit comments