@superfaceai/cli
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -10,2 +10,6 @@ # Changelog | ||
## [0.0.17] - 2021-06-08 | ||
### Changed | ||
- Generated Input and Result types are specific to both profile and usecase | ||
## [0.0.16] - 2021-06-07 | ||
@@ -98,3 +102,4 @@ | ||
[Unreleased]: https://github.com/superfaceai/cli/compare/v0.0.16...HEAD | ||
[Unreleased]: https://github.com/superfaceai/cli/compare/v0.0.17...HEAD | ||
[0.0.17]: https://github.com/superfaceai/cli/compare/v0.0.16...v0.0.17 | ||
[0.0.16]: https://github.com/superfaceai/cli/compare/v0.0.15...v0.0.16 | ||
@@ -101,0 +106,0 @@ [0.0.15]: https://github.com/superfaceai/cli/compare/v0.0.14...v0.0.15 |
@@ -30,3 +30,3 @@ "use strict"; | ||
const io_1 = require("./io"); | ||
const outputStreamDebug = debug_1.default('superface:OutputStream'); | ||
const outputStreamDebug = debug_1.default('superface:output-stream'); | ||
class OutputStream { | ||
@@ -33,0 +33,0 @@ /** |
@@ -372,3 +372,3 @@ "use strict"; | ||
const usecaseAssignments = usecases.map(usecase => { | ||
const pascalizedUsecaseName = pascalize(usecase.name); | ||
const pascalizedUsecaseName = pascalize(profileName) + pascalize(usecase.name); | ||
const helperCall = callExpression('typeHelper', [], [pascalizedUsecaseName + 'Input', pascalizedUsecaseName + 'Result']); | ||
@@ -375,0 +375,0 @@ return addDoc(propertyAssignment(usecase.name, helperCall), usecase.doc); |
@@ -19,3 +19,3 @@ "use strict"; | ||
async function interactiveInstall(options) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
let envContent = ''; | ||
@@ -142,12 +142,39 @@ //Super.json path | ||
} | ||
//Write .env file | ||
await output_stream_1.OutputStream.writeOnce('.env', envContent); | ||
//Install SDK | ||
(_g = options === null || options === void 0 ? void 0 : options.successCb) === null || _g === void 0 ? void 0 : _g.call(options, `\n\nInstalling package "@superfaceai/one-sdk"`); | ||
await quickstart_utils_1.installSdk({ logCb: options === null || options === void 0 ? void 0 : options.logCb, warnCb: options === null || options === void 0 ? void 0 : options.warnCb }); | ||
(_h = options === null || options === void 0 ? void 0 : options.successCb) === null || _h === void 0 ? void 0 : _h.call(options, `🆗 Superface have been configured successfully!`); | ||
//Prompt user for optional SDK token | ||
(_h = options === null || options === void 0 ? void 0 : options.successCb) === null || _h === void 0 ? void 0 : _h.call(options, `\n\nConfiguring package "@superfaceai/one-sdk"`); | ||
const tokenEnvName = 'SUPERFACE_SDK_TOKEN'; | ||
if (!envContent.includes(`${tokenEnvName}=`)) { | ||
const tokenResponse = await inquirer_1.default.prompt({ | ||
name: 'token', | ||
message: '(Optional) You can enter your SDK token generated at https://superface.ai:', | ||
type: 'password', | ||
validate: input => { | ||
const tokenRegexp = /^(sfs)_([^_]+)_([0-9A-F]{8})$/i; | ||
if (!input) { | ||
return true; | ||
} | ||
if (!tokenRegexp.test(input)) { | ||
return 'Entered value has unexpected format. Please try again'; | ||
} | ||
return true; | ||
}, | ||
}); | ||
if (tokenResponse.token) { | ||
envContent += env_1.envVariable(tokenEnvName, tokenResponse.token); | ||
(_j = options === null || options === void 0 ? void 0 : options.successCb) === null || _j === void 0 ? void 0 : _j.call(options, `Your SDK token was saved to ${tokenEnvName} variable in .env file. You can use it for authentization during SDK usage by loading it to your enviroment.`); | ||
} | ||
else { | ||
(_k = options === null || options === void 0 ? void 0 : options.successCb) === null || _k === void 0 ? void 0 : _k.call(options, 'Continuing without SDK token'); | ||
} | ||
} | ||
//Write .env file | ||
await output_stream_1.OutputStream.writeOnce('.env', envContent); | ||
(_l = options === null || options === void 0 ? void 0 : options.successCb) === null || _l === void 0 ? void 0 : _l.call(options, `🆗 Superface have been configured successfully!`); | ||
//Lead to docs page | ||
//TODO: usecase specific page | ||
const url = 'https://docs.superface.ai/getting-started'; | ||
(_j = options === null || options === void 0 ? void 0 : options.successCb) === null || _j === void 0 ? void 0 : _j.call(options, `Now you can follow our documentation to use installed capability: "${url}"`); | ||
(_m = options === null || options === void 0 ? void 0 : options.successCb) === null || _m === void 0 ? void 0 : _m.call(options, `Now you can follow our documentation to use installed capability: "${url}"`); | ||
} | ||
@@ -154,0 +181,0 @@ exports.interactiveInstall = interactiveInstall; |
{ | ||
"name": "@superfaceai/cli", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Superface CLI utility", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
378615
5779