D
D
Dmitry Baibukhtin2020-05-04 12:39:58
npm
Dmitry Baibukhtin, 2020-05-04 12:39:58

How to create a simple typescript npm package for a cordova (ionic) project?

Good afternoon.
I have several cordova (angular) applications. We need to move common solutions to npm packages.
I looked at a lot of articles, everything is so complicated everywhere, prebuilds, types, a bunch of generated files and so on, I don’t need it, I make a package only for my projects ...
Is it possible to make it as simple as possible so that the package is just a set of classes that I could use it in my project in the same way as if it were not a package, without any index.d.ts, Gruntfile and other garbage? The only thing you need is the ability to declare dependencies

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-05-04
@PiloTeZ

The bottom line is that npm should have javascript. From ts, only declarations remain there. Therefore assembly.
Physically, you can send a pure ts package (where module and\or main point to a .ts file), but the problem here is that everyone has their own version of ts, as well as their own ts-transpiler and linter settings, which is why the random user nichrome not going.
If you do it purely for yourself, then there will be no such problem. At first. And then the zoo will definitely grow and you will curse everything.
But in general, right now, nothing prevents you from simply collecting ts files into a folder, adding the appropriate package.json and getting the package you need without unnecessary gestures.)
The simplest assembly: tsc -d --outDir ./distand package.json, looking at the result.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question