Drop-ins SDK
CLI usage
To see all the available CLI commands in the terminal, use the --help flag:
npx elsie --helpgql
The gql command can generate types and mocks for your GraphQL API. Files will
be generated in <domain package root>/src/__generated__/.
To use it, you must first configure your .elsie.js with the necessary values:
// For Adobe Commerce Catalog Serviceschema: { endpoint: "https://catalog-service-sandbox.adobe.io/graphql", headers: { "MAGENTO-ENVIRONMENT-ID": "..." "MAGENTO-STORE-VIEW-CODE": "..." "MAGENTO-WEBSITE-CODE": "..." "MAGENTO-STORE-CODE": "..." "MAGENTO-CUSTOMER-GROUP": "..." "API-KEY": "..." }}// For Adobe Mesh APIschema: { endpoint: "https://graph.adobe.io/api/.../graphql?api_key=...", headers: { "some-mesh-specific-header": "mesh-header-value" }}// For Adobe Commerce (non-Mesh)schema: { endpoint: "https://commerce-backend-url.test.graphql", headers: {}}Then the following commands will generate to
npx elsie gql typesnpx elsie gql mocksgenerate
Summary list of commands for quick copy/paste.
npx elsie generate config --name <Domain>npx elsie generate component --pathname <MyUIComponent>npx elsie generate container --pathname <MyContainer>npx elsie generate api --pathname <myApiFunction>Add Config
Generate a new .elsie.js configuration file for the project.
npx elsie generate config --name <Domain>module.exports = { name: '<Domain>', api: { root: './src/api', importAliasRoot: '@/<Domain>/api', }, components: [ { id: 'Components', root: './src/components', importAliasRoot: '@/<Domain>/components', cssPrefix: 'elsie', default: true, }, ], containers: { root: './src/containers', importAliasRoot: '@/<Domain>/containers', }, schema: { endpoint: process.env.ENDPOINT, // Add necessary headers headers: {}, },};Add Component
Generate a new UI Component for the project.
npx elsie generate component --pathname <MyUIComponent>๐ src/components/LoginForm/LoginForm.css created๐ src/components/LoginForm/LoginForm.stories.tsx created๐ src/components/LoginForm/LoginForm.test.tsx created๐ src/components/LoginForm/LoginForm.tsx created๐ src/components/LoginForm/index.ts createdโ๏ธ src/components/index.ts updatedAdd Container
Generate a new Frontend Container for the project.
npx elsie generate container --pathname <MyContainer>๐ src/containers/Login/Login.stories.tsx created๐ src/containers/Login/Login.test.tsx created๐ src/containers/Login/Login.tsx created๐ src/containers/Login/index.ts createdโ๏ธ src/containers/index.ts updatedAdd Function
Generate a new API function for the project.
npx elsie generate api --pathname <myApiFunction>๐ src/api/login/login.mdx created๐ src/api/login/login.test.ts created๐ src/api/login/login.ts created๐ src/api/login/index.ts createdโ๏ธ src/api/index.ts updated