Skip to content

"project.app" key hard-coded during Cordova engine addition/removal #3106

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

Closed
ionitron-bot bot opened this issue Apr 25, 2018 · 6 comments
Closed

"project.app" key hard-coded during Cordova engine addition/removal #3106

ionitron-bot bot opened this issue Apr 25, 2018 · 6 comments

Comments

@ionitron-bot
Copy link

ionitron-bot bot commented Apr 25, 2018

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ ] 3.x
[x] 4.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request

Current behavior:

When running ionic cordova run browser the error projects.app key in angular.json is undefined--cannot add assets. is thrown.
Expected behavior:

Ionic CLI should be able to run ionic cordova run browser if there is only one project in the angular.json projects list without it being named 'app'. If the Ionic CLI cannot support a multiple app configuration, allow a default app to be specified in the Ionic config or take the first available project if only one is specified. If more than one is available, i would expect an error to be thrown and a message given saying that a entry app needs to be specified in the Ionic config.

I should not have to rename my app to 'app' in order to run the ionic CLI serve command.

Steps to reproduce:

Take an ionic 3 project and add a .angular-cli.json file to it. Use ng upgrade to upgrade the schema so that it now is compliant with angular.json schema. Use the Ionic v4 CLI to try and run the app.

{
  "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "my-app": {
      "root": "",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/app/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "/assets"
              }
            ],
            "styles": [],
            "scripts": []
          },
          "configurations": {}
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "my-app:build"
          },
          "configurations": {}
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "my-app:build"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [],
            "exclude": []
          }
        }
      }
    },
    "my-app-e2e": {
      "root": "",
      "projectType": "application",
      "cli": {},
      "schematics": {}
    }
  },
  "cli": {}
}

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):


   @ionic/cli-utils  : 2.0.0-rc.5
   ionic (Ionic CLI) : 4.0.0-rc.5

global packages:

   cordova (Cordova CLI) : 8.0.0

local packages:

   @angular-devkit/core       : 0.5.7
   @angular-devkit/schematics : 0.5.7
   @angular/cli               : 6.0.0-rc.5
   @ionic/schematics-angular  : 1.0.0-rc.5
   Cordova Platforms          : browser 5.0.3
   Ionic Framework            : @ionic/angular 4.0.0-alpha.2

System:

   NodeJS : v8.11.1
   npm    : 5.6.0
   OS     : Windows 10

Environment Variables:

   ANDROID_HOME : not set
@imhoffd
Copy link
Contributor

imhoffd commented Apr 26, 2018

@cwoolum Agreed. You've encountered an issue with the gross hack that's in place between v4 and Cordova. There are a few other known issues. As a reminder, the v4 stuff is all opt-in and experimental, even though the CLI itself is in RC.

Thanks for the issue! I'll update this when it's improved.

As an aside, support for the Cordova browser platform in general isn't the best right now. Please see #2312 (comment) and #3043

@imhoffd imhoffd changed the title Error running migrated app in V4 "project.app" key hard-coded during Cordova engine addition/removal Apr 26, 2018
@cwoolum
Copy link

cwoolum commented Apr 26, 2018

This isn't actually a browser platform specific. This also occurs during Android. The main issue is that the CLI is looking for a project named "app" in the angular CLI config.

@imhoffd
Copy link
Contributor

imhoffd commented Apr 26, 2018

yep, it's the same behavior with any cordova run/emulate

@stupidawesome
Copy link
Contributor

stupidawesome commented May 9, 2018

It's possible to pass options to ionic serve to select a target project.

ionic serve -- --project <name-of-app>

This doesn't work for builds unfortunately. I'm currently setting up multiple ionic apps with a shared code base so I'm looking forward to see where this goes.

@imhoffd
Copy link
Contributor

imhoffd commented May 9, 2018

@stupidawesome This is an issue with Cordova commands, not ionic serve. You're looking for this issue 👉 #3087

@imhoffd
Copy link
Contributor

imhoffd commented Jun 2, 2018

Tracked by #3103

Already fixed in master 😄

@imhoffd imhoffd closed this as completed Jun 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants