Code Monkey home page Code Monkey logo

cs-marketplace-app's Introduction

Contentstack Marketplace App Boilerplate

Provider

<MarketplaceAppProvider>

This provider is responsible for the following actions

  • Initialize the contentstack SDK
  • Make the SDK instance available via hooks to avoid props drilling
  • Set global properties for Analytics and Error tracking
  • Send "App Initialized / Failed" event

Hooks

  • useAppConfig
  • useAppLocation
  • useAppSdk
  • useCustomField
  • useEntry
  • useFrame
  • useHostUrl
  • useInstallationData
  • useSdkDataByPath

Routes

Each route represents one location. It is recommended to lazy load the route components to reduce the bundle size.

Adding new route

  • Create a new Route component inside route. Use default export
    • Inside App.tsx, lazy load the route component.
      • eg: const CustomFieldExtension = React.lazy(() => import("./routes/CustomField"))
    • Add the route wrapped inside Suspense.
      • Eg: <Route path="/new" element={<Suspense><CustomFieldExtension /></Suspense>} />

Testing

  • All e2e test files are stored in e2e folder

  • Create a .env file in the root directory & add environment variables as shown in .env.sample file.

  • Please refer the below commands to run e2e tests locally and setup the perquisites before running them.

  • Note: To run the below commands make sure the app is running in the background i.e on port http://localhost:3000

      "test:chrome": "npx playwright test --config=playwright.config.ts --project=Chromium",
      "test:firefox": "npx playwright test --config=playwright.config.ts --project=firefox",
      "test:chrome-headed": "npx playwright test --headed --config=playwright.config.ts --project=Chromium",
      "test:firefox-headed": "npx playwright test --headed --config=playwright.config.ts --project=firefox" 
    
  • Unit & integration tests are stored in src/__tests__ folder

  • run npm run test to run unit and integration tests

Styling

  • This setup uses basic CSS for styling

Reference to documentation

cs-marketplace-app's People

Watchers

Kaushik Shetty avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.