@ionic/cli-plugin-ionic1
Advanced tools
Comparing version 0.0.5 to 0.0.6-alpha.950ade14
@@ -1,2 +0,4 @@ | ||
import { ICLIEventEmitter } from '@ionic/cli-utils'; | ||
export declare function registerEvents(emitter: ICLIEventEmitter): void; | ||
import { IHookEngine } from '@ionic/cli-utils'; | ||
export declare const name = "__NAME__"; | ||
export declare const version = "__VERSION__"; | ||
export declare function registerHooks(hooks: IHookEngine): void; |
@@ -11,8 +11,25 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = require("path"); | ||
const cli_utils_1 = require("@ionic/cli-utils"); | ||
const index_1 = require("./serve/index"); | ||
function registerEvents(emitter) { | ||
emitter.on('serve', (args) => __awaiter(this, void 0, void 0, function* () { | ||
exports.name = '@ionic/cli-plugin-ionic1'; | ||
exports.version = '0.0.6-alpha.950ade14'; | ||
function registerHooks(hooks) { | ||
hooks.register(exports.name, 'command:docs', () => __awaiter(this, void 0, void 0, function* () { | ||
return 'https://ionicframework.com/docs/v1/'; | ||
})); | ||
hooks.register(exports.name, 'command:info', ({ env }) => __awaiter(this, void 0, void 0, function* () { | ||
if (!env.project.directory) { | ||
return []; | ||
} | ||
const ionicVersionJson = yield cli_utils_1.fsReadJsonFile(path.resolve(env.project.directory, 'www', 'lib', 'ionic', 'version.json')); | ||
return [ | ||
{ type: 'local-npm', name: 'Ionic Framework', version: `ionic1 ${ionicVersionJson['version'] || 'unknown'}` }, | ||
{ type: 'local-npm', name: exports.name, version: exports.version }, | ||
]; | ||
})); | ||
hooks.register(exports.name, 'command:serve', (args) => __awaiter(this, void 0, void 0, function* () { | ||
return index_1.serve(args); | ||
})); | ||
} | ||
exports.registerEvents = registerEvents; | ||
exports.registerHooks = registerHooks; |
@@ -5,5 +5,2 @@ /// <reference types="express" /> | ||
import { IProject } from '@ionic/cli-utils'; | ||
/** | ||
* Create HTTP server | ||
*/ | ||
export declare function createHttpServer(project: IProject, options: ServerOptions): Promise<expressType.Application>; |
@@ -18,5 +18,2 @@ "use strict"; | ||
const modules_1 = require("../lib/modules"); | ||
/** | ||
* Create HTTP server | ||
*/ | ||
function createHttpServer(project, options) { | ||
@@ -30,3 +27,2 @@ return __awaiter(this, void 0, void 0, function* () { | ||
app.use('/', express.static(options.wwwDir)); | ||
// Lab routes | ||
app.use(config_1.IONIC_LAB_URL + '/static', express.static(path.join(__dirname, '..', '..', 'lab', 'static'))); | ||
@@ -60,8 +56,4 @@ app.get(config_1.IONIC_LAB_URL, lab_1.LabAppView); | ||
} | ||
/** | ||
* http responder for /index.html base entrypoint | ||
*/ | ||
function serveIndex(req, res) { | ||
const options = req.app.get('serveOptions'); | ||
// respond with the index.html file | ||
const indexFileName = path.join(options.wwwDir, 'index.html'); | ||
@@ -76,5 +68,2 @@ fs.readFile(indexFileName, (err, indexHtml) => { | ||
} | ||
/** | ||
* http responder for cordova.js file | ||
*/ | ||
function serveMockCordovaJS(req, res) { | ||
@@ -84,5 +73,2 @@ res.set('Content-Type', 'application/javascript'); | ||
} | ||
/** | ||
* Middleware to serve platform resources | ||
*/ | ||
function servePlatformResource(req, res, next) { | ||
@@ -89,0 +75,0 @@ const options = req.app.get('serveOptions'); |
@@ -1,4 +0,4 @@ | ||
import { CLIEventEmitterServeEventArgs } from '@ionic/cli-utils'; | ||
export declare function serve(args: CLIEventEmitterServeEventArgs): Promise<{ | ||
import { CommandHookArgs } from '@ionic/cli-utils'; | ||
export declare function serve(args: CommandHookArgs): Promise<{ | ||
[key: string]: any; | ||
}>; |
@@ -16,4 +16,4 @@ "use strict"; | ||
const live_reload_1 = require("./live-reload"); | ||
const cli_utils_1 = require("@ionic/cli-utils"); | ||
const config_1 = require("./config"); | ||
const network_1 = require("../utils/network"); | ||
const arguments_1 = require("../utils/arguments"); | ||
@@ -25,4 +25,3 @@ const modules_1 = require("../lib/modules"); | ||
console.log(` Starting server: ${chalk.bold(appScriptsArgs.join(' '))}`); | ||
// Find appropriate IP to use for cordova to reference | ||
const availableIPs = network_1.getAvailableIPAddress(); | ||
const availableIPs = cli_utils_1.getAvailableIPAddress(); | ||
if (availableIPs.length === 0) { | ||
@@ -43,3 +42,2 @@ throw new Error(`It appears that you do not have any external network interfaces. ` + | ||
} | ||
// Setup Options and defaults | ||
const serverOptions = { | ||
@@ -65,13 +63,11 @@ projectRoot: args.env.project.directory, | ||
}; | ||
// Clean up args based on environment state | ||
serverOptions.address = (serverOptions.address === '0.0.0.0') ? 'localhost' : serverOptions.address; | ||
const portResults = yield Promise.all([ | ||
network_1.findClosestOpenPort(serverOptions.address, serverOptions.port), | ||
network_1.findClosestOpenPort(serverOptions.address, serverOptions.livereloadPort), | ||
cli_utils_1.findClosestOpenPort(serverOptions.address, serverOptions.port), | ||
cli_utils_1.findClosestOpenPort(serverOptions.address, serverOptions.livereloadPort), | ||
]); | ||
serverOptions.port = portResults[0]; | ||
serverOptions.livereloadPort = portResults[1]; | ||
// Check if gulp is installed globally for sass | ||
try { | ||
yield args.env.shell.run('gulp', ['-v']); | ||
yield args.env.shell.run('gulp', ['-v'], { showExecution: false }); | ||
} | ||
@@ -81,3 +77,2 @@ catch (e) { | ||
} | ||
// Start up server | ||
const settings = yield setupServer(args.env, serverOptions); | ||
@@ -99,3 +94,5 @@ args.env.log.msg(`dev server running: http://${serverOptions.address}:${serverOptions.port}`); | ||
case '.scss': | ||
yield processSassFile(env, options); | ||
if (!options.nosass) { | ||
yield processSassFile(env, options); | ||
} | ||
return; | ||
@@ -121,2 +118,5 @@ default: | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (options.nogulp) { | ||
return; | ||
} | ||
if (!options.gulpInstalled) { | ||
@@ -123,0 +123,0 @@ env.log.error(`You are trying to build a sass file, but unfortunately Ionic1 projects require\n` + |
@@ -1,5 +0,2 @@ | ||
/** | ||
* Main Lab app view | ||
*/ | ||
export declare function LabAppView(req: any, res: any): any; | ||
export declare function ApiCordovaProject(req: any, res: any): void; |
@@ -5,5 +5,2 @@ "use strict"; | ||
const cordova_config_1 = require("../utils/cordova-config"); | ||
/** | ||
* Main Lab app view | ||
*/ | ||
function LabAppView(req, res) { | ||
@@ -10,0 +7,0 @@ return res.sendFile('index.html', { |
@@ -22,3 +22,2 @@ "use strict"; | ||
if (contentStr.indexOf('/livereload.js') > -1) { | ||
// already added script | ||
return content; | ||
@@ -25,0 +24,0 @@ } |
@@ -6,7 +6,3 @@ export interface CordovaProject { | ||
} | ||
/** | ||
* Parse and build a CordovaProject config object by parsing the | ||
* config.xml file in the project root. | ||
*/ | ||
export declare function buildCordovaConfig(errCb: Function, cb: Function): void; | ||
export declare function parseConfig(parsedConfig: any): CordovaProject; |
@@ -6,6 +6,2 @@ "use strict"; | ||
let lastConfig; | ||
/** | ||
* Parse and build a CordovaProject config object by parsing the | ||
* config.xml file in the project root. | ||
*/ | ||
function buildCordovaConfig(errCb, cb) { | ||
@@ -34,3 +30,2 @@ const xml2js = modules_1.load('xml2js'); | ||
let widget = parsedConfig.widget; | ||
// Widget attrs are defined on the <widget> tag | ||
let widgetAttrs = widget.$; | ||
@@ -37,0 +32,0 @@ let config = { |
@@ -25,6 +25,4 @@ "use strict"; | ||
catch (e) { | ||
// Empty gulpfile (or one that doesn't require gulp?), and no gulp | ||
throw `Gulpfile detected, but gulp is not installed.\nDo you need to run npm install`; | ||
} | ||
// setup gulp logging | ||
return patchGulpEventLogging(gulp); | ||
@@ -35,5 +33,2 @@ } | ||
function runGulpHook(gulp, hookName) { | ||
// swallow errors because we already check to make sure the task exists | ||
// so not a missingTask error, and gulp already reports its own errors | ||
// which we set up with Cli.logEvents | ||
return new Promise((resolve, reject) => { | ||
@@ -59,3 +54,2 @@ gulp.start.bind(gulp, hookName, (err, results) => { | ||
if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf(names[i]) !== -1) { | ||
// ignore missing gulpfile | ||
continue; | ||
@@ -71,4 +65,2 @@ } | ||
gulpInst.on('task_start', function (e) { | ||
// TODO: batch these | ||
// so when 5 tasks start at once it only logs one time with all 5 | ||
console.log('Starting', '\'' + chalk.cyan(e.task) + '\'...'); | ||
@@ -87,3 +79,2 @@ }); | ||
; | ||
// Format orchestrator errors | ||
function formatGulpError(e) { | ||
@@ -93,13 +84,10 @@ if (!e.err) { | ||
} | ||
// PluginError | ||
if (typeof e.err.showStack === 'boolean') { | ||
return e.err.toString(); | ||
} | ||
// Normal error | ||
if (e.err.stack) { | ||
return e.err.stack; | ||
} | ||
// Unknown (string, number, etc.) | ||
return new Error(String(e.err)).stack; | ||
} | ||
; |
{ | ||
"name": "@ionic/cli-plugin-ionic1", | ||
"version": "0.0.5", | ||
"version": "0.0.6-alpha.950ade14", | ||
"description": "Ionic CLI build plugin for Ionic 1 projects", | ||
@@ -9,8 +9,13 @@ "homepage": "https://ionic.io/", | ||
"scripts": { | ||
"clean": "rm -rf ./dist", | ||
"lint": "../../node_modules/.bin/tslint -c ../../tslint.json 'src/**/*.ts'", | ||
"build": "npm run clean && ../../node_modules/.bin/tsc", | ||
"clean": "rm -rf ./dist", | ||
"changelog": "conventional-changelog -i CHANGELOG.md -s -p angular", | ||
"build": "npm run clean && npm run build-ts && npm run build-js", | ||
"build-ts": "../../node_modules/.bin/tsc", | ||
"build-js": "npm run -s script-prepublish", | ||
"watch": "npm run clean && ../../node_modules/.bin/concurrently -p '{name} ' -n 'TS,JS' -c 'cyan.bold,yellow.dim' 'npm run watch-ts' 'npm run watch-js'", | ||
"watch-ts": "../../node_modules/.bin/tsc -w", | ||
"watch-js": "../../node_modules/.bin/chokidar --silent 'dist/**/*.js' -c 'npm run build-js'", | ||
"script-prepublish": "node ../../scripts/prepublish.js cli-plugin-ionic1", | ||
"test": "../../node_modules/.bin/jest", | ||
"watch": "npm run clean && ../../node_modules/.bin/tsc --watch" | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -41,3 +46,3 @@ "repository": { | ||
"dependencies": { | ||
"@ionic/cli-utils": "^0.0.10", | ||
"@ionic/cli-utils": "0.0.11-alpha.950ade14", | ||
"chalk": "^1.1.3", | ||
@@ -44,0 +49,0 @@ "express": "^4.15.2", |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
0
0
25171
24
569
+ Added@ionic/cli-utils@0.0.11-alpha.950ade14(transitive)
- Removed@ionic/cli-utils@0.0.10(transitive)