0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor: ui -> experience (part 2)

Rename `phrases-ui` to `phrases-experience`.
This commit is contained in:
Gao Sun 2023-09-15 10:29:41 +08:00
parent ea6b475a72
commit 083ef8379e
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
169 changed files with 55 additions and 68 deletions

View file

@ -47,7 +47,7 @@
"@logto/core-kit": "workspace:^2.0.1",
"@logto/language-kit": "workspace:^1.0.0",
"@logto/phrases": "workspace:^1.4.1",
"@logto/phrases-ui": "workspace:^1.2.0",
"@logto/phrases-experience": "workspace:^1.2.0",
"@logto/schemas": "workspace:1.8.0",
"@logto/shared": "workspace:^2.0.0",
"@silverhand/essentials": "^2.8.4",

View file

@ -1,6 +1,6 @@
import { isLanguageTag } from '@logto/language-kit';
import { isBuiltInLanguageTag as isPhrasesBuiltInLanguageTag } from '@logto/phrases';
import { isBuiltInLanguageTag as isPhrasesUiBuiltInLanguageTag } from '@logto/phrases-ui';
import { isBuiltInLanguageTag as isPhrasesUiBuiltInLanguageTag } from '@logto/phrases-experience';
import type { CommandModule } from 'yargs';
import { consoleLog, inquireInstancePath } from '../../utils.js';
@ -37,12 +37,12 @@ const create: CommandModule<{ path?: string }, { path?: string; 'language-tag':
if (isPhrasesUiBuiltInLanguageTag(languageTag)) {
consoleLog.info(
languageTag + ' is a built-in tag of phrases-ui, updating untranslated phrases'
languageTag + ' is a built-in tag of phrases-experience, updating untranslated phrases'
);
}
await createFullTranslation({
instancePath,
packageName: 'phrases-ui',
packageName: 'phrases-experience',
languageTag,
});
},

View file

@ -1,6 +1,6 @@
import { languages } from '@logto/language-kit';
import { isBuiltInLanguageTag as isPhrasesBuiltInLanguageTag } from '@logto/phrases';
import { isBuiltInLanguageTag as isPhrasesUiBuiltInLanguageTag } from '@logto/phrases-ui';
import { isBuiltInLanguageTag as isPhrasesUiBuiltInLanguageTag } from '@logto/phrases-experience';
import chalk from 'chalk';
import type { CommandModule } from 'yargs';
@ -16,7 +16,7 @@ const listTags: CommandModule<Record<string, unknown>> = {
...[
tag,
isPhrasesBuiltInLanguageTag(tag) && chalk.blue('phrases'),
isPhrasesUiBuiltInLanguageTag(tag) && chalk.blue('phrases-ui'),
isPhrasesUiBuiltInLanguageTag(tag) && chalk.blue('phrases-experience'),
].filter(Boolean)
);
}

View file

