Moving a Project to Angular Package Format - javascript

I have a project:
https://www.npmjs.com/package/#fireflysemantics/slice
I need to move it to the Angular package format. The reason is this:
node_modules/#fireflysemantics/slice/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format.
I think the right way to do this is to create a new empty branch with:
git checkout --orphan angular-package-format
//clear the working directory
git rm --cached -r .
Then just generate a new Angular library project into this new branch:
ng new angular-package-format --create-application=false
cd angular-package-format
ng generate library slice
Then commit and publish that library as noted here:
https://medium.com/#ole.ersoy/creating-an-angular-9-npm-library-1a658ecfa3dc
I think this is probably the right way to go about it, but wanted to check with everyone else as this is the first time I'm attempting this. Is there anything you would change WRT the steps I mentioned?

Related

Vue custom (cli ?) project generator

All my VueJS projects use at the beginning the same baseline :
Vuex
Vue Router
Immutable.js
MathJS
MomentJs
ChartJS
Plus, all my projects have quite the same "index.js" file.
Is there a way to have a command line (preferably based on Vue CLI) that can generate a project with a pre-coded "index.js" file and a package.json with those above dependencies ?
It sounds like you are wanting to use the Vue CLI to create a project. However, you additionally want some default npm packages to be installed and imported into your index.js file.
Answer: no. this functionality does not exist (currently)
Some Suggestions:
Open a feature request here. If you did do a feature request, you should descibe it in a more general way. For example 'allow the ability to specify npm packages on project creation' opposed to specifically installing ChartJS, Moment and the other ones. That's too specific, that will get shot down and closed in a heart beat.
Create a repo with the project structure and packages you want and always start from that repo (opposed to using vue cli)
Write your own custom node cli to interface with vue cli that handels your extra steps for you. You could easily write a node (console program) that executes the steps you want. Basically, create the vue project, npm install what you need, generate an index.js with your package imports.
I think the easiest route is to just create an empty vue project how you want it. Save that repo as 'vue-boilerplate' or something and just always start off with that empty project opposed to doing vue create every time.
In my personal opinion, I think going through all this to npm install 3 packages and add the imports to a js file isn't entirely worth it unless you find yourself creating a massive amount of projects that will all require the exact same setup.
Angular has a similar idea called schematics but I do not see an equivilant within Vue as of yet.

How to quickfix and build a bug in an NPM package, so it's available to the build server?

Maybe this question is a bit off the rules. I'm using and npm package, which built in type definitions for TypeScript. Unfortunately there is a bug in the definitions, which I can easily fix.
I want to make this new version of the package available to my build server. First I thought I can just fork the repository on Github and add this repository as the source in my package.json, but then I realized that this package needs to be built.
So my question is, where should I go from here? Of course I've sent a pull request, but what can I do until this is merged and released? Should I clone the package and publish it by myself?
I just forked the repo and build it with my fix included.
Then i used my github-fork in the package json.
(you can use github links with branch or tag annotations)
As soon as the merge was made i switched back to the original package.
I had quite similar problem with buggy type definitions. The steps to fix an npm package and then use are:
fork the package
create a new fix branch,
fix the bug, push to your forked repo,
point to the repo in your package.json,
create a pull request to help package maintainers 💪
You can find more details here on my blog: https://www.kozubek.dev/2019/02/23/fixing-npm-package.html
Hope this helps!

how to migrate a react-native-vanilla project to expo?

right now, I have a React-native project which I created with the vanilla CLI.
I just heard of expo, and I wanted to use it, but it seems I must create my project on it first.
is there a way to migrate a react-native-vanilla project to expo?
Yes, if you have exp installed, you can run exp convert in your project directory. Note that this process won't check whether you have any native modules in your project, and if you do you'll likely have some issues.
As of this writing, there's one notable bug in this process where it may leave your project with both an exp.json file and an app.json file, which need to be manually merged.

simple captcha field type for meteor autoform

I need a simple captcha field type for my form. I used meteor-autoform for generating form.
I don't know how to create custom (captcha) field type for auto-form.
For example how to wrap this node.js module to auto-form add-on.
I also don't want to use google reCaptcha.
Please guide me.
Ok a common issue when building with meteor is figuring out how to include node packages in a meteor project. Here's the way I do it!
Install the lovely meteorhacks:npm package which allows for easy node package wrapping.
meteor add meteorhacks:npm
Edit the packages.json file (which meteorhacks adds to your meteor project root)
The packages.json file should something like this:
{
"node-captcha" : "0.2.1"
}
Note: 0.2.1 is the latest package version of node-captcha which I found on the npm link you supplied.
Anytime you are including a node package using meteorhacks:npm, you need to list a node package version.
node-captcha can now be included in your meteor js files by using the following statement:
Meteor.npmRequire('node-captcha');
This should do the trick! Please accept my answer if this is what you are looking for :)

WebStorm - How to keep LiveTemplates in a repository?

I'm looking for a solution that allows the rest of my team to work with my custom Webstorm-LiveTemplates.
Is there a way to keep live templates in a repository like git?
I need that WebStorm automatically loads it...
If you have NPM (Node Package Manager) installed you can use:
live-template-installer
Command line utility for automatically installing live templates to
Intellij or Webstorm
One of the features is installing a live template from git repo.
It is intended to sync to a git for easy distribution and backup of
templates.
Enjoy.
I'm looking for a solution like .editorconfig project, a simple-way to tell WebStorm which liveTemplates we are using for single project...
I would not be obligated to perform tasks grunt or similar

Categories

Resources