Is it possible to have npm get a dependency from local files but fallback to a published package? - npm

I'm developing both an application and a package which it will depend on. I'd like to use git submodules to include the package in my dev environment and build using a published package from npm when I compile for production. What is the easiest way to achieve something like this?

Related

How to stub NPM sub-dependency at build time in next.js

In my next.js project a package has a dependency which I don't want to include in production build because I hink it's safe to just remove the package to make a smaller build.
Is there a way to alias the loaded package to some empty stub module?
I'm using Next.js 12.2 with SWC, Typescript, NPM as a package manager.

Publish NPM library developed with NX monorepo

I have built library with NX monorepo I would like to publish the library to an internal NPM artifactory.
I don't want to install #jscutlery/semver to do that.
So the question is: Is there a way to do it manually or automatically without 3rd party libs?
For example: I need - Docs, semver, changelog in addition to my code.

How to reference npm project locally?

I am using npm, yarn build as manager tool. Using these tech, create two project , CommonLib and SampleProject. so first I build CommonLib project, release its library and publish it to AWS codeartifact then ref that published artifact to SampleProject.
This flow looks fine and works well as well. But this whole process force us to publish our changes to artifact which block other.
So not think to do change locally in IDE (here is mscode), release it locally and then ref it to SampleProject.
I used npm install ../CommonLib command to install the package and IDE start point to locally project. But it doesn't compile the project.
Can anyone help me on this, what could be wrong here.

Install webdriver globally or localy?

The manual states that
You can also install the package globally on your machine and use the
wdio directly from the command line. However it is recommended to
install it per project.
Why is that? What downfall should I worry if installing globally?
If you only wish to use webdriver only in your shell regardless of any project then you can install it globally. However, if you wish to use it in a project, such that it is required to run project tests then install it locally (in this case it should be devDependency). The reasons are:
1) When multiple people working on a project, it is ensured that all of them have the same versions of the required packages.
2) Portability. The project dependencies should be completely defined in package.json so that after running npm install the project is ready to use in every environment.
For people new to NPM and Node, I'd recommend a global install to keep it simple. There are reasons to install it locally though, mostly to do with version compatibility and ease of project sharing: https://www.joezimjs.com/javascript/no-more-global-npm-packages/

Publish ember addon to local NPM registry for developer builds?

How can I support these NPM/ember addon scenarios?
developers build ember addon A and use build ember application B which uses their A local package
developers only builds B installing A from our nexus NPM integration repository
build system builds ember addon A installing into our nexus NPM release repository
Maven
developer desktop builds install packages to a local repo to be used later in the build.
build system builds deploy packages to our internal shared repo to be used by developers so they don't need to build all
NPM
build system builds can use npm publish --registry http://ourrepo/nexus/.... to publish into a private registry
develop desktop builds do????
We could use DependsOnMe with relative paths but that requires us to setup some kind of rule where builds work one way locally and another on the build machine.
While possible, I hope there's a more elegant solution to making this happen.
Can I have developers generate packages that go into the local npm cache for later use and if so can you point me to that documentation?
Related
locally build npm package in project
nexus npm deploy doc
Because we use maven front end plugin to manage npm and ember we can encapsulate an additional npm module (in this case an ember addon) as a maven artifact and make use of maven dependency management for our various scenarios
Ember Add On module
add 'npm pack' to generate local package in npm repository (in our case root/target/tmp/.npm//)
add assembly to generate tar.gz containing tar file (a little silly) and attach it to module as an artifact (type: tar.gz, classifer: ember-addon)
Client module
add maven-dependency-plugin unpack which unpacks addon module's tar.gz classifier: ember-addon to target/ember-addons prior to npm execution for this module
modify package.json to use local dependency "our-addon" : "file:../../target/ember-addons///package.tgz"
If a user builds ember and client, then addon module build placing the artifact in local maven repository. Client module unpacks from local repository and pulls into node_modules via npm ember build process.
If a user only builds client, then client module fetches addon artifact from our nexus repository prior to the unpack and use phases.