Skip to content
Open
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
5 changes: 3 additions & 2 deletions packages/react-native-codegen/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@ function getBuildPath(file, buildFolder) {

async function buildFile(file, silent) {
const destPath = getBuildPath(file, BUILD_DIR);
const globPath = path.relative(PACKAGE_DIR, file).split(path.sep).join('/');

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

if (micromatch.isMatch(file, IGNORE_PATTERN)) {
if (micromatch.isMatch(globPath, IGNORE_PATTERN)) {
silent ||
process.stdout.write(
styleText('dim', ' \u2022 ') +
path.relative(PACKAGE_DIR, file) +
' (ignore)\n',
);
} else if (!micromatch.isMatch(file, JS_FILES_PATTERN)) {
} else if (!micromatch.isMatch(globPath, JS_FILES_PATTERN)) {
fs.createReadStream(file).pipe(fs.createWriteStream(destPath));
silent ||
process.stdout.write(
Expand Down
5 changes: 3 additions & 2 deletions scripts/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ async function buildFile(
const {silent = false} = options;
const packageName = getPackageName(file);
const buildPath = getBuildPath(file);
const globPath = path.relative(PACKAGES_DIR, file).split(path.sep).join('/');
const {emitFlowDefs, emitTypeScriptDefs} = getBuildOptions(packageName);

const logResult = ({copied, desc} /*: {copied: boolean, desc?: string} */) =>
Expand All @@ -175,14 +176,14 @@ async function buildFile(
(desc != null ? ' (' + desc + ')' : ''),
);

if (micromatch.isMatch(file, IGNORE_PATTERN)) {
if (micromatch.isMatch(globPath, IGNORE_PATTERN)) {
logResult({copied: false, desc: 'ignore'});
return;
}

await fs.mkdir(path.dirname(buildPath), {recursive: true});

if (!micromatch.isMatch(file, JS_FILES_PATTERN)) {
if (!micromatch.isMatch(globPath, JS_FILES_PATTERN)) {
await fs.copyFile(file, buildPath);
logResult({copied: true, desc: 'copy'});
return;
Expand Down