react-native-builder-bob
Advanced tools
Comparing version 0.35.3 to 0.36.0
@@ -30,3 +30,3 @@ "use strict"; | ||
if (!(await _fsExtra.default.pathExists(codegenAndroidPath))) { | ||
throw new Error(`The codegen android path defined in your package.json: ${codegenAndroidPath} doesnt' exist.`); | ||
throw new Error(`The codegen android path defined in your package.json: ${codegenAndroidPath} doesn't exist.`); | ||
} | ||
@@ -62,6 +62,14 @@ const codegenJavaPackageName = packageJson.codegenConfig.android.javaPackageName; | ||
})); | ||
await _fsExtra.default.rm(_path.default.resolve(codegenAndroidPath, 'java/com/facebook'), { | ||
recursive: true | ||
}); | ||
if (await _fsExtra.default.pathExists(_path.default.resolve(codegenAndroidPath, 'java/com/facebook/react/viewmanagers'))) { | ||
// Keep the view managers | ||
await _fsExtra.default.rm(_path.default.resolve(codegenAndroidPath, 'java/com/facebook/fbreact'), { | ||
recursive: true | ||
}); | ||
} else { | ||
// Delete the entire facebook namespace | ||
await _fsExtra.default.rm(_path.default.resolve(codegenAndroidPath, 'java/com/facebook'), { | ||
recursive: true | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=patchCodegenAndroidPackage.js.map |
@@ -25,3 +25,3 @@ "use strict"; | ||
}; | ||
const mockJavaSpec = ` | ||
const mockJavaModuleSpec = ` | ||
/** | ||
@@ -31,3 +31,3 @@ * Some comment | ||
package com.bobtest; | ||
package com.facebook.fbreact.specs; | ||
@@ -41,4 +41,16 @@ import com.example.exampleimport; | ||
}`; | ||
const mockJavaViewSpec = ` | ||
/** | ||
* Some comment | ||
*/ | ||
package com.facebook.react.viewmanagers; | ||
public interface SomeInterface<T extends View> { | ||
void setColor(T view, @Nullable String value); | ||
} | ||
`; | ||
const mockProjectPath = _nodePath.default.resolve(__dirname, 'mockProject'); | ||
const mockCodegenSpecsPath = _nodePath.default.resolve(mockProjectPath, 'android/generated/java/com/facebook/fbreact/specs'); | ||
const mockCodegenModuleSpecsPath = _nodePath.default.resolve(mockProjectPath, 'android/generated/java/com/facebook/fbreact/specs'); | ||
const mockCodegenViewSpecsPath = _nodePath.default.resolve(mockProjectPath, 'android/generated/java/com/facebook/react/viewmanagers'); | ||
(0, _globals.describe)('patchCodegenAndroidPackage', () => { | ||
@@ -50,4 +62,4 @@ (0, _globals.beforeEach)(() => { | ||
}, | ||
[mockCodegenSpecsPath]: { | ||
'NativeBobtestSpec.java': mockJavaSpec | ||
[mockCodegenModuleSpecsPath]: { | ||
'NativeBobtestSpec.java': mockJavaModuleSpec | ||
} | ||
@@ -73,5 +85,27 @@ }); | ||
await (0, _patchCodegenAndroidPackage.patchCodegenAndroidPackage)(mockProjectPath, mockPackageJson, mockReport); | ||
(0, _globals.expect)(await _fsExtra.default.pathExists(mockCodegenSpecsPath)).toBe(false); | ||
(0, _globals.expect)(await _fsExtra.default.pathExists(mockCodegenModuleSpecsPath)).toBe(false); | ||
}); | ||
(0, _globals.it)("doesn't delete the view manager specs", async () => { | ||
const mockPackageJsonWithTypeAll = { | ||
...mockPackageJson, | ||
codegenConfig: { | ||
...mockPackageJson.codegenConfig, | ||
type: 'all' | ||
} | ||
}; | ||
(0, _mockFs.default)({ | ||
[mockProjectPath]: { | ||
'package.json': JSON.stringify(mockPackageJsonWithTypeAll) | ||
}, | ||
[mockCodegenModuleSpecsPath]: { | ||
'NativeBobtestSpec.java': mockJavaModuleSpec | ||
}, | ||
[mockCodegenViewSpecsPath]: { | ||
'BobtestViewManagerInterface.java': mockJavaViewSpec | ||
} | ||
}); | ||
await (0, _patchCodegenAndroidPackage.patchCodegenAndroidPackage)(mockProjectPath, mockPackageJsonWithTypeAll, mockReport); | ||
(0, _globals.expect)(await _fsExtra.default.pathExists(_nodePath.default.join(mockCodegenViewSpecsPath, 'BobtestViewManagerInterface.java'))).toBeTruthy(); | ||
}); | ||
}); | ||
//# sourceMappingURL=patchCodegenAndroidPackage.test.js.map |
{ | ||
"name": "react-native-builder-bob", | ||
"version": "0.35.3", | ||
"version": "0.36.0", | ||
"description": "CLI to build JavaScript files for React Native libraries", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">= 18.0.0" | ||
"node": ">= 20.0.0" | ||
}, | ||
@@ -91,3 +91,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "0bacd58eab2ce56f20be84009aa6f4315dd95c52" | ||
"gitHead": "f06514d852d578df98008b0ce87de69e0fde59bd" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
212007
1755