open-index/open-npm huggingface dataset:
npm package: @khesse-project/express-maker-cli
Description: This package is a tool to generate an Express.js server with in few steps. I'm inspired by some others tools such as :  - [sequelize-cli](https://www.npmjs.com/package/sequelize-cli), more information here  - `symfony/maker-bundle`, a symfony package whic
Author: Kevin HESSE
Latest version: 1.1.0

# Express maker CLI

This package is a tool to generate an Express.js server with in few steps. I'm inspired by some others tools such as : 
- [sequelize-cli](https://www.npmjs.com/package/sequelize-cli), more information here 
- `symfony/maker-bundle`, a symfony package which generate some file.

This project is born of my need to generate a bunch of Express.js application during my training course. 

## FeedBack

Don't hesitate to give feedback [here](https://github.com/Kevin-HESSE/express-maker-cli/issues). 

Try to explain how the problem occurs. It can be helpful to resolve.

## How to use

Run this command inside the project folder where you need to install express :

```bash 
npx @khesse-project/express-maker-cli init
```

You need to answer several questions :
- Do you want to use Typescript ?
- Do you need a view engine ? 
- Do you use the application as an APIRest ?
- Which default port do you want to use ?
- Which package manager do you want to use?
- Do you intend to use a test library?

After that, all files and folders will be created based on your answers. 

### Dependencies

:warning: No dependencies will be installed ! :warning:. You have to do it manually.

The list of dependencies to install is shown after the CLI execution with the selected package manager.

If typescript and test options are selected, the program prompt you a link how configure jest with typescript.

### Templates options

You can use the -t, for template, option with an argument to skip all questions. There is only two templates available, api-js and api-ts.

```bash 
npx @khesse-project/express-maker-cli init -t api-js
```

- **api-js** is equal to :

| Question                                   | Answer      |
|--------------------------------------------|-------------|
| Do you want to use Typescript ?            | ```False``` |
| Do you need a view engine ?                | ```False``` |
| Do you use the application as an APIRest ? | ```True```  |
| Which default port do you want to use ?    | ```3000```  |
| Which package manager do you want to use?  | ```npm```   |
| Do you intend to use a test library?       | ```True```  |


```bash 
npx @khesse-project/express-maker-cli init -t api-ts
```

- **api-ts** is equal to :

| Question                                   | Answer      |
|--------------------------------------------|-------------|
| Do you want to use Typescript ?            | ```True```  |
| Do you need a view engine ?                | ```False``` |
| Do you use the application as an APIRest ? | ```True```  |
| Which default port do you want to use ?    | ```3000```  |
| Which package manager do you want to use?  | ```npm```   |
| Do you intend to use a test library?       | ```True```  |
npm package: @kheuser79/vision-camera-code-scanner
Description: VisionCamera Frame Processor Plugin to read barcodes using MLKit Vision Barcode Scanning
Author: Rodrigo gomes
Latest version: 0.2.0

## Forked from [https://github.com/jorgebrunetto/vision-camera-code-scanner](https://github.com/jorgebrunetto/vision-camera-code-scanner)

# vision-camera-code-scanner

VisionCamera Frame Processor Plugin to read barcodes using MLKit Vision Barcode Scanning

## Installation

```sh
yarn add vision-camera-code-scanner
```

make sure you correctly [setup](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/) react-native-reanimated and insert as a first line of your [`index.tsx`](https://github.com/rodgomesc/vision-camera-code-scanner/blob/1409a8afd02328a26e336036493b2d6ef8441359/example/index.tsx#L1)

```sh
import 'react-native-reanimated'
```

Add this to your `babel.config.js`

```
[
  'react-native-reanimated/plugin',
  {
    globals: ['__scanCodes'],
  },
]
```

## Usage

Simply call the `useScanBarcodes()` hook or call `scanBarcodes()` inside of the `useFrameProcessor()` hook. In both cases you will need to pass an array of `BarcodeFormat` to specify the kind of barcode you want to detect.

> Note: The underlying MLKit barcode reader is only created once meaning that changes to the array will not be reflected in the app.

```js
import * as React from 'react';

import { StyleSheet, Text } from 'react-native';
import { useCameraDevices } from 'react-native-vision-camera';
import { Camera } from 'react-native-vision-camera';
import { useScanBarcodes, BarcodeFormat } from 'vision-camera-code-scanner';

export default function App() {
  const [hasPermission, setHasPermission] = React.useState(false);
  const devices = useCameraDevices();
  const device = devices.back;

  const [frameProcessor, barcodes] = useScanBarcodes([BarcodeFormat.QR_CODE], {
    checkInverted: true,
  });

  // Alternatively you can use the underlying function:
  //
  // const frameProcessor = useFrameProcessor((frame) => {
  //   'worklet';
  //   const detectedBarcodes = scanBarcodes(frame, [BarcodeFormat.QR_CODE], { checkInverted: true });
  //   runOnJS(setBarcodes)(detectedBarcodes);
  // }, []);

  React.useEffect(() => {
    (async () => {
      const status = await Camera.requestCameraPermission();
      setHasPermission(status === 'authorized');
    })();
  }, []);

  return (
    device != null &&
    hasPermission && (
      <>
        <Camera
          style={StyleSheet.absoluteFill}
          device={device}
          isActive={true}
          frameProcessor={frameProcessor}
          frameProcessorFps={5}
        />
        {barcodes.map((barcode, idx) => (
          <Text key={idx} style={styles.barcodeTextURL}>
            {barcode.displayValue}
          </Text>
        ))}
      </>
    )
  );
}

const styles = StyleSheet.create({
  barcodeTextURL: {
    fontSize: 20,
    color: 'white',
    fontWeight: 'bold',
  },
});
```

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT
npm package: @khgame/conv
Description: token conversion based game framework
Author: kinghand
Latest version: 0.0.1-beta.1

# tconv

token conversion based game framework

# Usage

```js
const TConv = require('tconv')
const userStore = require('../userStore') // for example

let conv = new TConv()
conv.use(async (ctx, next) => {
  console.log('event', ctx.params.event, ctx.params.nonce)
  await next()
  console.log('asset operations', JSON.stringify(ctx))
  for (let i in ctx.t.in) {
    let { uid, tid, num } = ctx.t.in[i]
    ctx.assert(num && num > 0, 'token-in error, invalid num')
    await userStore.incToken(uid, { tid, num: -num })
  }
  for (let i in ctx.t.out) {
    let { uid, tid, num } = ctx.t.out[i]
    ctx.assert(num && num > 0, 'token-out error, invalid num')
    await userStore.incToken(uid, { tid, num: num })
  }
})

conv.init()
conv.apply({ event: 'gather', uid: '0000001' })
```
npm package: @khgame/decorator-koa-router
Description: decorator of koa router
Author: kinghand
Latest version: 0.1.3

# decorator-koa-router.ts

decorator of koa route

## Usage

### install

`npm i --save @khgame/decorator-koa-router`     
or  
`yarn add @khgame/decorator-koa-router`

### in code

> To use this lib with typescripts, option experimentalDecorators should be enabled in the tsconfig.json

1. import methods api, controller and constant HttpMethod
```js
import { api, controller, HttpMethod } from "@khgame/decorator-koa-router"
```
2. decorate `@controller` for your controller class and `@api` for your method
```js
@controller("user")
export class userController {
    @api(HttpMethod.GET | HttpMethod.POST, "get_user")
    getUser(ctx){
    }
}
```
3. register them in your service entrance
```js
import { router, useController } from "@khgame/decorator-koa-router";
useController(`${__dirname}/your_controller_file`)
router.prefix("/api"); // is you want a api prefix
app.use(router.routes()).use(router.allowedMethods()); // the controller will registered automatically
````
if you are using index file to export all controllers, for example
```js
// controllers/index.ts or controllers/index.js
export * from './userController';
export * from './resController';
...
// service.js
import { router, useController } from "@khgame/decorator-koa-router";
useController(`${__dirname}/controllers`)
```
the only file need to apply `useController` is the index file
4. further more, you can use `useFolder` to load all controllers recursively in a folder
```js
// for folder structure:
// controllers/userController.ts
// controllers/resController.ts
// controllers/more/bookController.ts
import { router, useFolder } from "@khgame/decorator-koa-router";
useFolder(`${__dirname}/controllers`) // load: userController and resController
useFolder(`${__dirname}/controllers`, true) // recursice load: all controllers
```

### Detail of decorate

- `@controller(path: string, ...middleware: Middleware[])`  
    1. path are required
    2. must decorate to the class  
- `@api(method?: HttpMethod, path?: string, ...middleware: Middleware[])`    
    1. path are optioned, the slash "/" should be added manually  
        `@api("/show_me_the_money")`  
    2. when path are set as `undefined` or left empty, the api name is the methods name  
        `@api()`  
        `@api(undefined, HttpMethod.GET)`  
    3. using only one "/" to set path as the root of the controller
        `@api("/")`
    4. you can set method by bit operation, for example
        `api(path?: string, method?: HttpMethod, ...middleware: Middleware[])`
- HttpMethod 
```js
    export enum HttpMethod {
        GET = 0x01,
        POST = 0x02,
        PUT = 0x04,
        DELETE = 0x08,
        HEAD = 0x10,
        OPTIONS = 0x20,
        PATCH = 0x40,
        BASIC = GET | POST,
        ALL = BASIC | PUT | DELETE | HEAD | OPTIONS | PATCH
    }
```
### More Example

see ./bench
npm package: @khgame/err
Description: another node.js error library, which supports error code
Author: bagaking
Latest version: 0.1.1

# @khgame/err

another node.js error library, which supports error code

## usage

### CError

```typescript
import {CError} from "@khgame/err"
// ...
throw new CError(ERROR_CODE.ValidateError, "Oops") // ERROR_CODE can be enum type of string or number
// ...
```

### CAssert

```typescript
import {CAssert} from "@khgame/err"

const assert = new CAssert({
  fnLog: console.error // optional, log msg will be send to the logger function if given
})
// ...
CAssert.cThrow(ERROR_CODE.ValidateError, "Oops"); // ERROR_CODE can be enum type of string or number
CAssert.cok(true, ERROR_CODE.ValidateError, () => `you can use this string function to avoid string concat.`);
CAssert.cOk(true, ERROR_CODE.ValidateError, () => `you can also insert an existed error.` );
CAssert.cNotNullAndUndefined(undefined, ERROR_CODE.ValidateError, "there are some more APIs");
CAssert.cStrictEqual(1, 2, ERROR_CODE.ValidateError, "this case will go error");
CAssert.cNotStrictEqual("1", 1, ERROR_CODE.ValidateError, "nothing happend");
// ...
```
npm package: @khgame/one-line-call
Description: one line call parser
Author: bagaking
Latest version: 0.1.5

# Usage

1. install  
    `npm i --save @khgame/one-line-call` or  
    `yarn add @khgame/one-line-call`
2. import  
    `import {OneLineCall} from "@kgame/one-line-call";`
3. parse
    `OneLineCall.parse("@[func:arg1,arg2]")`
npm package: @khgame/table-vc
Description: tools and standards for game value tables version control
Latest version: 0.2.6

# table-version-control

value tables version control tool, based on git

## usage

### cli

1. `npm i -g @khgame/table-vc`
2. `cd your_project_dir`
3. using `table-vc --init` to create a `table-vc.json` file
4. using `table-vc --alias` to create alias
5. using `table-vc --update` to fetch tables of locked version
6. using `table-vc --checkout ALIAS|BRANCH_NAME` to checkout selected branch or commits, and then set this version as lock in table-vc.json file

### config

#### schema

the table-vc file is something like this *(the default config)*
```json
{
  "repoUrl": "git@localhost/table.git",
  "tableDir": "tables/in",
  "alias": {
    "master": "master",
    "latest": "master",
    "develop": "develop"
  }
}
```

#### config entry 

- repoUrl : the repoUrl of your table repo
- tableDir : the target directory to put your table files
- alias : cv alias => git branch|commit

example:
- config
    ```json
    {
      ...
      "alias": {
        ...
        "test": "301a05e",
      }
    }
    ```
- usage
    `table-vc -c test`

#### update config

once you checkout a target of the repo, the real branch|commit will be locked in the table-vc.json file

```json
    {
      ...
      "lock": "3885fb105a"
    }
```

therefore, you can easily use `table-vc -u` to sync the table to the locked version

#### practise  

you can this to you package.json

```json
{
  ...
  "scripts": {
    ...
    "table:checkout": "npx table-vc --branch"
  }
}
```
and use ```npm run table:checkout test``` to checkout table branch

### node.js
  
you can also import this lib in your code:

```js
import { loadTable } from '@khgame/table-vc'
```

definition

`loadTable: async (repoUrl, dirOut, version)`
npm package: @khgame/tconv
Description: token conversion based game framework
Author: kinghand
Latest version: 0.0.1-beta.1

# tconv

token conversion based game framework

# Usage

```js
const TConv = require('tconv')
const userStore = require('../userStore') // for example

let conv = new TConv()
conv.use(async (ctx, next) => {
  console.log('event', ctx.params.event, ctx.params.nonce)
  await next()
  console.log('asset operations', JSON.stringify(ctx))
  for (let i in ctx.t.in) {
    let { uid, tid, num } = ctx.t.in[i]
    ctx.assert(num && num > 0, 'token-in error, invalid num')
    await userStore.incToken(uid, { tid, num: -num })
  }
  for (let i in ctx.t.out) {
    let { uid, tid, num } = ctx.t.out[i]
    ctx.assert(num && num > 0, 'token-out error, invalid num')
    await userStore.incToken(uid, { tid, num: num })
  }
})

conv.init()
conv.apply({ event: 'gather', uid: '0000001' })
```