Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sour-trainers-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rootapp/dolphin': patch
---

Fixed local dolphin.y[a]ml not automatically detected issue
7 changes: 1 addition & 6 deletions apps/cli/src/commands/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Arguments, ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
import { importLocalizations, loadConfig } from './core.js';

interface CmdArgs extends Arguments {
config: string;
config?: string;
bundlePath: string;
}

Expand All @@ -21,7 +21,6 @@ const cmd: CommandModule<{}, CmdArgs> = {
describe:
'Path to the config file. Will search dolphin.y[a]ml under root path if not specified',
type: 'string',
demandOption: true,
},
bundlePath: {
alias: 'p',
Expand Down Expand Up @@ -50,10 +49,6 @@ async function handleImportCommand(args: CmdArgs) {
logger.info('===================================');
logger.info('============= Importing ===========');
logger.info('===================================');
if (!args.config) {
spinner.fail(chalk.red('Config file path is not specified'));
return;
}
const config = await loadConfig({
path: args.config,
});
Expand Down
4 changes: 0 additions & 4 deletions packages/base/src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import { describe, expect, it } from 'vitest';
import { LocalizationFormat, parseConfig, parseConfigText } from '../config';

describe('Config Parser', () => {
it('should throw error when no config path provided', async () => {
await expect(parseConfig(undefined)).rejects.toThrow('Missing config file');
});

it('should throw error for invalid config path', async () => {
await expect(
parseConfig('/some-invalid/path/config.yml'),
Expand Down
8 changes: 1 addition & 7 deletions packages/base/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,7 @@ export async function parseConfigText({
}

export async function parseConfig(userConfigPath?: string): Promise<Config> {
let configPath = userConfigPath;
if (!configPath) {
throw new Error(
`Missing config file. You can either set using --config or put dolphin.y[a]ml under the root path of the project.`,
);
}
configPath = absoluteFilePath(configPath, process.cwd());
let configPath = absoluteFilePath(userConfigPath ?? '', process.cwd());
// Check if configPath is a directory
const stats = await fs.promises.stat(configPath);
if (stats.isDirectory()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/translate/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,6 @@ describe('mergeDolphinJsons', () => {
});

mergeDolphinJsons({ newJson, previousJson });
expect(newJson.strings.key1.localizations.ja.state).toBe('translated');
expect(newJson.strings.key1.localizations.ja.state).toBe('new');
});
});
5 changes: 1 addition & 4 deletions packages/translate/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ function getState({
);
if (isSourceDifferent) {
// if source changes, we consider it as new
if (newTargetUnit.state === 'undefined') {
return 'new';
}
return newTargetUnit.state;
return 'new';
}
const isTargetDifferent = newTargetUnit.value !== previousTargetUnit.value;
if (isTargetDifferent) {
Expand Down