{"id":14385273,"url":"https://github.com/angular-ui/angular-ui-publisher","last_synced_at":"2025-08-23T18:32:13.658Z","repository":{"id":12797527,"uuid":"15471338","full_name":"angular-ui/angular-ui-publisher","owner":"angular-ui","description":"Helper component for building and publishing your angular modules as bower components","archived":true,"fork":false,"pushed_at":"2015-10-29T23:27:19.000Z","size":747,"stargazers_count":20,"open_issues_count":2,"forks_count":13,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-08-09T02:54:52.051Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angular-ui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-27T10:02:08.000Z","updated_at":"2023-01-28T18:15:27.000Z","dependencies_parsed_at":"2022-09-15T13:10:40.627Z","dependency_job_id":null,"html_url":"https://github.com/angular-ui/angular-ui-publisher","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-ui%2Fangular-ui-publisher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-ui%2Fangular-ui-publisher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-ui%2Fangular-ui-publisher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-ui%2Fangular-ui-publisher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angular-ui","download_url":"https://codeload.github.com/angular-ui/angular-ui-publisher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":217384950,"owners_count":16168829,"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-08-28T18:02:04.533Z","updated_at":"2024-08-28T18:06:50.951Z","avatar_url":"https://github.com/angular-ui.png","language":"JavaScript","readme":"# Angular UI Publisher [![Build Status](https://travis-ci.org/angular-ui/angular-ui-publisher.png?branch=master)](https://travis-ci.org/angular-ui/angular-ui-publisher) [![NPM version](https://badge.fury.io/js/angular-ui-publisher.png)](http://badge.fury.io/js/angular-ui-publisher)\n\nHelper component for building and publishing your angular modules as bower components\n\n## Goal\n\nThe goal of all this is to automatize the construction of this type of repo tree.\n\n```\n+ git repo\n  + master (src) branch // build directory is ignored\n    - tag: src1.0.x\n    - tag: src1.1.x\n  + gh-pages (doc) branch\n  + bower (build) branch // build directory is committed\n    - tag: v1.0.x\n    - tag: v1.1.x\n  + bower-subcomponent-a (like angular-ui-event) branch\n    - tag: subcomponent-a-1.0.x\n    - tag: subcomponent-a-1.1.x\n  + bower-subcomponent-b (like angular-ui-event) branch\n    - tag: subcomponent-b-1.0.x\n    - tag: subcomponent-b-1.1.x\n```\n\nSo the `master` branch is free of builds files, the `gh-pages` branch is free of source files and the `bower` branches are only containing the vital part of a component. This way if a repo produces separate components, I could simply create multiple bower-branches for each produced component. Like for the component `subcomponent-a`, the branch `bower-subcomponent-a` with the specific version tags prefixed with `bower-subcomponent-a-`\n\nLike so, throw bower you can install\n```sh\n# All the repo\nbower install \u003cpackage\u003e#master\n\n# The latest bower build\nbower install \u003cpackage\u003e#bower\n\n# A specific bower build\nbower install \u003cpackage\u003e#v0.0.8\n\n# The latest bower build of a sub component\nbower install \u003cpackage\u003e#bower-subcomponent-a\n\n# A specific bower build of a sub component\nbower install \u003cpackage\u003e#subcomponent-a-0.0.8\n```\n\n## Usage\n\nAdd it as a npm component:\n\n```\nnpm install angular-ui-publisher --save-dev\n```\n\nYou have now access to the gulp build system in :  \n`./node_modules/angular-ui-publisher/node_modules/.bin/gulp`.  \nLike it's pretty far and **you're current path must be in the `/node_modules/angular-ui-publisher`** it's safer to use it in another build system to do the thing.\n\n### Play nice with Gulp\n\nThis project is itself made with Gulp :)  \nStill, here is some handy functions to do the work.\n\n```javascript\n//\n// ACCESS TO THE ANGULAR-UI-PUBLISHER\nfunction targetTask(task){\n  return function(done){\n\n    var spawn = require('child_process').spawn;\n    var path = require('path');\n\n    spawn(path.resolve(process.cwd(), './node_modules/.bin/gulp'), process.argv.slice(2), {\n      cwd : './node_modules/angular-ui-publisher',\n      stdio: 'inherit'\n    }).on('close', done);\n  }\n}\n\n\ngulp.task('build', targetTask('build'));\ngulp.task('publish', targetTask('publish'));\n```\n\nand use\n\n```sh\n./node_modules/.bin/gulp build --branch=bower\n# or\n./node_modules/.bin/gulp build --branch=gh-pages\n# or\n./node_modules/.bin/gulp publish --branch=bower\n# or\n./node_modules/.bin/gulp publish --branch=gh-pages\n```\n\n\n### Hack nice with Grunt\n\nFor Grunt you can do this :\n\n```javascript\n//\n// HACK TO ACCESS TO THE ANGULAR-UI-PUBLISHER\nfunction fakeTargetTask(prefix){\n  return function(){\n\n    if (this.args.length !== 1) return grunt.log.fail('Just give the name of the ' + prefix + ' you want like :\\ngrunt ' + prefix + ':bower');\n\n    var done = this.async();\n    var spawn = require('child_process').spawn;\n    spawn('./node_modules/.bin/gulp', [ prefix, '--branch='+this.args[0] ].concat(grunt.option.flags()), {\n      cwd : './node_modules/angular-ui-publisher',\n      stdio: 'inherit'\n    }).on('close', done);\n  };\n}\n\ngrunt.registerTask('build', fakeTargetTask('build'));\ngrunt.registerTask('publish', fakeTargetTask('publish'));\n//\n```\n\nand use\n\n```sh\ngrunt build:bower\n# or\ngrunt build:gh-pages\n# or\ngrunt publish:bower\n# or\ngrunt publish:gh-pages\n```\n\n## Tasks\n\n### build\n\nIt's just coping or processing template files to the `out/built/\u003cbranch_name\u003e` with `\u003cbranch_name\u003e` given by the flag `--branch`.\n\n### publish\n\nIt's acting in `out/clones/\u003cbranch_name\u003e`.\n * Clones the given `\u003cbranch_name\u003e`.\n * Copy the built files into it.\n * Commits the result (with the current build number on TravisCI)\n * Tags it with the current version (given by the package.json)\n * Push it (only on TravisCI for now)\n\n## Building configuration\n\nThe component publisher can use a configuration file named `publish.js` to specify various thing to use while building the branches.  \nThis file must return a object with the configuration like so :\n\n```javascript\nmodule.exports = function() {\n  return {\n    // ...\n  };\n};\n```\n\nThis config object can content the following key:\n\n```javascript\n{\n  humaName : String,\n  // the name used as title in the gh-pages (ex: 'UI.Utils')\n\n  repoName : String,\n  // the repo name used in github links in the gh-pages (ex: 'ui-utils')\n\n  inlineHTML : String,\n  // The html to inline in the index.html file in the gh-pages\n  // (ex: 'Hello World' or fs.readFileSync(__dirname + '/demo/demo.html'))\n\n  inlineJS : String,\n  // The javascript to inline at the end of the index.html file in the gh-pages\n\n  js : Array.of(String) | Function,\n  // The js files to use in the gh-pages, loaded after angular by default (ex: ['dist/ui-utils.js'])\n  // or\n  // function that returns the final array of files to load \n  // (ex: function(defaultJsFiles) { return ['beforeFile.js'].concat(defaultJsFiles); })\n\n  css : Array.of(String),\n  // The css files to use in the gh-pages\n\n  tocopy : Array.of(String),\n  // Additional files to copy in the vendor directory in the gh-pages\n\n\n\n  main_dist_dir : String,\n  // directory used to store the main sources in the './dist' directory (ex: 'main')\n\n  sub_dist_dir : String,\n  // directory used to store the sub component sources in the './dist' directory (ex: 'sub')\n\n  bowerData : {\n    // Bower data to overwrite.\n    // (ex: { name: 'my-component', main: './my-component.js' })\n  }\n\n  subcomponents : {  // Collection of sub component\n    \"\u003csub component name\u003e\" : {\n      // Bower data to overwrite.\n      // (ex: { name: 'my-component', main: './my-component.js' })\n    }\n  }\n\n}\n```\n\n\n## CLI flags\n\n*--branch*\nAllows you to specify the branch to take care of.\n\n* `build --branch=gh-pages` or `build --branch=bower`  \nwill build the `gh-pages` or the `bower` files in `./out/built`\n* `publish --branch=gh-pages` or `publish --branch=bower`  \nwill publish the `gh-pages` or the `bower` files in `./out/clones`\n\n### Made for Travis-CI\n\n**It's working with ssh deploy key ! (so even organization can make Travis commit on them repos.**  \nYou can find a quick tuto [here](https://gist.github.com/douglasduteil/5525750#file-travis-secure-key-sh).\n\nAfter you added your deploy key to GitHub and Travis (in  `.travis.yml`).  \nAdd a global value with your repo name, like :\n\n```\nenv:\n  global:\n  - REPO=\"git@github.com:\u003corg\u003e/\u003crepo\u003e.git\"\n  - secure: ! 'MR37oFN+bprRlI1/YS3...etc...\n```\n\nThen add the authentication script that will automatically decode your deploy key (passed encoded in your .travis.yml). And try SSH to  Github.\n\n```yaml\nafter_success:\n- \"./node_modules/angular-ui-publisher/travis/authentication.sh || exit 0\"\n- \"grunt dist build:gh-pages publish:gh-pages build:bower publish:bower\"\n```\n\nI recommend adding a ` || exit 0` after the authentication script to make sure that if your access is denied no building and publishing will be made.  \nIf you need to change the restriction to another branch that *master* by default, use the environment variable `MAIN_BRANCH` like below :\n\n```yaml\nenv:\n  global:\n  - MAIN_BRANCH=develop\n  - REPO=\"git@github.com:\u003corg\u003e/\u003crepo\u003e.git\"\n  - secure: ! 'MR37oFN+bprRlI1/YS3...etc...\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-ui%2Fangular-ui-publisher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangular-ui%2Fangular-ui-publisher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-ui%2Fangular-ui-publisher/lists"}