{"id":17910897,"url":"https://github.com/sudongyuer/unxlsx","last_synced_at":"2025-03-23T22:33:15.733Z","repository":{"id":44557739,"uuid":"512830032","full_name":"sudongyuer/unxlsx","owner":"sudongyuer","description":"🌸 A cli can automatically generate files from Excel files.","archived":false,"fork":false,"pushed_at":"2022-08-29T17:02:04.000Z","size":174,"stargazers_count":25,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T23:44:24.460Z","etag":null,"topics":["cli","excel","generator","xlsx"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sudongyuer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"sudongyuer"}},"created_at":"2022-07-11T16:23:53.000Z","updated_at":"2023-12-07T08:11:22.000Z","dependencies_parsed_at":"2022-09-06T10:40:48.865Z","dependency_job_id":null,"html_url":"https://github.com/sudongyuer/unxlsx","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funxlsx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funxlsx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funxlsx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funxlsx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sudongyuer","download_url":"https://codeload.github.com/sudongyuer/unxlsx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245179528,"owners_count":20573484,"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","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":["cli","excel","generator","xlsx"],"created_at":"2024-10-28T19:35:24.989Z","updated_at":"2025-03-23T22:33:15.448Z","avatar_url":"https://github.com/sudongyuer.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sudongyuer"],"categories":[],"sub_categories":[],"readme":"# unxlsx\n\nA cli can automatically generate files from Excel files.\n\n[![NPM version](https://img.shields.io/github/package-json/v/sudongyuer/unxlsx)](https://www.npmjs.com/package/unxlsx)\n\n\n\u003cp align='center'\u003e\n\u003cimg src='https://git.poker/sudongyuer/image-bed/blob/master/20220712/unxlsx.2tc3vjrbqla0.png?raw=true' width='200'/\u003e\n\u003c/p\u003e\n\n## Why\n\nWe often need to export some information from `XLSX` to generate our files, such as `multi-language`, such as `error message copywriting`, such as project `translation copywriting`, when we need `unxlsx` to help us automatically generate\n\n## Features\n\n- Multiple xlsx support\n- Custom filed key support\n- Custom filed value support\n- Automatic generation of files if the file does not exist\n- Typescript support config file\n- ✨ support `{}` slot in the filed value\n\n## Usage\n\n### Install\n\n```bash\npnpm add -D unxlsx\n```\n\n### Config `generate.config.ts`\n\n- xlsxDir (require) : xlsx file directory base on `process.cwd()`\n\n- files (require) : all the files you want to generate\n  - key (require) : the key in the xlsx file\n  - value (require) : the value in the xlsx file\n  - outPutFileDir (require) : the file you want to generate to\n\n```js\nimport { defineGenerateConfig } from 'unxlsx/utils'\nexport default defineGenerateConfig({\n  xlsxDirs: [\n    {\n      xlsxDir: './xxx1.xlsx',\n      files: [\n        {\n          key: 'key1',\n          value: 'value1',\n          outPutFileDir: './src/generate/file1.ts',\n        },\n        {\n          key: 'key2',\n          value: 'value2',\n          outPutFileDir: './src/generate/file2.ts',\n        },\n      ],\n    },\n    {\n      xlsxDir: './xxx2.xlsx',\n      files: [\n        {\n          key: '后端接口错误码',\n          value: '中文文案对照',\n          outPutFileDir: './src/generate/file3.ts',\n        },\n        {\n          key: '后端接口错误码',\n          value: '英文文案',\n          outPutFileDir: './src/generate/file4.ts',\n        },\n      ],\n    },\n  ],\n})\n```\n\n### Generate `\u003cfileName\u003e.ts`\n\n```bash\npnpm run unxlsx\n```\n\n### UseSlot Demo\n- `EnTranslate` was the object that describes the information in the xlsx file\n- `EnTranslateKeys` was the array that describes the `EnTranslate` keys\n- `getEnTranslate` you can get the value you want to use in the file\n- `@/constant/EnTranslate` was the directory of the generated file directory\n- above code all generated by unxlsx\n\n`In react jsx`\n```jsx\nimport EnTranslate, { EnTranslateKeys, getEnTranslate } from '@/constant/EnTranslate'\n\n//...\nreturn (\n    \u003c\u003e\n      {/* normal use */}\n      \u003cp\u003e\n        {getEnTranslate(EnTranslateKeys.xxx1)}\n      \u003c/p\u003e\n      {/* use slot */}\n      \u003cp\u003e\n        {getEnTranslate(EnTranslateKeys.xxx2, 'slot1', 'slot2')}\n      \u003c/p\u003e\n    \u003c/\u003e\n)\n```\n\n## Author\n\nsudongyuer email:976499226@qq.com\n\n## License\n\n[MIT](./LICENSE) License © 2021 [SuDongYu](https://github.com/sudongyuer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudongyuer%2Funxlsx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudongyuer%2Funxlsx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudongyuer%2Funxlsx/lists"}