Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Remove main.js requirement for themes #9434

Merged
merged 1 commit into from
Oct 9, 2014
Merged

Remove main.js requirement for themes #9434

merged 1 commit into from
Oct 9, 2014

Conversation

le717
Copy link
Contributor

@le717 le717 commented Oct 3, 2014

This is for #8626.

var mainJS = path.join(extractDir, commonPrefix, "main.js");
if (!fs.existsSync(mainJS)) {
var mainJS = path.join(extractDir, commonPrefix, "main.js"),
isTheme = checkIfTheme(packageJSON);
Copy link
Member

Choose a reason for hiding this comment

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

You can just use metadata here instead of re-parsing it. (Unless metadata is falsy, in which case you should skip the check since the data is unreadable anyway).

So, something like this: var isTheme = metadata && metadata.theme;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does metadata exist in that scope? I just read the code again, I don't see any place metadata has been introduced in that scope unless it is coming in through the callback parameter.

Copy link
Member

Choose a reason for hiding this comment

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

@le717 Yes -- if you look at line 300, metadata is an argument to the function that you're adding this code to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm. That's interesting, as I am not finding metadata in the script scope, only in individual functions. Will fix this with your suggestion right now.

@peterflynn
Copy link
Member

@dangoor should probably do the official review here, but this looks like a decent start to me -- marking as ready for full review (pending my comment above being addressed).

@le717
Copy link
Contributor Author

le717 commented Oct 3, 2014

@peterflynn Changes pushed.

isTheme = metadata && metadata.theme;

// Throw missing main.js file only for non-theme extensions
if (!fs.existsSync(mainJS) && !isTheme) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Checking isTheme first will completely skip checking the file system if the extension is a theme.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! Fixed.

@MiguelCastillo
Copy link
Contributor

Changes look good to me. Theme authors will appreciate this one :)

@dangoor
Copy link
Contributor

dangoor commented Oct 5, 2014

There are jasmine-node tests for package validation. Please add a test to spec/Validator.spec.js to exercise the theme check.

@dangoor
Copy link
Contributor

dangoor commented Oct 5, 2014

Also, can you bump the version in the src/extensibility/node/package.json file to 0.45.0? That way, we'll be able to easily install this as a new version for brackets-registry.

The change itself seems fine and will be a nice improvement!

@le717
Copy link
Contributor Author

le717 commented Oct 5, 2014

@dangoor Changes pushed, ready for further review. I could not find the item in the Jasmine window to run these tests, so can you clue me in on where that link is as well?

@dangoor
Copy link
Contributor

dangoor commented Oct 5, 2014

Since that's a node part of Brackets, you can run npm install in that directory and also run npm install -g jasmine-node to be able to run Jasmine from the command line.

There are some integration tests that run from the test window but these unit tests run from the command line.

Sent from my iPhone

On Oct 5, 2014, at 3:43 PM, Triangle717 [email protected] wrote:

@dangoor Changes pushed, ready for further review. I could not find the item in the Jasmine window to run these tests, so can you clue me in on where that link is as well?


Reply to this email directly or view it on GitHub.

@le717
Copy link
Contributor Author

le717 commented Oct 6, 2014

@dangoor All tests pass, including the new one you requested. I'll squash this in a few minutes. :)

@le717
Copy link
Contributor Author

le717 commented Oct 7, 2014

That was a long few minutes. Squashed and ready to go.

@ingorichter
Copy link
Contributor

Looks good to me. Thanks.

ingorichter added a commit that referenced this pull request Oct 9, 2014
Remove main.js requirement for themes
@ingorichter ingorichter merged commit d48ab74 into adobe:master Oct 9, 2014
@le717
Copy link
Contributor Author

le717 commented Oct 9, 2014

All the theme authors right now.

Cheering

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants