{"id":21106435,"url":"https://github.com/centerforopenscience/ember-osf","last_synced_at":"2025-05-17T09:40:47.874Z","repository":{"id":6889953,"uuid":"55632427","full_name":"CenterForOpenScience/ember-osf","owner":"CenterForOpenScience","description":"Ember Addon for interacting with the Open Science Framework","archived":false,"fork":false,"pushed_at":"2023-10-09T16:09:57.000Z","size":10518,"stargazers_count":15,"open_issues_count":2,"forks_count":38,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2025-04-28T02:38:20.284Z","etag":null,"topics":["addon","ember","osf","science"],"latest_commit_sha":null,"homepage":"http://centerforopenscience.github.io/ember-osf/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CenterForOpenScience.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-04-06T18:51:35.000Z","updated_at":"2024-05-30T03:03:35.000Z","dependencies_parsed_at":"2023-10-05T05:05:54.821Z","dependency_job_id":null,"html_url":"https://github.com/CenterForOpenScience/ember-osf","commit_stats":{"total_commits":2107,"total_committers":41,"mean_commits":"51.390243902439025","dds":0.7413383958234456,"last_synced_commit":"00ff0f33a5c2fe156e09dca18f370b3eb3970db0"},"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterForOpenScience%2Fember-osf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterForOpenScience%2Fember-osf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterForOpenScience%2Fember-osf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterForOpenScience%2Fember-osf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CenterForOpenScience","download_url":"https://codeload.github.com/CenterForOpenScience/ember-osf/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254688894,"owners_count":22112514,"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":["addon","ember","osf","science"],"created_at":"2024-11-20T00:26:24.168Z","updated_at":"2025-05-17T09:40:46.650Z","avatar_url":"https://github.com/CenterForOpenScience.png","language":"JavaScript","readme":"# Ember OSF\n\n`master` Build Status: ![Master Build Status](https://github.com/CenterForOpenScience/ember-osf/workflows/CI/badge.svg?branch=master)\n[![npm Version](https://img.shields.io/npm/v/@centerforopenscience/ember-osf.svg)](https://www.npmjs.com/package/@centerforopenscience/ember-osf)\n\n`develop` Build Status: ![Develop Build Status](https://github.com/CenterForOpenScience/ember-osf/workflows/CI/badge.svg?branch=develop)\n[![Coverage Status](https://coveralls.io/repos/github/CenterForOpenScience/ember-osf/badge.svg?branch=develop)](https://coveralls.io/github/CenterForOpenScience/ember-osf?branch=develop)\n\nThis repo contains code for interacting with the [OSF APIv2](https://api.osf.io/v2/) inside of an Ember app. See\n[addon API Docs](http://centerforopenscience.github.io/ember-osf/) for a list of what this addon provides.\n\n## Contributing\n\nPlease read the [CONTRIBUTING.md](https://github.com/CenterForOpenScience/ember-osf/blob/develop/.github/CONTRIBUTING.md)\n\n## Installing tools to develop and modify this addon\n\nSee the [yarn docs](https://yarnpkg.com/) for installing and using yarn. These instructions will prepare your\nenvironment if you plan to modify and test this addon in isolation.\n\n-   `git clone` this repository\n-   `yarn install --frozen-lockfile`\n\n## Using this addon in another Ember app\n\n### For production use\n\nOther applications that wish to consume this addon should add the following line manually to the consuming Ember app's\n`package.json` file, then run `yarn install` inside that app.\n\n`\"ember-osf\": \"git+https://github.com/CenterForOpenScience/ember-osf.git#NewestCommitHashGoesHere\",`\n\nIn the future, we will provide an installable `npm` package to simplify this process.\n\n### For local development\n\n1. Clone the repository: `git clone https://github.com/CenterForOpenScience/ember-osf.git`\n2. From the consuming Ember app:\n\n-   install the addon and it's dependencies: `ember install ../ember-osf`\n    -   this generates a config/local.yml file (see 'Configuration' below)\n-   link the app for local development: `npm link ../ember-osf`\n-   Import code from ember-osf like:\n\n```javascript\nimport Ember from \"ember\";\nimport OsfTokenLoginRouteMixin from \"ember-osf/mixins/osf-token-login-route\";\n\nexport default Ember.Route.extend(OsfLoginRouteMixin);\n```\n\n\u003e **Note**: Running ember install will automatically install many npm dependencies for ember-osf.\n\n## Configuration\n\n### Specifying configuration information\n\n#### local.yml settings\n\nIf for some reason you don't have a config/local.yml you can generate one. To do this:\n\n```bash\nember generate ember-osf\n```\n\nEmber-osf needs certain configuration variables to run. This is usually done via a config file structured as follows:\n\n```yaml\nOAUTH_SCOPES: osf.full_write\nREDIRECT_URI: http://localhost:4200/login\n\nCLIENT_ID: null\nPERSONAL_ACCESS_TOKEN: null\n```\n\nYou will need to fill out options for each backend you want to use (see 'Running' below).\nWe recommend using the 'test' backend for development and testing as it is the most stable\nof our environments. When configuring your application, make sure that your login redirect\nuri is correct. If it needs a trailing slash, be sure to include a trailing slash!\n\nEdit the new file (installed in the config directory) and set:\n\n-   `CLIENT_ID` to the client id of your developer application\n-   `PERSONAL_ACCESS_TOKEN` to the newly generated token (Only required or recognized for the LOCAL backend; do not set\n    this value for staging, production, or test backends)\n-   `REDIRECT_URI`: Must exactly match the redirect URI used to register the OAuth developer application.\n    Default value is appropriate for local development using `ember server`, with a login page at `/login`\n\nBecause of the potential for this file to include sensitive information, **we strongly recommend adding this file to\n`.gitignore`** for your project.\n\n#### Alternate option: Environment variables\n\nIf you do not wish to use file-based configuration, any of the settings above can be overridden individually as\nenvironment variables with the same name as appears in the config file. Eg\n\n`BACKEND=test CLIENT_ID=gibberish ember server`\n\nIf you provide a setting in both the config file and an environment variable, the environment variables take precedence.\n\nYou can always override auth-related settings, but attempts to override server URLs will be ignored unless you\nexplicitly specify `BACKEND=env` (see \"Running\" for example).\n\n### Using the API\n\nMost apps that use this addon will authorize requests via OAuth2. As may be apparent from the `CLIENT_ID` and\n`REDIRECT_URI` settings above, you will need to [create a developer application](https://test.osf.io/settings/applications/)\non the relevant version of the OSF, and provide the appropriate settings for your app.\n\n### Advanced usage: Selecting an authorization type\n\nWe expect that most projects based on `ember-osf` will authenticate via OAuth 2.0 (\"Token Login\"); the addon is\nconfigured to use this out of the box, so long as you provide your own login page based on the appropriate mixins.\nThis is the most effective way for third-party applications to work with our services.\n\nIf you are developing an application that will be hosted under the `osf.io` domain, you may wish to use cookie-based\nauthentication instead. In that rare case, add the following lines to your `config/environment.js` file:\n\n```javascript\nvar authorizationType = \"cookie\";\nENV.authorizationType = authorizationType;\n\nENV[\"ember-simple-auth\"] = {\n    authorizer: `authorizer:osf-${authorizationType}`,\n    authenticator: `authenticator:osf-${authorizationType}`,\n};\n```\n\n### Running the OSF Locally (optional)\n\nFor local development, you will need to be running the [OSF APIv2](https://github.com/CenterForOpenScience/osf.io#running-the-api-server).\nTo connect to the APIv2 while using [fakecas](https://github.com/CenterForOpenScience/osf.io#running-the-osf), you\nwill need to generate a personal access token on your local OSF instance [here](http://localhost:5000/settings/tokens/)-\ngo ahead and grant full privilege access to all scopes (the `osf.full_write` option).\n\n## Using this addon\n\n### Ember Data: Using the OSF models\n\nThe models, serializers, adapters bundled in this addon with be available to you automatically.\nFor example, simply do:\n\n```javascript\nthis.store.findAll(\"node\");\n```\n\nto fetch all nodes (or at least the first page of results). If you need to fetch many results, see the API docs for\ninformation about how to handle pagination. Ember-osf also provides support for\n[paginated relationship requests](https://github.com/mdehoog/ember-data-has-many-query) via a third-party addon.\n\n### MathJax\n\nWe use [MathJax](https://www.mathjax.org/) to make math look pretty in all browsers. If you want this in your application, copy this section into the `\u003chead\u003e` element of your `index.html` file:\n\n```\n\u003cscript type=\"text/javascript\"\n    src=\"//cdnjs.cloudflare.com/ajax/libs/mathjax/2.6.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML\"\u003e\n\u003c/script\u003e\n\u003cscript type=\"text/x-mathjax-config\"\u003e\n    MathJax.Hub.Config({\n        tex2jax: {inlineMath: [['$','$'], ['\\\\(','\\\\)']], processEscapes: true},\n        skipStartupTypeset: true\n    });\n\u003c/script\u003e\n```\n\n### Advanced: using components and styles\n\nSome of the ember-osf components require additional configuration to take advantage of premade widgets or styles.\n\nSome of these settings, as well as recommended best practices, are gathered together in a\n[demonstration app](https://github.com/abought/demo-ember-osf/) that consumes this addon.\n\n## Running\n\n### Using the addon with a specific server\n\nWe recommend developers target our test server:\n\n-   test (`test`): matches production features, very stable\n\nEmber-osf also ships with builtin support for several other servers:\n\n-   local (`local`): for developers running the OSF stack locally\n-   staging (`stage`): contains bleeding edge features, but less stable\n-   staging2 (`stage2`) or `staging3` (`stage3`): Staging servers that run specific feature branches, usually for\n    functionality that is being tested for longer or not targeted for immediate release\n-   production (`prod`): The main osf.io site. This is a good choice for apps you deploy, but please be a good citizen\n    and avoid using the production server for your test data.\n\nThen (using test as an example) run:\n`BACKEND=test ember server`\n\nand visit your app at http://localhost:4200.\n\n**Note:** When run from within the `ember-osf` repository, this command runs the dummy app contained in /tests/dummy\n\n### Using a custom OSF backend\n\nIn certain circumstances, you may wish to use a custom set of servers not known to the `ember-osf` addon.\nYou can elect to specify your server URLs individually, by specifying `BACKEND=env` and passing additional environment\nvariables/config file entries. For example:\n\n`BACKEND=env OSF_URL=https://e.io/ OSF_API_URL=https://api.e.io OSF_RENDER_URL=https://mfr.e.io/render OSF_FILE_URL=https://files.e.io OSF_HELP_URL=https://help.e.io OSF_COOKIE_LOGIN_URL=https://accounts.e.io/login OSF_OAUTH_URL=https://accounts.e.io/oauth2/authorize ember server`\n\n## Running Tests\n\n-   `yarn test` will run all tests used by Github Actions\n-   `ember test --server` will run just ember tests, and reload any time that code is changed\n\nFor more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).\n\n## Distribution / releases\n\nThe information below applies only to package maintainers, and most users will not need this.\n\nThe following commands can be used to publish a new release of `ember-osf`:\n\n-   `yarn run bump-version [\u003cnewversion\u003e | major | minor | patch]`: Verify that the code is in a releasable state,\n    increment the version number without generating a new git commit, and update documentation.\n    See [docs](https://docs.npmjs.com/cli/version) for recognized options.\n-   `yarn run make-release`: Uses [git flow](https://github.com/nvie/gitflow) to prepare a new release.\n    You must be on the develop branch, commit all changes, and have run `git init` in this folder at least one time (ever).\n-   `yarn publish`: [Publish](https://docs.npmjs.com/getting-started/publishing-npm-packages) a new version of the\n    package to the NPM registry. It is highly recommended that you do this from a fresh checkout of the repo, and\n    [validate](https://docs.npmjs.com/misc/developers#before-publishing-make-sure-your-package-installs-and-works)\n    the package contents before uploading. You must be a recognized NPM collaborator or this command will fail.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenterforopenscience%2Fember-osf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcenterforopenscience%2Fember-osf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenterforopenscience%2Fember-osf/lists"}