Can a package be published to both github and npm? (with a single `npm publish`) - npm

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"
}
}

Related

publishConfig is not respected by Yarn 1.22

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"
}
}

Autoupdate package.json version with Dependabot

So when Dependabot runs and create a PR with a library update it's updates the library version in the package.json and package-lock.json, but is there any config that I could be missing, that in every PR of the dependabot update the package.json version too, for example:
{
"name": "my-projetc",
"version": "0.0.1",
"description": "Some description",
"private": true,
"author": "My",
"license": "MIT",
...
dependencies: {
...
}
devDependencies: {
...
}
The current version is version: 0.0.1
After run dependabot and create the corresponding PR for some library update, is there a way to increase the number of the package.json (with semver), like this:
{
"name": "my-projetc",
"version": "0.0.2",
"description": "Some description",
"private": true,
"author": "My",
"license": "MIT",
...
dependencies: {
...
}
devDependencies: {
...
}
After the update the version should be: version: 0.0.2
According to the documentation there are existing options for
* automerged_updates and
* version_requirement_updates
But both options are for updating the versions of the libraries used inside the dependencies or devDependencies.

How to create react-native android modules using native modules?

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.

grunt-package-modules cannot install dependency of itself

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.

react-native rnpm windiows throws error

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".