Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Does not support Prettier 3 #169

Closed
1 task done
austinw-fineart opened this issue Oct 25, 2023 · 3 comments
Closed
1 task done

Bug: Does not support Prettier 3 #169

austinw-fineart opened this issue Oct 25, 2023 · 3 comments

Comments

@austinw-fineart
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is this a regression?

No

Current behavior

Failed to run prettier prettier.resolveConfig.sync is not a function
This function was removed as of Prettier 3.0
https://prettier.io/blog/2023/07/05/3.0.0.html

Expected behavior

#79

Please provide a link to a minimal reproduction of the bug

N/A

Transloco Config

No response

Debug Logs

No response

Please provide the environment you discovered this bug in

Transloco: 5.0.7
Transloco Keys Manager: 3.8.0
Angular: 16.2.10
Node: 18.18.0
Package Manager: npm 10.2.1
OS: Windows 11 (22H2)

Additional context

No response

I would like to make a pull request for this bug

No

@bartholomej
Copy link

Just for the record: This issue is resolved because the repository uses the current prettier 3.2+

BUT just make sure you don't have the older "@ngneat/transloco-keys-manager" package installed at the same time, then you might get this error.

Solution:

  1. Remove @ngneat/transloco-keys-manager completely
  2. Migrate all imports to @jsverse/transloco-keys-manager (including marker and other stuff)

@shaharkazaz
Copy link
Collaborator

@bartholomej Thanks, it's probably ok starting from v4.

@KingDarBoja
Copy link

KingDarBoja commented Aug 2, 2024

Still issue is still showing even if using latest version (5.0.0) as the prettier resolveConfig function is being called at run-prettier.ts file.

> transloco-keys-manager extract --config transloco.config.ts


Starting Translation Files Build 👷🏗

- Extracting Template and Component Keys 🗝
✔ Extracting Template and Component Keys 🗝
ℹ 3 keys were found in 14 files.
Failed to run prettier prettier.resolveConfig is not a function

              🌵 Done! 🌵

EDIT 1: This was caused due to how I setup the config via NX workspaces where now my transloco config for the keys manager is as follows:

/** This is used for the transloco-keys-manager lib. */
import { TranslocoGlobalConfig } from '@jsverse/transloco-utils';

const config: TranslocoGlobalConfig = {
  // rootTranslationsPath: 'src/assets/i18n/',
  langs: ['en', 'fr', 'es'],
  keysManager: {
    // input: ['src/app'],
    // output: 'src/assets/i18n',
    /** @ts-ignore: Somehow the type doesnt have it. */
    sort: true,
    /** @ts-ignore: Somehow the type doesnt have it. */
    unflat: true,
  },
};

export default config;

And the command is ran via project.json with nx:run-commands option:

{
    "i18n-extract": {
      "executor": "nx:run-commands",
      "outputs": [],
      "options": {
        "command": "transloco-keys-manager extract --project dashboard"
      }
    },
    "i18n-find": {
      "executor": "nx:run-commands",
      "outputs": [],
      "options": {
        "command": "transloco-keys-manager find --project dashboard"
      }
    }
}

The issue was generated if you used the cwd option at the nx:run-commands configuration.

So everything works fine 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants