Skip to content

Commit 95fde33

Browse files
committed
Final fixes
1 parent 17e67f8 commit 95fde33

File tree

17 files changed

+4055
-1739
lines changed

17 files changed

+4055
-1739
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# create-openapi-repo [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url]
2-
> Generator for OpenAPI(fka Swagger) repository
1+
# create-openapi-repo
2+
3+
[![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url]
4+
5+
> Generator for OpenAPI repository
36
47
<center>
58

6-
![logo](./logo.png)
9+
<img src="./logo.png" widht="500px"/>
710

811
</center>
912

@@ -17,11 +20,11 @@ There are a few advantages in hosting your API specification + docs on GitHub:
1720

1821
## Features
1922
This generator helps to create a GitHub repo with the following features:
20-
- Possibility to split a big Swagger spec into smaller files and bundle it for deployment
23+
- Possibility to split a big OpenAPI spec into smaller files and bundle it for deployment
2124
- Continuous integration/deployment on Travis
2225
- Code samples as separate files
23-
- Swagger spec is validated after each commit
24-
- Swagger spec + ReDoc deployed to Github Pages (you can use a custom domain)
26+
- OpenAPI spec is validated after each commit
27+
- OpenAPI spec + ReDoc deployed to Github Pages (you can use a custom domain)
2528
- Live editing in your editor or `swagger-editor` :heart_eyes:
2629
![live editing](./live-edit.gif)
2730

cli.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function ask() {
3838
type: "input",
3939
name: "specFileName",
4040
message:
41-
"Please specify the path to the OpenAPI/Swagger spec (local file):",
41+
"Please specify the path to the OpenAPI spec (local file):",
4242
validate(fileName) {
4343
return validateSpecFileName(fileName);
4444
}
@@ -115,8 +115,13 @@ async function ask() {
115115
}
116116

117117
function printSuccess(opts, root) {
118+
let travisNote = '';
119+
if (opts.travis) {
120+
travisNote = `We generated ${chalk.blue('.travis')} for you. Follow steps from ${chalk.blue('README.md')} to finish Travis CI setup`
121+
}
122+
118123
console.log(`${chalk.green("Success!")} Created ${chalk.green(
119-
path.dirname(root)
124+
path.basename(root)
120125
)} at ${chalk.blue(root)}
121126
Inside that directory, you can run several commands:
122127
@@ -131,15 +136,13 @@ Inside that directory, you can run several commands:
131136
${chalk.blue(`npm test`)}
132137
Validates the spec.
133138
134-
${opts.travis &&
135-
` ${chalk.blue(`npm run deploy`)}
136-
Deploys the spec to GitHub Pages. You don't need to run it manually if you have Travis CI configured.
137-
`}
139+
${chalk.blue(`npm run gh-pages`)}
140+
Deploys docs to GitHub Pages. You don't need to run it manually if you have Travis CI configured.
138141
139142
We suggest that you begin by typing:
140143
141-
${chalk.blue("cd")} ${path.dirname(root)}
142-
${chalk.blue("npm start")}`);
144+
${chalk.blue("cd")} ${path.basename(root)}
145+
${chalk.blue("npm start")}` + (travisNote ? '\n\n' + travisNote : ''));
143146
}
144147

145148
async function run() {
@@ -176,7 +179,7 @@ Choose another directory or remove contents.
176179

177180
const data = {
178181
...opts,
179-
packageName: slugify(opts.apiTitle),
182+
packageName: slugify(opts.apiTitle).toLowerCase(),
180183
ghPagesBaseUrl: opts.repo ? getGhPagesBaseUrl(opts.repo) : undefined
181184
};
182185

@@ -211,13 +214,13 @@ Choose another directory or remove contents.
211214

212215
copyDirSync("web");
213216

214-
swaggerRepo.syncWithSwagger(fs.readFileSync(specFileName).toString());
217+
swaggerRepo.syncWithSpec(fs.readFileSync(specFileName).toString());
215218

216219
fs.writeFileSync(REDOCLY_RC, yaml.safeDump(opts, { skipInvalid: true }));
217220

218221
console.log("Installing packages. This might take a couple of minutes.\n");
219222

220-
await installDeps(opts);
223+
await installDeps('@^2.0.0-rc.2');
221224
console.log();
222225

223226
try {

lib/install-deps.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const spawn = require("cross-spawn");
22

3-
exports.installDeps = opts => {
3+
exports.installDeps = (toolsVersion = '') => {
44
const command = "npm";
55
const args = [
66
"install",
77
"--save",
88
"--loglevel",
99
"error",
10-
"swagger-repo"
11-
].concat(opts.travis ? ["deploy-to-gh-pages"] : []);
10+
`swagger-repo${toolsVersion}`
11+
];
1212

1313
return new Promise((resolve, reject) => {
1414
const child = spawn(command, args, { stdio: "inherit" });

0 commit comments

Comments
 (0)