{"id":15415846,"url":"https://github.com/davidje13/neutrino-typescript","last_synced_at":"2025-04-19T14:24:06.461Z","repository":{"id":57310446,"uuid":"195529693","full_name":"davidje13/neutrino-typescript","owner":"davidje13","description":"Transpiles TypeScript as part of the build process.","archived":false,"fork":false,"pushed_at":"2020-11-25T19:34:59.000Z","size":41,"stargazers_count":8,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T08:32:59.414Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/davidje13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-06T11:01:31.000Z","updated_at":"2023-11-02T14:23:34.000Z","dependencies_parsed_at":"2022-09-08T05:41:35.849Z","dependency_job_id":null,"html_url":"https://github.com/davidje13/neutrino-typescript","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2Fneutrino-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2Fneutrino-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2Fneutrino-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2Fneutrino-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidje13","download_url":"https://codeload.github.com/davidje13/neutrino-typescript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249712032,"owners_count":21314347,"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-10-01T17:10:01.420Z","updated_at":"2025-04-19T14:24:06.413Z","avatar_url":"https://github.com/davidje13.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neutrino Typescript\n\nTranspiles TypeScript as part of the build process.\n\nThis follows the configuration suggested in\n[the official TypeScript / Babel announcement](https://devblogs.microsoft.com/typescript/typescript-and-babel-7/).\n\n## Installation\n\n1. Install dependencies:\n\n   ```bash\n   npm install --save-dev neutrinojs-typescript typescript\n   ```\n\n   (note that `neutrino-typescript` in NPM - without `js` - is an unrelated package which is unmaintained).\n\n2. Include in `.neutrinorc.js`:\n\n   ```javascript\n   const typescript = require('neutrinojs-typescript');\n   // ...\n\n   module.exports = {\n     use: [\n       typescript(), // must be first in use section\n       // ...\n       node(), // or whichever target you are using\n     ],\n   };\n   ```\n\n3. Include type checking in `package.json` scripts:\n\n   ```json\n   {\n     \"scripts\": {\n       \"prebuild\": \"rewrite-tsconfig\",\n       \"prelint\": \"rewrite-tsconfig\",\n       \"lint\": \"tsc\"\n     }\n   },\n   ```\n\n   To combine this with other linting steps, you can join the commands like so:\n\n   ```json\n   {\n     \"scripts\": {\n       \"prebuild\": \"rewrite-tsconfig\",\n       \"prelint\": \"rewrite-tsconfig\",\n       \"lint\": \"existing lint command \u0026\u0026 tsc\"\n     }\n   },\n   ```\n\n4. Run `npm run lint` to create the initial `tsconfig.json` file and test the\n   integration.\n\n### tsconfig.json\n\nA `tsconfig.json` file will be generated automatically by `rewrite-tsconfig`\nand should be included in your repository. It does not have to be included\n(the `prelint` script will generate it when needed), but including it is\nrecommended because many IDEs will look for it to configure their own type\nchecking.\n\nIf you prefer managing `tsconfig.json` yourself, simply remove\n`rewrite-tsconfig` from your NPM scripts. You will need to ensure it remains\ncompatible with the webpack / babel configuration in `.neutrinorc.js`.\n\nIf you prefer using [tsconfig.js](https://www.npmjs.com/package/tsconfig.js)\n(or a similar tsconfig-as-code tool), remove `rewrite-tsconfig` from your\nNPM scripts and set the content of `tsconfig.js` to:\n\n```javascript\nconst neutrino = require('neutrino');\n\nmodule.exports = neutrino().tsconfig();\n```\n\n### Customisation\n\nSince `rewrite-tsconfig` replaces any `tsconfig.json` file in the project\ndirectory. You should specify customisations in `.neutrinorc.js` instead:\n\n```javascript\nconst typescript = require('neutrinojs-typescript');\n\nmodule.exports = {\n  use: [\n    typescript({ tsconfig: {\n      compilerOptions: {\n        strict: true,\n        allowJs: true,\n        importsNotUsedAsValues: 'remove', // legacy behaviour\n        typeRoots: [\n          'src/types', // custom types directory\n          'node_modules/@types',\n        ],\n      },\n      include: ['some-other-dir'], // sources and tests are included by default\n    } }),\n  ],\n};\n```\n\nSome settings cannot be customised due to babel compatibility requirements.\nIf you attempt to change those settings, they will be ignored and a warning\nwill be printed.\n\n### Generating declaration (`.d.ts`) files\n\nIf you are creating a library, you probably want to include a `.d.ts` file.\nThis can be turned on by specifying `declaration: true` as normal in the\ntsconfig options:\n\n```javascript\nconst typescript = require('neutrinojs-typescript');\n\nmodule.exports = {\n  use: [\n    typescript({ tsconfig: {\n      compilerOptions: {\n        declaration: true,\n        declarationMap: true, // defaults to true\n      },\n    } }),\n  ],\n};\n```\n\nOne declaration file will be generated for each entrypoint you have specified\nin `mains`. The file will be named to match the input file (for default\nneutrino configuration, this means you will get `build/index.d.ts`).\n\n## Linting with ESLint\n\nIf you want to use eslint with typescript, you can install the\n[neutrinojs-typescript-eslint](https://github.com/davidje13/neutrino-typescript-eslint#readme) module.\n\n## Testing with Jest\n\nThis will work out-of-the-box with Jest, but you will need to install the Jest types:\n\n```bash\nnpm install --save-dev @types/jest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidje13%2Fneutrino-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidje13%2Fneutrino-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidje13%2Fneutrino-typescript/lists"}