{"id":22699836,"url":"https://github.com/enactjs/jsdoc-to-ts","last_synced_at":"2025-04-13T05:51:44.693Z","repository":{"id":39614725,"uuid":"154889382","full_name":"enactjs/jsdoc-to-ts","owner":"enactjs","description":"A tool to convert jsdoc to typescript definition files","archived":false,"fork":false,"pushed_at":"2024-07-26T01:27:12.000Z","size":774,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":77,"default_branch":"master","last_synced_at":"2024-08-28T09:07:19.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/enactjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null}},"created_at":"2018-10-26T20:15:26.000Z","updated_at":"2024-08-15T04:04:08.000Z","dependencies_parsed_at":"2023-02-18T07:50:39.565Z","dependency_job_id":"484f9aa8-2051-42d3-ace5-5d5db10bdd9f","html_url":"https://github.com/enactjs/jsdoc-to-ts","commit_stats":{"total_commits":82,"total_committers":12,"mean_commits":6.833333333333333,"dds":0.6097560975609756,"last_synced_commit":"cc731541d5f9b9dcc86e38232b53d48880330fd8"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enactjs%2Fjsdoc-to-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enactjs%2Fjsdoc-to-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enactjs%2Fjsdoc-to-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enactjs%2Fjsdoc-to-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enactjs","download_url":"https://codeload.github.com/enactjs/jsdoc-to-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670504,"owners_count":21142901,"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":[],"created_at":"2024-12-10T06:08:51.209Z","updated_at":"2025-04-13T05:51:44.682Z","avatar_url":"https://github.com/enactjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## @enact/jsdoc-to-ts [![NPM](https://img.shields.io/npm/v/@enact/jsdoc-to-ts.svg?style=flat-square)](https://www.npmjs.com/package/@enact/jsdoc-to-ts)\n\n\u003e Converts JSDoc comments into TypeScript d.ts files\n\n\u003e Note. It's an experimental module.\n\n### Installation\n\n```\nnpm install --save-dev @enact/jsdoc-to-ts\n```\n\n## Usage\n\nAssuming this directory is a peer of the Enact source, and you want to write this into an installed (from npm) version of enact:\n\n```bash\nnode -e \"import('./index.js').then(({default: jsdocToTs}) =\u003e {\n  ['core', 'ui', 'moonstone', 'i18n', 'webos', 'spotlight'].forEach(p =\u003e jsdocToTs({\n    package: '../enact/packages/' + p,\n    output: require('fs').writeFileSync,\n    ignore: ['node_modules', 'ilib'],\n    importMap: {\n      ui: '@enact/ui',\n      moonstone: '@enact/moonstone',\n      core: '@enact/core',\n      webos: '@enact/webos',\n      spotlight: '@enact/spotlight',\n      i18n: '@enact/i18n'\n    },\n    outputPath: '\u003cpath to installation\u003e/node_modules/@enact/' + p\n  }))\n})\"\n```\nNOTE: Replace `\u003cpath to installation\u003e` with the directory you wish to update. The script requires at least Node.js 13.2.0. or later.\n\n**IMPORTANT:** jsdoc-to-ts 1.0.0 is the ESM. After upgrading from 0.1.x, please change the previous command as follows.\n```bash\n// Before\nnode -e \"['core', 'ui', 'moonstone', 'i18n', 'webos', 'spotlight'].forEach(p =\u003e require('.')({\n  ...\n}))\" \"(path of jsdoc-to-ts)\"\n\n// After\nnode -e \"import('(path of jsdoc-to-ts)/index.js').then(({default: jsdocToTs}) =\u003e {\n  ['core', 'ui', 'moonstone', 'i18n', 'webos', 'spotlight'].forEach(p =\u003e jsdocToTs({\n    ...\n})\"\n```\n\n## Working with Linked Enact\n\nThe following command will parse the Enact source into a local `types` directory, so you can use TypeScript with linked Enact:\n\n```bash\nnode -e \"import('./index.js').then(({default: jsdocToTs}) =\u003e {\n    ['core', 'ui', 'moonstone', 'i18n', 'webos', 'spotlight'].forEach(p =\u003e jsdocToTs({\n    package: '\u003cpath to enact\u003e/packages/' + p,\n    output: (filepath, content) =\u003e {\n      const path = require('path');\n      const dir = path.dirname(filepath);\n      const wfs = require('fs').writeFileSync;\n      // recursively create the path to the folder in types\n      require('mkdirp').sync(dir);\n      // write a package.json with a types member pointing to the .d.ts file\n      wfs(path.join(dir, 'package.json'), '{\\\"types\\\": \\\"' + path.basename(filepath) + '\\\"}');\n      // write the .d.ts file\n      wfs(filepath, content);\n    },\n    importMap: {\n      ui: '@enact/ui',\n      moonstone: '@enact/moonstone',\n      core: '@enact/core',\n      webos: '@enact/webos',\n      spotlight: '@enact/spotlight',\n      i18n: '@enact/i18n'\n    },\n    outputPath: '\u003cpath to installation\u003e/types/@enact/' + p\n  }))\n})\"\n```\nNOTE: You may need to install `mkdirp` module in `jsdoc-to-ts` by yourself.\n\nYou also have to configure the app to resolve the generated typings by adding the following to the `tsconfig.json`.\n\n```\n    \"compilerOptions\": {\n        \"baseUrl\": \".\",\n        \"paths\": {\n            \"*\": [\n                \"*\",\n                \"types/*\"\n            ]\n        }\n    }\n```\n\n## Usage with cli option on installation path\n\nAssuming jsdoc-to-ts is installed and linked globally on the current device, and we want to run the command in one of the installed Enact packages (core, ui, i18n, etc.) folder:\n\n```bash\njsdoc-to-ts --ignore='[\"node_modules\", \"ilib\", \"build\", \"docs\", \"tests\", \"samples\"]' --importMap='{\"core\":\"@enact/core\",\"ui\":\"@enact/ui\",\"spotlight\":\"@enact/spotlight\",\"i18n\":\"@enact/i18n\",\"webos\":\"@enact/webos\",\"moonstone\":\"@enact/moonstone\",\"agate\":\"@enact/agate\",\"sandstone\":\"@enact/sandstone\"}' --outputPath='.'\n```\n\n## Assumptions\n\nMany assumptions, currently:\n\n* Modules will be the root level component (documented with `@module`).\n* Higher-order components will be documented with `@hoc` tag (documenting the parameters and returns of the hoc should result in successful conversion, too).\n* Assumes you're using React and will inject React import into everything.\n\n### Copyright and License Information\n\nUnless otherwise specified, all content, including all source code files and\ndocumentation files in this repository are:\n\nCopyright (c) 2018-2024 LG Electronics\n\nUnless otherwise specified or set forth in the NOTICE file, all content,\nincluding all source code files and documentation files in this repository are:\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this content except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenactjs%2Fjsdoc-to-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenactjs%2Fjsdoc-to-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenactjs%2Fjsdoc-to-ts/lists"}