@@ -4,7 +4,7 @@ import { Schema } from '../deploy/schema';
44const Heroku = require ( 'heroku-client' ) ;
55import * as tar from 'tar' ;
66const fetch = require ( "node-fetch" ) ;
7-
7+ import { ensureDir , copy , remove } from 'fs-extra' ;
88// TODO: add your deployment code here!
99export async function run ( dir : string ,
1010 options : Schema ,
@@ -29,20 +29,27 @@ export async function run(dir: string,
2929 // const upload
3030 // console.log(site);
3131 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`);
3239
3340 console . log ( `${ outDir } outdir` ) ;
3441 const tarResponse = await tar . c (
3542 {
3643 gzip : true ,
3744 file : 'slug.tgz'
3845 } ,
39- [ outDir ]
46+ [ 'app' ]
4047 ) ;
4148
4249 console . log ( `${ tarResponse } response` ) ;
4350
4451 const response = await fetch ( slugResult . blob . url , {
45- method : ` ${ slugResult . blob . method } ` , // or 'PUT'
52+ method : 'PUT' , // or 'PUT'
4653 // body: JSON.stringify(data), // data can be `string` or {object}!
4754 body : `@${ dir } /slug.tgz` ,
4855 headers : {
0 commit comments