nxtend-team / nxtend

MIT License
190 stars 42 forks source link

Running migration update-workspace-json-11.0.0 Cannot create property 'cmd' on string 'android' #388

Closed montella1507 closed 3 years ago

montella1507 commented 3 years ago

Callstack:

C:\GIT\Cue\frontends\node_modules\yargs\build\lib\yargs.js:1132
                throw err;
                ^

Error: Command failed: npx tao migrate --run-migrations=migrations.json
    at checkExecSyncError (child_process.js:630:11)
    at Object.execSync (child_process.js:666:15)
    at Object.handler (C:\GIT\Cue\frontends\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:76:21)
    at Object.runCommand (C:\GIT\Cue\frontends\node_modules\yargs\build\lib\command.js:196:48)
    at Object.parseArgs [as _parseArgs] (C:\GIT\Cue\frontends\node_modules\yargs\build\lib\yargs.js:1043:55)
    at Object.get [as argv] (C:\GIT\Cue\frontends\node_modules\yargs\build\lib\yargs.js:986:25)
    at Object.initLocal (C:\GIT\Cue\frontends\node_modules\@nrwl\cli\lib\init-local.js:23:13)
    at Object.<anonymous> (C:\GIT\Cue\frontends\node_modules\@nrwl\cli\bin\nx.js:41:18)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 34292,
  stdout: null,
  stderr: null
}

migrations.json

{
  "migrations": [
    {
      "version": "11.0.0-beta.1",
      "description": "Update @nxtend/capacitor workspace config",
      "factory": "./src/migrations/update-11-0-0/update-workspace-json-11-0-0",
      "package": "@nxtend/capacitor",
      "name": "update-workspace-json-11.0.0"
    },
    {
      "version": "11.0.0-beta.1",
      "description": "Update libraries",
      "factory": "./src/migrations/update-11-0-0/update-11-0-0",
      "package": "@nxtend/capacitor",
      "name": "update-11.0.0"
    }
  ]
}

Workplace:

