I have a nx monorepository, where I have a webcomponent which are boundled as a js file.
Presently, reuse of code works with including the webcomponent js file in the index.html. I would like to export this as an npm package at my feed in azure DevOps so other developers in my company can reuse this code by the npm i command upon the package.
How do I move from the present solution to a npm package using nx. Do I need to make a new nx project for creating such an npm package, since it requires a package.json or is there a way I can use nx to create npm from a js file?
Related
I'm trying to patch one of the web3 packages and use the patched version in my node script. I'm confused about what to use in the npm link program: web3 or web3.js.
Here's what I did:
Cloned the web3 repo.
Executed npm bootstrap (which linked web3 subpackages).
Ran npm link (which put a link to the web3.js folder into my global modules folder).
Created a project named web3test and ran npm install web3 for it.
Now I don't know how to link my project to the local copy of web3. If I run npm link web3, it puts a web3 folder in the global modules directory, which is not the same as my web3.js repository. But my project is supposed to use web3, not web3.js, so it doesn't make sense to link to web3.js.
I'm on Windows 10.
I realized that web is actually a package within web3.js. So I went into the \web3.js\packages\web3 directory and executed npm link from there. Of course, I had to also run npm build for the main package so that all web3 packages were built.
is it possible to get the package.json from a GitLab npm package? With the GitLab API I can call up the GitLap package information. But I haven't found any way to read the package.json without load the full package. Especially I need the tags from the package.json.
I am trying to create a react native component npm package following:
https://www.freecodecamp.org/news/how-to-publish-a-react-native-component-to-npm-its-easier-than-you-think-51f6ae1ef850/
but I do not understand at which step the npm package is created. Can I create the package and test its installation before publishing it to npm?
Thanks
The npm package is created at beginning of article.
To test it, in an application you can add your package with yarn add file:path_relative_component.
But I don't have the 'tips' to test it without lost a lot of time with delete node_modules folder and execute command. See Develop own NPM package for react-native
I am creating a stencil project which uses an npm package inside it, is there any options to add an npm package inside stencil project. Any suggestions I searching for a solution for quite a while.
This is how i use ck-editor in angular
<ck-editor name="editor" #myEditor [(ngModel)]="templateSetValue.template_content"
(change)="handleEditorData($event)">
</ck-editor>
Is it possible to use the same is stencil project
https://www.npmjs.com/package/ngx-ckeditor
Not sure if I understood the question correctly, but to add a package from npm in your Stencil.js project, you can just install it, like you would in any other node project:
npm install <some-package>
For example nprogress:
npm install nprogress #types/nprogress
and then import it in your code like
import nprogress from 'nprogress';
nprogress.start();
// ...
I have a react boilerplate that configures a nodejs server for background api calls and a create-react-app for the frontend.
I wanted to create a npm package that would prepare the whole environment when installing.
Eg.: npm i myPackage
This would create all the files and folders based on the structure I have defined, just like cloning the repository...
How could achieve that?
I just need some directions on how to start this, I published an npm package based on my repository and it only downloaded two files but not the whole structure.
Try adding a postinstall script like
"scripts": {
"postinstall": "./executable-script or cp dir/* $INIT_CWD/"
}
into the package.json file. It will run right after the package is installed.
For more documentation read https://docs.npmjs.com/misc/scripts and https://docs.npmjs.com/cli/run-script.
I never used it before, but it would likely solve it for you.