Skip to content

Commit b71e509

Browse files
added code to create app folder and inside slug
1 parent b4d661d commit b71e509

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/engine/engine.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Schema } from '../deploy/schema';
44
const Heroku = require('heroku-client');
55
import * as tar from 'tar';
66
const fetch = require("node-fetch");
7-
7+
import { ensureDir, copy, remove } from 'fs-extra';
88
// TODO: add your deployment code here!
99
export 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

Comments
 (0)