Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/multi-arch
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyBG committed Jul 24, 2024
2 parents da8ca13 + 5817d38 commit 5f1e969
Show file tree
Hide file tree
Showing 948 changed files with 54,691 additions and 41,982 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ jobs:
- name: Install NodeJS Dependencies
run: |
npm config set spin false
npm ci --no-audit --no-color
npm ci --prefix webapp --no-audit --no-color
npm ci --prefix cli --no-audit --no-color
npm ci --prefix jipt --no-audit --no-color
npm set fund false
npm set audit false
npm set color false
npm ci
npm ci --prefix webapp
npm ci --prefix cli
npm ci --prefix jipt
- name: Build webapp production
run: npm run build-production-inline --prefix webapp
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
elixir 1.15.7-otp-26
erlang 26.1.2
nodejs 16.19.1
nodejs 21.6.1
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Build webapp and jipt deps
#
FROM node:16.19-bullseye-slim AS webapp-builder
FROM node:21.6.1-bullseye-slim AS webapp-builder
RUN apt-get update -y && \
apt-get install -y build-essential git python3 python3-pip && \
apt-get clean && \
Expand All @@ -11,7 +11,7 @@ COPY webapp .
RUN npm ci --no-audit --no-color && \
npm run build-production

FROM node:16.19-bullseye-slim AS jipt-builder
FROM node:21.6.1-bullseye-slim AS jipt-builder
RUN apt-get update -y && \
apt-get install -y build-essential git python3 python3-pip && \
apt-get clean && \
Expand Down Expand Up @@ -47,10 +47,11 @@ COPY config config
RUN mix deps.get --only prod
RUN mix deps.compile --only prod

COPY vendor vendor
COPY vendor/language_tool/priv/ vendor/language_tool/priv/
RUN cd ./vendor/language_tool/priv/native/languagetool && ./gradlew shadowJar
RUN cp ./vendor/language_tool/priv/native/languagetool/app/build/libs/language-tool.jar priv/native/language-tool.jar

COPY vendor vendor
COPY lib lib

RUN mix compile --only prod
Expand Down
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ lint-eslint:

.PHONY: lint-prettier
lint-prettier:
npx prettier --check './{webapp,jipt,cli}/!(node_modules)/**/*.{js,ts,json,svg,scss,md,hbs}' '*.md'
npx prettier --trailing-comma none --check './{webapp,jipt,cli}/!(node_modules)/**/*.{js,ts,json,svg,scss,md,hbs}' '*.md'

.PHONY: lint-template-hbs
lint-template-hbs:
Expand All @@ -110,16 +110,12 @@ type-check: ## Type-check typescript files
cd jipt && npx tsc

.PHONY: test
test: test-api test-webapp
test: test-api

.PHONY: test-api
test-api: ## Run the backend test suite
mix test

.PHONY: test-webapp
test-webapp: ## Run the frontend test suite
cd webapp && npx ember exam --reporter dot

.PHONY: test-coverage
test-coverage: ## Generate the code coverage report
mix coveralls
Expand All @@ -133,7 +129,7 @@ format-elixir:

.PHONY: format-prettier
format-prettier:
npx prettier --write --single-quote --no-bracket-spacing './{webapp,jipt,cli}/!(node_modules)/**/*.{js,ts,json,svg,scss,md,hbs}' '*.md'
npx prettier --write --single-quote --trailing-comma none --no-bracket-spacing './{webapp,jipt,cli}/!(node_modules)/**/*.{js,ts,json,svg,scss,md,hbs}' '*.md'

