Skip to content

Commit

Permalink
feat(contributor-workflow): add command to copy vendored PUI packages…
Browse files Browse the repository at this point in the history
… to projects

- See contributing guidelines for details

[Finishes #95551932]
  • Loading branch information
matt-royal committed Jun 18, 2015
1 parent 26352e2 commit 8538ef3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ This will ensure our conversation doesn't get lost in email or slack.
git push -f origin head
```

1. While you're waiting for your PR to be accepted, you can use your forked
changes in your project. For example, if you made changes to the react alerts
component, run the following command:
```bash
gulp vendor-package --type=react --component=alerts --dest=<your-project-folder>
```
Similarly, if you made changes to the CSS typography component, run
```bash
gulp vendor-package --type=css --component=typography --dest=<your-project-folder>
```
This creates a vendored version of your modified components
(`pui-react-alerts` or `pui-css-typography`) in your project, and points your
project's package json to these vendored versions. This way, you can use your
forked changes right away, even in production!

1. Once we accept your pull request, we will publish any new or updated pacakges
to NPM.

Expand Down
26 changes: 26 additions & 0 deletions tasks/vendor-package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {exec} from 'child_process';
import gulp from 'gulp';
import path from 'path';
import {argv} from 'yargs';

gulp.task('vendor-package', ['css-build', 'react-build'], (callback) => {
const {type: componentType, component: componentName, dest} = argv;

function useVendoredPackageInProject() {
console.log('hi');

This comment has been minimized.

Copy link
@stubbornella

stubbornella Jun 24, 2015

Contributor

hmm... :)

const originalDirectory = process.cwd();
process.chdir(dest);

exec(`npm install --save ${path.join('pui-vendor', componentType, componentName)}`, (error) => {
if (error) {
new gutil.PluginError('vendor-package', {message: error});
}
process.chdir(originalDirectory);
callback();
});
}

gulp.src(`dist/${componentType}/${componentName}/*`)
.pipe(gulp.dest(`${dest}/pui-vendor/${componentType}/${componentName}`))
.on('end', useVendoredPackageInProject);
});

0 comments on commit 8538ef3

Please sign in to comment.