Skip to content

Commit 9a3cbbd

Browse files
added api to get app name and slug url
1 parent 87a8e97 commit 9a3cbbd

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/deploy/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export default async function deploy(
2222
const configuration = options.configuration ? options.configuration : 'production'
2323
const overrides = {
2424
// this is an example how to override the workspace set of options
25-
...(options.baseHref && {baseHref: options.baseHref})
25+
...(options.baseHref && { baseHref: options.baseHref })
2626
};
2727

28-
context.logger.info(`📦 Building "${ context.target.project }". Configuration: "${ configuration }".${ options.baseHref ? ' Your base-href: "' + options.baseHref + '"' : '' }`);
28+
context.logger.info(`📦 Building "${context.target.project}". Configuration: "${configuration}".${options.baseHref ? ' Your base-href: "' + options.baseHref + '"' : ''}`);
2929

3030
const build = await context.scheduleTarget({
3131
target: 'build',

src/engine/engine.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,26 @@ import { logging } from '@angular-devkit/core';
22
import * as fse from 'fs-extra';
33

44
import { Schema } from '../deploy/schema';
5+
const Heroku = require('heroku-client');
56

67
// TODO: add your deployment code here!
78
export async function run(dir: string, options: Schema, logger: logging.LoggerApi) {
89

910
try {
1011

11-
options.targetDir = options.targetDir || '/example-folder';
12+
const heroku = new Heroku({ token: '' });
1213

13-
if (!await fse.pathExists(options.targetDir)) {
14-
throw new Error(`Target directory ${ options.targetDir } does not exist!`);
15-
}
14+
const result = await heroku.get('/apps');
15+
const site = result.find((app => app.name === 'ngx-deploy-demo'))
1616

17-
await fse.copy(dir, options.targetDir)
18-
19-
logger.info('🚀 Successfully published via @angular-schule/ngx-deploy-starter! Have a nice day!');
17+
const slugResult = await heroku.post(`/apps/${site.name}/slugs`,{
18+
body: {
19+
process_types: { "web": "node-v0.10.20-linux-x64/bin/node index.js" }
20+
}
21+
}
22+
);
23+
// console.log(site);
24+
console.log(slugResult.blob.url);
2025
}
2126
catch (error) {
2227
logger.error('❌ An error occurred!');

src/ng-add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const ngAdd = (options: NgAddOptions) => (
7575
}
7676

7777
project.architect['deploy'] = {
78-
builder: '@angular-schule/ngx-deploy-starter:deploy',
78+
builder: 'ngx-heroku-deploy:deploy',
7979
options: {}
8080
};
8181

0 commit comments

Comments
 (0)