We're very happy to hear that you want to contribute! 🎊
- Check whether it has been asked before or not. You can either search through issues.
- If it hasn't been asked before, open an issue.
Open an issue or fix the bug yourself and submit a pull request!
We usually don't accept new features in inkjs. The purpose of the project is to provide an implementation of ink in JavaScript, compliant with the reference implementation.
If you feel that ink is missing a feature, we recommend that you bring it up in the main repository first, or alternatively, in the official discord server.
-
Do not port comments from the C# codebase, but do add
inkjs-centric comment when it make sense. For example, it's important to document wheninkjsdisplay a slightly different behavior than the reference implementation. -
Try to match the C# type, that means that
Stringtranslates tostring | nullin TypeScript. In order to reduce confusion however, exposed methods that interact with JavaScript should use optional parameter / return types (i. e.variable?: <type>) when they are optional / nullable in the original codebase.
To be added.
inkjs uses prettier and esLint to ensure code consistency. We recommend that you run prettier either on save or before submitting your PR. Our CI lints every PR submitted, so make sure your code passes validation. Two NPM tasks can help you:
lintruns the linterlint:fixfixes lint errors and warnings automatically
inkjs contains two test suites. The first one contains inkjs-centric tests, while the second one has been ported from the reference C# implementation.
Both test suites are ran twice, first against the TypeScript code (transpiled on the fly) and then, a second time, against the distributable, minified resulting JavaScript file.
testruns the full test suite, both in TypeScript and JavaScript;test:typescriptruns the TypeScript test suite;test:javascriptruns the JavaScript test suite;test:javascript:distruns the test suite against the modern distributable JavaScript file.test:javascript:legacyruns the test suite against the legacy distributable JavaScript file.test:compileFilescompiles the fixtures required by the test case (requires inklecate to be available in$PATH)
test:compileFiles needs to be run again every time new tests are added or when
porting a new version of the runtime. The fixtures should always be compiled
with the latest version of inklecate.
test:javascript and its variants won't transpile the files, so be
sure to run build first.
To be added.
To be added.
The repository is set up to automatically publish a new version to npm whenever a new release is created through Github. The corresponding Github workflow can be found here. The secret npm token is stored via the Github UI — if it needs to be updated, get in touch with @y-lohse 😀!
To actually release a new version:
- Update the
versionfield in the package.json to the version you wish to publish - Update the compatibility table in the README file
- Create a new release through Github. Use the same version number as in the package.json file, prefixed with
v(eg.v1.2.3if the package.jsonversionfield is1.2.3).