Skip to content

Added package.js support for themes (and plugins)#2156

Merged
ErisDS merged 1 commit intoTryGhost:masterfrom
javorszky:iss2081
Feb 16, 2014
Merged

Added package.js support for themes (and plugins)#2156
ErisDS merged 1 commit intoTryGhost:masterfrom
javorszky:iss2081

Conversation

@javorszky
Copy link
Contributor

Closes #2081

  • Amended require-tree to allow package.json file parsing to return the contents of the file as json on the package.json key.
  • settings api populates theme data package.json if it exists. Otherwise it assigns false to it
  • general.hbs (salute) was reworked to if there is the package.json key on the theme is not false, it will use the name and version keys of that. You can break it by not having a name or version in the package.json file.

This comment was marked as abuse.

This comment was marked as abuse.

@javorszky
Copy link
Contributor Author

Do not merge this in, as I'd like to have eyes on this first. :)

This comment was marked as abuse.

@javorszky
Copy link
Contributor Author

As far as I can tell, this is ready to be merged.

@ErisDS ErisDS self-assigned this Feb 10, 2014
@ErisDS
Copy link
Member

ErisDS commented Feb 11, 2014

Sorry, I've not had much time to look at this yet (I'm prepping for a conference this week). One thing I did notice is that if you add a badly formatted package.json the error message looks like this:

error

When it needs to be a nicely formatted red-white-green error similar to what I get if I try to activate a non existent app:

error2

@javorszky
Copy link
Contributor Author

@ErisDS, updated with pretty error / warning messages. ^_^

And rebased.

@javorszky
Copy link
Contributor Author

Wee, so... juggled code around. This is the most sane solution I can come up with with how all the module dependencies are laid out.

errorHandling doesn't work within require-tree, as it causes a circular dependency. (server/index.js wants config/index.js which includes require-tree, but server/index.js already has errorHandling included, so require-tree can't. Hope this makes sense)

Also, hat tip to @hswolff!

Closes #2081
* Amended require-tree to populate availableThemes and availablePlugins to use full file names (`basename.ext`) as keys instead of just basename. This way `image.jpg`, `image.png`, `image.gif` won't overwrite the `image` key.
* Amended require-tree to allow package.json file parsing to return the contents of the file as json on the `package.json` key.
* settings api populates theme data `package` if it exists. Otherwise it assigns `false` to it
* `general.hbs` (salute) was reworked to if there is the package key on the theme is not false, it will use the `name` and `version` keys of that. You can break it by not having a `name` or `version` in the package.json file.
* Added error and warning messages for package.json file parse errors and misses

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@hswolff
Copy link
Contributor

hswolff commented Feb 14, 2014

This is lookin gooood!

ErisDS added a commit that referenced this pull request Feb 16, 2014
Added package.js support for themes (and plugins)
@ErisDS ErisDS merged commit 5124951 into TryGhost:master Feb 16, 2014
@javorszky javorszky deleted the iss2081 branch February 16, 2014 19:32
halfdan added a commit to halfdan/Ghost that referenced this pull request Feb 17, 2014
@ErisDS ErisDS removed their assignment Jun 22, 2021
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.

Add package.json support for Themes

4 participants