https://github.com/tobua/squak
Setup and build modern Web Servers in TypeScript.
https://github.com/tobua/squak
Last synced: 3 months ago
JSON representation
Setup and build modern Web Servers in TypeScript.
- Host: GitHub
- URL: https://github.com/tobua/squak
- Owner: tobua
- Created: 2021-03-12T09:28:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-02T14:41:55.000Z (almost 2 years ago)
- Last Synced: 2025-02-15T12:19:00.753Z (3 months ago)
- Language: TypeScript
- Homepage: https://npmjs.com/squak
- Size: 87.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# squak
Setup and build modern Web Servers in TypeScript.
- ESLint, Prettier
- TypeScript Configuration
- Watcher
- Production Standalone Build
- All just by installing it...## Installation
### Existing TypeScript Project
```
npm install squak --save-dev
```This will automatically adapt your `package.json` and create the necessary configuration files.
### New Project
```js
// Bootstrap the default template in the current directory.
npm init --yes now squak
// Additional options:
npm init --yes now squak [./my-web-server] [template = 'default' | 'empty' | 'full' | 'graphql' | 'serverless']
```The default template includes a basic [`express`](http://npmjs.com/express) server. Here are the [templates](https://github.com/tobua/squak/tree/main/template).
## Usage
### `npm start`
Run the compiler and the node server in watch mode. Use this for development.
### `npm run production` | `npx squak production`
Build the project, prune devDependencies and then run the server.
### `npm test` (if tests found) | `npx squak test`
Run tests with `jest`.
### `npx squak lint`
Lint all files in the project with `ESLint` and format them with [`Prettier`](https://prettier.io/docs/en/options.html).
### `npx squak build`
Build the project by compiling the TypeScript source files.
## Configuration
This plugin provides an extensive set of configurations aimed at working in various environments. However the configurations can easily be extended by adding a `squak` property to your `package.json`.
```js
{
"name": "my-web-server",
"squak": {
// What's the name of the entry file, automatically adds [src/]?index.ts file if available.
entry: 'my-server.ts',
entry: ['rest-server.ts', 'graphql-server.ts'],
// Output directory for compiled files, default 'dist'.
output: 'node-server',
// Folder where tests are located, default 'test', false to disable tests.
test: 'spec',
// Overrides for the TypeScript configuration.
tsconfig: {
compilerOptions: {
moduleResolution: 'NodeNext'
}
},
// Additional entries to be added to gitignore, default none.
// Can also be entered directly into .gitignore file.
gitignore: [],
}
}
```Changes for configuration files will be applied each time before a script is run. `tsconfig.json` is best configured through the `package.json` -> `squak` property. [`ESLint`](https://eslint.org/docs/user-guide/configuring) and [`jest`](https://jestjs.io/docs/configuration) can directly be adapted in their respective fields in `package.json` which will be added upon installation.