Skip to content

Conversation

@lindapaiste
Copy link
Collaborator

@lindapaiste lindapaiste commented May 9, 2023

Fixes #1423

Makes it easier to change the default project contents (for example, bumping the p5 version) because it doesn't need to be changed in so many different places.

Changes:

  • Choose server/domain-objects/createDefaultFiles.js as the "single source of truth" for default file contents and export the local constants defaultCSS, defaultHTML, defaultSketch.
  • Other files which duplicate these constants now import them createDefaultFiles.js instead. (server/scripts/examples.js, client/modules/IDE/reducers/files.js)
  • Export the initialState function from client/modules/IDE/reducers/files.js and use this function instead of duplicating the default files array. (client/modules/Preview/, client/testData/testReduxStore.js)

Next Steps:

  • There are still some files on the server with very repetitive code for creating files arrays. These can be cleaned up in a future PR by creating a utility function.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

Copy link
Collaborator

@raclim raclim left a comment

Choose a reason for hiding this comment

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

This is super helpful, thanks so much for working on this! Going to add this in too :)

@raclim raclim merged commit 1c05241 into processing:develop Jun 10, 2023
@lindapaiste lindapaiste deleted the refactor/default-sketch branch August 8, 2023 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use one default template

2 participants