Is it advisable to include auto-generated files in an npm package upon publication?

I have a TypeScript NPM package where my build process compiles all *.ts files into myLib.d.ts, myLib.js, and myLib.js.map.

In order for my NPM package to function properly, it requires the src/*.ts files as well as the auto-generated myLib.* files.

However, I'm unsure if I should include these auto-generated myLib.* files in my git repository.

Is there a potential issue with publishing files in an npm package that are not under version control?

Answer №1

It is recommended that the output/generated files myLib.d.ts, myLib.js, and myLib.js.map are not managed in the git repository.

To ensure this, you can add these files to your .gitignore list. This will not affect the publishing of npm packages.

You may find it helpful to look at the example .gitignore file for TypeScript.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Conceal the initial value in a dropdown menu in a React component

I've set up a codesandbox to demonstrate the issue (https://codesandbox.io/s/practical-flower-k6cyl?file=/src/App.tsx) Is there a way to prevent the "AGE" text (first option) in the select box from being selected again? It should only be visible when ...

What is the best way to save the content of an RFC822 message body as a String?

let inbox = require("inbox"); let client = inbox.createConnection(false, "imap.gmail.com", { secureConnection: true, auth:{ user: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99f4e0fcf4f8f0f5d9fef4f8f0f5b7fa ...

No results are generated by babel.js

After installing it using the command $ sudo npm install babel, I tried running $ babel which didn't produce any output, suggesting that bash was able to find something. However, when I ran $ babel foo.js, again no output was generated. Similarly, the ...

Having trouble installing dependencies in your Vue project?

I recently encountered an error while running the npm i command on our Vue project to install all node packages. I'm not sure what this error means or how to resolve it. https://i.stack.imgur.com/rP2iU.png ...

Encountering an Npm error when trying to build a new project, with only moment.js included as an additional

Encountered a perplexing issue while updating my React application hosted by Nginx in a docker container. The error during npm install has me stumped, unable to pinpoint the root cause. The docker file I'm using is quite straightforward; FROM node:12 ...

Type returned by a React component

I am currently using a basic context provider export function CustomStepsProvider ({ children, ...props }: React.PropsWithChildren<CustomStepsProps>) => { return <Steps.Provider value={props}> {typeof children === 'function&ap ...

Understanding the Lack of Dependency Sharing in NodeJS and npm

When I create a package.json file and execute npm install ./ npm installs dependencies of dependencies even if they are identical. For example: ExpressJs 4.0.0-rc4 in node_modules/cookie === cookie-parser in node_modules/cookie When Node.js loads a fi ...

A Vue component library devoid of bundled dependencies or the need for compiling SCSS files

My current challenge involves the task of finding a way to publish our team's component library. These components are intended to be used by various internal applications within our organization. I have specific requirements: The library must be acc ...

Interference of NestJS provider classes in separate event loops causing conflicts

I'm currently facing an issue where my shared library injectables are conflicting with each other. The bootstrap file initiates this file alongside a proxy server to start local microservices import { serviceA } from '@company/serviceA' imp ...

Unable to access nvm within a bash script

I'm currently working on automating the setup of my development environment using a shell script. This involves installing Python, NVM, Node, MongoDB, and other tools. For installing Node, I rely on NVM. However, after running the installation command ...

The object literal's property 'children' is assumed to have a type of 'any[]' by default

Is there a way to assign the property myOtherKey with any value? I encountered a Typescript error that says.. A problem occurred while initializing an object. The property 'children' in the object literal implicitly has an array type of 'a ...

Determine the type of embedded function by analyzing the callback

Are you struggling to create a function that takes an object and returns a nested function, which in turn accepts a callback and should return the same type of function? It seems like achieving this with the same type as the callback is posing quite a chal ...

Looking to verify a file using ngx-file-drop in Angular 5 or higher?

I am currently implementing "ngx-file-drop" in Angular 6. <file-drop headertext="Drop files here" (onFileDrop)="dropped($event)" (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" multiple> <span> ...

Endpoint path for reverse matching in Mongodb API

I am currently in the process of setting up a webhook system that allows users to connect to any method on my express server by specifying a method and an endpoint to listen to (for example PUT /movies/*). This setup will then send the updated movie to the ...

Combining one item from an Array Class into a new array using Typescript

I have an array class called DocumentItemSelection with the syntax: new Array<DocumentItemSelection>. My goal is to extract only the documentNumber class member and store it in another Array<string>, while keeping the same order intact. Is th ...

Is it possible to generate an array of strings from the keys of a type or interface?

Imagine a scenario where we have a type or interface defined as NumberLookupCriteria: type NumberLookupCriteria = { dialCode: string; phoneNumber: string; } or interface NumberLookupCriteria { dialCode: string; phoneNumber: string; } Is there a w ...

Utilizing .js file alongside declaration files .d.ts in Angular: A guide

I am facing an issue with my Angular 7 app where I need to include some typed JS constants from outside of the project. These constants are essential for the AngularJS app and need to be kept in a separate js file. I have defined a new path in the tsconfig ...

Addressing security issues identified by npm audit

I am working on resolving 3 vulnerabilities that were identified by running npm audit, and it appears that the issues cannot be automatically fixed using npm audit fix. ❯ npm audit fix npm WARN audit fix <a href="/cdn-cgi/l/email-protection" class="__ ...

Encountering the identical error while trying to fetch an updated version of the React application

We are facing an issue with our react app located in a shared repository. It appears that only one person is able to work on it at a time. Whenever someone works on the project, pushes a new version, and another team member tries to pull and run the update ...

NPM is having trouble installing packages, but on the bright side, Yarn

After cloning a starter code of express, I encountered an issue when running npm install to install packages from "packagejson". However, when using Yarn with yarn install, all packages were installed successfully. This has happened to me before and I am c ...