Install vuex without npm or yarn? - javascript

Hey I want to install vuex in my Vue3 project. Because of several reasons I have no possibility to install it with npm or yarn. I already googled for solutions but it seems like there aren't any. Had someone of you maybe the same problem or an idea how to fix this?

You should be able to use with by loading it from a "CDN" as below
https://unpkg.com/vuex#4
Unpkg.com provides NPM-based CDN links. The above link will always point to the latest release on NPM. You can also use a specific version/tag via URLs like https://unpkg.com/vuex#4.0.0/dist/vuex.global.js
For more info refer to installation section of Vuex docs

Related

How to create a React Native package (View) which depends on other Native packages

Long story short, I am currently creating an npm package for React Native that is dependent on other packages that are native and require linking, pod install, etc.
I am currently using peerDependencies to make it work but I would like to include everything in the package for people to enjoy an easy installation process instead of manually installing 3-6 dependencies themselves.
I am not sure where to start about that or if it's even possible, any thoughts are appreciated.
I think the first think you should check is this library. It's actually recommended by the official React Native documentation.
You can create basic bootstrap for your npm package with this command (check the link above to RN docs for more information):
npx create-react-native-library react-native-awesome-module
if you wanna use a native package then you will need for
IOS
you will need to add s.dependency in react-native-pkgname.podspec REF
Android
you will need to add implementation in android/build.gradle file REF
To make new package, you can use this CLI
https://github.com/callstack/react-native-builder-bob
npx create-react-native-library react-native-awesome-module

Trouble installing with d3-context-menu with bower using VS code

I am trying to install the d3-context-menu for my vue js and d3.js web app. For reference here is the github here I don't have bower installed so I installed it using
npm install -g bower
Then I ran the command
bower install d3-context-menu
However I get the error message
bower ESUDO Cannot be run with sudo
Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.
http://www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814
You can however run a command with sudo using "--allow-root" option
I looked this up online and I cannot find a fix. Would this be because of me using d3v6 or that the context menu github is outdated?
Or is their a better alternative to create a context menu using d3.js?
I am very new to this so any help is greatly appreciated. Thank you
You can use this package in two other ways.
Some examples are described in the README file, here and here, where the author uses the package including the script tag directly in HTML.
<link rel="stylesheet" href="d3-context-menu.css" />
<script src="d3-context-menu.js"></script>
A second way is to install the package using npm. This package is published in the npm registry: https://www.npmjs.com/package/d3-context-menu.
So, theoretically, all you need is:
npm i d3-context-menu
I haven't tested the second way, but the canonical form can be tested directly in the online environment where the examples are, the Plunker platform and it works.

local change in node modules file

I need to make some changes in one of my node module package. But the problem is that if I am changing any file inside node modules folder then the changes won't be available to the other developers as it won't be checked in. Others will install it via package.json.
Is there any way I can include the file in my application instead of node modules and will it be a good approach?
Kindly suggest if there is any other alternative.
You have three options
Send a PR to the actual npm package, if the change is like a bug fix or enhancement that aligns with the actual packages goal.
Fork the package repo, and make changes and use it in your project as a dependency, in case you are adding changes that does not align with the goals of the actual package
move the package code into your source code, and use it as source code rather than a package from npm
you can make a fork of the project, then inside your package.json add the dependency as
"package-name": "<your username>/<your repo name/probably same as package-name>#<branch>",
also you can install it using yarn/npm
npm install --save username/repo#branch-name-or-commit-or-tag
as show this link
this is all, run yarn o npm install and you'll get your changes, please make a PR to the original author and when this will be accepted you can return

How to setup custom package install location in yarn?

I run a project and have decided to switch from using bower to using yarnpkg. However, I would like to install the modules at a custom location rather than at the default node_modules/. In bower, currently I am achieving this functionality in bower by putting the following in the .bowerrc:
{
"directory": "./public/lib"
}
Is this kind of installation of packages at custom locations possible in yarnpkg? If yes, how can I do it? I have looked for such configuration options in the official documentation but have had no luck.
I don't think it's possible to specify a different directory for local installs. I think it's related to an underlying node/npm issue, specifically this github issue.

How to patch a dependency of a npm library?

I experienced a bug in a deep dependency of a library installed using the npm.
I fixed that bug in a fork and created a pull request on github.
I'm wondering how to share my fix with my co-workers.
I found this article but since it's not my dependency but a dependency of a library I use I don't know how to solve this problem.
Even if my pull-request get's accepted fast, I need to wait for the maintainer of the library to update his dependencies, what may never even happen.
Is there any common way how to solve such a thing?
This library appears to be targeting this issue: https://www.npmjs.com/package/patch-package
by using patch-package, you can patch the dependency of a dependency like:
npx patch-package package/another-package
or in scoped package
npx patch-package #my/package/#my/other-package
please check the package docs
If the license of the original library allows you to take and modify it as you wish, you could clone it and submit your own NPM module (a relatively easy process) with the properly fixed submodule. Or just check that into your company's repository and don't include it on your package.json as a dep (to prevent it from overwriting it with npm install).
Or you can create a patch and apply it in the 'postinstall' phase.

Categories

Resources