{
  "version": 2,
  "projects": {
    "assist-mobile": {
      "projectType": "application",
      "root": "apps/assist-mobile",
      "sourceRoot": "apps/assist-mobile/src",
      "prefix": "cue",
      "targets": {
        "build": {
          "executor": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/apps/assist-mobile",
            "index": "apps/assist-mobile/src/index.html",
            "main": "apps/assist-mobile/src/main.ts",
            "polyfills": "apps/assist-mobile/src/polyfills.ts",
            "tsConfig": "apps/assist-mobile/tsconfig.app.json",
            "aot": true,
            "assets": [
              "apps/assist-mobile/src/assets",
              {
                "glob": "**/*.svg",
                "input": "node_modules/ionicons/dist/ionicons/svg",
                "output": "./svg"
              }
            ],
            "styles": [
              "apps/assist-mobile/src/styles.scss",
              {
                "input": "apps\\assist-mobile/src/theme/variables.scss"
              }
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "apps/assist-mobile/src/environments/environment.ts",
                  "with": "apps/assist-mobile/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "executor": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "assist-mobile:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "assist-mobile:build:production"
            }
          }
        },
        "extract-i18n": {
          "executor": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "assist-mobile:build"
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/assist-mobile/tsconfig.app.json",
              "apps/assist-mobile/tsconfig.spec.json",
              "apps/assist-mobile/tsconfig.editor.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/assist-mobile/**/*"
            ]
          }
        },
        "test": {
          "executor": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "apps/assist-mobile/src/test.ts",
            "tsConfig": "apps/assist-mobile/tsconfig.spec.json",
            "karmaConfig": "apps/assist-mobile/karma.conf.js",
            "polyfills": "apps/assist-mobile/src/polyfills.ts",
            "styles": [],
            "scripts": [],
            "assets": []
          }
        },
        "add": {
          "executor": "@nxtend/capacitor:command",
          "options": {
            "command": "add",
            "platform": ""
          },
          "configurations": {
            "ios": {
              "platform": "ios"
            },
            "android": {
              "platform": "android"
            }
          }
        },
        "copy": {
          "executor": "@nxtend/capacitor:command",
          "options": {
            "command": "copy",
            "platform": ""
          },
          "configurations": {
            "platform": "android",
            "ios": {
              "platform": "ios"
            },
            "android": {
              "platform": "android"
            }
          }
        },
        "open": {
          "executor": "@nxtend/capacitor:command",
          "options": {
            "command": "open",
            "platform": ""
          },
          "configurations": {
            "platform": "android",
            "ios": {
              "platform": "ios"
            },
            "android": {
              "platform": "android"
            }
          }
        },
        "sync": {
          "executor": "@nxtend/capacitor:command",
          "options": {
            "command": "sync",
            "platform": ""
          },
          "configurations": {
            "platform": "android",
            "ios": {
              "platform": "ios"
            },
            "android": {
              "platform": "android"
            }
          }
        },
        "update": {
          "executor": "@nxtend/capacitor:command",
          "options": {
            "command": "update",
            "platform": ""
          },
          "configurations": {
            "platform": "android",
            "ios": {
              "platform": "ios"
            },
            "android": {
              "platform": "android"
            }
          }
        }
      }
    },
    "assist-mobile-e2e": {
      "root": "apps/assist-mobile-e2e",
      "sourceRoot": "apps/assist-mobile-e2e/src",
      "projectType": "application",
      "targets": {
        "e2e": {
          "executor": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/assist-mobile-e2e/cypress.json",
            "tsConfig": "apps/assist-mobile-e2e/tsconfig.e2e.json",
            "devServerTarget": "assist-mobile:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "assist-mobile:serve:production"
            }
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/assist-mobile-e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/assist-mobile-e2e/**/*"
            ]
          }
        }
      }
    },
    "assist-desktop": {
      "projectType": "application",
      "root": "apps/assist-desktop",
      "sourceRoot": "apps/assist-desktop/src",
      "prefix": "cue",
      "targets": {
        "build": {
          "executor": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/apps/assist-desktop",
            "index": "apps/assist-desktop/src/index.html",
            "main": "apps/assist-desktop/src/main.ts",
            "polyfills": "apps/assist-desktop/src/polyfills.ts",
            "tsConfig": "apps/assist-desktop/tsconfig.app.json",
            "aot": true,
            "assets": [
              "apps/assist-desktop/src/favicon.ico",
              "apps/assist-desktop/src/assets"
            ],
            "styles": [
              "apps/assist-desktop/src/styles.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "apps/assist-desktop/src/environments/environment.ts",
                  "with": "apps/assist-desktop/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "executor": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "assist-desktop:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "assist-desktop:build:production"
            }
          }
        },
        "extract-i18n": {
          "executor": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "assist-desktop:build"
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/assist-desktop/tsconfig.app.json",
              "apps/assist-desktop/tsconfig.spec.json",
              "apps/assist-desktop/tsconfig.editor.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/assist-desktop/**/*"
            ]
          }
        },
        "test": {
          "executor": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "apps/assist-desktop/src/test.ts",
            "tsConfig": "apps/assist-desktop/tsconfig.spec.json",
            "karmaConfig": "apps/assist-desktop/karma.conf.js",
            "polyfills": "apps/assist-desktop/src/polyfills.ts",
            "styles": [],
            "scripts": [],
            "assets": []
          }
        }
      }
    },
    "assist-desktop-e2e": {
      "root": "apps/assist-desktop-e2e",
      "sourceRoot": "apps/assist-desktop-e2e/src",
      "projectType": "application",
      "targets": {
        "e2e": {
          "executor": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/assist-desktop-e2e/cypress.json",
            "tsConfig": "apps/assist-desktop-e2e/tsconfig.e2e.json",
            "devServerTarget": "assist-desktop:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "assist-desktop:serve:production"
            }
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/assist-desktop-e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/assist-desktop-e2e/**/*"
            ]
          }
        }
      }
    },
    "admin": {
      "projectType": "application",
      "root": "apps/admin",
      "sourceRoot": "apps/admin/src",
      "prefix": "cue",
      "targets": {
        "build": {
          "executor": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/apps/admin",
            "index": "apps/admin/src/index.html",
            "main": "apps/admin/src/main.ts",
            "polyfills": "apps/admin/src/polyfills.ts",
            "tsConfig": "apps/admin/tsconfig.app.json",
            "aot": true,
            "assets": [
              "apps/admin/src/favicon.ico",
              "apps/admin/src/assets"
            ],
            "styles": [
              "apps/admin/src/styles.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "apps/admin/src/environments/environment.ts",
                  "with": "apps/admin/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "executor": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "admin:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "admin:build:production"
            }
          }
        },
        "extract-i18n": {
          "executor": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "admin:build"
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/admin/tsconfig.app.json",
              "apps/admin/tsconfig.spec.json",
              "apps/admin/tsconfig.editor.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/admin/**/*"
            ]
          }
        },
        "test": {
          "executor": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "apps/admin/src/test.ts",
            "tsConfig": "apps/admin/tsconfig.spec.json",
            "karmaConfig": "apps/admin/karma.conf.js",
            "polyfills": "apps/admin/src/polyfills.ts",
            "styles": [],
            "scripts": [],
            "assets": []
          }
        }
      }
    },
    "admin-e2e": {
      "root": "apps/admin-e2e",
      "sourceRoot": "apps/admin-e2e/src",
      "projectType": "application",
      "targets": {
        "e2e": {
          "executor": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/admin-e2e/cypress.json",
            "tsConfig": "apps/admin-e2e/tsconfig.e2e.json",
            "devServerTarget": "admin:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "admin:serve:production"
            }
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/admin-e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/admin-e2e/**/*"
            ]
          }
        }
      }
    },
    "assist-outlook": {
      "projectType": "application",
      "root": "apps/assist-outlook",
      "sourceRoot": "apps/assist-outlook/src",
      "prefix": "touchone",
      "targets": {
        "build": {
          "executor": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/apps/assist-outlook",
            "index": "apps/assist-outlook/src/index.html",
            "main": "apps/assist-outlook/src/main.ts",
            "polyfills": "apps/assist-outlook/src/polyfills.ts",
            "tsConfig": "apps/assist-outlook/tsconfig.app.json",
            "aot": true,
            "assets": [
              "apps/assist-outlook/src/favicon.ico",
              "apps/assist-outlook/src/assets",
              "apps/assist-outlook/src/manifest.xml"
            ],
            "styles": [
              "apps/assist-outlook/src/styles.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "apps/assist-outlook/src/environments/environment.ts",
                  "with": "apps/assist-outlook/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "executor": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "assist-outlook:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "assist-outlook:build:production"
            }
          }
        },
        "extract-i18n": {
          "executor": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "assist-outlook:build"
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/assist-outlook/tsconfig.app.json",
              "apps/assist-outlook/tsconfig.spec.json",
              "apps/assist-outlook/tsconfig.editor.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/assist-outlook/**/*"
            ]
          }
        },
        "test": {
          "executor": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "apps/assist-outlook/src/test.ts",
            "tsConfig": "apps/assist-outlook/tsconfig.spec.json",
            "karmaConfig": "apps/assist-outlook/karma.conf.js",
            "polyfills": "apps/assist-outlook/src/polyfills.ts",
            "styles": [],
            "scripts": [],
            "assets": []
          }
        }
      }
    },
    "assist-outlook-e2e": {
      "root": "apps/assist-outlook-e2e",
      "sourceRoot": "apps/assist-outlook-e2e/src",
      "projectType": "application",
      "targets": {
        "e2e": {
          "executor": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/assist-outlook-e2e/cypress.json",
            "tsConfig": "apps/assist-outlook-e2e/tsconfig.e2e.json",
            "devServerTarget": "assist-outlook:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "assist-outlook:serve:production"
            }
          }
        },
        "lint": {
          "executor": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/assist-outlook-e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!apps/assist-outlook-e2e/**/*"
            ]
          }
        }
      }
    }
  },
  "cli": {
    "defaultCollection": "@nxtend/ionic-angular"
  },
  "generators": {
    "@nrwl/angular:application": {
      "unitTestRunner": "karma",
      "e2eTestRunner": "cypress"
    },
    "@nrwl/angular:library": {
      "unitTestRunner": "karma"
    },
    "@nrwl/angular:component": {
      "style": "scss",
      "inlineTemplate": false,
      "inlinceStyle": false,
      "changeDetection": "OnPush"
    }
  },
  "defaultProject": "assist-mobile"
}
montella1507 commented 3 years ago

I think the problem is with part:

    "configurations": {
            "platform": "android",

i can imagine you patching every property in configurations:

  "configurations": {
            "platform": "android",
            "ios": {
              "platform": "ios"
            },
            "android": {
              "platform": "android"
            }
          }

and trying to add "cmd":

When i remove platform: "android" it works as expected.

devinshoemaker commented 3 years ago

Hi, thanks for the issue! I apologize for the inconvenience and have reproduced this. I should be able to push out a patch release to fix this migration today.

devinshoemaker commented 3 years ago

The fix for this has been released with @nxtend/capacitor 11.0.1.

montella1507 commented 3 years ago

Thanks, i dont think it is correct that you apologized for any sort of problems... you have invested lot of time to help us. So big thanks from all of us.

devinshoemaker commented 3 years ago

I appreciate it! Feel free to create more issues or create a discussion if you have any questions.