Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Why add *.js and *.d.ts files to source control? #658

Closed
BRUNNEL6 opened this issue May 9, 2018 · 9 comments
Closed

[Question] Why add *.js and *.d.ts files to source control? #658

BRUNNEL6 opened this issue May 9, 2018 · 9 comments

Comments

@BRUNNEL6
Copy link

BRUNNEL6 commented May 9, 2018

Is there a reason why the *.js and *.d.ts files are added to the source control inside the bundle-folder?
Build artifacts should usually not be stored inside a repository.

If these files get added to the .gitignore, it would lead to a smaller repository size and cleaner commits.

@weeco
Copy link

weeco commented May 9, 2018

I assume it's because this allows you you to directly use this repository as npm package.

@BrunnerLivio
Copy link
Member

BrunnerLivio commented May 9, 2018

@weeco
NPM does not care about .gitignore, if a .npmignore file exists. NPM only reads .npmignore file. So if the project is locally builded, NPM should deploy these files too. In the package.json is already a “prepublish” task, which builds the project before publishing. So this should work flawlessly

Quote from npmjs.org:

Use a .npmignore file to keep stuff out of your package. If there's no .npmignore file, but there is a .gitignore file, then npm will ignore the stuff matched by the .gitignore file. If you want to include something that is excluded by your .gitignore file, you can create an empty .npmignore file to override it.

@weeco
Copy link

weeco commented May 9, 2018

@BrunnerLivio Actually this is not correct, if there is no npmignore NPM will fallback to the gitignore. Anyways I don't see how this is relevant for your question / my response.

You asked why he added the bundle to github and I told you that you could install the package right from the github repository which allows you to test the non npm published features or fixes as well. That might be the reason why he didn't exclude the bundled packages in the gitignore.

@BrunnerLivio
Copy link
Member

@weeco oh got you now, kinda misunderstood you.

I just checked Angular & Angular Material & they also dont seem to add the build output files to the github repository. So I don’t think you really need to support git-repository dependencies. Correct me if I’m wrong or an example when you have to use a github repo instead of an npm package as dependency.

@wbhob
Copy link
Contributor

wbhob commented Sep 21, 2018

I remember why the compiled code is in source control: Lerna doesn't let you publish gitignor'ed directories, at least it didn't when we moved to Lerna. This is a bug with them that we've taken the fall for. As far as I know, this is still the case.

A solution would be to build directly into the src directory and ignore those files, but for right now the build scripts are linked to those files.

@BrunnerLivio
Copy link
Member

BrunnerLivio commented Sep 21, 2018

@wbhob this issue should get resolved if we use yarn workspaces #1060. We should focus on this PR for the 6.0.0 release. The build output will then be built inside the src directory. I can confirm this is possible because I got it working with yarn workspaces in my LXDHub project

@wbhob
Copy link
Contributor

wbhob commented Sep 21, 2018

I think this is something that can be discussed. That does add a lot of additional learning curve/complexity. This is something we can figure out down the line after comparing pros/cons of each

@kamilmysliwiec
Copy link
Member

Fixed due to #1176

@lock
Copy link

lock bot commented Sep 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants