Skip to content

Commit

Permalink
fix: add missing permissions (#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonrybczak authored and thymikee committed Apr 11, 2023
1 parent b2be0e2 commit c3378e0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const BUILD_DIR = 'build';
const JS_FILES_PATTERN = '**/*.js';
const TS_FILE_PATTERN = '**/*.ts';
const IGNORE_PATTERN = '**/__{tests,mocks,fixtures}__/**';
const FILES_WITH_755_PERMISSION = ['launchPackager.command'];

const transformOptions = require('../babel.config.js');

Expand Down Expand Up @@ -79,11 +80,19 @@ function buildFile(file, silent) {

fs.mkdirSync(path.dirname(destPath), {mode: 0o777, recursive: true});

const fileName = path.basename(file);

if (
!micromatch.isMatch(file, JS_FILES_PATTERN) &&
!micromatch.isMatch(file, TS_FILE_PATTERN)
) {
fs.createReadStream(file).pipe(fs.createWriteStream(destPath));
if (FILES_WITH_755_PERMISSION.includes(fileName)) {
fs.createReadStream(file).pipe(
fs.createWriteStream(destPath, {mode: 0o755}),
);
} else {
fs.createReadStream(file).pipe(fs.createWriteStream(destPath));
}
silent ||
process.stdout.write(
`${
Expand All @@ -95,12 +104,11 @@ function buildFile(file, silent) {
);
} else {
const options = Object.assign({}, transformOptions);
const filename = path.basename(destPath);

let {code, map} = babel.transformFileSync(file, options);

if (!file.endsWith('.d.ts') && map.sources.length > 0) {
code = `${code}\n\n//# sourceMappingURL=${filename}.map`;
code = `${code}\n\n//# sourceMappingURL=${fileName}.map`;
map.sources = [path.relative(path.dirname(destPath), file)];
fs.writeFileSync(`${destPath}.map`, JSON.stringify(map));
}
Expand Down

0 comments on commit c3378e0

Please sign in to comment.