@ionic/cli-plugin-ionic-angular
Advanced tools
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = require("path"); | ||
const cli_utils_1 = require("@ionic/cli-utils"); | ||
@@ -20,4 +21,5 @@ const modules_1 = require("./lib/modules"); | ||
process.argv = ['node', 'appscripts'].concat(appScriptsArgs); | ||
const ionicInfo = yield cli_utils_1.getIonicInfo(); | ||
if (ionicInfo.version.charAt(0) < 3) { | ||
const appDirectory = '.'; // TODO: change this | ||
const ionicInfo = yield cli_utils_1.readPackageJsonFile(path.resolve(appDirectory, 'node_modules', 'ionic-angular', 'package.json')); // TODO | ||
if (Number(ionicInfo.version.charAt(0)) < 3) { | ||
throw new Error(`The generate command is only available for projects that use ionic-angular >= 3.0.0`); | ||
@@ -32,12 +34,12 @@ } | ||
case 'component': | ||
const componentData = yield promptQuestions('component', context); | ||
const componentData = yield promptQuestions(context); | ||
return yield AppScripts.processComponentRequest(context, name, componentData); | ||
case 'directive': | ||
const directiveData = yield promptQuestions('directive', context); | ||
const directiveData = yield promptQuestions(context); | ||
return yield AppScripts.processDirectiveRequest(context, name, directiveData); | ||
case 'pipe': | ||
const pipeData = yield promptQuestions('pipe', context); | ||
const pipeData = yield promptQuestions(context); | ||
return yield AppScripts.processPipeRequest(context, name, pipeData); | ||
case 'provider': | ||
const providerData = yield promptQuestions('provider', context); | ||
const providerData = yield promptQuestions(context); | ||
return yield AppScripts.processProviderRequest(context, name, providerData); | ||
@@ -52,5 +54,5 @@ case 'tabs': | ||
exports.generate = generate; | ||
function promptQuestions(name, context) { | ||
function promptQuestions(context) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield generate_1.prompt(name, context); | ||
return yield generate_1.prompt(context); | ||
}); | ||
@@ -57,0 +59,0 @@ } |
import { ICLIEventEmitter } from '@ionic/cli-utils'; | ||
export declare const version = "__VERSION__"; | ||
export declare function registerEvents(emitter: ICLIEventEmitter): void; |
@@ -11,9 +11,30 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = require("path"); | ||
const cli_utils_1 = require("@ionic/cli-utils"); | ||
const build_1 = require("./build"); | ||
const generate_1 = require("./generate"); | ||
const serve_1 = require("./serve"); | ||
exports.version = '0.0.6-alpha.d32d569c'; | ||
function registerEvents(emitter) { | ||
emitter.on('docs', () => __awaiter(this, void 0, void 0, function* () { | ||
const appDirectory = '.'; // TODO: change this | ||
const ionicAngularPackageJson = yield cli_utils_1.readPackageJsonFile(path.resolve(appDirectory, 'node_modules', 'ionic-angular', 'package.json')); // TODO | ||
const docsHomepage = 'https://ionicframework.com/docs'; | ||
const version = ionicAngularPackageJson.version; | ||
const url = `${docsHomepage}/${version}/api`; | ||
return url; | ||
})); | ||
emitter.on('generate', (args) => __awaiter(this, void 0, void 0, function* () { | ||
return generate_1.generate(args); | ||
yield generate_1.generate(args); | ||
})); | ||
emitter.on('info', () => __awaiter(this, void 0, void 0, function* () { | ||
const appDirectory = '.'; // TODO: change this | ||
const ionicAngularPackageJson = yield cli_utils_1.readPackageJsonFile(path.resolve(appDirectory, 'node_modules', 'ionic-angular', 'package.json')); // TODO | ||
const appScriptsPackageJson = yield cli_utils_1.readPackageJsonFile(path.resolve(appDirectory, 'node_modules', '@ionic', 'app-scripts', 'package.json')); // TODO | ||
return [ | ||
{ type: 'local-npm', name: 'Ionic Framework', version: `ionic-angular ${ionicAngularPackageJson.version}` }, | ||
{ type: 'local-npm', name: '@ionic/cli-plugin-ionic-angular', version: exports.version }, | ||
{ type: 'local-npm', name: '@ionic/app-scripts', version: appScriptsPackageJson.version }, | ||
]; | ||
})); | ||
emitter.on('serve', (args) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -23,5 +44,5 @@ return serve_1.serve(args); | ||
emitter.on('build', (args) => __awaiter(this, void 0, void 0, function* () { | ||
return build_1.build(args); | ||
yield build_1.build(args); | ||
})); | ||
} | ||
exports.registerEvents = registerEvents; |
@@ -7,3 +7,3 @@ import * as AppScriptsType from '@ionic/app-scripts'; | ||
}[]>; | ||
export declare function prompt(type: string, context: AppScriptsType.BuildContext): Promise<string>; | ||
export declare function prompt(context: AppScriptsType.BuildContext): Promise<string>; | ||
export declare function tabsPrompt(): Promise<any[]>; |
@@ -28,34 +28,5 @@ "use strict"; | ||
exports.getPages = getPages; | ||
function prompt(type, context) { | ||
function prompt(context) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const inquirer = modules_1.load('inquirer'); | ||
const usageQuestion = yield inquirer.prompt({ | ||
type: 'confirm', | ||
name: 'usage', | ||
message: `Use this ${type} in more than one template?` | ||
}); | ||
if (!usageQuestion.usage) { | ||
const fileChoices = yield getPages(context); | ||
const filteredChoices = fileChoices.map((file) => { | ||
return { | ||
prettyName: path.dirname(file.relativePath), | ||
fullName: file.relativePath | ||
}; | ||
}); | ||
const usagePlaces = yield inquirer.prompt({ | ||
type: 'list', | ||
name: 'whereUsed', | ||
message: `Page or component that will be using this ${type}`, | ||
choices: filteredChoices.map((choiceObject) => { | ||
return choiceObject.prettyName; | ||
}) | ||
}); | ||
const chosenPath = fileChoices.find((file) => { | ||
return path.dirname(file.relativePath) === usagePlaces.whereUsed; | ||
}); | ||
return chosenPath.absolutePath; | ||
} | ||
else { | ||
return context.appNgModulePath; | ||
} | ||
return context.appNgModulePath; | ||
}); | ||
@@ -62,0 +33,0 @@ } |
{ | ||
"name": "@ionic/cli-plugin-ionic-angular", | ||
"version": "0.0.5", | ||
"version": "0.0.6-alpha.d32d569c", | ||
"description": "Ionic CLI build plugin for Ionic Angular projects", | ||
@@ -13,2 +13,4 @@ "homepage": "https://ionic.io/", | ||
"changelog": "conventional-changelog -i CHANGELOG.md -s -p angular", | ||
"prepublish": "npm run build && npm run version", | ||
"version": "node ../../scripts/versionPackage.js cli-plugin-ionic-angular", | ||
"test": "../../node_modules/.bin/jest", | ||
@@ -41,3 +43,3 @@ "watch": "npm run clean && ../../node_modules/.bin/tsc --watch" | ||
"dependencies": { | ||
"@ionic/cli-utils": "^0.0.10", | ||
"@ionic/cli-utils": "0.0.11-alpha.d32d569c", | ||
"chalk": "^1.1.3", | ||
@@ -44,0 +46,0 @@ "inquirer": "^3.0.6" |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
18720
3.47%18
5.88%0
-100%1
-50%1
Infinity%349
-1.41%