episerver / Foundation

Foundation offers a starting point that is intuitive, well-structured and modular allowing developers to explore CMS, Commerce, Personalization, Search and Navigation, Data Platform and Experimentation.
https://docs.developers.optimizely.com/digital-experience-platform/docs/optimizely-foundation-demo-sites
Apache License 2.0
132 stars 136 forks source link

Do not use Internal (or Deprecated) JS API's #187

Open seriema opened 4 years ago

seriema commented 4 years ago

Describe the bug Using internal API's isn't supported and can break the extensions in any upgrade (even patches).

To Reproduce Steps to reproduce the behavior:

  1. Go to the console
  2. Run npx @episerver/create-cms-api-report
  3. Observe the result table

Expected behavior The result table should be empty (0 violations).

Screenshots image

Additional context Each case needs to be considered individually but I only created this "master" issue here on Github.

Also consider using the analyzer tool as part of the build pipeline. See #186.

seriema commented 4 years ago

Running the tool produces this JSON file which shows where the violations are happening:

[
    {
        "location": "C:\\source\\Foundation\\src\\Foundation\\ClientResources\\Scripts\\ContentEditing\\CreateContent.js",
        "modules": [
            {
                "name": "epi-cms/contentediting/CreateContent",
                "category": "internal",
                "ruleId": "@episerver/cms/no-internal-episerver-apis",
                "line": 8,
                "column": 5
            },
            {
                "name": "epi/shell/widget/SearchBox",
                "category": "internal",
                "ruleId": "@episerver/cms/no-internal-episerver-apis",
                "line": 9,
                "column": 5
            }
        ]
    },
    {
        "location": "C:\\source\\Foundation\\src\\Foundation\\modules\\_protected\\VisualCompareMode\\ClientResources\\Scripts\\compareWithMarkupView.js",
        "modules": [
            {
                "name": "epi-cms/compare/views/SideBySideCompareView",
                "category": "internal",
                "ruleId": "@episerver/cms/no-internal-episerver-apis",
                "line": 6,
                "column": 5
            }
        ]
    },
    {
        "location": "C:\\source\\Foundation\\src\\Foundation\\modules\\_protected\\VisualCompareMode\\EpiServerOverridenLibs\\CustomCompareCommandProvider.js",
        "modules": [
            {
                "name": "epi-cms/component/command/_GlobalToolbarCommandProvider",
                "category": "internal",
                "ruleId": "@episerver/cms/no-internal-episerver-apis",
                "line": 3,
                "column": 5
            },
            {
                "name": "epi-cms/command/_NonEditViewCommandMixin",
                "category": "internal",
                "ruleId": "@episerver/cms/no-internal-episerver-apis",
                "line": 8,
                "column": 5
            }
        ]
    },
    {
        "location": "C:\\source\\Foundation\\src\\Foundation\\modules\\_protected\\VisualCompareMode\\EpiServerOverridenLibs\\customWidgetSwitcher.js",
        "modules": [
            {
                "name": "epi/shell/StickyViewSelector",
                "category": "internal",
                "ruleId": "@episerver/cms/no-internal-episerver-apis",
                "line": 8,
                "column": 5
            },
            {
                "name": "epi/shell/layout/AnimatedCardContainer",
                "category": "internal",
                "ruleId": "@episerver/cms/no-internal-episerver-apis",
                "line": 10,
                "column": 5
            }
        ]
    }
]

episerver-cms-api-usage.txt - renamed from .json to upload on github