c9 / architect Goto Github PK
View Code? Open in Web Editor NEWA simple yet powerful plugin system for large-scale node applications
License: MIT License
A simple yet powerful plugin system for large-scale node applications
License: MIT License
Hello. I really like architect. But I have a question.
In real life plugin can have many versions and can have some installation and migration logic (e.g Db schema can change). How to implement this in application based on architect.
Thanks for help.
Is it worth mentioning that when a provided plugin is not a function, the register method sets a 'name' property. This could clobber any existing data if name was already in use.
I'm using c9.io since last 3 years, its one of the superb standalone application for Node.js for me. As Sometimes the browsers crashes and I lost the data and things, is it possible to have a open source Windows/Mac native app? I will be glad to contribute in any of the either platform.
Cheers!
Ok quick scenario
Lets say i want to provide a service as "db.mongo" and "db.mysql"
ok
lets say another plugin "app.users" consumes "db"
is it possible to render a object like
{db:{
mongo:$mongo_obj,
mysql:$mysql_obj
}}
but! lets say i only want to consume "db.mysql"
{db:{
mysql:$mysql_obj
}}
Hello,
What is the best practice to test an plugin with architect ?
Have you an example of test on a plugin ?
In fact, I have trouble in test of my plugins because it depends on other plugins...
Thank you in advance.
Route all logging calls to a logger/console instance that can be set via an option to createApp()
. If not set default to console
and if set to null
or false
disable all logging except for errors.
I was trying to install cloud9 and when I do I get an error with your application. When I tried to DL your master branch and build it, I see the same error...
npm ERR! node -v v0.7.7-pre
npm ERR! npm -v 1.1.22
npm ERR! message No compatible version found: architect-socket-transport@'>=0.2.0- <0.3.0-'
npm ERR! message Valid install targets:
npm ERR! message ["0.3.0"]
npm ERR!
Any Idea what I am doing wrong?
hi,i would like to ask if it's possible to create a plugin manager to enable and disable the plugins like wordpresa,drupal?and do you mind to give an example?thanks a lot
I was hoping you could put together a couple demo apps that are not web focused, maybe something like a server that collects logs, parses them, and dumps them into a db. Or a TCP server listening for connections and responding. Just trying to get a feel for how that would look modularized with Architect.
Looks like this was synced with cloud9 version recently. Could a new release to npm happen? Thanks!
Throws up this error ... . When i type http://localhost:8080/ I dont think the method Utils.modified exists in the connect 2.7.6 specified in the package.json.
/code/github.com/connect-architect/connect/middleware/static.js:184
if (!utils.modified(req, res)) {
^
TypeError: Object # has no method 'modified'
at /code/github.com/connect-architect/connect/middleware/static.js:184:18
at Object.oncomplete (fs.js:107:15)
PR was taken in last week but the NPM package hasn't been updated. Yipes!
It would be nice to have a search function for services. Cloud9 has a lot of plugins, and to better understand the abilities of each service I need to know which plugin defines the service.
i have hacked up a plugin auto loader
can be found at
I have read the README.markdown and the examples and also the plugins/architect.log plugin source and i think i have a basic understanding of how to use architect.
But as far as I've seen there are some undocumented functions and namings.
What is a plugin? What is a service? What is a module?
How does register and unregister at runtime work? Maybe others?
If a better/complete documentation exists, others (like me) could write more and better examples or contribute in other ways.
It's be nice to say something like architect create -name 'moduleOne' -dependencies 'dep1' 'dep2' 'dep3' -main 'module-one.js'
My project is growing to something like 50 modules so far and I find this creating of files to be a small distraction.
Any thoughts?
I found this problem (for me at least), in this module while using it in my application. When the application loads, and if loading of one plugin fails, the entire application fails. This is a considerable problem when you are developing a pluggable application where a set of developers implement the core of the applications and some others develop plugins for it. When one plugin fails, it affects the entire application.
I prefer if there's a way to only load the modules which were successfully loaded. And also +1 if I can get a list of failed modules so that I can display custom error log messages to identify them. I hope to create a fix for this and create a pull request if this issue seems sensible.
We need unit tests showing all usage options runnable via npm test
.
This will help when updating cloud9
.
Hey there, how do I use the plugin options? This is rarely documented. In particular I'd hope for a way to do IoC (I'd like to insert my current express
instance via options to a plugin from my main.js).
Is this somehow possible? Heads up for the library, though you should really update the stuff from core 👍
It seems there were no recent activities, I wonder if this project still active.
Does this work for for latest Node with ES 6 support?
Is there a plan to upgrade to ES 6 module?
npm ERR! code E404
npm ERR! 404 Not Found: architect-http-static@~0.0.1
While doing npm install getting above error
Hi,
I've gone through lots of different approaches when it comes down to organising large NodeJS apps and this one is by far the best one I've ever seen (probably just because I think exactly the same way about DI). The only thing I am worried about is the date of the last commit & the number of awaiting PR's to be reviewed / merged. Is the repo still production-ready & up to date or it's been deprecated? Thanks!
Another question (I will try to sort that out tomorrow) is - whether it's possible to include custom plugin-only dependencies in my package.json? Let's say I have 10 modules (each module declares passport strategy & rest links) and I don't want to pollute my root package.json with social media specific libraries like graph-fb
or instagram-node
.
And - the very last question - is 'register' callback capable of being invoked as async callback? Let's say I have database
module and I want to register it only after successful connection with the database. So it means that other modules that consume it will have to wait till the connection is being established.
If I want to inject, for example, the promise
npm module. How is this achieved? Forgive me if this is an obvious question, I've watched the YouTube video and read the documentation to no avail. Just getting my feet wet with different DI in Node
Im looking for a plugin system I can use that will allow users to add functionality, and take advantage of events/filters that already exist in the application. I can see that Architect allows you to install plugins that add functionality that can be used by the system and other plugins, but does it allow you to add/apply filters? (WPs add_filter() and apply_filters() for example), or add/apply actions/events?
Lets say i have plugin called "data-distribution" which consumes three services service1, service2,service3. In the "data-distribution" folder / plugin, there are other js files/modules are created. In one of the module of "data-distribution" needs to access "service1", how would it access it ?
so in other words, every single file has to be "plugin" (its own folder with package.json) or can it be some higher level plugin and all other can share the imported services ?
ಠ_ಠ
Hey,
Whats the status of this project? Are you guys still using it in production?
Currently, loadConfig
only accepts a file path. However, an equally reasonable approach is to pass the array of plugin definitions directly to loadConfig
.
loadConfig
supports a JS file, but it requires synchronous loading and return of the plugin list directly via module.exports, which may not be feasible in all applications.
Proposed change adds the following capability:
loadConfig(configArray, base, [callback])
configArray
array of plugins to load with their configurationbase
location to use as the base for pluginscallback
an (optional) callbackPR inbound.
usecase:
Cloud9 ace plugin reloads document when file on disk changes.
If diffing library is present, it can apply diff, to keep editor state like selection and folds.
But in case there is no diffing library, simply setting value is good enough.
Now adding dependency on diffing plugin, will break all configs using ace, and will require all of them to either include the diffing lib, or to include mock plugin as a fallback.
I think this is bad because it makes local change in ace plugin, into breaking change for all its consumers. But If optional dependencies were supported, only apps that needed diffing, would include it and it would only require one if statement in the ace plugin.
The container throws exceptions in a couple of places. This is bad since there is no way to catch those errors. This is especially problematic since we use architect as a library. The exceptions must be converted into error objects and passed the the callback of createApp().
https://github.com/c9/architect/blob/master/container.js#L52
For example, i have a plugin that creates a database connection when given the hostname for the db server.
Now i want to have two connections to two different servers.
so from plugin1 i will consume database
with hostname1
and from plugin2 i will consume database
with hostname2
is it possible?
I'm trying to update architect from 0.1.8 to 0.1.10 I get this error:
TypeError: Cannot assign to read only property 'name' of function ....
Here is a small project (just one plugin) that reproduce the error https://github.com/aledbf/architect-upgrade-type-error.git
Any idea?
Thanks
it would be ideal to have a "before" under plugins.package.json
so one can tell a plugin to load before a provided plugin (if provided plugin is defined)
{
"name": "auth",
"version": "0.0.1",
"main": "auth.js",
"private": true,
"plugin": {
"consumes": ["database"],
"provides": ["auth"]
}
}
{
"name": "auth-env",
"version": "0.0.1",
"main": "auth-env.js",
"private": true,
"plugin": {
"before": ["auth"]
}
}
this would allow plugin "auth-env" to register before "auth" without knowing "auth-env" is there,
and allow for testing and dev plugins without the main plugin knowing about it
resolveConfigSync
goes to inf loop (base eq /
, and resolve("/..")
eq /
) if package not exist
Hello,
Just to let you know that I have created a simple module to easily create base structure and files for new architect projects.
https://github.com/leeroybrun/architect-init
Feedback is always welcome !
Hi there,
I am using the module but I am a bit confused how the assertions are used. As I see in the core project, you are using the assertions against the options object. For example, in the c9.core/client.js it is used like that:
assert(options.baseUrl, "Option 'baseUrl' is required")
It is not used against imports though. For example, in the c9.vfs.standalone/standalone.js the preview handler it is imported like that:
var previewHandler = imports["preview.handler"];
What if a developer forget to add this dependency in the consume array? The previewHandler it will be undefined and it will break at runtime in this specific example. Why there is not an assertion like that:
assert(imports["preview.handler"], "preview.handler is required");
Is there something that I am missing?
If no consumes/provides are used in loaded plugins the serviceReady
event never fires causing the boot sequence to never finish.
Hello,
I have a question about ready signal. Is a way to access ready signal from plugin. When the whole app is ready I want a plugin do some stuff. Is it possible ?
Thanks !
Jérémie.
We use architect version 0.1.11. However, there is no 0.1.11 tag in your git repository :( Please, can you create tag corresponding to the 0.1.11 ?
I know this is unusual. Is it possible to add API for unloading a plugin?
Thanks!
When an err
object is passed to register
architect should stop and pass err
through to createApp
callback. Right now it continues to initialize.
I am using webpack for a bigger project, and am evaluating architect as plugin system.
You are using __dirname in the demos. I found the problem because of that - webpack replaces __dirname
with "/" - so it's unusable. But worse: even if using relative paths for the config file, architect does not find the file when usign webpack easily:
Using Architect.loadConfig("../config.js")
does not work when config.js is in the ".." firectory of the calling file.
Have you got any suggestions how to deal with that? I'm sure you are using webpack or another bundler for C9 as well - how did you manage not breaking Architect here?
I just started moving some of my apps' modules into Architect, and I'm wondering if you have any tips about unit testing architect-controlled modules. Some logic can be exposed by setting module.exports.method = ...
outside of the setup function, but what about modules that require registration before use?
I'm using Mocha for tests currently.
Hi,
A simple question from a Node/Javascript noob : Dose Architect supports a "shutdown" event ?
Thank you in advance :)
Hello,
I have a question about the management of your plugins in C9.
At C9, I think that you have multiples projects, with lots of plugins inside. And sometimes, you need to reuse plugin in another project. So :
If a developper, not working at C9, have an idea on the question, i'm also interested in !
Thanks !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.