Some utils to finish your deployment.
const path = require('path');
const { S3Uploader } = require('@abramstyle/deploy-tools');
const buildPath = path.resolve(__dirname, '../dist');
const uploadConfig = {
bucket: 'YOUR_BUCKET_NAME',
keyPrefix: 'YOUR_DIRECTORY_PREFIX',
};
async function startJob() {
const uploader = new S3Uploader(uploadConfig);
uploader.on('success', ({ count, finished, filename }) => {
console.log(`progress: ${finished}/${count}. file ${filename} upload success.`);
});
uploader.on('done', () => {
console.log('uploading finished.');
});
await uploader.uploadDir(buildPath);
}
console.log('initializing...');
startJob().then(() => {
console.log('start upload...');
}).catch((error) => {
console.error('file upload failed.', error);
});
interface UploaderConfig {
bucket: string,
keyPrefix: string,
}
public constructor(config: UploaderConfig)
public async uploadFile(filepath: string): Promise<any>
public async uploadDir(distDir: string): Promise<void>