SharePoint/sp-dev-docs

Command line switches for --skip-feature-deployment and --is-domain-isolated produce invalid results

eshupps opened this issue · 13 comments

The documentation states that the “—is-domain-isolated” value should be either “y” or “n” and that the “—skip-feature-deployment” value should be either “true” or “false”. Neither is correct. Both of these are switches, neither have actual values that should be supplied via the command line.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

For most cases, y/n and true/false for swithch is OK.

Thanks for the heads up @eshupps .

Update to this. The problem is primarily with the --is-domain-isolated option. It does accept "true" or "false" but not "y" or "no" as the online documentation indicates. The schema, however, still shows the option as invalid.

OK, I've pushed updates to the docs. You don't need to specify any options with the flag, just supply the flag itself.

Re-opening for a regression in v1.8.0.0. The command-line switches only produce the desired result if the user wants the boolean value of true to be inserted into the package-solution.json file. Omitting the flags causes the user to be prompted by the generator, which violates the silent execution objective of the command line switches. Any values passed as a parameter to either switch will be inserted into package-solution.json as a string value.

Take the following example:

yo @microsoft/sharepoint
  --solution-name "MySPFxProject1"
  --component-name "Test 1"
  --component-description "Test 1"
  --component-type "webpart"
  --framework "none"
  --skip-install
  --environment "spo"
  --package-manager "npm"
  --skip-feature-deployment
  --is-domain-isolated
  --skip-cache

This produces the correct package-solution.json:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "my-sp-fx-project-1-client-side-solution",
    "id": "734d14ab-507b-4664-83d1-c15ea7a4323b",
    "version": "1.0.0.0",
    "includeClientSideAssets": true,
    "skipFeatureDeployment": true,
    "isDomainIsolated": true
  },
  "paths": {
    "zippedPackage": "solution/my-sp-fx-project-1.sppkg"
  }
}

However, omitting either switche causes the generator to prompt for input, which it should not do. Instead, it should insert a false value into package-solution.json. If, as the documentation suggests, a string value of "false" is added as a parameter, this is not parsed to produce a boolean result but rather inserted as a string. Take the following example:

yo @microsoft/sharepoint 
  --solution-name "MySPFxProject1" 
  --component-name "Test 1" 
  --component-description "Test 1" 
  --component-type "webpart" 
  --framework "none" 
  --skip-install 
  --environment "spo" 
  --package-manager "npm" 
  --skip-feature-deployment false 
  --is-domain-isolated false 
  --skip-cache

This produces the following invalid result:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "my-sp-fx-project-1-client-side-solution",
    "id": "734d14ab-507b-4664-83d1-c15ea7a4323b",
    "version": "1.0.0.0",
    "includeClientSideAssets": true,
    "skipFeatureDeployment": "false",
    "isDomainIsolated": "false"
  },
  "paths": {
    "zippedPackage": "solution/my-sp-fx-project-1.sppkg"
  }
}

The same is true of any string value, such as "false", "n", n, no, $false, or anything else - the value is simply converted to a string and the project fails to build.

@eshupps tweaked the issue you submitted for readability... I added line breaks to the yo commands just for readability

As referenced above, generating a SharePoint solution via SPFx project template on VS2019 community edition resulted in a project with faulty config file (package-solution.json) "Expected type boolean but found type string", manually changing both skipFeatureDeployment and isDomainIsolated entries to false instead of "false" fixed it.

This is still an issue with SPFx 1.9.1

Still exists in SPFx 1.10.0

April 13, 2020, this is still an issue. Don't understand why it can't be fixed

1.13 is now out.

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues