NativeScript / nx

NativeScript for Nx.
Other
61 stars 15 forks source link

Update plugin for latest NX, refactor, implement prompts, shorthands #57

Open JakeAi opened 2 years ago

JakeAi commented 2 years ago

Updated plugin which fixes multiple issues that were presented with an NX update. Fixes #51

Implements shorthands. For example nx build nativescript-app android or nx run nativescript-app:build android nx build nativescript-app android -c=production or nx run nativescript-app:build:production android nx run nativescript-app android or nx run nativescript-app:run android

Implements warnings when proceeding without a specific platform (although defaults to iOS) Added a prompt to pick a platform.

Implements warnings when proceeding without a configuration. Added a prompt to pick a configuration.

Implements -s or --silent to skip prompts.

Split up {N} cli switch schema to become their own schemas which gets built when running npm run build

Project.json follows a more traditional angular-like project.json. For example

{
  "$schema": "..\\..\\node_modules\\nx\\schemas\\project-schema.json",
  "projectType": "application",
  "sourceRoot": "apps/nativescript-app/src",
  "prefix": "my-repo",
  "generators": {
    "@schematics/angular:component": {
      "styleext": "scss"
    }
  },
  "targets": {
    "build": {
      "executor": "@nativescript/nx:build",
      "options": {
        "noHmr": true,
        "uglify": true,
        "forDevice": true,
        "android": {
          "copyTo": "../../dist/apps/app.apk",
          "keyStorePath": "E:\\Android\\android.keystore",
          "keyStoreAlias": "app",
          "keyStorePassword": "pass",
          "keyStoreAliasPassword": "pass"
        },
        "ios": {
          "copyTo": "../../dist/apps/app.ipa"
        }
      },
      "configurations": {
        "production": {
          "production": true,
          "release": true,
          "android": {
            "keyStorePassword": "productionpw"
          },
          "fileReplacements": [
            {
              "replace": "./src/environments/environment.ts",
              "with": "./src/environments/environment.prod.ts"
            }
          ]
        }
      }
    },
    "prepare": {
      "executor": "@nativescript/nx:prepare",
      "options": {
        "noHmr": true,
        "production": true,
        "uglify": true,
        "release": true,
        "forDevice": true,
        "prepare": true
      }
    },
    "debug": {
      "executor": "@nativescript/nx:debug",
      "options": {
        "noHmr": true,
        "uglify": false,
        "release": false,
        "forDevice": true,
        "prepare": true
      }
    },
    "clean": {
      "executor": "@nativescript/nx:clean",
      "options": {}
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "options": {
        "lintFilePatterns": [
          "apps/nativescript-app/**/*.ts",
          "apps/nativescript-app/src/**/*.html"
        ]
      }
    },
    "test": {
      "executor": "@nativescript/nx:test",
      "outputs": [
        "coverage/apps/nativescript-app"
      ],
      "options": {
        "coverage": true
      },
      "configurations": {}
    }
  },
  "tags": []
}
NathanWalker commented 1 year ago

The plan is to release this alongside Nx 17 support (their next major version target - no date set yet) but we'll begin integrating this into everything to become the default with a migration to handle project.json adjustments.

NathanWalker commented 10 months ago

Nx 17 was released and we're working on the migration here to make this the standard going forward in these tools.