@ -31,7 +31,7 @@ const syncKeys: CommandModule<
.option('package', {
alias: 'pkg',
type: 'string',
describe: 'The package name of the phrases, one of `phrases` or `phrases-ui`',
describe: 'The package name of the phrases, one of `phrases` or `phrases-experience`',
default: 'phrases',
})
.option('target', {
@ -64,8 +64,8 @@ const syncKeys: CommandModule<
consoleLog.fatal('Baseline and target cannot be the same');
}
if (packageName !== 'phrases' && packageName !== 'phrases-ui') {
consoleLog.fatal('Invalid package name, expected `phrases` or `phrases-ui`');
if (packageName !== 'phrases' && packageName !== 'phrases-experience') {
consoleLog.fatal('Invalid package name, expected `phrases` or `phrases-experience`');
}
const instancePath = await inquireInstancePath(inputPath);

View file

@ -1,6 +1,6 @@
import { languages } from '@logto/language-kit';
import { isBuiltInLanguageTag as isPhrasesBuiltInLanguageTag } from '@logto/phrases';
import { isBuiltInLanguageTag as isPhrasesUiBuiltInLanguageTag } from '@logto/phrases-ui';
import { isBuiltInLanguageTag as isPhrasesUiBuiltInLanguageTag } from '@logto/phrases-experience';
import PQueue from 'p-queue';
import type { CommandModule } from 'yargs';
@ -39,7 +39,7 @@ const sync: CommandModule<{ path?: string }, { path?: string }> = {
if (isPhrasesUiBuiltInLanguageTag(languageTag)) {
await syncTranslation({
...baseOptions,
packageName: 'phrases-ui',
packageName: 'phrases-experience',
languageTag,
});
}

View file

@ -43,7 +43,7 @@ export const readBaseLocaleFiles = async (directory: string): Promise<string[]>
export type TranslationOptions = {
instancePath: string;
packageName: 'phrases' | 'phrases-ui';
packageName: 'phrases' | 'phrases-experience';
languageTag: LanguageTag;
verbose?: boolean;
queue?: PQueue;

View file

@ -275,13 +275,13 @@ export const lintLocaleFiles = async (
/** Logto instance path */
instancePath: string,
/** Target package name, ignore to lint both packages */
packageName?: 'phrases' | 'phrases-ui'
packageName?: 'phrases' | 'phrases-experience'
) => {
const spinner = ora({
text: 'Running `eslint --fix` for locales',
}).start();
const targetPackages = packageName ? [packageName] : ['phrases', 'phrases-ui'];
const targetPackages = packageName ? [packageName] : ['phrases', 'phrases-experience'];
await Promise.all(
targetPackages.map(async (packageName) => {

View file

@ -31,7 +31,7 @@
"@logto/core-kit": "workspace:^2.0.1",
"@logto/language-kit": "workspace:^1.0.0",
"@logto/phrases": "workspace:^1.4.1",
"@logto/phrases-ui": "workspace:^1.2.0",
"@logto/phrases-experience": "workspace:^1.2.0",
"@logto/react": "^2.1.0",
"@logto/schemas": "workspace:^1.8.0",
"@logto/shared": "workspace:^2.0.0",

View file

@ -1,5 +1,5 @@
import type { LanguageTag } from '@logto/language-kit';
import { builtInLanguages as builtInUiLanguages } from '@logto/phrases-ui';
import { builtInLanguages as builtInUiLanguages } from '@logto/phrases-experience';
import { deduplicate } from '@silverhand/essentials';
import { useCallback, useMemo } from 'react';
import useSWR from 'swr';

View file

@ -1,7 +1,7 @@
import type { LanguageTag } from '@logto/language-kit';
import { languages as uiLanguageNameMapping } from '@logto/language-kit';
import resource, { isBuiltInLanguageTag } from '@logto/phrases-ui';
import en from '@logto/phrases-ui/lib/locales/en';
import resource, { isBuiltInLanguageTag } from '@logto/phrases-experience';
import en from '@logto/phrases-experience/lib/locales/en';
import type { SignInExperience, Translation } from '@logto/schemas';
import cleanDeep from 'clean-deep';
import deepmerge from 'deepmerge';

View file

@ -1,4 +1,4 @@
import en from '@logto/phrases-ui/lib/locales/en';
import en from '@logto/phrases-experience/lib/locales/en';
import type { Translation } from '@logto/schemas';
export const flattenTranslation = (

View file

@ -37,7 +37,7 @@
"@logto/demo-app": "workspace:*",
"@logto/language-kit": "workspace:^1.0.0",
"@logto/phrases": "workspace:^1.4.1",
"@logto/phrases-ui": "workspace:^1.2.0",
"@logto/phrases-experience": "workspace:^1.2.0",
"@logto/schemas": "workspace:^1.8.0",
"@logto/shared": "workspace:^2.0.0",
"@logto/ui": "workspace:*",

View file

@ -1,4 +1,4 @@
import resource from '@logto/phrases-ui';
import resource from '@logto/phrases-experience';
import { type CustomPhrase } from '@logto/schemas';
import deepmerge from 'deepmerge';

View file

@ -1,5 +1,5 @@
import type { LocalePhrase } from '@logto/phrases-ui';
import resource, { isBuiltInLanguageTag } from '@logto/phrases-ui';
import type { LocalePhrase } from '@logto/phrases-experience';
import resource, { isBuiltInLanguageTag } from '@logto/phrases-experience';
import { trySafe } from '@silverhand/essentials';
import cleanDeep from 'clean-deep';
import deepmerge from 'deepmerge';

View file

@ -1,5 +1,5 @@
import type { LanguageTag } from '@logto/language-kit';
import { builtInLanguages } from '@logto/phrases-ui';
import { builtInLanguages } from '@logto/phrases-experience';
import type { CreateSignInExperience, SignInExperience } from '@logto/schemas';
import {

View file

@ -1,4 +1,4 @@
import { builtInLanguages } from '@logto/phrases-ui';
import { builtInLanguages } from '@logto/phrases-experience';
import type { ConnectorMetadata, LanguageInfo } from '@logto/schemas';
import { ConnectorType } from '@logto/schemas';
import { deduplicate } from '@silverhand/essentials';

View file

@ -1,4 +1,4 @@
import en from '@logto/phrases-ui/lib/locales/en/index.js';
import en from '@logto/phrases-experience/lib/locales/en/index.js';
import { type CustomPhrase, type SignInExperience } from '@logto/schemas';
import { pickDefault, createMockUtils } from '@logto/shared/esm';

View file

@ -1,5 +1,5 @@
import { languageTagGuard } from '@logto/language-kit';
import resource from '@logto/phrases-ui';
import resource from '@logto/phrases-experience';
import type { Translation } from '@logto/schemas';
import { CustomPhrases, translationGuard } from '@logto/schemas';
import cleanDeep from 'clean-deep';

View file

@ -1,4 +1,4 @@
import en from '@logto/phrases-ui/lib/locales/en/index.js';
import en from '@logto/phrases-experience/lib/locales/en/index.js';
import type { SignInExperience } from '@logto/schemas';
import { pickDefault } from '@logto/shared/esm';

View file

@ -1,4 +1,4 @@
import zhCN from '@logto/phrases-ui/lib/locales/zh-cn/index.js';
import zhCN from '@logto/phrases-experience/lib/locales/zh-cn/index.js';
import type { CustomPhrase, SignInExperience } from '@logto/schemas';
import { pickDefault, createMockUtils } from '@logto/shared/esm';

View file

@ -1,4 +1,4 @@
import { isBuiltInLanguageTag } from '@logto/phrases-ui';
import { isBuiltInLanguageTag } from '@logto/phrases-experience';
import { adminTenantId } from '@logto/schemas';
import { conditionalArray } from '@silverhand/essentials';
import { z } from 'zod';

View file

@ -1,5 +1,5 @@
import en from '@logto/phrases-ui/lib/locales/en/index.js';
import fr from '@logto/phrases-ui/lib/locales/fr/index.js';
import en from '@logto/phrases-experience/lib/locales/en/index.js';
import fr from '@logto/phrases-experience/lib/locales/fr/index.js';
import { isStrictlyPartial } from '#src/utils/translation.js';

View file

@ -0,0 +1,3 @@
# `@logto/phrases-experience`
See [the main README](../../README.md) for more information.

View file

@ -1,7 +1,7 @@
{
"name": "@logto/phrases-ui",
"name": "@logto/phrases-experience",
"version": "1.2.0",
"description": "Logto shared phrases (i18n) for main flow.",
"description": "Logto shared phrases (i18n) for experience.",
"author": "Silverhand Inc. <contact@silverhand.io>",
"homepage": "https://github.com/logto-io/logto#readme",
"license": "MPL-2.0",

Some files were not shown because too many files have changed in this diff Show more