{"id":16318031,"url":"https://github.com/workmanw/ember-multi-app","last_synced_at":"2025-03-22T21:31:39.481Z","repository":{"id":146325896,"uuid":"43615409","full_name":"workmanw/ember-multi-app","owner":"workmanw","description":"Demonstrates a pattern to enable multiple ember apps to share common code.","archived":false,"fork":false,"pushed_at":"2015-10-03T22:33:21.000Z","size":168,"stargazers_count":19,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T14:53:47.246Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workmanw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-03T21:20:46.000Z","updated_at":"2020-06-27T03:30:26.000Z","dependencies_parsed_at":"2023-04-09T02:54:24.843Z","dependency_job_id":null,"html_url":"https://github.com/workmanw/ember-multi-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-multi-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-multi-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-multi-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-multi-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workmanw","download_url":"https://codeload.github.com/workmanw/ember-multi-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245022573,"owners_count":20548562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T22:09:47.970Z","updated_at":"2025-03-22T21:31:39.156Z","avatar_url":"https://github.com/workmanw.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ember Multi App\n\n## Warning\nThis pattern is not formally sanctioned by the ember-cli. It's possible future ember-cli changes could break this causing you a painful upgrade. I will do my best to keep this up to date.\n\n## Overview\nThis repository demonstrates a pattern for structuring multiple ember-cli apps that share some common code (such as models, components, etc).\n\n### Why?\nAt [Batterii](http://batterii.com) we have multiple ember apps that share common code. These apps are separated because they are different apps, serving different purposes. They have different login pages, user home, settings, etc. But what they do share is components, models, helpers, some base services and mixins, and a few other things.\n\nIf you're thinking about using this pattern for performance or isolate/break up your codebase, I would urge you to hold out for [Engines](https://github.com/emberjs/rfcs/pull/10).\n\n## Details\n\n### Summary\n\nThe pattern demonstrated by this repo is essentially multiple concurrent ember-cli based applications. These applications make use of a \"local ember-addon\" mechanism and a symlink. Each app exists independantly of the others, they just share common code. When developing you'll use multiple to servers (one per app). When building the script will trigger multiple `ember build` calls (one per app) and smash the builds together into a single dist (there is no conflict concern since the files will be fingerprinted).\n\n### Outline of configurations.\nYou can use this section if you want to duplicate this setup without having to clone this repo.\n\n* \"apps/common\" is symlinked to \"apps/app1/lib/common\" and \"apps/app2/lib/common\".\n* \"apps/app1/package.json\" and \"apps/app2/package.json\" include \"lib/common\" as a \"ember-addon\".\n* \"apps/common/package.json\" has keywords for \"ember-addon\".\n* \"apps/common/app/styles/common.scss\" imports all SASS files in the common directory.\n  - \"apps/app1/styles/app.scss\" and \"apps/app2/styles/app.scss\" import \"common.scss\".\n* **ALL** apps (app1 and app2) have the same `modulePrefix` set in \"config/environment.js\".\n  - All ES2015 imports use \"app\" as the prefix, even in \"common\". Eg: `Import CommonAppMixin from \"app/mixins/common\";`\n* Each app is configured with a different port (see: \"apps/app1/.ember-cli\" and \"apps/app2/.ember-cli\")\n* \"apps/common/tests/integration\" and \"apps/common/tests/unit\" are symlinked to \"apps/app1/tests/common-integration\" and \"apps/app1/tests/common-unit\" respectfully.\n\n## Using repo\n\n### Installing\n\n  `./bin/install.sh`\n\n### Running server\n\n  `./bin/serve-app1.sh` [localhost:4200](http://localhost:4200)\n\n  `./bin/serve-app2.sh` [localhost:4300](http://localhost:4300)\n\nEach server runs on a different port so you can launch multiple at the same time.\n\n### Testing\n\nYou'll notice that there are \"apps/common/tests/integration\" and \"apps/common/tests/unit\". These tests relate to the code in the common addon, though due to ember-cli structure, they are not able to run independantly. So you'll find two additional symlinks in \"apps/app1/test\" for \"common-integration\" and \"common-unit\".\n\nThus common tests get lumped into the first app.\n\n  `./bin/test.sh`\n\n  -- or --\n\n  `./bin/server-app1.sh` and [localhost:4200/tests](http://localhost:4200/tests)\n\n### Building\n\n  `./bin/build.sh`\n\n**Note:** you may need to tweak the build script to match your deployment needs. Right now each app will build to an \"`app_name`.html\" file (eg \"app1.html\").\n\n### Adding another app\n  * `cd apps \u0026\u0026 ember init app3`\n  * `mkdir app3/lib \u0026\u0026 cd app3/lib \u0026\u0026 ln -s ../../common .`\n  * Edit \"app3/package.json\", adding the following (see app1/package.json as example):\n  * Edit \"app3/.ember-cli\" and bump the port number\n  * Copy \"bin/serve-app1.sh\" to \"bin/serve-app3.sh\"\n  * Edit \"bin/install.sh\", \"bin/build.sh\", \"bin/test.sh\", and \"bin/serve-app3.sh\". Updates should be obvious.\n\n  ```\"ember-addon\": { \"paths\": [ \"lib/common\" ]}```\n\n## Pattern Caveats\n* Each app has it's own `bower.json`, `package.json` and `ember-cli-build.js` file.\n  - This isn't necessarily a caveat, but it does mean if you add a dependency to the common addon, it will need to be added and imported to each app's config files.\n* Multiple Servers\n  - You will have to start multiple servers when developing on more that one app at a time.\n* All apps must share the same name\n  - As mentioned above, all apps must have the same `modulePrefix`.\n* WatchMan\n  - You will not be able to use watchman. It has an existing bug that prevents it from properly following symlinks. See: http://www.ember-cli.com/user-guide/#watchman for uninstall details.\n* Tests for common need to run as part of one of your apps. They cannot be easily run independantly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkmanw%2Fember-multi-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkmanw%2Fember-multi-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkmanw%2Fember-multi-app/lists"}