Creating new project with --minimal flag still creates everything
Description
When I try to create an api-only app using newly introduced --minimal flag, it still creates the full app.
Steps to Reproduce
amber new myapp --minimal
Expected behavior: An app that does not have any view + static asset to be created.
Actual behavior: Full app is created.
Reproduces how often: Can reproduce 100% of times.
Versions
Amber CLI (amberframework.org) - v0.35.0
Crystal 0.35.1 (2020-06-19)
LLVM: 10.0.0
Default target: x86_64-apple-macosx
Full logs:
2020-08-02T01:01:52.601280Z INFO - generate: Rendering App account in /Users/.../account
06:01:52 generate (Info) Rendering App account in /Users/.../account
2020-08-02T01:01:52.674574Z INFO - generate: new .amber.yml
06:01:52 generate (Info) new .amber.yml
2020-08-02T01:01:52.674865Z INFO - generate: new .encryption_key
06:01:52 generate (Info) new .encryption_key
2020-08-02T01:01:52.675106Z INFO - generate: new .gitignore
06:01:52 generate (Info) new .gitignore
2020-08-02T01:01:52.675342Z INFO - generate: new .travis.yml
06:01:52 generate (Info) new .travis.yml
2020-08-02T01:01:52.675546Z INFO - generate: new Dockerfile
06:01:52 generate (Info) new Dockerfile
2020-08-02T01:01:52.675742Z INFO - generate: new README.md
06:01:52 generate (Info) new README.md
2020-08-02T01:01:52.676037Z INFO - generate: new config/application.cr
06:01:52 generate (Info) new config/application.cr
2020-08-02T01:01:52.676315Z INFO - generate: new config/database.cr
06:01:52 generate (Info) new config/database.cr
2020-08-02T01:01:52.676546Z INFO - generate: new config/environments/development.yml
06:01:52 generate (Info) new config/environments/development.yml
2020-08-02T01:01:52.676751Z INFO - generate: new config/environments/production.yml
06:01:52 generate (Info) new config/environments/production.yml
2020-08-02T01:01:52.676944Z INFO - generate: new config/environments/test.yml
06:01:52 generate (Info) new config/environments/test.yml
2020-08-02T01:01:52.677214Z INFO - generate: new config/i18n.cr
06:01:52 generate (Info) new config/i18n.cr
2020-08-02T01:01:52.677484Z INFO - generate: new config/initializers/mailer.cr
06:01:52 generate (Info) new config/initializers/mailer.cr
2020-08-02T01:01:52.677745Z INFO - generate: new config/logger.cr
06:01:52 generate (Info) new config/logger.cr
2020-08-02T01:01:52.677997Z INFO - generate: new config/routes.cr
06:01:52 generate (Info) new config/routes.cr
2020-08-02T01:01:52.678333Z INFO - generate: new config/settings.cr
06:01:52 generate (Info) new config/settings.cr
2020-08-02T01:01:52.678495Z INFO - generate: new db/migrations/.gitkeep
06:01:52 generate (Info) new db/migrations/.gitkeep
2020-08-02T01:01:52.678734Z INFO - generate: new db/seeds.cr
06:01:52 generate (Info) new db/seeds.cr
2020-08-02T01:01:52.678968Z INFO - generate: new docker-compose.yml
06:01:52 generate (Info) new docker-compose.yml
2020-08-02T01:01:52.679207Z INFO - generate: new public/crossdomain.xml
06:01:52 generate (Info) new public/crossdomain.xml
2020-08-02T01:01:52.680069Z INFO - generate: new public/favicon.ico
06:01:52 generate (Info) new public/favicon.ico
2020-08-02T01:01:52.680337Z INFO - generate: new public/favicon.png
06:01:52 generate (Info) new public/favicon.png
2020-08-02T01:01:52.680565Z INFO - generate: new public/robots.txt
06:01:52 generate (Info) new public/robots.txt
2020-08-02T01:01:52.711349Z INFO - generate: new shard.yml
06:01:52 generate (Info) new shard.yml
2020-08-02T01:01:52.711599Z INFO - generate: new spec/spec_helper.cr
06:01:52 generate (Info) new spec/spec_helper.cr
2020-08-02T01:01:52.711807Z INFO - generate: new src/account.cr
06:01:52 generate (Info) new src/account.cr
2020-08-02T01:01:52.711983Z INFO - generate: new src/assets/fonts/.gitkeep
06:01:52 generate (Info) new src/assets/fonts/.gitkeep
2020-08-02T01:01:52.712219Z INFO - generate: new src/assets/images/.gitkeep
06:01:52 generate (Info) new src/assets/images/.gitkeep
2020-08-02T01:01:52.712521Z INFO - generate: new src/assets/images/logo.svg
06:01:52 generate (Info) new src/assets/images/logo.svg
2020-08-02T01:01:52.712867Z INFO - generate: new src/controllers/application_controller.cr
06:01:52 generate (Info) new src/controllers/application_controller.cr
2020-08-02T01:01:52.713372Z INFO - generate: new src/locales/en.yml
06:01:52 generate (Info) new src/locales/en.yml
2020-08-02T01:01:52.713745Z INFO - generate: new src/mailers/application_mailer.cr
06:01:52 generate (Info) new src/mailers/application_mailer.cr
2020-08-02T01:01:52.714106Z INFO - generate: new src/views/layouts/mailer.slang
06:01:52 generate (Info) new src/views/layouts/mailer.slang
2020-08-02T01:01:52.714165Z INFO - generate: Installing Dependencies
06:01:52 generate (Info) Installing Dependencies
Resolving dependencies
Fetching https://github.com/amberframework/amber.git
Fetching https://github.com/amberframework/granite.git
Fetching https://github.com/crystal-lang/json_mapping.cr.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/amberframework/quartz-mailer.git
Fetching https://github.com/arcage/crystal-email.git
Fetching https://github.com/crystal-lang/crystal-mysql.git
Fetching https://github.com/amberframework/micrate.git
Fetching https://github.com/amberframework/jasper-helpers.git
Fetching https://github.com/icyleaf/markd.git
Fetching https://github.com/crystal-lang/crystal-sqlite3.git
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/amberframework/citrine-i18n.git
Fetching https://github.com/veelenga/ameba.git
Fetching https://github.com/amberframework/amber-router.git
Fetching https://github.com/amberframework/cli.git
Fetching https://github.com/elorest/compiled_license.git
Fetching https://github.com/jeromegn/kilt.git
Fetching https://github.com/crystal-loot/exception_page.git
Fetching https://github.com/TechMagister/liquid.cr.git
Fetching https://github.com/amberframework/garnet-spec.git
Fetching https://github.com/stefanwille/crystal-redis.git
Fetching https://github.com/luckyframework/shell-table.cr.git
Fetching https://github.com/jeromegn/slang.git
Fetching https://github.com/phoffer/inflector.cr.git
Fetching https://github.com/mosop/teeplate.git
Fetching https://github.com/crystal-lang/yaml_mapping.cr.git
Fetching https://github.com/TechMagister/i18n.cr.git
Fetching https://github.com/amberframework/optarg.git
Fetching https://github.com/mosop/string_inflection.git
Fetching https://github.com/paulcsmith/selenium-webdriver-crystal.git
Fetching https://github.com/ysbaddaden/pool.git
Fetching https://github.com/crystal-community/future.cr.git
Fetching https://github.com/amberframework/callback.git
Shard "garnet_spec" version (0.1.1) doesn't match tag version (0.2.0)
Installing amber_router (0.3.0)
Installing callback (0.7.1)
Installing string_inflection (0.2.1)
Installing optarg (0.8.0)
Installing cli (0.9.3)
Installing compiled_license (0.1.3)
Installing kilt (0.6.0)
Installing inflector (0.1.8)
Installing json_mapping (0.1.0)
Installing liquid (0.3.3)
Installing db (0.9.0)
Installing micrate (0.8.0)
Installing pg (0.21.1)
Installing mysql (0.11.2)
Installing sqlite3 (0.16.0)
Installing pool (0.2.3)
Installing redis (2.6.0)
Installing shell-table (0.9.2 at 078a04e)
Installing slang (1.7.1)
Installing future (0.1.0)
Installing teeplate (0.10.1)
Installing exception_page (0.1.4)
Installing yaml_mapping (0.1.0)
Installing amber (0.35.0)
Installing granite (0.21.1)
Installing email (0.6.2)
Installing quartz_mailer (0.7.2)
Installing markd (0.2.0)
Installing jasper_helpers (0.2.5)
Installing i18n (0.3.1)
Installing citrine-i18n (0.4.0)
Installing selenium (0.3.0 at 427376b)
Installing garnet_spec (0.2.0)
Installing ameba (0.12.1)
Postinstall of ameba: make bin && make run_file
Writing shard.lock
I just took a look. It looks like --minimal invokes this:
def filter_for_minimal(entries)
return entries unless @minimal
filtered = entries.reject { |entry| entry.path.includes?(".js") || entry.path.includes?(".scss") || entry.path.includes?("package.json") ||
entry.path.includes?("config/webpack") || entry.path.includes?("home_controller") }
filtered.reject { |entry| entry.path.includes?("src/views") && !entry.path.includes?("mailer") }
end
In other words, it looks like minimal rejects the following files/extensions:
.js.scsspackage.jsonconfig/webpackhome_controllerviewsmailer
I just generated an app. It looks like the only thing making it through is views/layouts/mailer which makes sense as API's may still need mail functionality.
What functionality were you expecting that did not happen?
I know it's already too late and there are no updates in this issue, but I suppose folders/files likepublic/assets/i18n/views/layouts shouldn't be generated in a minimal project as per the OP reqs..
I just tried this on version Amber CLI (amberframework.org) - v1.4.1 and that flag has been removed. Considering it no longer exists, we can safely close this.
ubuntu:~$ amber new myapp --minimal
Parsing Error: The --minimal option is unknown.
/
amber new [OPTIONS] NAME
Generates a new Amber project
Arguments:
NAME name/path of project
Options:
-d Select the database database engine, can be one of: pg | mysql | sqlite
(default: pg)
--no-color Disable colored output
--no-deps Does not install dependencies, this avoids running shards update
-r Use a named recipe. See documentation at https://docs.amberframework.org/amber/cli/recipes.
-t Selects the template engine language, can be one of: slang | ecr
(default: slang)
-y, --assume-yes Assume yes to disable interactive mode
-h, --help show this help
We can close this bug as "Not Valid" given it is three years old and the feature is no longer supported.
@codered thank you!