Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold an official project structure on with meteor create #7807

Merged
merged 1 commit into from Nov 8, 2016

Conversation

@mhidou
Copy link
Contributor

@mhidou mhidou commented Sep 22, 2016

Hi,

This PR concerns the issue #6974

As a full stack developer, I enjoy to start my projects with the smallest amount of code to avoid spending time deleting what I don't need. So I've choose to create a minimal scaffold with architecture based on meteor guide, to help rookies understanding good practices.

Now when you want create a new meteor app you can add the --bare option if you want an empty app or you can add the --full option to create a full app.

In the full version I added the kadira:flow-router, kadira:blaze-layout and the less packages.

You can check this repo to see the boilerplate.

Hope that you will enjoy what I've done, it's always a pleasure to help the Meteor project.

  • Basic behavior of the create command
$ meteor create test
Created a new Meteor app in 'test'.

To run your new app:
  cd test
  meteor

If you are new to Meteor, try some of the learning resources here:
  https://www.meteor.com/learn

meteor create --bare to create an empty app.
meteor create --full to create a scaffolded app.

$ find test -type f
test/.meteor/local/...
test/.meteor/packages
test/.meteor/platforms
test/.meteor/release
test/.meteor/versions
test/client/main.css
test/client/main.html
test/client/main.js
test/package.json
test/server/main.js
  • The --bare option
$ meteor/meteor create --bare test-bare
Created a new Meteor app in 'test-bare'.

To run your new app:
  cd test-bare
  meteor

If you are new to Meteor, try some of the learning resources here:
  https://www.meteor.com/learn

$ find test-bare -type f
test-bare/.meteor/local/...
test-bare/.meteor/packages
test-bare/.meteor/platforms
test-bare/.meteor/release
test-bare/.meteor/versions
test-bare/package.json
  • The --full option
$ meteor/meteor create --full test-full
Created a new Meteor app in 'test-full'.

To run your new app:
  cd test-full
  meteor

If you are new to Meteor, try some of the learning resources here:
  https://www.meteor.com/learn

$ find test-full -type f
test-full/.meteor/local/...
test-full/.meteor/packages
test-full/.meteor/platforms
test-full/.meteor/release
test-full/.meteor/versions
test-full/client/head.html
test-full/client/main.js
test-full/client/main.less
test-full/imports/api/links/links.js
test-full/imports/api/links/links.tests.js
test-full/imports/api/links/methods.js
test-full/imports/api/links/methods.tests.js
test-full/imports/api/links/server/publications.js
test-full/imports/api/links/server/publications.tests.js
test-full/imports/startup/both/index.js
test-full/imports/startup/both/useraccounts-configuration.js
test-full/imports/startup/client/index.js
test-full/imports/startup/client/routes.js
test-full/imports/startup/server/fixtures.js
test-full/imports/startup/server/index.js
test-full/imports/startup/server/register-api.js
test-full/imports/ui/components/hello/hello.html
test-full/imports/ui/components/hello/hello.js
test-full/imports/ui/components/info/info.html
test-full/imports/ui/components/info/info.js
test-full/imports/ui/layouts/body/body.html
test-full/imports/ui/layouts/body/body.js
test-full/imports/ui/pages/home/home.html
test-full/imports/ui/pages/home/home.js
test-full/imports/ui/pages/not-found/not-found.html
test-full/imports/ui/pages/not-found/not-found.js
test-full/imports/ui/stylesheets/not-found.less
test-full/package.json
test-full/private/README.md
test-full/public/img/404.svg
test-full/public/img/bg-footer.svg
test-full/server/main.js
  • Man
$ meteor help create
Usage: meteor create [--release <release>] [--bare|--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.

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;
otherwise it will be created in the current directory.

The app will use the release of Meteor specified with the --release
option, or the latest available version if the option is not specified. (A
package created in an app, will be created using the application's version of
meteor and a package created outside a meteor app will use the latest release).

You can pass --example to start off with a copy of one of the Meteor
sample applications. Use --list to see the available examples. There are
currently no package examples.

Options:
  --package  Create a new meteor package instead of an app.
  --example  Example template to use.
  --list     Show list of available examples.
  --bare     Create an empty app.
  --full     Create a scafolded app.
@tmeasday
Copy link
Contributor

@tmeasday tmeasday commented Sep 23, 2016

Hi @mhidou can you please rebase this PR against current devel? The commit you started off had some problems running the Circle tests.

Loading

@mhidou mhidou force-pushed the skel-scaffold branch 3 times, most recently from d796176 to f8cc262 Sep 23, 2016
@mhidou
Copy link
Contributor Author

@mhidou mhidou commented Sep 23, 2016

@tmeasday rebase done

Loading

@tmeasday tmeasday self-assigned this Sep 28, 2016
@@ -115,6 +116,8 @@ Options:
--package Create a new meteor package instead of an app.
--example Example template to use.
--list Show list of available examples.
--bare Create an empty app.
--full Create a scafolded app.
Copy link
Contributor

@tmeasday tmeasday Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo here Create a scaffolded app

Loading

@@ -0,0 +1,58 @@
// The useraccounts package must be configured for both client and server to work properly.
Copy link
Contributor

@tmeasday tmeasday Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This app doesn't include this package, so this seems odd -- I think maybe you could just add a comment to the imports/startup/both/index.js detailing the kind of shared configuration you might have.

Loading

@@ -0,0 +1,18 @@
// Tests for the links publications
Copy link
Contributor

@tmeasday tmeasday Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we properly include tests?

Loading

Copy link
Contributor

@tmeasday tmeasday Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Like maybe we should include the publication collection package and the validated method stuff for method tests?)

Loading

@@ -0,0 +1,12 @@
// All link-related publications
//
// TODO: Remove the autopublish package before adding publications
Copy link
Contributor

@tmeasday tmeasday Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think removing autopublish + insecure in this app is a great idea.

Loading

Copy link
Contributor Author

@mhidou mhidou Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

Loading

@mhidou
Copy link
Contributor Author

@mhidou mhidou commented Oct 7, 2016

@tmeasday Thanks for your feedback, i've updated this PR

Loading

@stubailo
Copy link
Contributor

@stubailo stubailo commented Oct 7, 2016

If you are new to Meteor, try some of the learning resources here:

I'd say the --full should probably link to some page in the Meteor Guide that describes all of the stuff it has created.

Loading

Scaffold an official project structure
Add --bare option to meteor create

Notice scaffold options on meteor create

add full skeleton

add spaces

remove shell-server package from skew-full + add description of new packages

Add --bare option to meteor create

Notice scaffold options on meteor create

add full skeleton

add spaces

remove shell-server package from skew-full + add description of new packages

improve PR

resolve conflict

Fix rebase

fix static-assets readme

Fix tipo

Remove insecure and auto publish packages

Remove useraccounts-configuration.js

add tests

fix PR
@mhidou mhidou force-pushed the skel-scaffold branch from 41ad068 to e34e236 Oct 8, 2016
@tmeasday
Copy link
Contributor

@tmeasday tmeasday commented Nov 1, 2016

Sorry about the slow response here, this looks great now @mhidou. I'm sure there's a lot of bike-shedding that could happen here (which is why I am still a little tempted to have it in a separate repo somehow where that could happen more quickly), but I think this will help people a lot.

Loading

@tmeasday tmeasday merged commit d26f3fe into meteor:devel Nov 8, 2016
3 checks passed
Loading
@tmeasday
Copy link
Contributor

@tmeasday tmeasday commented Nov 8, 2016

Thanks for this @mhidou! Merged!

Loading

@dburles
Copy link
Contributor

@dburles dburles commented Nov 9, 2016

Hmm, the code style could be improved. Should we adhere to the airbnb styleguide as recommended by the Meteor guide?

Loading

@tmeasday
Copy link
Contributor

@tmeasday tmeasday commented Nov 9, 2016

Oh, please, send PRs to improve it!

Loading

@theodorDiaconu
Copy link
Contributor

@theodorDiaconu theodorDiaconu commented Nov 10, 2016

I think this is outside Meteor. Sorry but this is opinionated. I could easily create an advanced scaffolding tool in bash. Without having to affect Meteor code. I would rather see Meteor point to those libraries than build this inside it.

If you use Redux + React + Meteor you'll have a different file structure. If you build a trully large app, then again, different structure, maybe: imports/api, imports/ui => imports/submodule/api, imports/submodule/ui.

If you're building an app with a micro-service architecture... You get the idea, you may need to do it old-school with different PACKAGE_DIRS

Depending on the UI layer, React/Blaze/Vue/Angular2 you'll have ofcourse a difference ui structure.

Loading

@mhidou
Copy link
Contributor Author

@mhidou mhidou commented Nov 10, 2016

@theodorDiaconu I think that the scaffolded app is for rookies, it will help them to start with meteor guide files structure (a kind of example app) of course if you are building a large app this scaffold can be useless.

A scaffolding tool like in rails will be awesome. It will helps a lot of users and saves tons of time (But should be in a separate repo).

#5283

Loading

@abernix
Copy link
Member

@abernix abernix commented Nov 10, 2016

This doesn't break the ability to do micro-service architecture and it's certainly not going to work for every app, but as @mhidou stated it is intended to match up relatively well with what the Meteor Guide suggests for an app structure.

I do think it would be nice to keep these outside of the Meteor core repository but in the spirit of the long-standing meteor create command, this does seem on par with what meteor-tool would be expected to do.

As the task of making these 'import-able' from another repo seems like a much larger task, and to keep this lean and see if it's even popular, it seems harmless to include these here for now. I do agree the code style should be improved as @dburles pointed out though.

Loading

@dburles
Copy link
Contributor

@dburles dburles commented Nov 11, 2016

Hey guys so just looking into working on the code style a little. Just wondering how are the scaffold package.json dependencies going to be kept up to date with the Meteor release? can it be automated?

Loading

@tmeasday
Copy link
Contributor

@tmeasday tmeasday commented Nov 11, 2016

The meteor-node-stubs package @dburles? It doesn't change much, I'm sure we can change all three apps when we update it..

Loading

@dburles
Copy link
Contributor

@dburles dburles commented Nov 11, 2016

Yep and babel-runtime I guess now too.

Loading

benjamn added a commit that referenced this issue Nov 11, 2016
benjamn added a commit that referenced this issue Nov 14, 2016
@abernix abernix mentioned this pull request Nov 16, 2016
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants