Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "dat-song-bot",
"sideEffects": false,
"version": "0.1.0",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -68,6 +69,7 @@
},
"dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.0.18",
"@sentry/node": "5.4.3",
"axios": "^0.19.0",
"chrome-aws-lambda": "^1.17.1",
"date-fns": "^1.30.1",
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const config = {
YOUTUBE_CLIENT_SECRET: process.env.YOUTUBE_CLIENT_SECRET,
YOUTUBE_REFRESH_TOKEN: process.env.YOUTUBE_REFRESH_TOKEN,
UNSPLASH_ACCESS_KEY: process.env.UNSPLASH_ACCESS_KEY,
SENTRY_DSN: process.env.SENTRY_DSN,
};

export default config;
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ import { getUnsplashPhoto } from './image';
import { videoLogger } from './lib/utils';
import { Handler } from 'aws-lambda';
import { uploadVideo, connectToYoutube } from './upload';
import { init as initSentry } from '@sentry/node';
import config from './config';

const IMAGE_OUTPUT = '/tmp/out.png';
const VIDEO_OUTPUT = '/tmp/out.mp4';

if (process.env.NODE_ENV === 'production') {
global.__rootdir__ = __dirname || process.cwd();

initSentry({
dsn: config.SENTRY_DSN,
});
}

export const main: Handler = async () => {
try {
await launchPage();
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": ["src", "types", "test"],
"compilerOptions": {
"target": "es2015",
"module": "esnext",
"module": "es6",
"lib": ["dom", "esnext"],
"importHelpers": true,
"declaration": false,
Expand Down
6 changes: 6 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ declare module '@ffmpeg-installer/ffmpeg' {

export = installer;
}

declare module NodeJS {
interface Global {
__rootdir__: string;
}
}
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
},
],
},
devtool: 'inline-source-map',
externals: {
'chrome-aws-lambda': 'chrome-aws-lambda',
'aws-sdk': 'aws-sdk',
Expand Down
63 changes: 62 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,62 @@
into-stream "^5.0.0"
lodash "^4.17.4"

"@sentry/core@5.4.3":
version "5.4.3"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.4.3.tgz#c9e3a6cc9f5e296c5a5e19a7a925d9ee9125a95f"
integrity sha512-VjRv9BXip2BtCSohi/WQra+Ep4B8ajer1nU1VpKy5tUCjpVfXRpitY23EdEl+MVJH7h6YPZ45JsuFiKGgrtaFQ==
dependencies:
"@sentry/hub" "5.4.3"
"@sentry/minimal" "5.4.3"
"@sentry/types" "5.4.2"
"@sentry/utils" "5.4.2"
tslib "^1.9.3"

"@sentry/hub@5.4.3":
version "5.4.3"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.4.3.tgz#d6936f976435dd552e06a6a3e9f8cd643e9b9b3f"
integrity sha512-97bnk2dDuCdFv2xhujogqPiDDpKOsHxBXH1jOJ5ezr3/uZNsMRr450FDxxJJYDLuSx+qZ/+vUFfdVNjprBsuSg==
dependencies:
"@sentry/types" "5.4.2"
"@sentry/utils" "5.4.2"
tslib "^1.9.3"

"@sentry/minimal@5.4.3":
version "5.4.3"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.4.3.tgz#afaa8f7a3b5074efa8d70a2edac920b2e0cdbe15"
integrity sha512-xSCcKDtVtlmJIGmnlNH2fL++4l7iORJ+pOOfTz1Yjm/Il7Tz9wLVodbEfplXmAbOvgG/x9oilbW0MBSnrwKPfQ==
dependencies:
"@sentry/hub" "5.4.3"
"@sentry/types" "5.4.2"
tslib "^1.9.3"

"@sentry/node@5.4.3":
version "5.4.3"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.4.3.tgz#3de5b050b8c7ca44d25e3b1d6b0cf9b76833d937"
integrity sha512-QdLj1Po+94Ns9y5Z4orvA/febJV8i1uwSVK/cj61FISdb2DXlCWRFV9OYvm0I0EIHr9xAORpOCmyy0JbO1lE8w==
dependencies:
"@sentry/core" "5.4.3"
"@sentry/hub" "5.4.3"
"@sentry/types" "5.4.2"
"@sentry/utils" "5.4.2"
cookie "0.3.1"
https-proxy-agent "2.2.1"
lru_map "0.3.3"
tslib "^1.9.3"

"@sentry/types@5.4.2":
version "5.4.2"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.4.2.tgz#4ab327bced2cfd961dc7a29f0ff43398f913f6a6"
integrity sha512-yh1fd7x5lLOIZ8W3A1I792B3jowJVCWp4HcTRikjTsjbF8lcURY62m+hiLYUFPTIX99AlFRIPiApDkWiwMGYMA==

"@sentry/utils@5.4.2":
version "5.4.2"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.4.2.tgz#c88c6c08d635e1744a443cfefe9e2ed7fa250e4e"
integrity sha512-AW7/TGt2HiPQB8lJ8NgMgaFAIDQpKDF+wV8nENRbC1CP1zzcvb1QBF4zBL2auDT4fhkhVa817064s7vlDiJVLQ==
dependencies:
"@sentry/types" "5.4.2"
tslib "^1.9.3"

"@serverless/enterprise-plugin@^1.0.3":
version "1.0.7"
resolved "https://registry.yarnpkg.com/@serverless/enterprise-plugin/-/enterprise-plugin-1.0.7.tgz#0c99b5845f964552ab92b864d1320acd7c56bc05"
Expand Down Expand Up @@ -4672,7 +4728,7 @@ https-browserify@^1.0.0:
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=

https-proxy-agent@^2.2.1:
https-proxy-agent@2.2.1, https-proxy-agent@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0"
integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==
Expand Down Expand Up @@ -6450,6 +6506,11 @@ lru-cache@^5.0.0, lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"

lru_map@0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd"
integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=

lsmod@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lsmod/-/lsmod-1.0.0.tgz#9a00f76dca36eb23fa05350afe1b585d4299e64b"
Expand Down