Skip to content

Unify .js filename style to success the minification command - #5131

Open
neko314 wants to merge 1 commit into
reactjs:mainfrom
neko314:filename-style
Open

Unify .js filename style to success the minification command#5131
neko314 wants to merge 1 commit into
reactjs:mainfrom
neko314:filename-style

Conversation

@neko314

@neko314 neko314 commented Sep 29, 2022

Copy link
Copy Markdown

I always thank you all to maintain docs or codes.
I recently started to learn React with beta docs.

What's problem

I found the command in gaearon/minification.md fails. This page is referenced from React docs.

$ npx terser -c -m -o like_button.min.js -- like_button.js
ERROR: ENOENT: no such file or directory, open 'like_button.js'
    at Object.openSync (node:fs:599:3)
    at Object.readFileSync (node:fs:467:35)
    at read_file (/Users/keiko/playground/hello-react/node_modules/terser/dist/bundle.min.js:30065:23)
    at /Users/keiko/playground/hello-react/node_modules/terser/dist/bundle.min.js:29872:41
    at Array.forEach (<anonymous>)
    at run_cli (/Users/keiko/playground/hello-react/node_modules/terser/dist/bundle.min.js:29871:32)

The reason of this problem

The reason is why the difference of filename like_button.js or like-button.js.

The gist uses like_button.js but current React Docs BETA users like-button.js

What I confirmed

  1. With actual filename, the command success.
  2. I can jump to new page after this change.
Jump.to.new.gist.page.-.30.September.2022.mp4

What I did in this PR

Replace link to new gist. Thank you for your creation.

What I want you to help

Honestly, I can't judge which is better,like_button.js orlike-button.js by my self.
I found the style-guide by Google on filename. It says both is OK. It makes me feel more difficult to make a choice by me alone. That means, this PR is appropriate or not. What do you think?

@facebook-github-bot

Copy link
Copy Markdown
Collaborator

Hi @neko314!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@github-actions

github-actions Bot commented Sep 29, 2022

Copy link
Copy Markdown

Size Changes

Details

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

This PR introduced no changes to the javascript bundle 🙌

@gaearon

gaearon commented Sep 29, 2022

Copy link
Copy Markdown
Member

let's just use a different link, I made https://gist.github.com/gaearon/ee0201910608f15df3f8cd66aa83f98e instead

@facebook-github-bot

Copy link
Copy Markdown
Collaborator

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot

Copy link
Copy Markdown
Collaborator

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@neko314

neko314 commented Sep 29, 2022

Copy link
Copy Markdown
Author

@gaearon
oh, that's a simple and better idea!
I'll commit to update link later.

@neko314

neko314 commented Sep 29, 2022

Copy link
Copy Markdown
Author

@gaearon
I remade the commit and update description. As the movie I attached to description, I could access new gist page you created from doc on my development env.

In this page: https://gist.github.com/gaearon/42a2ffa41b8319948f9be4076286e1f3
filename is like_button.js.
But actual filename in React Doc Beta is like-button.js.
This difference caused the command to fail.

```
$ npx terser -c -m -o like_button.min.js -- like_button.js
ERROR: ENOENT: no such file or directory, open 'like_button.js'
    at Object.openSync (node:fs:599:3)
    at Object.readFileSync (node:fs:467:35)
    at read_file (/Users/keiko/playground/hello-react/node_modules/terser/dist/bundle.min.js:30065:23)
    at /Users/keiko/playground/hello-react/node_modules/terser/dist/bundle.min.js:29872:41
    at Array.forEach (<anonymous>)
    at run_cli (/Users/keiko/playground/hello-react/node_modules/terser/dist/bundle.min.js:29871:32)
```
@neko314

neko314 commented Sep 30, 2022

Copy link
Copy Markdown
Author

oops!
I took a mistake, that I added extra file.
I fixed the commit and push again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants