Vaadin 14 - Questions about package.json and pnpm-lock.yaml

Hi

I have notices some files like “package.json” “pnpm-lock.yaml” “webpack.config.js” etc
Is these files generated automatically or created manually?

Should I put these files in gitignore, is there a gitignore best practice I can follow?

Thanks & Regards

Hi,

At the end of this page you have a good summary of the best practices: https://vaadin.com/docs/v14/flow/v14-migration/v14-migration-guide.html

The following files/folders have been generated in the root of your project:

  • package.json and package-lock.json pnpm-lock.yaml: These files keep track of npm packages and pin their versions. You may want to add these to version control, in particular, if you added any local package directly with npm.
  • node_modules directory: npm package cache, do not add this to version control!
  • webpack.config.js: webpack configuration. Include in version control. You can add custom webpack configuration to this file.
  • webpack.generated.js: Auto-generated webpack configuration imported by webpack.config.js. Do not add to version control, as it is always overwritten by vaadin-maven-plugin during execution of the prepare-frontend goal.

By default you can use the gitignore included in our starter: (from Vaadin 16 starter)

/target/

# IDEA
.idea/
*.iml

# MacOS
.DS_Store

# Eclipse
.settings
.classpath
.project

# The following files are generated/updated by vaadin-maven-plugin
node_modules/
pnpmfile.js

# Browser drivers for local integration tests
drivers/
# Error screenshots generated by TestBench for failed integration tests
error-screenshots/

webpack.generated.js