Skip to content

Commit

Permalink
New Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar committed Jan 24, 2023
1 parent bae762a commit f651c71
Show file tree
Hide file tree
Showing 161 changed files with 18,164 additions and 7,962 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
**/node_modules/*
**/fixtures/*
**/locale/*
docs/*
website/*
README.md
**/npm/*
32 changes: 0 additions & 32 deletions .github/workflows/deploy-main-docs.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/docs-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: docs-suite

on:
push:
branches:
- '*'
paths:
- website/**

jobs:
validate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies
working-directory: website
run: yarn install --frozen-lockfile --pure-lockfile

- name: Build
working-directory: website
run: yarn build

- name: Lint
working-directory: website
run: yarn lint

- name: Check Formatting
working-directory: website
run: yarn checkFormat
33 changes: 33 additions & 0 deletions .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release-docs

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies
working-directory: website
run: yarn install --frozen-lockfile --pure-lockfile

- name: Build
working-directory: website
run: yarn build

- name: Deploy documentation
working-directory: website
run: |
npx vercel --public --yes --prod --token ${{ secrets.NOW_TOKEN }} --name lingui-docs build
# TODO: update Algolia index
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ build/packages/
.yalc/
yalc.lock
packages/**/build
docs/_build/

npm-debug.log
yarn-error.log
Expand Down
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

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.

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.

## Scope

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.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
https://github.com/lingui/js-lingui/discussions.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**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.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**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.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**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.

### 4. Permanent Ban

**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.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
82 changes: 48 additions & 34 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
# Contributing

:tada: First off, thanks for taking the time to contribute! :tada:

The following is a set of guidelines for contributing to Lingui. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

This project and everyone participating in it are governed by the [Code of Conduct](/CODE_OF_CONDUCT.md). We expect that all community members adhere to the guidelines within.

**Working on your first Pull Request?** You can learn how from this _free_ series
[How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)

## Contributing to the docs

Documentation uses Sphinx and reStructuredText. Source inside the
[docs](https://github.com/lingui/js-lingui/tree/main/docs) directory.
The documentation is based on [Docusaurus](https://docusaurus.io/) framework. Source inside the [website](https://github.com/lingui/js-lingui/tree/main/website) directory.

- Go to the `website` directory:

```sh
cd website
```

- Install dependencies:

```sh
yarn install
```

1. Go to the `docs` directory
- To build the docs, watch for changes and preview documentation locally at [http://localhost:3000/](http://localhost:3000/):

```sh
yarn start
```

2. Run `pipenv install` to setup Python environemnt (requires Python 3.6).
If you encounter `ValueError('unknown locale: %s' % localename)`,
run `export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8` and try again.
- It's also possible to run `yarn build` for single build. Incremental builds are much faster than the first one as only changed files are built.

3. Run `pipenv run make livehtml` to build the docs, watch for changes and preview
documentation locally at [http://127.0.0.1:8000](http://127.0.0.1:8000).
- Please lint and validate the documentation before submitting any changes:

4. It's also possible to run `pipenv run make html` for single build. Incremental builds
are much faster than the first one as only changed files are built.
```sh
yarn lint
yarn checkFormat
```

## Contributing the code

This project uses [yarn][yarninstall] package manager. Please follow
[official][yarninstall] docs to install it.
This project uses [yarn][yarninstall] package manager. Please follow [official][yarninstall] docs to install it.

### Setup local environment

Expand All @@ -32,10 +53,7 @@ This project uses [yarn][yarninstall] package manager. Please follow
cd js-lingui
```

2. Install development packages. This project uses
[yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) instead of Lerna,
so running `yarn` installs all development packages and also dependencies for all
workspaces (inside `packages/*`).
2. Install development packages. This project uses [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) instead of Lerna, so running `yarn` installs all development packages and also dependencies for all workspaces (inside `packages/*`).

```sh
yarn
Expand All @@ -51,22 +69,20 @@ This project uses [yarn][yarninstall] package manager. Please follow
yarn test
```

NOTE: if you are using an IDE to run test make sure to use the right Jest config.
For unit tests use `-c scripts/jest/config.unit.js`. Integration tests use
build packages (created using `yarn release:build`) and config `-c scripts/jest/config.integration.js`.
See [package.json](./package.json) for more info.

If you run tests manually instead of using `yarn watch` or `yarn test` commands and your tests
fail due to missing locale data (typically you'll get wrong number and currency formating)
make sure you have `NODE_ICU_DATA` variable set: `NODE_ICU_DATA=node_modules/full-icu`.
> **Note**
> If you are using an IDE to run test make sure to use the right Jest config.
> For unit tests use `-c scripts/jest/config.unit.js`. Integration tests use
> build packages (created using `yarn release:build`) and config `-c scripts/jest/config.integration.js`.
> See [package.json](./package.json) for more info.
> If you run tests manually instead of using `yarn watch` or `yarn test` commands and your tests
> fail due to missing locale data (typically you'll get wrong number and currency formating)
> make sure you have `NODE_ICU_DATA` variable set: `NODE_ICU_DATA=node_modules/full-icu`.
### Using development version in your project

After you successfully fix a bug or add a new feature, you most probably want
to test it in your project as soon as possible.
After you successfully fix a bug or add a new feature, you most probably want to test it in your project as soon as possible.

`jsLingui` uses [verdaccio](https://verdaccio.org/), a lightweight local NPM registry, to install
local build of packages in examples. You can do the same in your project:
`jsLingui` uses [verdaccio](https://verdaccio.org/), a lightweight local NPM registry, to install local build of packages in examples. You can do the same in your project:

1. Run `verdaccio` locally in docker (follow [verdaccio guide](https://verdaccio.org/docs/en/what-is-verdaccio.html)
if you don't want to run it in Docker):
Expand Down Expand Up @@ -106,18 +122,16 @@ local build of packages in examples. You can do the same in your project:

### Finalize changes

Please make sure that all tests pass and linter doesn't report any error before
submitting a PR (Don't worry though! If you can't figure out the problem, create a PR
anyway and we'll help you).
Please make sure that all tests pass and linter doesn't report any error before submitting a PR (Don't worry though! If you can't figure out the problem, create a PR anyway, and we'll help you).

- `yarn lint:all` - Linting & Type testing
- `yarn test` - Quick test suite (sufficient)
- `yarn release:test` - Full test suite (recommended)

`yarn release:test` builds all packages, simulates creating packages for NPM, runs unit
tests and finally runs integration tests using production build.
`yarn release:test` builds all packages, simulates creating packages for NPM, runs unit tests and finally runs integration tests using production build.

**Note**: Don't commit `scripts/build/results.json` created by `yarn release:test`.
> **Note**
> Don't commit `scripts/build/results.json` created by `yarn release:test`.
Now you can create PR and let CI service do their work!

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Tomáš Ehrlich
Copyright © 2017-2022 Tom Ehrlich, © 2022-2023 Crowdin.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit f651c71

Please sign in to comment.