{"id":31551356,"url":"https://github.com/betomorrow/clean-wording","last_synced_at":"2025-10-04T18:42:01.843Z","repository":{"id":234443644,"uuid":"788903794","full_name":"BeTomorrow/clean-wording","owner":"BeTomorrow","description":"Utility for cleaning up unused wordings","archived":false,"fork":false,"pushed_at":"2024-05-29T15:11:02.000Z","size":187,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-26T19:04:32.865Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeTomorrow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-19T10:10:27.000Z","updated_at":"2024-05-29T15:11:06.000Z","dependencies_parsed_at":"2024-04-22T11:46:57.123Z","dependency_job_id":null,"html_url":"https://github.com/BeTomorrow/clean-wording","commit_stats":null,"previous_names":["bderrien/clean-wording","betomorrow/clean-wording"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/BeTomorrow/clean-wording","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeTomorrow%2Fclean-wording","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeTomorrow%2Fclean-wording/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeTomorrow%2Fclean-wording/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeTomorrow%2Fclean-wording/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeTomorrow","download_url":"https://codeload.github.com/BeTomorrow/clean-wording/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeTomorrow%2Fclean-wording/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278358488,"owners_count":25973946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-04T18:41:56.672Z","updated_at":"2025-10-04T18:42:01.815Z","avatar_url":"https://github.com/BeTomorrow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clean-Wording\n\n## Description\n\nUtility for cleaning up unused wordings.\n\n## Create configuration\n\nCreate wording config file named for exemple '.clean_wording_config.json' at your project root location.\n\nAll required config :\n\n```\n{\n    \"projectSourcePath\": \"\u003cpath_to_source_files\u003e\",\n    \"projectSourceParser\": {\n        \"parser\": [\n            { \"type\":\"match\", \"regex\": \"\u003cregex\u003e\" },\n        ]\n    },\n    \"wordingsSource\": \"\u003cpath_to_source_wordings_file_or_url\u003e\",\n}\n```\n\nAll configs :\n\n```\n{\n    \"projectSourcePath\": \"\u003cpath_to_source_files\u003e\",\n    \"projectSourceParser\": {\n        \"parser\": [\n            {\n                \"type\": \"\u003cmatch/replace\u003e\",\n                \"regex\": \"\u003cregex_1_1\u003e\",\n                \"position\": \u003cmatch__extract_value_index_default_1\u003e,\n                \"by\": \"\u003creplace__value_default_empty\u003e\",\n                \"post_regex\": {\n                    \"type\":\"\u003cmatch/replace\u003e\",\n                    \"regex\": \"\u003cregex_1_2\u003e\",\n                    \"post_regex\": {\n                        ...\n                    }\n                }\n            },\n            ...\n        ],\n        onlyFilesWithExtensions: [\"\u003cextension_1\u003e\", ...]\n    },\n    \"wordingsSource\": \"\u003cpath_to_source_wordings_file_or_url\u003e\",\n    \"wordingsSourceParser\": {\n        \"replaces\": [\n            { \"regex\": \"\u003cregex\u003e\", \"by\": \"\u003cvalue_default_empty\u003e\" },\n            ...\n        ],\n    },\n    \"compare\" : {\n        \"dynamicRegexValue\": \"\u003cregex\u003e\"\n    }\n}\n```\n\nExemple for a React project (simple) :\n\n```\n{\n    \"projectSourcePath\": \"src/\",\n    \"projectSourceParser\": {\n        \"parser\": [{ \"type\": \"match\", \"regex\": \"i18n\\\\.t\\\\(\\\"((.|\\n)+?)\\\"\" }]\n    },\n    \"wordingsSource\": \"assets/strings/map.json\",\n    \"wordingsSourceParser\": {\n        \"replaces\": [\n            {\n                \"_comment\": \"remove .zero \u0026 .one \u0026 .other\",\n                \"regex\": \"(.zero|.one|.other)$\"\n            }\n        ]\n    }\n}\n```\n\nExemple for a React project (more complexe -\u003e trying to manage dynamic wordings) :\n\n```\n{\n  \"projectSourcePath\": \"src/\",\n  \"projectSourceParser\": {\n    \"parser\": [\n      {\n        \"_comment\": \"match all I18n.t(*)\",\n        \"type\": \"match\",\n        \"regex\": \"I18n\\\\.t\\\\(((?:[^()]*|\\\\((?:[^()]*|\\\\([^()]*\\\\))*\\\\))*)\\\\)\",\n        \"post_regex\": {\n          \"_comment\": \"match all \\\"*\\\" \",\n          \"type\": \"match\",\n          \"regex\": \"(?:\\\"|`|')(.*?)(?:\\\"|`|')\",\n          \"post_regex\": {\n            \"_comment\": \"replace dynamic value by *\",\n            \"type\": \"replace\",\n            \"regex\": \"(\\\\${.*})\",\n            \"by\": \"*\",\n            \"post_regex\": {\n              \"_comment\": \"keep only valid wordings because previous regex can have bad values\",\n              \"type\": \"replace\",\n              \"regex\": \"^.*[^a-zA-Z0-9._\\\\-*].*$\",\n            }\n          }\n        }\n      }\n    ]\n  },\n  \"wordingsSource\": \"assets/strings/EN-en.json\"\n  \"wordingsSourceParser\": {\n        \"replaces\": [\n            {\n                \"_comment\": \"remove wordings used only for config, store, ...\",\n                \"regex\": \"(NSCameraUsageDescription)|\u003c...\u003e\"\n            }\n        ]\n    }\n  \"compare\" : {\n    \"dynamicRegexValue\": \"\\\\*\"\n  }\n}\n```\n\nExemple for a Flutter project :\n\n```\n{\n    \"projectSourcePath\": \"lib/src/\",\n    \"projectSourceParser\": {\n        \"parser\": [\n            { \"type\": \"match\", \"regex\": \"context\\\\.curLocalizations\\\\.([a-zA-Z0-9_]+)\" },\n            { \"type\": \"match\", \"regex\": \"AppLocalizations\\\\.of\\\\(context\\\\)!?\\\\.([a-zA-Z0-9_]+)\" }\n        ]\n    },\n    \"wordingsSource\": \"lib/asset/translations/intl_fr.arb\",\n    \"wordingsSourceParser\": {\n        \"replaces\": [\n            {\n                \"_comment\": \"remove all keys begining by @\",\n                \"regex\": \"^@.*\"\n            }\n        ]\n    }\n}\n```\n\n## Integration \u0026 Run\n\n### React\n\nInstall it as dev dependencies\n\n```\n# With npm\n\nnpm install @betomorrow/clean-wording --save-dev\n\n# With yarn\n\nyarn add @betomorrow/clean-wording --save-dev\n```\n\nAdd scripts lines to invoke tools easily with npm in package.json\n\n```\n{\n    \"scripts\": {\n        \"clean-wording\": \"clean-wording -c .clean_wording_config.json\"\n    }\n}\n```\n\n### Flutter\n\nUse directly this command\n\n```\nnpx -p @betomorrow/clean-wording clean-wording -c .clean_wording_config.json\n```\n\n## Command options\n\n```\nOptions:\n    -c, --config \u003cpath\u003e                [Required] Path on config json file (ex: .clean_wording_config.json)\n    -sp, --showAllProjectWordingKeys   Show all detected project wording-keys\n    -sf, --showAllFileWordingKeys      Show all detected file wording-keys\n    -spo, --showOrphanProjectKeys      Show project wording-keys not present in the file wording-keys\n    -sfo, --showOrphanFileWordingKeys  [Default] Show file wording-keys not present in the project wording-keys\n    -v, --verbose                      show verbose logs\n    -h, --help                         display help for command\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetomorrow%2Fclean-wording","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetomorrow%2Fclean-wording","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetomorrow%2Fclean-wording/lists"}