How to include *forked* github branch as dependency in package.json - react-native

I'm trying to include a fork of https://github.com/segmentio/analytics-react-native
When I include "#segment/analytics-react-native": "^1.1.0", in my package.json
I see the following
├── README.md
├── RNAnalytics.podspec
├── android
├── build
├── ios
├── package.json
└── src
But if I include the fork of the library as "analytics-react-native": "account_name/analytics-react-native#master",, I see
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── RELEASING.md
├── package.json
├── packages
└── tsconfig.json
Of course, build fails with the forked version..
How Can I use the forked version as a dependency?

You want:
"git://github.com/your-account/analytics-react-native.git#branch_name": "^1.1.0"
See the documentation. #commit-ish can be any valid gitref (such as a commit, branch, or tag).
Edit: Ah, per the edit, the repo is a monorepo with the desired package.json a few levels down. This is currently an open request in Yarn. There's a similar request for npm which was closed. There are some good suggestions for compromises in that thread, but there's no one solution to that problem yet.

Related

Vue packages version mismatch

I'm trying to deploy my old nuxt project again with new changes but I get this error even tho I removed the node_modules folder, package-lock.json & refreshed the npm cache and of course run npm i after all of this + I don't have neither of these packages in my package.json.
Here's the error I'm getting after running npm run dev:
Vue packages version mismatch:
- vue#3.2.45
- vue-server-renderer#2.7.14
This may cause things to work incorrectly. Make sure to use the same version for both.
here's my package.json:
├── #nuxtjs/axios#5.13.6
├── #nuxtjs/dotenv#1.4.1
├── #nuxtjs/vercel-builder#0.22.1
├── #nuxtjs/vuetify#1.12.3
├── #stripe/stripe-js#1.46.0
├── body-parser#1.20.1
├── cookie-parser#1.4.6
├── cookieparser#0.1.0
├── core-js#3.26.1
├── cors#2.8.5
├── express#4.18.2
├── gsap#npm:#gsap/shockingly#3.11.3
├── nuxt-gsap-module#1.7.2
├── nuxt#2.15.8
├── stripe#8.222.0
├── underscore#1.13.6
└── vuex-persistedstate#4.1.0
I have tried all I can but cannot come up with a solution. Is there anything I could try to make this work?
Please execute this command.
npm install vue#2.7.14 --save

NPM 7 Workspaces - Multiple node_modules?

I'm having trouble running my app with NPM 7 Workspaces. I am expecting an npm install from the root folder to create a node_modules folder for each of my workspaces, similar to Lerna. However, when I run npm install at the root, I only get one node_modules, at the root level. Is this expected?
Example structure before npm i:
.
├── package.json -> { "workspaces": ["packages/*"] }
└── packages
├── a
│ ├── index.js
│ └── package.json
├── b
│ ├── index.js
│ └── package.json
└── c
├── index.js
└── package.json
Example structure after npm i (note only one package-lock.json/node_modules):
.
├── package.json -> { "workspaces": ["packages/*"] }
├── **node_modules**
├── **package-lock.json**
└── packages
├── a
│ ├── index.js
│ └── package.json
├── b
│ ├── index.js
│ └── package.json
└── c
├── index.js
└── package.json
Node version: 16.4.2
NPM version: 7.18.1
Update: After messing around a with a million things, I finally went and deleted the project and recloned it. It worked after this. I believe it was due to the fact that I was on an old node/npm version when I originally cloned the project. Must have been some funky state lingering around there. Anyway hope this helps anyone with the same problem!

Force include node_modules in package?

I want to npm publish my dist dir that looks like this:
dist
├── README.md
├── node_modules
│   └── clap
│   └── dist
│   └── es
│   ├── index.js
│   └── index.js.map
├── package.json
...
└── utils
├── memory-stream.js
├── memory-stream.js.map
├── mysql-users.js
├── mysql-users.js.map
├── sql.js
├── sql.js.map
├── utils.js
└── utils.js.map
Notice how there's a node_modules dir in there. I want to publish that along with everything else.
The files in there are compiled, but they're part of a local package not distributed on npm, so I do want it bundled.
My code references it like this:
var index = require('../node_modules/clap/dist/es/index.js');
So it should work perfectly fine.
The problem is that it looks like npm publish has it hardcoded to ignore directories called node_modules. Is there any way to override that behaviour?

webpack load amd path modules dependency

I am testing the loading of modules in webpack. How would you indicate the path of the dependency in an AMD module?
My project has something like this:
├── modules
│   ├── mod1.js
│   ├── mod2.js
│   └── others
│   └── mod3.js
├── public
│   └── bundle.js
├── src
│   └── app
│   └── app.js
└── webpack.config.js
in app.js I import only mod3.js therefore you must compile the three JS (mod1, mod2, mod3) since mod3.js depend on them.
I have a "others" route. Every time I create a folder I have to include the following line in webpack.config.js?
path.resolve(__dirname, 'modules/others'),
Is it not possible to indicate the path of the dependency in the module itself without webpack compiling go to the hard defined in the config?
Thank you

How do I setup a Minecraft Forge development environment?

I want to start creating awesome Minecraft mods, and it seems that the current way to do so is with Minecraft Forge. I already got Gradle and the JDK installed, but no matter what I do I can't seem to get anything to build.
How can I get a Forge development environment working?
After downloading the Forge Mod Development Kit (MDK) archive, it should contain the following files:
forge-somewhere/
├── build.gradle
├── CREDITS-fml.txt
├── eclipse
├── forge-1.10.2-12.18.1.2073-changelog.txt
├── gradle
│   └── wrapper
│   ├── gradle-wrapper.jar
│   └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── LICENSE-new.txt
├── MinecraftForge-Credits.txt
├── Paulscode IBXM Library License.txt
├── Paulscode SoundSystem CodecIBXM License.txt
├── README.txt
└── src
└── main
├── java
│   └── com
│   └── example
│   └── examplemod
│   └── ExampleMod.java
└── resources
└── mcmod.info
In the README.txt there are instructions on how to set it up, but to put it simple, open a console/terminal in forge-somewhere and run gradle setupDecompWorkspace. It should set up a development environment and then you should be able to run gradle build normally. Note that you have to re-run setupDecompWorkspace for every mod you want to develop/compile.
If you're not using an IDE, or the command fails because of heap memory, you can use gradle setupDevWorkspace instead. This doesn't decompile Minecraft, so you won't be able to check the sources (which you can't without an IDE or something anyway), but it doesn't use nearly as much RAM, which is useful if you're on a lower-end system.
Simple:
Once you have downloaded the Forge .zip for the version that you plan on using, go to the same directory as your "gradlew.bat" file, hold shift-rightclick and open the command prompt.
Type:
gradlew.bat setupDecompWorkspace eclipse
Or if you're running with Intellij Idea (Which I recommend):
gradlew.bat setupDecompWorkspace idea
After that, it'll set up the Workspace as well as the correct coding software package that you wish to be using.