Skip to content

Commit

Permalink
chore: Prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Nov 10, 2024
1 parent 604d9b6 commit 5a81d2a
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 25 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Build the CLI
run: npm run build
- name: Run npm release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: Tolgee Machine
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Tolgee Machine
GIT_COMMITTER_EMAIL: [email protected]
# We need to get ready for this first!
# - name: Build the CLI
# run: npm run build
# - name: Run npm release
# run: npm run release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# GIT_AUTHOR_NAME: Tolgee Machine
# GIT_AUTHOR_EMAIL: [email protected]
# GIT_COMMITTER_NAME: Tolgee Machine
# GIT_COMMITTER_EMAIL: [email protected]
21 changes: 12 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ jobs:
with:
path: ~/.npm
key: cache-node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm ci

- name: Build the CLI
run: npm run build
- name: Run npm release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: Tolgee Machine
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Tolgee Machine
GIT_COMMITTER_EMAIL: [email protected]

# We need to get ready for this firs!
# - name: Run npm release
# run: npm run release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# GIT_AUTHOR_NAME: Tolgee Machine
# GIT_AUTHOR_EMAIL: [email protected]
# GIT_COMMITTER_NAME: Tolgee Machine
# GIT_COMMITTER_EMAIL: [email protected]
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Tolgee AI i18n migrator

This tool is used to migrate your app code from raw string to use Tolgee SDKs, so you can manage
your localization effectively with Tolgee.

## Motivation

Although we still recommend to prepare your project for localization from the beginning, the reality
is that many developers start with raw strings and then decide to localize their app.

This tool is here to help you with this process. It will scan your project for raw strings and
replace them with Tolgee SDK calls.

e.g. for React, it will replace:
```typescript jsx
export const WelcomeMessage = () => {
return <div>Welcome!</div>;
};
```

with:
```typescript jsx
import { T } from '@tolgee/react';
export const WelcomeMessage = () => {
return <div><T keyName="welcome-message" /></div>
}
```

## Usage

1. Install the tool globally:
```bash
npm install -g @tolgee/ai-migrator
```
File renamed without changes.
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "ai-migrator",
"version": "1.0.0",
"description": "AI migration tool for Tolgee",
"main": "./src/cli.js",
"name": "@tolgee/ai-migrator",
"version": "1.0.0-alpha.1",
"description": "AI migration tool to migrate your project from raw string to Tolgee SDKs",
"bin": {
"tolgee-migrator": "./dist/src/cli.js"
},
Expand All @@ -13,6 +12,11 @@
"format": "eslint --fix",
"eslint": "eslint --max-warnings 0"
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"keywords": [],
"author": "",
"license": "ISC",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion testsGpt/exampleFiles/useTranslate.tsx.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const PasswordField = () => {
return <input placeholder="New Password" />;
return <input placeholder="New password" />;
};
7 changes: 7 additions & 0 deletions testsGpt/gptResponses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import * as path from "node:path";
import { buildNativePreset } from "../src/presets/buildNativePreset";
import dotenv from "dotenv";

jest.mock("fs-extra", () => ({
promises: {
readFile: jest.requireActual("fs-extra").promises.readFile,
writeFile: jest.fn()
},
}));

describe("Chat GPT", () => {
const fileProcessor = createFileProcessor();

Expand Down

0 comments on commit 5a81d2a

Please sign in to comment.