open-index/open-npm huggingface dataset:
npm package: @onlishop/app-server-sdk
Description: App Server SDK for JavaScript
Latest version: 1.1.30

# Shopware App Server SDK in TypeScript

This SDK is written in pure Typescript with portability in mind being able to use it on Node (20+), Deno, Cloudflare Worker or other runtimes.

## Features

- Provides registration process for app
- Verify and signing of requests / responses
- preconfigured API Client
- Complete Registration Handshake between Shopware and this

## How to use it?

```bash
npm install @shopware-ag/app-server-sdk --save
```

## Example

<details>
  <summary>Bun Plain</summary>

```typescript
import { AppServer, InMemoryShopRepository } from '@shopware-ag/app-server-sdk'
import { createNotificationResponse } from '@shopware-ag/app-server-sdk/helper/app-actions'

const app = new AppServer({
    appName: 'MyApp',
    appSecret: 'my-secret',
    authorizeCallbackUrl: 'http://localhost:3000/authorize/callback',
}, new InMemoryShopRepository());

const server = Bun.serve({
    port: 3000,
    async fetch(request) {
        const { pathname } = new URL(request.url);
        if (pathname === '/authorize') {
            return app.registration.authorize(request);
        } else if (pathname === '/authorize/callback') {
            return app.registration.authorizeCallback(request);
        } else if (pathname === '/app/product') {
            const context = await app.contextResolver.fromAPI(request);

            // do something with payload, and http client

            const notification = createNotificationResponse('success', 'Product created');

            // sign the response, with the shop secret
            await app.signer.signResponse(notification, context.shop.getShopSecret());

            return resp;
        }

        return new Response('Not found', { status: 404 });
    },
});

console.log(`Listening on localhost:${server.port}`);
```

</details>

Checkout the [examples](./examples) folder for more examples using:

- [Cloudflare Worker with Hono](./examples/cloudflare-hono)
- [Deno with Hono](./examples/deno-hono)
- [Node with Hono](./examples/node-hono)

or use clone them as a starting point for your own project.

```bash
# Node.js
npx tiged shopware/app-sdk-js/examples/node-hono demo-app

# Bun
npx tiged shopware/app-sdk-js/examples/bun-hono demo-app

# Deno
npx tiged shopware/app-sdk-js/examples/deno-hono demo-app

# Cloudflare Worker
npx tiged shopware/app-sdk-js/examples/cloudflare-hono demo-app
```

and then `cd demo-app` and `npm install` to install the dependencies.
npm package: @onlishop/eslint-config-base
Description: Common webpack configuration for several Onlishop related projects
Author: klarstil
Latest version: 2.0.0

# eslint-config-base

This repository provides a **shared ESLint configuration** for various Onlishop-related projects, ensuring a consistent code style and quality across Onlishop's JavaScript codebases.

## Features

- Shared, standardized ESLint rules for Onlishop projects
- Easy integration into new and existing JavaScript projects
- Promotes consistent code quality and style aligned with Onlishop conventions

## Installation

Install the package via npm:

```
npm install --save-dev @onlishop/eslint-config-base
```

## Usage

After installing, extend the configuration in your project's ESLint config file (e.g., `.eslintrc.js`, `.eslintrc.json`, or `eslint.config.js`):

**.eslintrc.js:**

```
module.exports = {
extends: ['@onlishop/eslint-config-base']
};
```

Refer to [ESLint documentation](https://eslint.org/docs/latest/use/configure/configuration-files) for details on configuration file formats and advanced setup.
npm package: @onlishop/jest-preset-sw6-admin
Description: Jest Test preset for Onlishop 6 administration unit tests
Latest version: 6.0.3

# Jest Test preset for Onlishop 6 administration unit tests

Default [Jest](https://jestjs.io/) preset for Onlishop 6 administration development.

```bash
npm install jest @onlishop/jest-preset-sw6-admin @babel/preset-env @babel/plugin-proposal-class-properties --save-dev
```

## Setup

After installaing the necessary required packages, please create a file called `babel.config.json` right next to your own `package.json` with the following content:

```json
{
    "presets": ["@babel/preset-env"],
    "plugins": ["@babel/plugin-proposal-class-properties"]
}
```

### Via `jest.config.js`

Next up, create a file `jest.config.js` which should contain the following content:

```js
module.exports = {
    preset: '@onlishop/jest-preset-sw6-admin',
    globals: {
        adminPath: '<file-path-to-sw6-administration>', // required, e.g. /www/sw6/platform/src/Administration/Resources/app/administration
    }
}
```

## Options the preset sets up for you

* `collectCoverage` - Code coverage will be generated using the reporters listed under `coverageReporters`
* `coverageReporters` - The presets uses `lcov`, `text` & `clover` as coverage reporters
* `watchPathIgnorePatterns` - Ignores the `node_modules` folder for the watch mode of Jest
* `clearMocks` - Automatically clear mock calls and instances before every test. 
* `moduleFileExtensions` - File with the extension `js` will automatically used as extensions your module use.
* `moduleNameMapper` - All `css`, `less` & `scss` files will be mocked and relative paths to `src` are getting mapped to the correct src directory
* `transform` - Transforms `js` files using [babel-jest](https://www.npmjs.com/package/babel-jest) and `twig` files are transformed using a custom twig transformer which we use in the administration as well
* `modulePathIgnorePatterns` - Ignores e2e test specs by default
* `setupFilesAfterEnv` - Provides a polyfill for Webpack' `require.context` and sets up the global Onlishop third-party interface for every test. The object can be accessed using `global.Onlishop` in test files.
* `testMatch` - Matches all files containing `.spec.js` in the test directory