Skip to content

Commit 3836bee

Browse files
committed
add community files
1 parent adf41c9 commit 3836bee

4 files changed

Lines changed: 188 additions & 0 deletions

File tree

‎.github/pull_request_template.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## What and why
2+
3+
<!-- What changes, and what problem does it solve? Link the issue if there is one. -->
4+
5+
## How it was tested
6+
7+
<!-- The test that fails without this change, or how you checked it. -->
8+
9+
## Checklist
10+
11+
- [ ] A test covers the change (it fails without it)
12+
- [ ] `npm test`, `npm run lint` and `npm run typecheck` pass
13+
- [ ] The API documentation (TSDoc) and `CHANGELOG.md` are updated for user-visible changes

‎CODE_OF_CONDUCT.md‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment for our community include:
12+
13+
* Demonstrating empathy and kindness toward other people
14+
* Being respectful of differing opinions, viewpoints, and experiences
15+
* Giving and gracefully accepting constructive feedback
16+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17+
* Focusing on what is best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior include:
20+
21+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
22+
* Trolling, insulting or derogatory comments, and personal or political attacks
23+
* Public or private harassment
24+
* Publishing others' private information, such as a physical or email address, without their explicit permission
25+
* Other conduct which could reasonably be considered inappropriate in a professional setting
26+
27+
## Enforcement Responsibilities
28+
29+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32+
33+
## Scope
34+
35+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36+
37+
## Enforcement
38+
39+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at github@matmen.dev. All complaints will be reviewed and investigated promptly and fairly.
40+
41+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42+
43+
## Enforcement Guidelines
44+
45+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46+
47+
### 1. Correction
48+
49+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50+
51+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52+
53+
### 2. Warning
54+
55+
**Community Impact**: A violation through a single incident or series of actions.
56+
57+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58+
59+
### 3. Temporary Ban
60+
61+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62+
63+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64+
65+
### 4. Permanent Ban
66+
67+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68+
69+
**Consequence**: A permanent ban from any sort of public interaction within the community.
70+
71+
## Attribution
72+
73+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74+
75+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76+
77+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78+
79+
[homepage]: https://www.contributor-covenant.org
80+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81+
[Mozilla CoC]: https://github.com/mozilla/diversity
82+
[FAQ]: https://www.contributor-covenant.org/faq
83+
[translations]: https://www.contributor-covenant.org/translations

‎CONTRIBUTING.md‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributing to ImageScript
2+
3+
Thanks for helping. Bug reports, fixes, and improvements to the documentation are all welcome.
4+
5+
## Questions, bugs and ideas
6+
7+
- **Questions about using ImageScript:** [GitHub Discussions](https://github.com/imagescript/ImageScript/discussions) or the
8+
[Discord server](https://discord.gg/8hPrwAH).
9+
- **A bug:** open an [issue](https://github.com/imagescript/ImageScript/issues/new/choose). A short script and the file that
10+
shows the problem help most.
11+
- **A feature or a bigger change:** open an issue first, so we can agree on the shape of the API before you spend time on it.
12+
- **A security problem:** please don't open an issue, see the [security policy](SECURITY.md).
13+
14+
By taking part you agree to the [code of conduct](CODE_OF_CONDUCT.md).
15+
16+
## Setting up
17+
18+
You need Node.js 22.13 or newer. Deno and Bun are used by the CI and are optional locally.
19+
20+
```sh
21+
git clone https://github.com/imagescript/ImageScript.git
22+
cd ImageScript
23+
npm install
24+
npm run build # compiles src/ to dist/, which the tests import
25+
node tests/crop.js # one test file
26+
npm test # build and run every test file
27+
npm run lint
28+
npm run typecheck
29+
npm run docs # the API documentation, must build without warnings
30+
```
31+
32+
`master` is the 4.0 line, `v3` takes fixes for 3.x. Open pull requests against `master` (or `v3` for a 3.x fix).
33+
34+
## Tests
35+
36+
Every behavior change comes with a test, and a fix comes with a test that fails without it.
37+
38+
- Tests are plain scripts in `tests/` (`tests/<area>.js`) that exit with a non-zero status when something is wrong.
39+
`tests/run.js` runs every file with Node, Deno or Bun, so a test must work on all three.
40+
- Keep a file's run time well under a minute: the CI runs it on several platforms and under coverage with a limit of two
41+
minutes a file. Split long cases into a file of their own.
42+
- Fixtures go in `tests/`; keep them small, and put the licence of files that aren't ours next to them (like `tests/pngsuite/LICENSE`).
43+
- Output that must stay identical (an encoder's bytes, a rendered pixel) is compared against a stored file or hash.
44+
45+
## Code
46+
47+
- ImageScript is TypeScript without runtime dependencies, WebAssembly or native code. Code in `src/` runs in Node.js, Deno,
48+
Bun, browsers and edge runtimes.
49+
- The public API is documented with TSDoc: parameters, `@throws`, `@defaultValue`, and an `@example` where it helps.
50+
The documentation is generated from it (`npm run docs`).
51+
- Methods that take options take an object and check its type. An option that doesn't exist is ignored on purpose.
52+
- Errors say what they got: `width must be 1-2147483647, not 0`. A wrong type is a `TypeError`, a value out of range a
53+
`RangeError`, a limit that is reached a `LimitError`.
54+
- Anything derived from other code keeps its licence: add the project to
55+
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md), put the licence in `licenses/` and say so in the file's header.
56+
57+
## Changes and pull requests
58+
59+
- Add user-visible changes to [CHANGELOG.md](CHANGELOG.md) under the upcoming version.
60+
- Short commit messages that say what changed. Several small commits are fine, no need to squash.
61+
- Say in the pull request what changed and why, and how you tested it. A draft pull request is fine for early feedback.
62+
- The CI has to pass: the tests on Node.js (several versions and platforms), Deno and Bun, the edge runtimes and a browser, lint, and the coverage run.

‎SECURITY.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Security policy
2+
3+
## Supported versions
4+
5+
Security fixes go into the latest release of the current major version (4.x). 3.x gets fixes for serious problems on the
6+
[`v3` branch](https://github.com/imagescript/ImageScript/tree/v3) while 3.20.x is current. Older versions don't get fixes.
7+
8+
## Reporting a vulnerability
9+
10+
Please report vulnerabilities privately, not in a public issue:
11+
12+
- through a [private security advisory](https://github.com/imagescript/ImageScript/security/advisories/new) on GitHub, or
13+
- by email to [github@matmen.dev](mailto:github@matmen.dev).
14+
15+
A short description and a file, SVG or script that shows the problem help most. We aim to answer within a week. We
16+
will tell you when a fix is released and credit you, unless you prefer not to be named.
17+
18+
## What counts
19+
20+
ImageScript decodes image files, fonts and SVG documents that often come from untrusted sources. Reports we want:
21+
22+
- code execution, or reading or writing outside the memory a decoder owns;
23+
- a small input that makes a decoder, the SVG renderer or the text renderer run out of memory, hang, or take far longer than
24+
its size and the documented limits (`maxPixels`, `maxLayerPixels`, `maxImagePixels` and the work limits that throw a
25+
`LimitError`) allow;
26+
- output that depends on data it should not read (for example, an SVG that reads files or fetches URLs: ImageScript does
27+
not fetch anything and takes external images only as data you pass in).
28+
29+
Limits that grow with the size of the output (the SVG work budgets) are documented: for untrusted input, lower
30+
`maxPixels`. A document that stays within the limits but is slow on a large output is not a vulnerability.

0 commit comments

Comments
 (0)