mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Support meteor create --minimal for creating very small apps.
Like `meteor create --bare`, except with even fewer Meteor core packages, so that the client-side footprint of the app is as tiny as possible.
This commit is contained in:
@@ -489,8 +489,9 @@ main.registerCommand({
|
||||
list: { type: Boolean },
|
||||
example: { type: String },
|
||||
package: { type: Boolean },
|
||||
bare: { type: Boolean },
|
||||
minimal: { type: Boolean },
|
||||
full: { type: Boolean },
|
||||
bare: { type: Boolean }
|
||||
},
|
||||
catalogRefresh: new catalog.Refresh.Never()
|
||||
}, function (options) {
|
||||
@@ -733,13 +734,13 @@ main.registerCommand({
|
||||
toIgnore.push(/(\.html|\.js|\.css)/)
|
||||
}
|
||||
|
||||
let skelName = 'skel';
|
||||
|
||||
if(options.bare){
|
||||
skelName += '-bare';
|
||||
}
|
||||
else if(options.full){
|
||||
skelName += '-full';
|
||||
let skelName = "skel";
|
||||
if (options.minimal) {
|
||||
skelName += "-minimal";
|
||||
} else if (options.bare) {
|
||||
skelName += "-bare";
|
||||
} else if (options.full) {
|
||||
skelName += "-full";
|
||||
}
|
||||
|
||||
files.cp_r(files.pathJoin(__dirnameConverted, '..', 'static-assets', skelName), appPath, {
|
||||
@@ -819,6 +820,12 @@ main.registerCommand({
|
||||
// do next.
|
||||
Console.info("To run your new app:");
|
||||
|
||||
function cmd(text) {
|
||||
Console.info(Console.command(text), Console.options({
|
||||
indent: 2
|
||||
}));
|
||||
}
|
||||
|
||||
if (appPathAsEntered !== ".") {
|
||||
// Wrap the app path in quotes if it contains spaces
|
||||
const appPathWithQuotesIfSpaces = appPathAsEntered.indexOf(' ') === -1 ?
|
||||
@@ -826,13 +833,10 @@ main.registerCommand({
|
||||
`'${appPathAsEntered}'`;
|
||||
|
||||
// Don't tell people to 'cd .'
|
||||
Console.info(
|
||||
Console.command("cd " + appPathWithQuotesIfSpaces),
|
||||
Console.options({ indent: 2 }));
|
||||
cmd("cd " + appPathWithQuotesIfSpaces);
|
||||
}
|
||||
|
||||
Console.info(
|
||||
Console.command("meteor"), Console.options({ indent: 2 }));
|
||||
cmd("meteor");
|
||||
|
||||
Console.info("");
|
||||
Console.info("If you are new to Meteor, try some of the learning resources here:");
|
||||
@@ -840,13 +844,21 @@ main.registerCommand({
|
||||
Console.url("https://www.meteor.com/tutorials"),
|
||||
Console.options({ indent: 2 }));
|
||||
|
||||
if (!options.full && !options.bare){
|
||||
// Notice people about --bare and --full
|
||||
const bareOptionNotice = 'meteor create --bare to create an empty app.';
|
||||
const fullOptionNotice = 'meteor create --full to create a scaffolded app.';
|
||||
if (! options.bare &&
|
||||
! options.minimal &&
|
||||
! options.full) {
|
||||
// Notify people about --bare, --minimal, and --full.
|
||||
Console.info([
|
||||
"",
|
||||
"To start with a different app template, try one of the following:",
|
||||
"",
|
||||
].join("\n"));
|
||||
|
||||
Console.info("");
|
||||
Console.info(bareOptionNotice + '\n' + fullOptionNotice);
|
||||
cmd("meteor create --bare # to create an empty app");
|
||||
cmd("meteor create --minimal # to create an empty app with as " +
|
||||
"few Meteor packages as possible");
|
||||
cmd("meteor create --full # to create a more complete " +
|
||||
"scaffolded app");
|
||||
}
|
||||
|
||||
Console.info("");
|
||||
|
||||
@@ -142,15 +142,16 @@ Options:
|
||||
|
||||
>>> create
|
||||
Create a new project.
|
||||
Usage: meteor create [--release <release>] [--bare|--full] <path>
|
||||
Usage: meteor create [--release <release>] [--bare|--minimal|--full] <path>
|
||||
meteor create [--release <release>] --example <example_name> [<path>]
|
||||
meteor create --list
|
||||
meteor create --package [<package_name>]
|
||||
|
||||
Make a subdirectory named <path> if it doesn't exist and create a new Meteor app
|
||||
there. You can pass an absolute path, relative path, or '.' for the current
|
||||
directory. Use the --bare option to create an empty app. To scaffold the app
|
||||
use the --full option.
|
||||
Make a subdirectory named <path> if it doesn't exist and create a new Meteor
|
||||
app there. You can pass an absolute path, relative path, or '.' for the
|
||||
current directory. Use the --bare option to create an empty app, or the
|
||||
--minimal option to create an empty app with as few Meteor packages as
|
||||
possible. To scaffold a more complete app, use the --full option.
|
||||
|
||||
With the --package option, creates a Meteor package instead of an app. If you're
|
||||
in an app, the package will go in the app's top-level 'packages' directory;
|
||||
@@ -170,7 +171,8 @@ Options:
|
||||
--example Example template to use.
|
||||
--list Show list of available examples.
|
||||
--bare Create an empty app.
|
||||
--full Create a scaffolded app.
|
||||
--minimal Create an empty app with as few Meteor packages as possible.
|
||||
--full Create a fully scaffolded app.
|
||||
|
||||
|
||||
>>> update
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"start": "meteor run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.36",
|
||||
"@babel/runtime": "^7.0.0-beta.40",
|
||||
"meteor-node-stubs": "^0.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"test": "meteor test --once --driver-package meteortesting:mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.36",
|
||||
"@babel/runtime": "^7.0.0-beta.40",
|
||||
"meteor-node-stubs": "^0.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
1
tools/static-assets/skel-minimal/.gitignore
vendored
Normal file
1
tools/static-assets/skel-minimal/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
1
tools/static-assets/skel-minimal/.meteor/.gitignore
vendored
Normal file
1
tools/static-assets/skel-minimal/.meteor/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
local
|
||||
13
tools/static-assets/skel-minimal/.meteor/packages
Normal file
13
tools/static-assets/skel-minimal/.meteor/packages
Normal file
@@ -0,0 +1,13 @@
|
||||
# Meteor packages used by this project, one per line.
|
||||
# Check this file (and the other files in this directory) into your repository.
|
||||
#
|
||||
# 'meteor add' and 'meteor remove' will edit this file for you,
|
||||
# but you can also edit it by hand.
|
||||
|
||||
static-html # Define static page content in .html files
|
||||
standard-minifier-css # CSS minifier run for production mode
|
||||
standard-minifier-js # JS minifier run for production mode
|
||||
es5-shim # ECMAScript 5 compatibility for older browsers
|
||||
ecmascript # Enable ECMAScript2015+ syntax in app code
|
||||
shell-server # Server-side component of the `meteor shell` command
|
||||
webapp # Serves a Meteor app over HTTP
|
||||
2
tools/static-assets/skel-minimal/.meteor/platforms
Normal file
2
tools/static-assets/skel-minimal/.meteor/platforms
Normal file
@@ -0,0 +1,2 @@
|
||||
server
|
||||
browser
|
||||
11
tools/static-assets/skel-minimal/package.json
Normal file
11
tools/static-assets/skel-minimal/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "~name~",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "meteor run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.40",
|
||||
"meteor-node-stubs": "^0.3.2"
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
"start": "meteor run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.36",
|
||||
"@babel/runtime": "^7.0.0-beta.40",
|
||||
"meteor-node-stubs": "^0.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,3 +58,31 @@ selftest.define("create", function () {
|
||||
|
||||
// XXX XXX more more
|
||||
});
|
||||
|
||||
["bare",
|
||||
"minimal",
|
||||
"full",
|
||||
].forEach(template => {
|
||||
selftest.define("create --" + template, function () {
|
||||
const s = new Sandbox;
|
||||
|
||||
// Can we create an app? Yes!
|
||||
let run = s.run("create", "--" + template, template);
|
||||
run.waitSecs(60);
|
||||
run.match("Created a new Meteor app in '" + template + "'.");
|
||||
run.match("To run your new app");
|
||||
|
||||
s.cd(template);
|
||||
run = s.run();
|
||||
run.waitSecs(60);
|
||||
run.match(template);
|
||||
run.match("proxy")
|
||||
run.waitSecs(60);
|
||||
run.match("your app");
|
||||
run.waitSecs(5);
|
||||
run.match("running at");
|
||||
run.match("localhost");
|
||||
|
||||
run.stop();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user