Skip to content

Commit

Permalink
Remove sourcemaps from cdn_deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
owenpearson committed Jun 9, 2022
1 parent 43f41bb commit 38d76e7
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions scripts/cdn_deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function run() {
// Comma separated directories (relative to `path`) to exclude from upload
excludeDirs: 'node_modules,.git',
// Regex to match files against for upload
fileRegex: '^ably(\\.noencryption)?(\\.min)?\\.js(\\.map)?',
fileRegex: '^ably(\\.noencryption)?(\\.min)?\\.js',
...argv,
};

Expand Down Expand Up @@ -66,21 +66,14 @@ async function run() {
file
);
const split = relativePath.split('.js');
const newPath = `${split[0]}-${version}.js${split[1]}`;
const newPath = `${split[0]}-${version}.js`;
let fileData = fs.readFileSync(file).toString();
let ContentType;
if (newPath.endsWith('.min.js')) {
fileData = fileData.replace('//# sourceMappingURL=ably.min.js.map', `//# sourceMappingURL=${newPath}.map`);
ContentType = 'application/json';
} else {
ContentType = 'application/javascript';
}

await upload(s3, {
Body: fileData,
Key: path.join(config.root, newPath),
Bucket: config.bucket,
ContentType,
ContentType: 'application/javascript',
});
}
}
Expand Down

0 comments on commit 38d76e7

Please sign in to comment.