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

factor common export code into export.js #27772

Merged
merged 3 commits into from Mar 30, 2019

Conversation

cpirich
Copy link
Contributor

@cpirich cpirich commented Mar 29, 2019

  • A sizable portion of src/gamelab/Exporter.js and src/applab/Exporter.js are similar or identical. I've taken the pieces that are essentially identical and moved them into src/export.js to simplify maintenance - and provide a location for further consolidation.

@cpirich cpirich requested a review from islemaster March 29, 2019 16:33
@islemaster
Copy link
Contributor

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

Great extraction and cleanup! All these helpers you've isolated and broken global dependencies seem ripe for unit-testing. 😍

@@ -0,0 +1,138 @@
import {SnackSession} from '@code-dot-org/snack-sdk';
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this file should live in apps/src/lib/util instead of the source-root. Just thinking for someone trying to understand our code, this isn't one of the first things we'd want them to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I debated that as well. we have src/, src/util/, src/lib/util/ as potential candidates. I tried to match the convention being used (common code seemed to be at root, re-usable "utilities" seem to be in util) - but I can definitely see the argument against using the root of src

Copy link
Contributor

Choose a reason for hiding this comment

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

I still try to stick to the organization proposed in https://github.com/code-dot-org/code-dot-org/blob/8990f16a29d8a1cf9dba0ffb220bd424e8542810/apps/docs/refactor.md although I'm not sure that's a shared goal anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

after merging with staging, I've moved the code into a new file recently created by @davidsbailey called src/util/exporter.js

}, data);
}

export function getEnvironmentPrefix() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not introduced in this PR, but wanted to call out that this big switch statement feels like something that should be a locals/globals.yml configuration setting and passed down to the client, rather than hard-coded in the client code here.

@cpirich
Copy link
Contributor Author

cpirich commented Mar 29, 2019

Updated after merging staging to fix a new issue: the webpack runtime needs to be referenced in the publishToExpo path. It was added for the ZIP path but not the other path.

@davidsbailey
Copy link
Member

Sorry for missing this, Chris! Thanks for catching.

@jmkulwik
Copy link
Contributor

Thank you for making this change!! +1 on the unit testing comment.

@cpirich cpirich merged commit d0ec2eb into staging Mar 30, 2019
@cpirich cpirich deleted the cpirich/factor-common-export-code branch March 30, 2019 04:35
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.

None yet

4 participants