diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 45c6fbf..d627ac9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,99 +7,3 @@ for commercial and other private use. A CLA is also not currently defined. When these issues are resolved and more formalized contributions will then be accepted with the appropriate caveats. - -## Building and Editing - -## Getting Started - -- Clone the repository - -```batch -git clone --depth=1 ... -``` - -- Install dependencies - -```batch -cd -npm install -``` - -- Build - -```batch -npm run build -``` - -## Project Structure - -| Name | Description | -|:------------------|:--------------------------------------------------------------------------------------------------------------| -| .cache | Cache directory generated by [Parcel](https://parceljs.org/) | -| .vscode | Settings for VS Code | -| azure | Build pipeline definitions used by Azure Devops | -| dist | Contains the compiled output of the build | -| docs | Library documentation | -| node_modules | node package dependencies | -| src | Contains the source code that will be compiled to the `dist` dir | -| .editorconfig | Config settings for [EditorConfig](https://editorconfig.org/) IDE code style checking | -| .gitignore | Specifies files untracked by version control | -| .npmrc | npm config settings | -| LICENSE | GNU General Public License v2.0 only | -| package-lock.json | Autogenerated [meta-manifest](https://docs.npmjs.com/files/package-lock.json) of package.json | -| package.json | [Node Package configuration](https://docs.npmjs.com/files/package.json) settings with related build scripts | -| README.md | The current file. A high level overview of the library | -| tsconfig.json | Config settings for compiling TypeScript code | -| tslint.json | Config settings for TSLint code style checking | - -## Build and Test - -To build and test this library locally you will need the following: - -- [VS Code](https://code.visualstudio.com/) - - - Install the recommended extensions - -- A [active](https://github.com/nodejs/Release) version of [Node.js](https://nodejs.org/en/) - - With a corresponding [npm installation](https://www.npmjs.com/get-npm) - -| Npm Script | Description | -|:--------------|:------------| -| `build` | Performs a full build of the library including type generation and linting. Outputs to the `dist` folder | -| `build-nofix` | Perfoms the sames steps as `build` except that `lint-nofix` will be executed. | -| `build-types` | Generates type definitions for the library in the `dist` folder | -| `clean` | deletes the `dist` folder | -| `clean-full` | deletes the `dist`, `node_modules`, and `.cache` folders | -| `debug` | Starts debugger | -| `lint` | Performs linting and type checking of the library | -| `lint-nofix` | Performs linting but will not autofix problems. | -| `test` | Executes unit tests | -| `type-check` | Performs type checking | - -## Dependencies - -Dependencies are managed through `package.json`. There are no runtime dependencies. -The development dependencies are as follows: - -| Package | Description | License | -|:------------------------------------------|:----------------------------------------------|--------------| -| `@types/jest` | Type definitions for `ts-jest` support | MIT | -| `@types/node` | Type definitions for node. (used for build) | MIT | -| `@typescript-eslint/eslint-plugin` | Type definitions for ESLint | MIT | -| `@typescript-eslint/parser` | Type definitions for ESLint parser | BSD-2-Clause | -| `eslint` | ECMAScript linting library | MIT | -| `eslint-plugin-header` | ESLint extension for linting file headers | MIT | -| `eslint-plugin-import` | ESLint extension for linting imports | MIT | -| `jest` | JavaScript Unit testing library | MIT | -| `jest-junit` | Jest extension for JUnit reporting | Apache-2.0 | -| `rimraf` | Cross platform lib for deleting files/folders | ISC | -| `ts-jest` | TypeScript support for `jest` | MIT | -| `ts-loader` | TypeScript loader for Webpack | MIT | -| `typescript` | TypeScript compiler | Apache-2.0 | -| `webpack` | Module bundler | MIT | -| `webpack-cli` | Command line library for WebPack | MIT | - -If you're using Windows and a newer version of NodeJS then you may additionally -need to run the following command due to a transitive dependency on [node-gyp](https://github.com/nodejs/node-gyp): - -`npm install -g windows-build-tools` diff --git a/README.md b/README.md index f08aff7..e8c139d 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ class Stack implements StackType { } top(): T { - return this.#implementation[this.#implementation.length - 1]; + return this.#implementation.at(-1); } } ``` @@ -315,20 +315,14 @@ properties with accessors should be used instead. Example: ```ts @Contracted(pointContract) class Point2D { - #x: number - #y: number + accessor x: number + accessor y: number constructor(x: number, y: number) { super() - this.#x = x - this.#y = y + this.x = x + this.y = y } - - get x(): number { return this.#x } - set x(value: number) { this.#x = value } - - get y(): number { return this.#y } - set y(value: number) { this.#y = value } } ``` @@ -344,7 +338,7 @@ True assertions do not throw an error. An example of this is given below using a ```typescript const stackContract = new Contract>({ - [invariants](self) { + [invariant](self) { return self.isEmpty() == (self.size == 0) && self.isFull() == (self.size == self.limit) && self.size >= 0 && self.size <= self.limit @@ -572,7 +566,7 @@ The remaining arguments of `ensures` reflect the arguments of the associated fea ```typescript const baseContract = new Contract({ someMethod: { - ensures(_self, old, x: number){ return 0 <= x && x <= 10 } + ensures(_self, _old, x: number){ return 0 <= x && x <= 10 } } }) @@ -707,7 +701,7 @@ recursion. An example of `retry` usage: ```ts const studentRepositoryContract = new Contract({ getStudent: { - rescue(self, error, [id], retry) { + rescue(_self, error, [id], retry) { console.error(error) console.log('Retrying with legacy id...') retry(`old-${id}`) diff --git a/package-lock.json b/package-lock.json index 2ea6642..c8f403c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@final-hill/decorator-contracts", - "version": "0.25.0", + "version": "0.25.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@final-hill/decorator-contracts", - "version": "0.25.0", + "version": "0.25.1", "license": "AGPL-3.0-only", "devDependencies": { "@types/jest": "^29.5.4", diff --git a/package.json b/package.json index 9f7cd96..bf10565 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@final-hill/decorator-contracts", - "version": "0.25.0", + "version": "0.25.1", "description": "Code Contracts for TypeScript and ECMAScript classes", "type": "module", "exports": {