@jetbrains/create-youtrack-app
Advanced tools
Comparing version 0.0.1-alpha.10 to 0.0.1-alpha.11
@@ -1,2 +0,3 @@ | ||
// TODO: How to run manifest generator first? | ||
const {validateNotEmpty} = require('../../utils'); | ||
module.exports = [ | ||
@@ -6,2 +7,4 @@ { | ||
name: "appName", | ||
initial: 'my-app', | ||
validate: validateNotEmpty, | ||
message: "What is the name of your app?", | ||
@@ -12,2 +15,3 @@ }, | ||
name: "title", | ||
initial: 'My App', | ||
message: "What is the title of your app?", | ||
@@ -14,0 +18,0 @@ }, |
@@ -0,1 +1,4 @@ | ||
const { validateNotEmpty } = require("../../utils"); | ||
const { PERMISSIONS } = require("../../consts"); | ||
const extensionPoints = [ | ||
@@ -68,16 +71,19 @@ { | ||
prompt: async ({ prompter, args }) => { | ||
const { key } = await prompter.prompt({ | ||
const { key } = args.key ? args : await prompter.prompt({ | ||
type: "input", | ||
name: "key", | ||
validate: validateNotEmpty, | ||
message: "What is the key of your widget?", | ||
}); | ||
const { folderName } = await prompter.prompt({ | ||
const { folderName } = args.folderName ? args : await prompter.prompt({ | ||
type: "input", | ||
name: "folderName", | ||
validate: validateNotEmpty, | ||
message: "What is the folder name of your widget?", | ||
initial: key, | ||
}); | ||
const { name } = await prompter.prompt({ | ||
const { name } = args.name ? args : await prompter.prompt({ | ||
type: "input", | ||
name: "name", | ||
validate: validateNotEmpty, | ||
message: "What is the name of your widget?", | ||
@@ -87,5 +93,6 @@ initial: key, | ||
const { indexPath } = await prompter.prompt({ | ||
const { indexPath } = args.indexPath ? args : await prompter.prompt({ | ||
type: "input", | ||
name: "indexPath", | ||
validate: validateNotEmpty, | ||
initial: `${folderName}/index.html`, | ||
@@ -95,3 +102,3 @@ message: `What is the path of your widget's index file?`, | ||
const { extensionPoint } = await prompter.prompt({ | ||
const { extensionPoint } = args.extensionPoint ? args : await prompter.prompt({ | ||
type: "select", | ||
@@ -106,3 +113,3 @@ name: "extensionPoint", | ||
const { description } = await prompter.prompt({ | ||
const { description } = args.description ? args : await prompter.prompt({ | ||
type: "input", | ||
@@ -113,4 +120,24 @@ name: "description", | ||
const { addDimensions } = await prompter.prompt({ | ||
const { limitPermissions } = args.limitPermissions ?? await prompter.prompt({ | ||
type: "confirm", | ||
name: "limitPermissions", | ||
message: "Would you like to make widget visibility limited?", | ||
}); | ||
let permissions = false; | ||
if (limitPermissions) { | ||
const res = await prompter.prompt({ | ||
type: "multiselect", | ||
name: "permissions", | ||
message: "Would you like to limit visibility of this widget? Leave empty to keep it always visible", | ||
choices: PERMISSIONS.map(({ key, description }) => ({ | ||
message: `"${key}": ${description}`, | ||
name: key, | ||
})), | ||
}); | ||
permissions = res.permissions; | ||
} | ||
const { addDimensions } = args.addDimensions ?? await prompter.prompt({ | ||
type: "confirm", | ||
name: "addDimensions", | ||
@@ -144,23 +171,6 @@ message: "Do you want to add dimensions to your widget?", | ||
let iconPath; | ||
if ( | ||
[ | ||
"HELPDESK_CHANNEL", | ||
"ARTICLE_OPTIONS_MENU_ITEM", | ||
"ISSUE_OPTIONS_MENU_ITEM", | ||
].includes(extensionPoint) | ||
) { | ||
await prompter | ||
.prompt({ | ||
type: "input", | ||
name: "iconPath", | ||
message: `What is the path of your widget's icon?`, | ||
}) | ||
.then((res) => { | ||
iconPath = res.iconPath; | ||
}); | ||
} | ||
return { | ||
key, | ||
name, | ||
permissions, | ||
folderName, | ||
@@ -173,5 +183,4 @@ indexPath, | ||
height, | ||
iconPath, | ||
}; | ||
}, | ||
}; |
12
index.js
@@ -50,6 +50,16 @@ #!/usr/bin/env node | ||
console.log(` | ||
======= Your App is created ======== | ||
Now let's add first widget! | ||
You can add more later by running "npx @jetbrains/create-youtrack-app widget add" | ||
==================================== | ||
`) | ||
await runHygen(['widget', 'add', ...argv]); | ||
if ( | ||
!(await new Confirm({ | ||
initial: true, | ||
message: `Would you like your App to have Settings (you can do it later by running "npm init @jetbrains/youtrack-app init settings")`, | ||
message: `Would you like your App to have Settings (you can do it later by running "npx @jetbrains/create-youtrack-app init settings")`, | ||
}).run()) | ||
@@ -56,0 +66,0 @@ ) { |
{ | ||
"name": "@jetbrains/create-youtrack-app", | ||
"version": "0.0.1-alpha.10", | ||
"version": "0.0.1-alpha.11", | ||
"description": "A scaffolder for YouTrack App generating", | ||
@@ -5,0 +5,0 @@ "main": "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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39495
35
724