Skip to content

add --client command line arg to gulpfile #1220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ponelat
Copy link
Contributor

@ponelat ponelat commented Apr 28, 2015

Small change to gulpfile to allow for --client command line argument.

# Usage:
gulp --client='../some/swagger-client.js'
# default still works as expected...
gulp

defaults to the node_module's swagger-client

@mohsen1
Copy link
Contributor

mohsen1 commented Apr 28, 2015

I believe this is unnecessary. You can use npm link to point swagger-client of SwaggerUI to your local modified SwaggerJS.

You will need to do following:

# in swagger-client folder
npm link
# in swagger-ui folder
npm link swagger-client

Remember that you should never commit changes in dist when you are using a non-published swagger-client. It can cause many issues.

@ponelat ponelat force-pushed the feature/gulp-edge branch from af4049b to e685544 Compare April 28, 2015 18:58
@ponelat
Copy link
Contributor Author

ponelat commented Apr 29, 2015

You're right about committing bleeding edge changes, yuck!
Although I think npm link, while a decent alternative - may lead to doing just that.
As far as I know, you have to npm uninstall swagger-client && npm install to get the original client back. Which someone (ie: me) might forget to do.

So what I suggest, and what I'll use on my dev rig is that we touch a file when building from a different source, one that gets picked up by git. Something like...
dist/DONT_COMMIT_THIS__FIRST_RUN_GULP_WITHOUT_ARGS
which my subtly hint that this isn't to be committed.

running gulp <no-args> will clean out the file, and not raise any flags with git.

I still need to run different client's now and then when debugging, not sure if anyone else will need it though.

@ponelat
Copy link
Contributor Author

ponelat commented Apr 30, 2015

For those who'd like to live on the bleeding edge...

Clone and checkout the develop_2.0 branch on both repos...
https://github.com/swagger-api/swagger-js
https://github.com/swagger-api/swagger-ui

Link them up

cd /path/to/swagger-ui
npm link ../some/path/to/swagger-js

# if you don't have already, you probably want gulp installed globally...
npm install -g gulp

Now any time you want to be on the edge
Run through these steps...

# You need to build swagger-js before swagger-ui
cd /some/path/to/swagger-js
git checkout develop_2.0
git pull
npm install
gulp build

cd /some/path/to/swagger-ui
git checkout develop_2.0
git pull
npm install
gulp

And because we care, you can even serve up your fresh UI with gulp serve

Note: you don't need to checkout develop_2.0 everytime, but I like to be verbose :)
WARNING: you can't base PR changes you make on this, because we don't want to mix the swagger-js with the swagger-ui. You could be using a slightly different version and it would cause headaches. If you want to create a PR from swagger-ui, you need to 'unlink' the bleeding edge.
Like this...

cd /some/path/to/swagger-ui
npm uninstall swagger-client
npm install

@fehguy
Copy link
Contributor

fehguy commented May 8, 2015

ok since npm link seems to do the trick, i'm going to close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants