I wanted to create redis client from react native and I was going through some tutorials.
https://www.smoothterminal.com/articles/using-android-native-modules
I have built it. now I am searching/wanted to know how can i put it as service on npm ?
I wanted to know what are important files in my project and how people can use it in their project
First of all, upload the github project.
Create an account on npm.
Then just log in from the console to be able to load it. Upload the
project to npm.
Look at the Example package.json file, so you will link the project
that is loaded on npm with the one on github.
Example package.json
{
"name": "react-native-nameproject",
"version": "0.0.1",
"description": "",
"repository": {
"type": "git",
"url": "https://github.com/user/react-native-nameproject.git"
},
"bugs": {
"url": "https://github.com/user/react-native-nameproject/issues"
},
"homepage": "https://github.com/user/react-native-nameproject#readme",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"react-native"
],
"author": "",
"license": "",
"peerDependencies": {}
If you put the link of your project on git, it would be better to help you.
Related
I'm using yarn v1.22 and yarn workspace for building my application as a monorepo. Here is the package.json for our component library package. I want to use publishConfig to override the main field when I do npm publish or yarn publish. But when I tried to run those commands, the main field is no changed. Can anyone share some suggestions? Thanks.
{
"name": "components",
"private": false,
"version": "0.1.2",
"main": "src/index.ts",
"files": [
"dist"
],
"publishConfig": {
"main": "dist/index.js"
}
}
I got access to the github package registry beta, just fiddled with it and followed the configuration steps to publish.
The thing is, I published it correctly, but noticed it didn't publish to npm. Is there a way to publish in both registries with the same command? Does it make sense to have the package published in both registries?
Also, my package name in the package.json is #alvarocastro/quicksort (as stated in the doc) and the name in the github page ends up being that, but in the command example to install, the scope is duplicated, eg: #alvarocastro/#alvarocastro/quicksort
Here is the complete package.json file as a reference:
{
"name": "#alvarocastro/quicksort",
"version": "1.0.1",
"description": "An implementation of the quicksort algorithm",
"main": "index.js",
"scripts": {
"performance": "node performance.js",
"test": "xo && nyc ava",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"publishConfig": {
"registry":"https://npm.pkg.github.com/#alvarocastro"
},
"repository": {
"type": "git",
"url": "git+https://github.com/alvarocastro/quicksort.git"
},
"keywords": [
"quicksort",
"sort",
"algorithm"
],
"author": "Alvaro Castro",
"license": "MIT",
"bugs": {
"url": "https://github.com/alvarocastro/quicksort/issues"
},
"homepage": "https://github.com/alvarocastro/quicksort#readme",
"devDependencies": {
"ava": "2.3.0",
"coveralls": "3.0.6",
"nyc": "14.1.1",
"xo": "0.24.0"
}
}
I'm trying to use the npm package grunt-package-modules to gather my npm_module dependencies for a bundled deployment but ran into the error when running the command grunt packageModules:
Fatal error: Refusing to install test as a dependency of itself
This error typically occurs when the name of the project also appears in the list of dependencies in package.json as was the case here, but that does not occur in the original file or the one that is copied into the dist folder.
I was able to get this error with the simplest project setup I could create from the examples given in the grunt tutorial and the package wiki. Is there something I'm missing in setting up this plugin?
package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"underscore": "^1.8.3"
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt-package-modules": "^1.0.0"
}
}
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
packageModules: {
dist: {
src: 'package.json',
dest: 'dist'
},
}
});
grunt.loadNpmTasks('grunt-package-modules');
}
I'm on a PC and had the same thing happen on my home PC but had my co-worker run through this same setup on his mac and it worked successfully for him. Also tried updating node and npm since we had different versions with no luck.
I am trying to build sample UWP app using react-native. Here is my package.JSON.
` {
"name": "netizen_uwp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "15.2.0-rc.1",
"react-native": "0.29.0-rc.0",
"react-native-windows": "0.29.0-rc.0"
},
"main": "index.android.js",
"devDependencies": {
"rnpm-plugin-windows": "^0.1.1"
},
"author": "",
"license": "ISC",
"description": ""
}`
When i run >rnpm windows,I am getting attached error even all my react/react-native/react-native-windows modules are latest.
Can some one help me here?
This is a general problem with react-native-windows being a plugin. We're always slightly behind the release train for react-native. You could have solved this problem using the --windowsVersion flag, as in:
rnpm windows --windowsVersion 0.29.0-rc.0
Also, as of react-native#>=0.31, you no longer need to use the rnpm global command line, and instance just use the command "react-native windows".
I'm a big fan of bower. I don't need to put a stack of packages in my repository, I just commit bower.json each time and I'm done.
So my question really is, can I make npm read from a json file in the same way that bower does?
npm has package.json. This file has dependencies and devDependencies parts. You can use this file similar to bower.json.
npm install
will install necessary dependencies to your project's node_modules directory.
See sample package.json below.
{
"name": "SampleMobileApp",
"version": "0.0.1",
"description": "Sample App",
"dependencies": {
"grunt": "~0.4.2",
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.8.0",
"grunt-open": "~0.2.3",
"grunt-contrib-copy": "~0.5.0",
"grunt-bowercopy": "~0.7.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-phonegap": "~0.12.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"grunt",
"javascript"
],
"author": "Atilla Ozgur",
"license": "MIT",
}
dependencies are your runtime dependencies that your users need to download while devDependencies are your developer dependencies like your test runtime, grunt helper packages etc.