TypeScript boilerplate.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
dd50811132
commit
0f2f619e96
|
@ -0,0 +1,51 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
name: build
|
||||
|
||||
steps:
|
||||
- name: install
|
||||
image: node:lts-alpine
|
||||
commands:
|
||||
- npm install
|
||||
|
||||
- name: lint
|
||||
image: node:lts-alpine
|
||||
commands:
|
||||
- npm run lint
|
||||
depends_on:
|
||||
- install
|
||||
|
||||
- name: test
|
||||
image: node:lts-alpine
|
||||
commands:
|
||||
- npm run test
|
||||
depends_on:
|
||||
- install
|
||||
|
||||
- name: build
|
||||
image: node:lts-alpine
|
||||
commands:
|
||||
- apk add zip
|
||||
- npm run build
|
||||
- zip -r bennc-m.zip dist/
|
||||
depends_on:
|
||||
- install
|
||||
|
||||
- name: publish
|
||||
image: plugins/gitea-release
|
||||
depends_on:
|
||||
- lint
|
||||
- test
|
||||
- build
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
settings:
|
||||
base_url: https://git.jacknet.io
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
files:
|
||||
- bennc-m.zip
|
||||
checksum:
|
||||
- md5
|
||||
- sha256
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"orta.vscode-jest"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "pwa-node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/dist/index.js",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/**/*.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "typescript",
|
||||
"tsconfig": "tsconfig.json",
|
||||
"option": "watch",
|
||||
"problemMatcher": [
|
||||
"$tsc-watch"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"label": "tsc: watch - tsconfig.json"
|
||||
}
|
||||
]
|
||||
}
|
57
README.md
57
README.md
|
@ -1,3 +1,56 @@
|
|||
# bennc-js
|
||||
# BENNC-JS
|
||||
[![Build Status](https://drone.jacknet.io/api/badges/TerribleCodeClub/bennc-js/status.svg)](https://drone.jacknet.io/TerribleCodeClub/bennc-js) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
|
||||
|
||||
A TypeScript/Javascript BENNC implementation.
|
||||
An implementation of the [BENNC](https://wiki.jacknet.io/books/simontech/chapter/bennc) client specification.
|
||||
|
||||
## Build
|
||||
|
||||
To build the BENNC-JS library, first clone this repository.
|
||||
|
||||
Run the following commands from the root of the repository:
|
||||
```bash
|
||||
$ npm install
|
||||
$ npm run build
|
||||
```
|
||||
The build output will be saved to the `dist` directory.
|
||||
|
||||
## Development instructions
|
||||
|
||||
Requirements:
|
||||
- The latest LTS builds of Node and npm.
|
||||
|
||||
Follow the instructions below to lint, test and build BENNC-JS.
|
||||
|
||||
#### Lint
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
$ npm run lint
|
||||
```
|
||||
|
||||
#### Test
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
$ npm run test
|
||||
```
|
||||
#### Build
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
$ npm run build
|
||||
```
|
||||
|
||||
### Visual Studio Code
|
||||
|
||||
This repository contains the necessary configuration files to debug, test and build BENNC-JS using only Visual Studio Code.
|
||||
|
||||
Run the build task (`Ctrl+Shift+B` or `⇧⌘B`) to automatically compile the Typescript source files in the background.
|
||||
|
||||
Unit tests use the [Jest](https://jestjs.io/) library. Support for Visual Studio Code is offered through the [Jest marketplace package](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) maintained by Orta.
|
||||
|
||||
## Contribution guidelines
|
||||
|
||||
[![JavaScript Style Guide](https://cdn.rawgit.com/standard/standard/master/badge.svg)](https://github.com/standard/standard)
|
||||
|
||||
This library uses [ts-standard](https://github.com/standard/ts-standard), based on [JavaScript Standard Style](https://standardjs.com/rules.html). Please ensure all contributions are ts-standard compliant before submitting a pull request.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "bennc-js",
|
||||
"version": "1.0.0",
|
||||
"description": "A TypeScript/Javascript BENNC implementation.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "ts-standard",
|
||||
"test": "jest",
|
||||
"build": "tsc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.jacknet.io/TerribleCodeClub/bennc-js"
|
||||
},
|
||||
"author": "Butlersaurus",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"typescript": "^4.5.5",
|
||||
"ts-standard": "^11.0.0",
|
||||
"jest": "^27.4.7",
|
||||
"ts-jest": "^27.1.3",
|
||||
"@types/jest": "^27.4.0"
|
||||
},
|
||||
"jest": {
|
||||
"verbose": true,
|
||||
"transform": {
|
||||
"^.+\\.ts?$": "ts-jest"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
export function addNumbers (a: number, b: number): number {
|
||||
return a + b
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import { addNumbers } from '../src/bennc'
|
||||
|
||||
test('Add two numbers', () => {
|
||||
expect(addNumbers(1, 2)).toBe(3)
|
||||
})
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
// "include": ["src", "tests"],
|
||||
"exclude": []
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
"rootDir": "src", /* Specify the root folder within your source files. */
|
||||
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
"outDir": "dist", /* Specify an output folder for all emitted files. */
|
||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
},
|
||||
"exclude": ["tests"]
|
||||
}
|
Loading…
Reference in New Issue