Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defaultName for saving .js or .zip #178

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

North101
Copy link

Allows exporting defaultName which will be used when saving .js or .zip files

Fixes #177

Copy link
Owner

@sgenoud sgenoud left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Can you remove the code that changes the script name (or change it in a way that it actually takes the default name)

Always great to see people contributing!

export default (code, fileName) => {
fileName = fileName ?? 'replicad-script'
export default async (code, fileName) => {
fileName = fileName
Copy link
Owner

Choose a reason for hiding this comment

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

Are you sure this does something? I feel like it always take the name of the first export

Copy link
Author

Choose a reason for hiding this comment

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

    const shapeName =
      store.currentMesh.length === 1 ? store.currentMesh[0]?.name : null;
    return downloadCode(store.code.current, shapeName);

It'll use the shape name if there is only 1 shape and only if it has a name, then it will use the defaultName then it will fallback to replicad-script.

Copy link
Author

@North101 North101 Jan 11, 2025

Choose a reason for hiding this comment

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

Would defaultName ?? shapeName ?? 'replicad-script' be a better order?

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.

Change .zip filename
2 participants