mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Add --extra-packages option
This commit is contained in:
@@ -270,7 +270,8 @@ var runCommandOptions = {
|
||||
'no-lint': { type: Boolean },
|
||||
// Allow the version solver to make breaking changes to the versions
|
||||
// of top-level dependencies.
|
||||
'allow-incompatible-update': { type: Boolean }
|
||||
'allow-incompatible-update': { type: Boolean },
|
||||
'extra-packages': { type: String }
|
||||
},
|
||||
catalogRefresh: new catalog.Refresh.Never()
|
||||
};
|
||||
@@ -289,10 +290,16 @@ function doRunCommand(options) {
|
||||
const { parsedServerUrl, parsedMobileServerUrl } =
|
||||
parseServerOptionsForRunCommand(options, runTargets);
|
||||
|
||||
var includePackages = [];
|
||||
if (options['extra-packages']) {
|
||||
includePackages = options['extra-packages'].split(',');
|
||||
}
|
||||
|
||||
var projectContext = new projectContextModule.ProjectContext({
|
||||
projectDir: options.appDir,
|
||||
allowIncompatibleUpdate: options['allow-incompatible-update'],
|
||||
lintAppAndLocalPackages: !options['no-lint']
|
||||
lintAppAndLocalPackages: !options['no-lint'],
|
||||
includePackages: includePackages,
|
||||
});
|
||||
|
||||
main.captureAndExit("=> Errors while initializing project:", function () {
|
||||
|
||||
@@ -86,6 +86,7 @@ Options:
|
||||
downgraded to versions that are potentially incompatible with
|
||||
the current versions, if required to satisfy all package
|
||||
version constraints.
|
||||
--extra-packages Run with additional packages (comma separated)
|
||||
|
||||
>>> debug
|
||||
Run the project, but suspend the server process for debugging.
|
||||
|
||||
@@ -68,6 +68,8 @@ _.extend(ProjectContext.prototype, {
|
||||
self.projectDir = options.projectDir;
|
||||
self.tropohouse = options.tropohouse || tropohouse.default;
|
||||
|
||||
self._includePackages = options.includePackages;
|
||||
|
||||
self._packageMapFilename = options.packageMapFilename ||
|
||||
files.pathJoin(self.projectDir, '.meteor', 'versions');
|
||||
|
||||
@@ -322,7 +324,8 @@ _.extend(ProjectContext.prototype, {
|
||||
|
||||
// Read .meteor/packages.
|
||||
self.projectConstraintsFile = new exports.ProjectConstraintsFile({
|
||||
projectDir: self.projectDir
|
||||
projectDir: self.projectDir,
|
||||
includePackages: self._includePackages
|
||||
});
|
||||
if (buildmessage.jobHasMessages())
|
||||
return;
|
||||
@@ -874,6 +877,9 @@ exports.ProjectConstraintsFile = function (options) {
|
||||
self.filename = files.pathJoin(options.projectDir, '.meteor', 'packages');
|
||||
self.watchSet = null;
|
||||
|
||||
// List of packages that should be included if not provided in .meteor/packages
|
||||
self._includePackages = options.includePackages || [];
|
||||
|
||||
// Have we modified the in-memory representation since reading from disk?
|
||||
self._modified = null;
|
||||
// List of each line in the file; object with keys:
|
||||
@@ -949,6 +955,21 @@ _.extend(exports.ProjectConstraintsFile.prototype, {
|
||||
}
|
||||
self._constraintMap[lineRecord.constraint.package] = lineRecord;
|
||||
});
|
||||
|
||||
_.each(self._includePackages, function (pkg) {
|
||||
var lineRecord = {
|
||||
leadingSpace: '',
|
||||
trailingSpaceAndComment: '',
|
||||
constraint: utils.parsePackageConstraint(pkg.trim()),
|
||||
skipOnWrite: true
|
||||
};
|
||||
|
||||
if (_.has(self._constraintMap, lineRecord.constraint.package))
|
||||
return;
|
||||
|
||||
self._constraintLines.push(lineRecord);
|
||||
self._constraintMap[lineRecord.constraint.package] = lineRecord;
|
||||
});
|
||||
},
|
||||
|
||||
writeIfModified: function () {
|
||||
@@ -959,6 +980,9 @@ _.extend(exports.ProjectConstraintsFile.prototype, {
|
||||
_write: function () {
|
||||
var self = this;
|
||||
var lines = _.map(self._constraintLines, function (lineRecord) {
|
||||
// Don't write packages that were not loaded from .meteor/packages
|
||||
if (lineRecord.skipOnWrite)
|
||||
return;
|
||||
var lineParts = [lineRecord.leadingSpace];
|
||||
if (lineRecord.constraint) {
|
||||
lineParts.push(lineRecord.constraint.package);
|
||||
|
||||
Reference in New Issue
Block a user