Fix new-library to copy to current project
Summary: - new-library was copying file inside the <project_root>/node_modules/react-native/Libraries instead of <project_root>/Libraries. This was due to the path.resolve that was being passed 2 full paths instead of a base path + relative path segment. --- Before: ```js console.log(libraryDest, dest, path.resolve(libraryDest, dest); // <base-path>/Libraries/TestLib // <base-path>/node_modules/react-native/Libraries/TestLib/package.json // <base-path>/node_modules/react-native/Libraries/TestLib/package.json ``` After: ```js console.log(libraryDest, dest, path.resolve(libraryDest, dest); // <base-path>/Libraries/TestLib // ../TestLib/package.json // <base-path>/Libraries/TestLib/package.json ``` Closes https://github.com/facebook/react-native/pull/13748 Differential Revision: D5043652 Pulled By: shergin fbshipit-source-id: febee13781fc7075276daa67f9a78cc73dfd4b73
This commit is contained in:
parent
fff3ad1336
commit
c98fc33ce5
|
@ -44,7 +44,7 @@ function library(argv, config, args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dest = f.replace(/Sample/g, args.name).replace(/^_/, '.');
|
const dest = path.relative(source, f.replace(/Sample/g, args.name).replace(/^_/, '.'));
|
||||||
copyAndReplace(
|
copyAndReplace(
|
||||||
path.resolve(source, f),
|
path.resolve(source, f),
|
||||||
path.resolve(libraryDest, dest),
|
path.resolve(libraryDest, dest),
|
||||||
|
|
Loading…
Reference in New Issue