question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to update the build - dist/*.js files

See original GitHub issue

@dharmendrasha I would really appreciate your opinion on this.

We are packaging all .js code into dist/index.js - as it’s done in the typescript-action template. The reasoning is to make the action immediately runnable, without waiting for npm i.

This has two unfortunate consequences:

  • We are mixing the code repository with the build artifacts storage. The builds now have ~2.8MB. Every change to those files adds them to git history so if we changed them after every PR, maybe a few times in the PR, the repository size will grow. This is probably not a concern for the usage of the action - I guess when the action is checked out in a workflow, it fetches only the single specific commit.
  • dist/index.js file is too big to be manually reviewed. It wouldn’t be hard to inject malicious code into this action hidden in otherwise relevant PR.

Up until now, I updated the dist/*.js files only before releasing a new version instead of every PR and also I avoided merging changes to the dist/index.js made by others. With more PRs coming this is not sustainable.

What would you suggest? I was thinking about documenting contribution guidelines where it would be stated the dist/index.js should not be modified in the PRs and instead automate the build as part of the workflow run. The best would be if we could fail the check run if the file is modified and at the same time the workflow would run the build and update the file automatically before the PR is merged or before the release.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dornycommented, Nov 13, 2022

Interestingly, the content of the source map was the same on windows and WSL but the diff was detected when it was running in GitHub action. I’m disabling the source-map, it’s not much useful as you said.

1reaction
dornycommented, Nov 13, 2022

@flobernd Turns out we already had .gitattributes set to force LF. I also don’t see any absolute path from my own PC in the source maps. There must have been some other issue that was resolved in the last two years. I’m adding the check from the typescript-action template.

Locally when you have index.js checked out with LF endings and run npm run package you will see the files as modified even when the CRLF would get converted to the LF on the remote. I added a package to convert CRLF to LF in the dist folder as part of the package command. This should prevent it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My Dist file is not updated - Stack Overflow
I'm trying to create a 'Dist' folder with "ng build..." in Angular 4, but the file created is not updated (one month ago...
Read more >
Where do I put JS files so they are added to the /dist/ folder?
I don't understand how to add custom JS files so they get auto imported into the /dist/ folder. Furthermore, I have some custom...
Read more >
How can I recompile js file in dist folder?
Show activity on this post. It appears that calling the following from your theme folder should do the job: npm install npm run...
Read more >
Output Management - webpack
Now run an npm run build and inspect the /dist folder. If everything went well you should now only see the files generated...
Read more >
Documentation - Creating .d.ts Files from .js files - TypeScript
How to add d.ts generation to JavaScript projects. ... Run the TypeScript compiler to generate the corresponding d.ts files for JS files ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found