{"action":"created","issue":{"url":"https://api.github.com/repos/phetsims/chipper/issues/433","labels_url":"https://api.github.com/repos/phetsims/chipper/issues/433/labels{/name}","comments_url":"https://api.github.com/repos/phetsims/chipper/issues/433/comments","events_url":"https://api.github.com/repos/phetsims/chipper/issues/433/events","html_url":"https://github.com/phetsims/chipper/issues/433","id":128019205,"number":433,"title":"specify PhET-iO API file in package.json?","user":{"login":"pixelzoom","id":3046552,"avatar_url":"https://avatars.githubusercontent.com/u/3046552?v=3","gravatar_id":"","url":"https://api.github.com/users/pixelzoom","html_url":"https://github.com/pixelzoom","followers_url":"https://api.github.com/users/pixelzoom/followers","following_url":"https://api.github.com/users/pixelzoom/following{/other_user}","gists_url":"https://api.github.com/users/pixelzoom/gists{/gist_id}","starred_url":"https://api.github.com/users/pixelzoom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixelzoom/subscriptions","organizations_url":"https://api.github.com/users/pixelzoom/orgs","repos_url":"https://api.github.com/users/pixelzoom/repos","events_url":"https://api.github.com/users/pixelzoom/events{/privacy}","received_events_url":"https://api.github.com/users/pixelzoom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"samreid","id":679486,"avatar_url":"https://avatars.githubusercontent.com/u/679486?v=3","gravatar_id":"","url":"https://api.github.com/users/samreid","html_url":"https://github.com/samreid","followers_url":"https://api.github.com/users/samreid/followers","following_url":"https://api.github.com/users/samreid/following{/other_user}","gists_url":"https://api.github.com/users/samreid/gists{/gist_id}","starred_url":"https://api.github.com/users/samreid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samreid/subscriptions","organizations_url":"https://api.github.com/users/samreid/orgs","repos_url":"https://api.github.com/users/samreid/repos","events_url":"https://api.github.com/users/samreid/events{/privacy}","received_events_url":"https://api.github.com/users/samreid/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2016-01-21T21:05:04Z","updated_at":"2016-01-28T17:43:15Z","closed_at":null,"body":"In getBuildConfig.js:\r\n\r\n```js\r\n    // add the together API file\r\n    if ( brand === 'phet-io' ) {\r\n\r\n      var TOGETHER_API_FILENAME = '../together/js/api/' + packageJSON.name + '-api.js';\r\n      if ( !grunt.file.exists( TOGETHER_API_FILENAME ) ) {\r\n        grunt.log.warn( 'together API file does not exist: ' + TOGETHER_API_FILENAME );\r\n      }\r\n\r\n      preload.push( TOGETHER_API_FILENAME );\r\n      preload.push( '../together/js/finishedPreloads.js' );\r\n    }\r\n```\r\n\r\nWhy not add the API file to package.json? (`packageJSON[ 'phet-io' ].preload`, in getBuildConfig.js) \r\n\r\nFor example, here's what concentration/package.json would look like:\r\n\r\n```js\r\n{\r\n  ...\r\n  \"phet-io\": {\r\n    \"preload\": [\r\n      \"../together/js/api/beers-law-lab-api.js\",\r\n      \"../together/js/api/concentration-api.js\"\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\nThen the `if` statement in getBuildConfig.js becomes:\r\n\r\n```js\r\n    if ( brand === 'phet-io' ) {\r\n      // add preload that must be last\r\n      preload.push( '../together/js/finishedPreloads.js' );\r\n    }\r\n```\r\n\r\nPros: \r\n• Makes explicit what API files are preloaded\r\n• We already have to specify dependency API files (eg,beers-law-lab-api.js), so this provides a more complete view of what API files are used. \r\n• Naming convention for the API file is no longer frozen in code\r\n\r\nCons:\r\n• API file must be added to package.json for every sim that has been instrumented\r\n• API file paths are visible in package.json"},"comment":{"url":"https://api.github.com/repos/phetsims/chipper/issues/comments/176298847","html_url":"https://github.com/phetsims/chipper/issues/433#issuecomment-176298847","issue_url":"https://api.github.com/repos/phetsims/chipper/issues/433","id":176298847,"user":{"login":"samreid","id":679486,"avatar_url":"https://avatars.githubusercontent.com/u/679486?v=3","gravatar_id":"","url":"https://api.github.com/users/samreid","html_url":"https://github.com/samreid","followers_url":"https://api.github.com/users/samreid/followers","following_url":"https://api.github.com/users/samreid/following{/other_user}","gists_url":"https://api.github.com/users/samreid/gists{/gist_id}","starred_url":"https://api.github.com/users/samreid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samreid/subscriptions","organizations_url":"https://api.github.com/users/samreid/orgs","repos_url":"https://api.github.com/users/samreid/repos","events_url":"https://api.github.com/users/samreid/events{/privacy}","received_events_url":"https://api.github.com/users/samreid/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T17:43:15Z","updated_at":"2016-01-28T17:43:15Z","body":"Nope, the last step will be for me to review."}}