@@ -4,7 +4,7 @@ import { Schema } from '../deploy/schema';
4
4
const Heroku = require ( 'heroku-client' ) ;
5
5
import * as tar from 'tar' ;
6
6
const fetch = require ( "node-fetch" ) ;
7
-
7
+ import { ensureDir , copy , remove } from 'fs-extra' ;
8
8
// TODO: add your deployment code here!
9
9
export async function run ( dir : string ,
10
10
options : Schema ,
@@ -29,20 +29,27 @@ export async function run(dir: string,
29
29
// const upload
30
30
// console.log(site);
31
31
console . log ( slugResult ) ;
32
+ // !fs.existsSync(`${dir}/app`) && fs.mkdirSync(`${dir}/app`);
33
+
34
+ await remove ( `${ dir } /app` ) ;
35
+ await remove ( `${ dir } /slug.tgz` ) ;
36
+ await ensureDir ( `${ dir } /app` ) ;
37
+ await copy ( `${ outDir } ` , `${ dir } /app` ) ;
38
+ // await copy(`${dir}/index.js`, `${dir}/app`);
32
39
33
40
console . log ( `${ outDir } outdir` ) ;
34
41
const tarResponse = await tar . c (
35
42
{
36
43
gzip : true ,
37
44
file : 'slug.tgz'
38
45
} ,
39
- [ outDir ]
46
+ [ 'app' ]
40
47
) ;
41
48
42
49
console . log ( `${ tarResponse } response` ) ;
43
50
44
51
const response = await fetch ( slugResult . blob . url , {
45
- method : ` ${ slugResult . blob . method } ` , // or 'PUT'
52
+ method : 'PUT' , // or 'PUT'
46
53
// body: JSON.stringify(data), // data can be `string` or {object}!
47
54
body : `@${ dir } /slug.tgz` ,
48
55
headers : {
0 commit comments