mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #9382 from meteor/abernix/fix-cordova-add
Ensure that Cordova is installed for `meteor [add | remove] cordova:*`.
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
CORDOVA_PLATFORMS,
|
||||
ensureDevBundleDependencies,
|
||||
filterPlatforms,
|
||||
} from '../cordova';
|
||||
} from '../cordova/index.js';
|
||||
|
||||
function createProjectContext(appDir) {
|
||||
import { ProjectContext } from '../project-context.js';
|
||||
|
||||
@@ -23,7 +23,11 @@ var packageMapModule = require('../packaging/package-map.js');
|
||||
var packageClient = require('../packaging/package-client.js');
|
||||
var tropohouse = require('../packaging/tropohouse.js');
|
||||
|
||||
import * as cordova from '../cordova';
|
||||
import {
|
||||
ensureDevBundleDependencies,
|
||||
newPluginId,
|
||||
splitPluginsAndPackages,
|
||||
} from '../cordova/index.js';
|
||||
import { updateMeteorToolSymlink } from "../packaging/updater.js";
|
||||
|
||||
// For each release (or package), we store a meta-record with its name,
|
||||
@@ -1998,34 +2002,39 @@ main.registerCommand({
|
||||
|
||||
// Split arguments into Cordova plugins and packages
|
||||
const { plugins: pluginsToAdd, packages: packagesToAdd } =
|
||||
cordova.splitPluginsAndPackages(options.args);
|
||||
splitPluginsAndPackages(options.args);
|
||||
|
||||
if (!_.isEmpty(pluginsToAdd)) {
|
||||
let plugins = projectContext.cordovaPluginsFile.getPluginVersions();
|
||||
let changed = false;
|
||||
function cordovaPluginAdd() {
|
||||
const plugins = projectContext.cordovaPluginsFile.getPluginVersions();
|
||||
let changed = false;
|
||||
|
||||
for (target of pluginsToAdd) {
|
||||
let { id, version } =
|
||||
require('../cordova/package-id-version-parser.js').parse(target);
|
||||
const newId = cordova.newPluginId(id);
|
||||
for (target of pluginsToAdd) {
|
||||
const { id, version } =
|
||||
require('../cordova/package-id-version-parser.js').parse(target);
|
||||
const newId = newPluginId(id);
|
||||
|
||||
if (!(version && utils.isValidVersion(version, {forCordova: true}))) {
|
||||
Console.error(`${id}: Meteor requires either an exact version \
|
||||
(e.g. ${id}@1.0.0), a Git URL with a SHA reference, or a local path.`);
|
||||
exitCode = 1;
|
||||
} else if (newId) {
|
||||
plugins[newId] = version;
|
||||
Console.info(`Added Cordova plugin ${newId}@${version} \
|
||||
(plugin has been renamed as part of moving to npm).`);
|
||||
changed = true;
|
||||
} else {
|
||||
plugins[id] = version;
|
||||
Console.info(`Added Cordova plugin ${id}@${version}.`);
|
||||
changed = true;
|
||||
if (!(version && utils.isValidVersion(version, {forCordova: true}))) {
|
||||
Console.error(`${id}: Meteor requires either an exact version \
|
||||
(e.g. ${id}@1.0.0), a Git URL with a SHA reference, or a local path.`);
|
||||
exitCode = 1;
|
||||
} else if (newId) {
|
||||
plugins[newId] = version;
|
||||
Console.info(`Added Cordova plugin ${newId}@${version} \
|
||||
(plugin has been renamed as part of moving to npm).`);
|
||||
changed = true;
|
||||
} else {
|
||||
plugins[id] = version;
|
||||
Console.info(`Added Cordova plugin ${id}@${version}.`);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
changed && projectContext.cordovaPluginsFile.write(plugins);
|
||||
}
|
||||
|
||||
changed && projectContext.cordovaPluginsFile.write(plugins);
|
||||
ensureDevBundleDependencies();
|
||||
cordovaPluginAdd();
|
||||
}
|
||||
|
||||
if (_.isEmpty(packagesToAdd)) {
|
||||
@@ -2191,34 +2200,39 @@ main.registerCommand({
|
||||
|
||||
// Split arguments into Cordova plugins and packages
|
||||
const { plugins: pluginsToRemove, packages } =
|
||||
cordova.splitPluginsAndPackages(options.args);
|
||||
splitPluginsAndPackages(options.args);
|
||||
|
||||
if (!_.isEmpty(pluginsToRemove)) {
|
||||
let plugins = projectContext.cordovaPluginsFile.getPluginVersions();
|
||||
let changed = false;
|
||||
function cordovaPluginRemove() {
|
||||
const plugins = projectContext.cordovaPluginsFile.getPluginVersions();
|
||||
let changed = false;
|
||||
|
||||
for (id of pluginsToRemove) {
|
||||
const newId = cordova.newPluginId(id);
|
||||
for (id of pluginsToRemove) {
|
||||
const newId = newPluginId(id);
|
||||
|
||||
if (/@/.test(id)) {
|
||||
Console.error(`${id}: do not specify version constraints.`);
|
||||
exitCode = 1;
|
||||
} else if (_.has(plugins, id)) {
|
||||
delete plugins[id];
|
||||
Console.info(`Removed Cordova plugin ${id}.`);
|
||||
changed = true;
|
||||
} else if (newId && _.has(plugins, newId)) {
|
||||
delete plugins[newId];
|
||||
Console.info(`Removed Cordova plugin ${newId} \
|
||||
(plugin has been renamed as part of moving to npm).`);
|
||||
changed = true;
|
||||
} else {
|
||||
Console.error(`Cordova plugin ${id} is not in this project.`);
|
||||
exitCode = 1;
|
||||
if (/@/.test(id)) {
|
||||
Console.error(`${id}: do not specify version constraints.`);
|
||||
exitCode = 1;
|
||||
} else if (_.has(plugins, id)) {
|
||||
delete plugins[id];
|
||||
Console.info(`Removed Cordova plugin ${id}.`);
|
||||
changed = true;
|
||||
} else if (newId && _.has(plugins, newId)) {
|
||||
delete plugins[newId];
|
||||
Console.info(`Removed Cordova plugin ${newId} \
|
||||
(plugin has been renamed as part of moving to npm).`);
|
||||
changed = true;
|
||||
} else {
|
||||
Console.error(`Cordova plugin ${id} is not in this project.`);
|
||||
exitCode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
changed && projectContext.cordovaPluginsFile.write(plugins);
|
||||
}
|
||||
|
||||
changed && projectContext.cordovaPluginsFile.write(plugins);
|
||||
ensureDevBundleDependencies();
|
||||
cordovaPluginRemove();
|
||||
}
|
||||
|
||||
if (_.isEmpty(packages)) {
|
||||
|
||||
@@ -16,6 +16,7 @@ var Console = require('../console/console.js').Console;
|
||||
var projectContextModule = require('../project-context.js');
|
||||
var release = require('../packaging/release.js');
|
||||
|
||||
import { ensureDevBundleDependencies } from '../cordova/index.js';
|
||||
import { CordovaRunner } from '../cordova/runner.js';
|
||||
import { iOSRunTarget, AndroidRunTarget } from '../cordova/run-targets.js';
|
||||
|
||||
@@ -403,7 +404,6 @@ function doRunCommand(options) {
|
||||
});
|
||||
}
|
||||
|
||||
import { ensureDevBundleDependencies } from '../cordova';
|
||||
ensureDevBundleDependencies();
|
||||
prepareCordovaProject();
|
||||
}
|
||||
@@ -1042,10 +1042,9 @@ ${Console.command("meteor build ../output")}`,
|
||||
main.captureAndExit('', () => {
|
||||
|
||||
import {
|
||||
ensureDevBundleDependencies,
|
||||
pluginVersionsFromStarManifest,
|
||||
displayNameForPlatform,
|
||||
} from '../cordova';
|
||||
} from '../cordova/index.js';
|
||||
|
||||
ensureDevBundleDependencies();
|
||||
|
||||
@@ -1828,7 +1827,6 @@ function doTestCommand(options) {
|
||||
});
|
||||
}
|
||||
|
||||
import { ensureDevBundleDependencies } from '../cordova';
|
||||
ensureDevBundleDependencies();
|
||||
prepareCordovaProject();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ var Console = require('../console/console.js').Console;
|
||||
var catalog = require('../packaging/catalog/catalog.js');
|
||||
var Profile = require('../tool-env/profile.js').Profile;
|
||||
var release = require('../packaging/release.js');
|
||||
import * as cordova from '../cordova';
|
||||
import { pluginVersionsFromStarManifest } from '../cordova/index.js';
|
||||
import { CordovaBuilder } from '../cordova/builder.js';
|
||||
import { closeAllWatchers } from "../fs/safe-watcher.js";
|
||||
import { eachline } from "../utils/eachline.js";
|
||||
@@ -662,7 +662,7 @@ _.extend(AppRunner.prototype, {
|
||||
const cordovaRunner = self.cordovaRunner;
|
||||
if (cordovaRunner) {
|
||||
const pluginVersions =
|
||||
cordova.pluginVersionsFromStarManifest(bundleResult.starManifest);
|
||||
pluginVersionsFromStarManifest(bundleResult.starManifest);
|
||||
|
||||
if (!cordovaRunner.started) {
|
||||
const { settingsFile, mobileServerUrl } = self;
|
||||
|
||||
@@ -5,7 +5,7 @@ var files = require('./fs/files.js');
|
||||
var Console = require('./console/console.js').Console;
|
||||
import main from './cli/main.js';
|
||||
import buildmessage from './utils/buildmessage.js';
|
||||
import * as cordova from './cordova';
|
||||
import { convertPluginVersions } from './cordova/index.js';
|
||||
|
||||
// This file implements "upgraders" --- functions which upgrade a Meteor app to
|
||||
// a new version. Each upgrader has a name (registered in upgradersByName).
|
||||
@@ -183,7 +183,7 @@ var upgradersByName = {
|
||||
messages = buildmessage.capture(
|
||||
{ title: `converting Cordova plugins` }, () => {
|
||||
let pluginVersions = pluginsFile.getPluginVersions();
|
||||
pluginVersions = cordova.convertPluginVersions(pluginVersions);
|
||||
pluginVersions = convertPluginVersions(pluginVersions);
|
||||
pluginsFile.write(pluginVersions);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user