open-index/open-npm huggingface dataset:
npm package: @mueang/craftsman
Description: Command line make code like laravel artisan run with node.js.
Author: Supakit Tanyung
Latest version: 0.0.0

craftsman
=========



[![Version](https://img.shields.io/npm/v/craftsman.svg)](https://npmjs.org/package/craftsman)
[![CircleCI](https://circleci.com/gh/MunNaaS/craftsman/tree/master.svg?style=shield)](https://circleci.com/gh/MunNaaS/craftsman/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/MunNaaS/craftsman?branch=master&svg=true)](https://ci.appveyor.com/project/MunNaaS/craftsman/branch/master)
[![Codecov](https://codecov.io/gh/MunNaaS/craftsman/branch/master/graph/badge.svg)](https://codecov.io/gh/MunNaaS/craftsman)
[![Downloads/week](https://img.shields.io/npm/dw/craftsman.svg)](https://npmjs.org/package/craftsman)
[![License](https://img.shields.io/npm/l/craftsman.svg)](https://github.com/MunNaaS/craftsman/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g craftsman
$ craftsman COMMAND
running command...
$ craftsman (-v|--version|version)
craftsman/0.0.0 linux-x64 node-v10.1.0
$ craftsman --help [COMMAND]
USAGE
  $ craftsman COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`craftsman hello [FILE]`](#craftsman-hello-file)
* [`craftsman help [COMMAND]`](#craftsman-help-command)

## `craftsman hello [FILE]`

describe the command here

```
USAGE
  $ craftsman hello [FILE]

OPTIONS
  -f, --force
  -h, --help       show CLI help
  -n, --name=name  name to print

EXAMPLE
  $ craftsman hello
  hello world from ./src/hello.ts!
```

_See code: [src/commands/hello.ts](https://github.com/MunNaaS/craftsman/blob/v0.0.0/src/commands/hello.ts)_

## `craftsman help [COMMAND]`

display help for craftsman

```
USAGE
  $ craftsman help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v1.2.10/src/commands/help.ts)_
<!-- commandsstop -->
npm package: @mueang/migrations
Description: Command line migrations for knex.js with typescript power by oclif.
Author: Supakit Tanyung
Latest version: 0.0.0

migrations
==========



[![Version](https://img.shields.io/npm/v/migrations.svg)](https://npmjs.org/package/migrations)
[![CircleCI](https://circleci.com/gh/MunNaaS/migrations/tree/master.svg?style=shield)](https://circleci.com/gh/MunNaaS/migrations/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/MunNaaS/migrations?branch=master&svg=true)](https://ci.appveyor.com/project/MunNaaS/migrations/branch/master)
[![Codecov](https://codecov.io/gh/MunNaaS/migrations/branch/master/graph/badge.svg)](https://codecov.io/gh/MunNaaS/migrations)
[![Downloads/week](https://img.shields.io/npm/dw/migrations.svg)](https://npmjs.org/package/migrations)
[![License](https://img.shields.io/npm/l/migrations.svg)](https://github.com/MunNaaS/migrations/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g @mueang/migrations
$ migrations COMMAND
running command...
$ migrations (-v|--version|version)
@mueang/migrations/0.0.0 linux-x64 node-v10.1.0
$ migrations --help [COMMAND]
USAGE
  $ migrations COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`migrations hello [FILE]`](#migrations-hello-file)
* [`migrations help [COMMAND]`](#migrations-help-command)

## `migrations hello [FILE]`

describe the command here

```
USAGE
  $ migrations hello [FILE]

OPTIONS
  -f, --force
  -h, --help       show CLI help
  -n, --name=name  name to print

EXAMPLE
  $ migrations hello
  hello world from ./src/hello.ts!
```

_See code: [src/commands/hello.ts](https://github.com/MunNaaS/migrations/blob/v0.0.0/src/commands/hello.ts)_

## `migrations help [COMMAND]`

display help for migrations

```
USAGE
  $ migrations help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v1.2.10/src/commands/help.ts)_
<!-- commandsstop -->
npm package: @muehle/common
Description: Angular Universal common utilities
Latest version: 11.1.1

# Angular Universal Common Module

This is the common Angular Universal module that is common across server-side rendering app
irrespective of the rendering engine.

The package can be installed using:

`npm install @nguniversal/common --save`

## TransferHttpCacheModule

Moved to [/docs/transfer-http.md](https://github.com/angular/universal/tree/master/docs/transfer-http.md)
npm package: @muehle/express-engine
Description: Express Engine for running Server Angular Apps
Latest version: 11.1.1

# Angular Express Engine

This is an Express Engine for running Angular Apps on the server for server side rendering.

## Usage

`npm install @nguniversal/express-engine --save`

To use it, set the engine and then route requests to it

```ts
import * as express from 'express';
import { ngExpressEngine } from '@nguniversal/express-engine';

const app = express();

// Set the engine
app.engine('html', ngExpressEngine({
  bootstrap: ServerAppModule // Give it a module to bootstrap
}));

app.set('view engine', 'html');

app.get('/**/*', (req: Request, res: Response) => {
  res.render('../dist/index', {
    req,
    res
  });
});
```

## Configuring the URL and Document

It is possible to override the default URL and document fetched when the rendering engine
is called. To do so, simply pass in a `url` and/or `document` string to the renderer as follows:

```ts
app.get('/**/*', (req: Request, res: Response) => {
  let url = 'http://someurl.com';
  let doc = '<html><head><title>New doc</title></head></html>';
  res.render('../dist/index', {
    req,
    res,
    url,
    document: doc
  });
});
```

## Extra Providers

Extra Providers can be provided either on engine setup

```ts
app.engine('html', ngExpressEngine({
  bootstrap: ServerAppModule,
  providers: [
    ServerService
  ]
}));
```

## Advanced Usage

### Request based Bootstrap

The Bootstrap module as well as more providers can be passed on request

```ts
app.get('/**/*', (req: Request, res: Response) => {
  res.render('../dist/index', {
    req,
    res,
    bootstrap: OtherServerAppModule,
    providers: [
      OtherServerService
    ]
  });
});
```

### Using the Request and Response

The Request and Response objects are injected into the app via injection tokens.
You can access them by @Inject

```ts
import { Request } from 'express';
import { REQUEST } from '@nguniversal/express-engine/tokens';

@Injectable()
export class RequestService {
  constructor(@Inject(REQUEST) private request: Request) {}
}
```

If your app runs on the client side too, you will have to provide your own versions of these in the client app.

### Using a Custom Callback

You can also use a custom callback to better handle your errors

```ts
app.get('/**/*', (req: Request, res: Response) => {
  res.render('../dist/index', {
    req,
    res
  }, (err: Error, html: string) => {
    res.status(html ? 200 : 500).send(html || err.message);
  });
});
```
npm package: @muehle/hapi-engine
Description: Hapi Engine for running Server Angular Apps
Latest version: 11.1.1

# Angular Hapi Engine

This is a Hapi Engine for running Angular Apps on the server for server side rendering.

## Usage

`npm install @nguniversal/hapi-engine --save`

To use it, set the engine and then route requests to it

```ts
import { Request, Server } from 'hapi';
import { ngHapiEngine } from '@nguniversal/hapi-engine';

const server = new Server();
server.connection({
  host: 'localhost',
  port: 8000
});

server.route({
  method: 'GET',
  path: '/{path*}',
  handler: (req: Request) => ngHapiEngine({req, bootstrap: ServerAppModule})
});
```

## Configuring the URL and Document

It is possible to override the default URL and document fetched when the rendering engine
is called. To do so, simply pass in a `url` and/or `document` string to the renderer as follows:

```ts
server.route({
  method: 'GET',
  path: '/{path*}',
  handler: (req: Request) => {
    const url = 'http://someurl.com';
    const document = '<html><head><title>New doc</title></head></html>';
    return ngHapiEngine({
      req,
      url,
      document,
    });
  }
});
```

## Extra Providers

Extra Providers can be provided either on engine setup

```ts
const hapiEngine = ngHapiEngine({
  bootstrap: ServerAppModule,
  providers: [
    ServerService
  ]
});
```

## Advanced Usage

### Request based Bootstrap

The Bootstrap module as well as more providers can be passed on request

```ts
server.route({
  method: 'GET',
  path: '/{path*}',
  handler: (req: Request) => 
    ngHapiEngine({
      bootstrap: OtherServerAppModule,
      providers: [
        OtherServerService
      ],
      req
    })
});
```

### Using the Request and Response

The Request and Response objects are injected into the app via injection tokens.
You can access them by `@Inject`

```ts
import { Request } from 'hapi';
import { REQUEST } from '@nguniversal/hapi-engine/tokens';

@Injectable()
export class RequestService {
  constructor(@Inject(REQUEST) private request: Request) {}
}
```

If your app runs on the client side too, you will have to provide your own versions of these in the client app.
npm package: @muehle/socket-engine
Description: Socket Engine for running Server Angular Apps
Latest version: 11.1.1

# Angular Universal Socket Engine

Framework and Platform agnostic Angular Universal rendering.

## Usage Server

`npm install @nguniversal/socket-engine @nguniversal/common --save`

```js
const socketEngine = require('@nguniversal/socket-engine');

// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {AppServerModuleNgFactory, LAZY_MODULE_MAP} = require('./dist/server/main');

socketEngine.startSocketEngine(AppServerModuleNgFactory);
```
This will the socket engine which internally hosts a TCP Socket server.  
The default port is `9090` and host of `localhost`
You may want to leave this as a plain `.js` file since it is so simple and to make deploying it easier, but it can be easily transpiled from Typescript.  

## Usage Client

Your client can be whatever language, framework or platform you like.  
As long as it can connect to a TCP Socket (which all frameworks can) then you're good to go.

This example will use JS for simplicity
```typescript
import * as net from 'net';

const client = net.createConnection(9090, 'localhost', () => {
  console.log('connected to SSR server');
});

client.on('data', data => {
  const res = JSON.parse(data.toString()) as SocketEngineResponse;
  expect(res.id).toEqual(1);
  expect(res.html).toEqual(template);
  server.close();
  done();
});

const renderOptions = {id: 1, url: '/path', document: '<app-root></app-root>'} as SocketEngineRenderOptions;
client.write(JSON.stringify(renderOptions));
```