Jasonette / Jasonette/JASONETTE-iOS
Jasonette Extension Manager
- Dominant language
- JavaScript
- Stars
- 5.2k
- Forks
- 347
- PR merge metrics
- No merged PRs in 30d
Description
# Jasonette Extension Manager
I've been thinking about how to make extensions easier to write and easier to use. Last time we tackled this problem we decided that each extension should be a cocoa touch library which then needs to be published to CocoaPods registry. Here's the solution by @seletz : https://github.com/Jasonette/JASONETTE-iOS/issues/34
I liked this at first, but after a while I realized that having to write a CocoaPod and publishing to its registry everytime you want to write an extension introduces too much friction. It's just too much work, and I think even a lot of experienced developers don't have experience creating a CocoaPod library, which means a huge mental hurdle to get started.
So I've been thinking about this for a while and recently had a mini-epiphany, and wanted to share my idea, and hopefully we can come up with a great solution once and for all.
Basically the idea is that: while Jasonette extensions can depend on other 3rd party libraries, **the extensions themselves don't depend on another extension**. This means there is no "dependency" to manage between extensions, and I think this is important.
### Extension manager
What if, instead of building a full fledged library for every extension, we just write a config file for each extension, which includes information about what libraries it depends on? And once a user decides which extension to use, just automatically add all these 3rd party libraries to the **core Jasonette**'s `Podfile` and install once? Here's how it would work in practice:
#### A. From an extension developer's point of view
1. Write a class and a method (Let's say we're writing a class called `JasonPeanutAction`)
2. If the extension relies on a CocoaPod library, add that to some config file. Let's just name this `package.json` for now. The file would look something like this:
```
{
"dependency": [
"pod 'AFNetworking'",
"pod 'SDWebImage'"
]
}
```
3. At this point, we have three files:
- `JasonPeanutAction.h`
- `JasonPeanutAction.m`
- `package.json`
4. Now just publish this to Github. No complex code generation. No submmission to registry. Just a simple push to a repo. This is all you have to do as an extension developer.
#### B. From extension user's point of view:
1. Run `ExtensionManager` (Which is a hypothetical program that comes with Jasonette by default, like `Setup`)
2. `ExtensionManager` prompts the user to enter the github repo URLs of the Jasonette extensions they would like to use.
3. When the user enters the github urls, it clones them to Jasonette project folder. Now we have all the classes. But we still need to add the libraries the extensions depend on.
4. So the `ExtensionManager` goes through all the extensions, looks at each `package.json` file, and adds the `items` array to Jasonette's `Podfile`.
5. Lastly, `ExtensionManager` runs `pod install` to finish installation.
All of above is taken care of automatically by the `ExtensionManager` app. Maybe we could even integrate this into `Setup`.
### Cross-platform?
I think this approach can be easily scaled out to other platforms. We are not implementing a dependency manager, it's just a meta manager that takes advantage of each platform specific dependency manager. In case of Android, here's what the workflow would look like:
#### A. From extension developer's point of view:
1. Write a class and a method (`JasonPeanutAction.java`)
2. If the extension relies on an Android library, add that to `package.json`. The file would look something like this:
```
{
"dependency": [
"compile 'com.squareup.okhttp3:okhttp:3.4.2'",
"compile 'com.github.bumptech.glide:glide:3.7.0'"
]
}
```
3. Just publish on github. At this point, the only files we have written are the `JasonPeanutAction.java`, and `package.json` files.
#### B. From extension user's point of view:
1. Run `ExtensionManager`
2. `ExtensionManager` prompts the user to enter the github repo URLs
3. When the user enters the github urls, it clones them to Jasonette project folder. Now we have all the classes.
4. Then `ExtensionManager` looks at the `package.json` file for each extension, and adds the `items` array to Jasonette's `build.gradle`.
5. Lastly, `ExtensionManager` runs `gradlew build` to finish installation.
### Conclusion
This approach would mean:
1. No need to build a full fledged library just to write an extension.
2. No need to publish to package manager registries like CocoaPods or Maven
3. One command execution takes care of all the extension installation
**This is just a rough draft so there may be some flaws in the details, but I would appreciate it if anyone can share thoughts or feedback. Or if you have a better idea please share!**
Contributor guide
Research direction
The proposal names Setup, ExtensionManager, package.json, Podfile, and build.gradle, but no implementation files or tests. Start by reviewing how Setup currently works, then define the supported extension and dependency workflows for iOS and Android. Done would require an agreed design and an implemented manager workflow rather than feedback on the concept.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, github, ios, java, objective-c
- Domain
- build-system, mobile-dev, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100