# Development targets
# -------------------
Expand Down
50 changes: 28 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Accent provides a powerful abstraction around the process maintaining translatio
| --------------------------------------------------- | -------------------------------------------------------------------- |
| [🚀 Getting started](#-getting-started) | Quickly setup a working app |
| [🚧 Requirements](#-requirements) | Dependencies required to run Accent’ stack |
| [🎛 Mix commands](#-executing-mix-commands) | How to execute mix task with the Twelve-Factor pattern |
| [🏎 Quickstart](#-quickstart) | Steps to run the project, from API to webapp, with or without Docker |
| [🎛 Mix commands](#-executing-mix-commands) | How to execute mix task with the Twelve-Factor pattern |
| [🏎 Quickstart](#-quickstart) | Steps to run the project, from API to webapp, with or without Docker |
| [🌳 Environment variables](#-environment-variables) | Required and optional env var used |
| [✅ Tests](#-tests) | How to run the extensive tests suite |
| [🚀 Heroku](#-deploy-on-heroku) | Easy deployment setup with Heroku |
Expand Down Expand Up @@ -103,13 +103,14 @@ The Makefile should be the main entry for common tasks such as tests, linting, D

For the production setup, we use Docker to build an OTP release of the app. With docker-compose, you can run the image locally. Here are the steps to have a working app running locally with Docker:

_When running the production env, you need to provide a valid GOOGLE_API_CLIENT_ID in the `docker-compose.yml` file._
_When running the production env, you need to provide a valid authentication setup in the `environment` section in `docker-compose.yml` file._
See the following sections to see available variables to enable third-party logins or dummy login (email only, no password).

1. Run `make build` to build the OTP release with Docker
2. Run `make dev-start-postgresql` to start an instance of Postgresql. The instance will run on port 5432 with the `postgres` user. You can change those values in the `docker-compose.yml` file.
3. Run `make dev-start-application` to start the app! The release hook of the release will execute migrations and seeds before starting the webserver on port 4000 (again you can change the settings in `docker-compose.yml`)

_That’s it! You now have a working Accent instance without installing Elixir or Node!_
_That’s it! You now have a working Accent instance without installing Elixir or NodeJS!_

## 🌳 Environment variables

Expand Down Expand Up @@ -139,24 +140,29 @@ Accent provides a default value for every required environment variable. This me

Various login providers are included in Accent using Ueberauth to abstract services.

| Variable | Default | Description |
| -------------------------- | -------------------- | --------------------------------------------------------------------------------------- |
| `DUMMY_LOGIN_ENABLED` | _none_ | If specified, the password-less authentication (with only the email) will be available. |
| `GITHUB_CLIENT_ID` | _none_ | |
| `GITHUB_CLIENT_SECRET` | _none_ | |
| `GITLAB_CLIENT_ID` | _none_ | |
| `GITLAB_CLIENT_SECRET` | _none_ | |
| `GITLAB_SITE_URL` | `https://gitlab.com` | |
| `GOOGLE_API_CLIENT_ID` | _none_ | |
| `GOOGLE_API_CLIENT_SECRET` | _none_ | |
| `SLACK_CLIENT_ID` | _none_ | |
| `SLACK_CLIENT_SECRET` | _none_ | |
| `SLACK_TEAM_ID` | _none_ | |
| `DISCORD_CLIENT_ID` | _none_ | |
| `DISCORD_CLIENT_SECRET` | _none_ | |
| `MICROSOFT_CLIENT_ID` | _none_ | |
| `MICROSOFT_CLIENT_SECRET` | _none_ | |
| `MICROSOFT_TENANT_ID` | _none_ | |
| Variable | Default | Description |
| -------------------------- | ---------------------- | --------------------------------------------------------------------------------------- |
| `DUMMY_LOGIN_ENABLED` | _none_ | If specified, the password-less authentication (with only the email) will be available. |
| `GITHUB_CLIENT_ID` | _none_ | |
| `GITHUB_CLIENT_SECRET` | _none_ | |
| `GITLAB_CLIENT_ID` | _none_ | |
| `GITLAB_CLIENT_SECRET` | _none_ | |
| `GITLAB_SITE_URL` | `https://gitlab.com` | |
| `GOOGLE_API_CLIENT_ID` | _none_ | |
| `GOOGLE_API_CLIENT_SECRET` | _none_ | |
| `SLACK_CLIENT_ID` | _none_ | |
| `SLACK_CLIENT_SECRET` | _none_ | |
| `SLACK_TEAM_ID` | _none_ | |
| `DISCORD_CLIENT_ID` | _none_ | |
| `DISCORD_CLIENT_SECRET` | _none_ | |
| `MICROSOFT_CLIENT_ID` | _none_ | |
| `MICROSOFT_CLIENT_SECRET` | _none_ | |
| `MICROSOFT_TENANT_ID` | _none_ | |
| `OIDC_CLIENT_ID` | _none_ | |
| `OIDC_CLIENT_SECRET` | _none_ | |
| `OIDC_DISCOVERY_URI` | _none_ | |
| `OIDC_UID_FIELD` | `sub` | |
| `OIDC_SCOPE` | `openid profile email` | |

### Email setup

Expand Down
16 changes: 8 additions & 8 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ npm install -g accent-cli
$ accent COMMAND
running command...
$ accent (-v|--version|version)
accent-cli/0.16.0 darwin-arm64 node-v16.19.1
accent-cli/0.16.2 darwin-arm64 node-v21.6.1
$ accent --help [COMMAND]
USAGE
$ accent COMMAND
Expand All @@ -47,7 +47,7 @@ accent-cli reads from a `accent.json` file. The file should contain valid JSON r
"source": "localization/fr/*.json",
"target": "localization/%slug%/%document_path%.json",
"hooks": {
"afterSync": "touch sync-done.txt"
"afterSync": ["touch sync-done.txt", "echo 'Done!'"]
}
}
]
Expand Down Expand Up @@ -207,7 +207,7 @@ EXAMPLES
$ accent export --order-by=key --version=build.myapp.com:0.12.345
```

_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/export.ts)_
_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.16.2/src/commands/export.ts)_

## `accent format`

Expand All @@ -225,7 +225,7 @@ EXAMPLE
$ accent format
```

_See code: [src/commands/format.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/format.ts)_
_See code: [src/commands/format.ts](https://github.com/mirego/accent/blob/v0.16.2/src/commands/format.ts)_

## `accent help [COMMAND]`

Expand Down Expand Up @@ -262,7 +262,7 @@ EXAMPLE
$ accent jipt
```

_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/jipt.ts)_
_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.16.2/src/commands/jipt.ts)_

## `accent lint`

Expand All @@ -279,7 +279,7 @@ EXAMPLE
$ accent lint
```

_See code: [src/commands/lint.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/lint.ts)_
_See code: [src/commands/lint.ts](https://github.com/mirego/accent/blob/v0.16.2/src/commands/lint.ts)_

## `accent stats`

Expand All @@ -299,7 +299,7 @@ EXAMPLE
$ accent stats
```

_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/stats.ts)_
_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.16.2/src/commands/stats.ts)_

## `accent sync`

Expand Down Expand Up @@ -331,7 +331,7 @@ EXAMPLES
$ accent sync --add-translations --merge-type=smart --order-key=key --version=v0.23
```

_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.16.0/src/commands/sync.ts)_
_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.16.2/src/commands/sync.ts)_
<!-- commandsstop -->

# GitHub Actions
Expand Down
4 changes: 2 additions & 2 deletions cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "accent-cli",
"version": "0.16.0",
"version": "0.16.2",
"author": "Simon Prévost",
"description": "Accent CLI",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const sleep = async (ms: number) =>

export const configFlag = flags.string({
default: 'accent.json',
description: 'Path to the config file',
description: 'Path to the config file'
});

const parseConfigFlag = (argv: string[]) => {
Expand Down
8 changes: 4 additions & 4 deletions cli/src/commands/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ export default class Export extends Command {

static examples = [
`$ accent export`,
`$ accent export --order-by=key --version=build.myapp.com:0.12.345`,
`$ accent export --order-by=key --version=build.myapp.com:0.12.345`
];

static args = [];
static flags = {
'order-by': flags.string({
default: 'index',
description: 'Order of the keys',
options: ['index', 'key'],
options: ['index', 'key']
}),
version: flags.string({
default: '',
description: 'Fetch a specific version',
description: 'Fetch a specific version'
}),
config: configFlag,
config: configFlag
};

async run() {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export default class Format extends Command {
'order-by': flags.string({
default: 'index',
description: 'Order of the keys',
options: ['index', 'key', '-index', '-key'],
options: ['index', 'key', '-index', '-key']
}),
config: configFlag,
config: configFlag
};

async run() {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/jipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default class Jipt extends Command {
{
description: 'The pseudo language for in-place-translation-editing',
name: 'pseudoLanguageName',
required: true,
},
required: true
}
];

static flags = {config: configFlag};
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export default class Lint extends Command {
const {path, language} = target;
if (fs.existsSync(path)) {
const {
data: {lint_translations: lintTranslations},
data: {lint_translations: lintTranslations}
} = (await document.lint(path, language)) as {data: any};

const lintTranslationsWithLocalPath = lintTranslations.map(
(lintTranslation: LintTranslation) => ({
...lintTranslation,
path,
path
})
);

Expand Down
8 changes: 4 additions & 4 deletions cli/src/commands/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export default class Stats extends Command {
static flags = {
version: flags.string({
default: undefined,
description: 'View stats for a specific version',
description: 'View stats for a specific version'
}),
'check-reviewed': flags.boolean({
description: 'Exit 1 when reviewed percentage is not 100%',
description: 'Exit 1 when reviewed percentage is not 100%'
}),
'check-translated': flags.boolean({
description: 'Exit 1 when translated percentage is not 100%',
description: 'Exit 1 when translated percentage is not 100%'
}),
config: configFlag,
config: configFlag
};

async run() {
Expand Down
Loading

0 comments on commit 5f1e969

Please sign in to comment.