Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Manual React setup #26

Conversation

Jack-Music
Copy link

As discussed on discord, i tried to change te setup from create-react-app to a manual setup

  • I would suggest to comment as many config options as we can, that every configuration is reasonable
  • Maybe we should change .gitignore to allow vscode settings and recommendations (very common)
  • It switches to four tabs as indent
  • It keeps the service-worker and the icons

If you have any suggestions or corrections, please leave a comment.

"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two can be good additions to this -

    "@babel/plugin-proposal-optional-chaining",
    "@babel/plugin-proposal-nullish-coalescing-operator"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 6e66da9

public/
webpack.config.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should webpack.config.js be ignored? How can other developers build it locally?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought wepack.config.js should not be linted

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, my bad. Read the filename as gitignore

.eslintrc Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
"html-webpack-plugin": "^4.3.0",
"style-loader": "^1.2.1",
"typescript": "^3.9.3",
"webpack": "^4.43.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought, since we've started with this config - why not use webpack 5?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as i know, webpack 5.0 is still in beta.
https://github.com/webpack/webpack/releases

"theme_color": "#000000",
"background_color": "#ffffff"
"short_name": "vMMX",
"name": "virtual Marbe Machine X",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo with Marbe

tsconfig.json Outdated
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"outDir": "./dist/",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally use this -

  "exclude": ["node_modules"]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add it, but is it really necessary when using: "include": ["src"]?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. No harm in explicitly ignoring node_modules I think

const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
// webpack will take the files from ./src/index
entry: './src/index',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it work without specifying the extension?

// and output it into /dist as bundle.js
output: {
path: path.join(__dirname, '/dist'),
filename: 'bundle.js',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to use filename : 'bundle.[hash].js' so that user won't have to hard reload for changes to take effect

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in 6e66da9

@Udayraj123
Copy link
Collaborator

Overall this stuff shall improve the collaborative developer experience by a good magnitude 😄

package.json Outdated
},
"scripts": {
"bundle": "webpack",
"test": "echo \"Error: no test specified\" && exit 1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it exit 0 for now to pass the checks

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6e66da9

},
"lint-staged": {
"*.{js,ts,tsx}": "eslint --cache --fix --ignore-path .eslintignore",
"*.{css,md}": "prettier --write --ignore-path .eslintignore"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier should apply to js/jsx/tsx too-

	"lint-staged": {
		"*.{js,ts,tsx}": "eslint --cache --fix --ignore-path .eslintignore",
		"*.{js,ts,tsx,css,md}": "prettier --write --ignore-path .eslintignore"
	},

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin "plugin:prettier/recommended" in .eslintrc starts prettier with eslint.
So prettier indirectly applies to js/jsx/tsx.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, wasn't aware of that feat. Cool!

<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<title>React App</title>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to keep this title?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review!
I replaced it with vMMX in 6e66da9.
Do you have suggestions for a better title?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vMMX sounds good for me - maybe we can later extend it with the currently loaded song.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's now add a favicon too now that we have a new logo 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay nvm it's already added

- added babel plugins
- fixed eslintrc, tsconfig, webpack.config
- fixed spelling issues in manifest and index
- updated dependencies
@Udayraj123
Copy link
Collaborator

Merged into dev branch #31

@mozi-h
Copy link
Member

mozi-h commented Jun 19, 2020

If this PR is no longer nececcary, you can close it, @Udayraj123
(Note: This has a more elaborate description and a longer history than your new PR, so you might want to continue #30's work here?)

@Udayraj123
Copy link
Collaborator

@mozi-h #30 is done too. And I can close this now. The history will be preserved well given we've mentioned this issue there too.

@Udayraj123 Udayraj123 closed this Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants