Skip to content

Commit b4d661d

Browse files
chnages for uploading tar files
1 parent 3f022a5 commit b4d661d

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

src/deploy/actions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { Schema } from './schema';
55

66

77
export default async function deploy(
8-
engine: { run: (dir: string, options: Schema, logger: logging.LoggerApi) => Promise<void> },
8+
engine: { run: (dir: string, options: Schema, outDir: string, logger: logging.LoggerApi) => Promise<void> },
99
context: BuilderContext,
1010
projectRoot: string,
11+
outDir: string,
1112
options: Schema
1213
) {
1314

@@ -38,6 +39,7 @@ export default async function deploy(
3839
await engine.run(
3940
projectRoot,
4041
options,
42+
outDir,
4143
context.logger as unknown as logging.LoggerApi
4244
);
4345
}

src/deploy/builder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export default createBuilder<any>(
5151
await deploy(
5252
engine,
5353
context,
54-
path.join(workspaceRoot, targets.build.options.outputPath),
54+
path.join(workspaceRoot),
55+
targets.build.options.outputPath,
5556
options
5657
);
5758
} catch (e) {

src/engine/engine.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import * as tar from 'tar';
66
const fetch = require("node-fetch");
77

88
// TODO: add your deployment code here!
9-
export async function run(dir: string, options: Schema, logger: logging.LoggerApi) {
9+
export async function run(dir: string,
10+
options: Schema,
11+
outDir: string,
12+
logger: logging.LoggerApi) {
1013

1114
try {
1215

@@ -17,8 +20,8 @@ export async function run(dir: string, options: Schema, logger: logging.LoggerAp
1720

1821
const slugResult = await heroku.post(`/apps/${site.name}/slugs`, {
1922
body: {
20-
process_types: { "web": "node-v0.10.20-linux-x64/bin/node index.js" },
21-
buildpack_provided_description: "heroku/nodejs"
23+
buildpack_provided_description: "heroku/nodejs",
24+
process_types: { "web": `node-v0.10.20-linux-x64/bin/node index.js` }
2225
}
2326
}
2427
);
@@ -27,22 +30,23 @@ export async function run(dir: string, options: Schema, logger: logging.LoggerAp
2730
// console.log(site);
2831
console.log(slugResult);
2932

33+
console.log(`${outDir} outdir`);
3034
const tarResponse = await tar.c(
3135
{
3236
gzip: true,
33-
file: `${dir}.tgz`
37+
file: 'slug.tgz'
3438
},
35-
[dir]
39+
[outDir]
3640
);
3741

3842
console.log(`${tarResponse} response`);
3943

4044
const response = await fetch(slugResult.blob.url, {
4145
method: `${slugResult.blob.method}`, // or 'PUT'
4246
// body: JSON.stringify(data), // data can be `string` or {object}!
43-
body: `@${dir}.tgz`,
47+
body: `@${dir}/slug.tgz`,
4448
headers: {
45-
'Content-Type': ``
49+
'Content-Type': ''
4650
}
4751
});
4852
console.log(response);

0 commit comments

Comments
 (0)