Reputation: 122
What are the steps to follow publish React-native component to npm? Am trying to publish sample component in NPM. Do we need to build that before? if yes, how? Please can any one tell in detail along with the commands?
Upvotes: 1
Views: 619
Reputation: 1286
No you no need to build, just put android native code in android and ios directory and a index.js in root to refreance them, then
Like this in package.json
{
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_location": "/package-name",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "package-name",
"escapedName": "package-name",
"rawSpec": "0.1.3",
"saveSpec": null,
"fetchSpec": "0.1.3"
},
"_requiredBy": [
"/"
],
"_spec": "0.1.3",
"author": {
"name": "Your name",
"email": "[email protected]"
},
"bugs": {
"url": "https://github.com/bug/issues"
},
"dependencies": {
"prop-types": "^15.6.0"
},
"description": "description about pacakge",
"homepage": "https://github.com/#readme",
"keywords": [
"react-native",
"react",
"dnd"
],
"license": "MIT",
"main": "index.js",
"name": "package-name",
"peerDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/package-name.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.1.3"
}
Upvotes: 1