{"_id":"@anygridtech/frappe-ts-tools","_rev":"3-729d212153f18a30e05f7aa840f470ce","name":"@anygridtech/frappe-ts-tools","dist-tags":{"latest":"0.2.0"},"versions":{"0.0.2":{"name":"@anygridtech/frappe-ts-tools","version":"0.0.2","keywords":["frappe","typescript","build","esbuild","doctype"],"author":{"name":"AnyGridTech"},"license":"MIT","_id":"@anygridtech/frappe-ts-tools@0.0.2","maintainers":[{"name":"troyaks1","email":"LGOTCFG@gmail.com"}],"homepage":"https://github.com/anygridtech/frappe-ts-tools#readme","bugs":{"url":"https://github.com/anygridtech/frappe-ts-tools/issues"},"bin":{"frappe-build":"bin/frappe-build.js","frappe-watch":"bin/frappe-watch.js","frappe-typecheck":"bin/frappe-typecheck.js"},"dist":{"shasum":"d49c82644f5188f7563a360f4850dadf7f2f2bb2","tarball":"https://registry.npmjs.org/@anygridtech/frappe-ts-tools/-/frappe-ts-tools-0.0.2.tgz","fileCount":6,"integrity":"sha512-wnWL4urXiGMBTTTchFz4B5/POqPkTIUbYoHXjYsF5+g1zROBTmYT93dcIpwLUY5kzgOSFTiuF0EN9icOKAaaZQ==","signatures":[{"sig":"MEUCIQCUswgrvk24ky9EZiSYOUCxWxUM8qgH3z6jgQOAfLz3LwIgPlK1IyT88dqjozrBmmBEjrOy1vK80bFOMqg+LN3G35s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17102},"main":"lib/index.js","engines":{"node":">=18.0.0"},"gitHead":"327d1150c9d9287f7aca0a80886a482c26ce2ee2","_npmUser":{"name":"troyaks1","email":"LGOTCFG@gmail.com"},"repository":{"url":"git+https://github.com/anygridtech/frappe-ts-tools.git","type":"git"},"_npmVersion":"10.9.2","description":"Build tools for Frappe DocTypes with TypeScript","directories":{},"_nodeVersion":"22.15.0","dependencies":{"esbuild":"^0.25.11"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":">=5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/frappe-ts-tools_0.0.2_1761333425862_0.08276681374095474","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@anygridtech/frappe-ts-tools","version":"0.1.0","keywords":["frappe","typescript","build","esbuild","doctype"],"author":{"name":"AnyGridTech"},"license":"MIT","_id":"@anygridtech/frappe-ts-tools@0.1.0","maintainers":[{"name":"troyaks1","email":"LGOTCFG@gmail.com"}],"homepage":"https://github.com/anygridtech/frappe-ts-tools#readme","bugs":{"url":"https://github.com/anygridtech/frappe-ts-tools/issues"},"bin":{"frappe-build":"bin/frappe-build.js","frappe-watch":"bin/frappe-watch.js","frappe-typecheck":"bin/frappe-typecheck.js"},"dist":{"shasum":"b4f872e0953d86a7f244e1dd9c3d68957238c6c7","tarball":"https://registry.npmjs.org/@anygridtech/frappe-ts-tools/-/frappe-ts-tools-0.1.0.tgz","fileCount":6,"integrity":"sha512-16ZzH+BknY8hencHwC35rKGDAuorNkLQlkrui+d3cpFHrfkpZPigvA4+3kszM09n30ojWqx2yF9fDpmEGb+BPw==","signatures":[{"sig":"MEQCICc7vBNEUoA3divPyaYn7zMdjLszrZL8Oy2zzBAOhDktAiAlQOvMM2LdgNmAJbikBCFolf1J+jVmBVA8aMld4cY8xw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18164},"main":"lib/index.js","engines":{"node":">=18.0.0"},"gitHead":"cb482d520e369d3c5f27463518b3d7142197e305","_npmUser":{"name":"troyaks1","email":"LGOTCFG@gmail.com"},"repository":{"url":"git+https://github.com/anygridtech/frappe-ts-tools.git","type":"git"},"_npmVersion":"10.9.2","description":"Build tools for Frappe DocTypes with TypeScript","directories":{},"_nodeVersion":"22.15.0","dependencies":{"esbuild":"^0.25.11"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":">=5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/frappe-ts-tools_0.1.0_1761856192857_0.692500466663406","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anygridtech/frappe-ts-tools","version":"0.2.0","description":"Build tools for Frappe DocTypes with TypeScript","main":"lib/index.js","bin":{"frappe-build":"bin/frappe-build.js","frappe-watch":"bin/frappe-watch.js","frappe-typecheck":"bin/frappe-typecheck.js"},"keywords":["frappe","typescript","build","esbuild","doctype"],"author":{"name":"AnyGridTech"},"license":"MIT","dependencies":{"esbuild":"^0.25.11"},"peerDependencies":{"typescript":">=5.0.0"},"engines":{"node":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/anygridtech/frappe-ts-tools.git"},"_id":"@anygridtech/frappe-ts-tools@0.2.0","gitHead":"056be63b600c091b1f021d1664569b244aacee69","bugs":{"url":"https://github.com/anygridtech/frappe-ts-tools/issues"},"homepage":"https://github.com/anygridtech/frappe-ts-tools#readme","_nodeVersion":"22.15.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-+dX3c2vZctqMr3Vf4c5m2BccERRB6MKam6jfeqaK07oHAY4EWbnHHYHDBfJH0xsa+I5eIH6FJm0M1IUnugl7/g==","shasum":"27cf21d14dc4e4088fc77419c35ec4618a3e2f2b","tarball":"https://registry.npmjs.org/@anygridtech/frappe-ts-tools/-/frappe-ts-tools-0.2.0.tgz","fileCount":6,"unpackedSize":21590,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDcP88SgjJ3m9/3BDr21rDHEgmAThbWXbOIiuNkiJDgUwIgUrxhZ6w/xt7HprmTlUepS7te1WruOrbdHoCVDPDfNO8="}]},"_npmUser":{"name":"troyaks1","email":"LGOTCFG@gmail.com"},"directories":{},"maintainers":[{"name":"troyaks1","email":"LGOTCFG@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/frappe-ts-tools_0.2.0_1762951499801_0.24724602053357536"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-24T19:17:05.755Z","modified":"2025-11-12T12:45:00.489Z","0.0.2":"2025-10-24T19:17:06.046Z","0.1.0":"2025-10-30T20:29:53.057Z","0.2.0":"2025-11-12T12:44:59.969Z"},"bugs":{"url":"https://github.com/anygridtech/frappe-ts-tools/issues"},"author":{"name":"AnyGridTech"},"license":"MIT","homepage":"https://github.com/anygridtech/frappe-ts-tools#readme","keywords":["frappe","typescript","build","esbuild","doctype"],"repository":{"type":"git","url":"git+https://github.com/anygridtech/frappe-ts-tools.git"},"description":"Build tools for Frappe DocTypes with TypeScript","maintainers":[{"name":"troyaks1","email":"LGOTCFG@gmail.com"}],"readme":"# @anygridtech/frappe-ts-tools\r\n\r\nBuild tools for Frappe DocTypes with TypeScript support.\r\n\r\n## Features\r\n\r\n- 🚀 Fast bundling with esbuild\r\n- 👀 Watch mode for development\r\n- 🔍 TypeScript type-checking\r\n- 📦 Auto-discovers DocTypes with TypeScript\r\n- 📁 Compiles public TypeScript files (one-to-one, no bundling)\r\n- ⚡ Zero configuration needed\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install --save-dev @anygridtech/frappe-ts-tools typescript\r\n```\r\n\r\n## Configuration\r\n\r\nYou need a `tsconfig.json` file in your module's root directory (or in the directory with the `public/` folder). Here's a recommended configuration:\r\n\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"rootDir\": \".\",\r\n    \"outDir\": \"./js\",\r\n    \"module\": \"preserve\",\r\n    \"target\": \"ESNext\",\r\n    \"esModuleInterop\": false,\r\n    \"importHelpers\": false,\r\n    \"noEmitHelpers\": true,\r\n    \"verbatimModuleSyntax\": false,\r\n    \"types\": [\r\n      \"jquery\",\r\n      \"@anygridtech/frappe-agt-types\",\r\n      \"@anygridtech/frappe-types\"\r\n    ],\r\n    \"sourceMap\": false,\r\n    \"allowSyntheticDefaultImports\": true,\r\n    \"noUncheckedIndexedAccess\": true,\r\n    \"exactOptionalPropertyTypes\": true,\r\n    \"noImplicitReturns\": true,\r\n    \"noImplicitOverride\": true,\r\n    \"noUnusedLocals\": true,\r\n    \"noUnusedParameters\": true,\r\n    \"noFallthroughCasesInSwitch\": true,\r\n    \"noPropertyAccessFromIndexSignature\": true,\r\n    \"removeComments\": true,\r\n    \"strict\": true,\r\n    \"isolatedModules\": true,\r\n    \"noUncheckedSideEffectImports\": true,\r\n    \"moduleDetection\": \"force\"\r\n  },\r\n  \"include\": [\"ts/**/*.ts\", \"**/ts/**/*.ts\"],\r\n  \"exclude\": [\"node_modules\", \"**/__bundle_entry__.ts\"],\r\n  \"watchOptions\": {\r\n    \"watchFile\": \"fixedPollingInterval\",\r\n    \"watchDirectory\": \"fixedPollingInterval\",\r\n    \"fallbackPolling\": \"dynamicPriority\"\r\n  }\r\n}\r\n```\r\n\r\n**Note:** Adjust the `types` array according to your installed type packages.\r\n\r\n## Usage\r\n\r\n### Build all DocTypes\r\n\r\n```bash\r\nnpx frappe-build\r\n```\r\n\r\n### Watch mode (auto-rebuild on changes)\r\n\r\n```bash\r\nnpx frappe-watch\r\n```\r\n\r\n### Watch mode with type-checking\r\n\r\n```bash\r\nnpx frappe-watch --typecheck\r\n```\r\n\r\n### Type-check only\r\n\r\n```bash\r\nnpx frappe-typecheck\r\n```\r\n\r\n### Type-check in watch mode\r\n\r\n```bash\r\nnpx frappe-typecheck --watch\r\n```\r\n\r\n## Project Structure\r\n\r\nYour Frappe app should have this structure:\r\n\r\n```\r\nyour_app/\r\n├── your_module/\r\n│   └── doctype/\r\n│       └── your_doctype/\r\n│           ├── your_doctype.json\r\n│           ├── your_doctype.py\r\n│           ├── your_doctype.js  (output)\r\n│           └── ts/              (source)\r\n│               ├── onload.ts\r\n│               ├── refresh.ts\r\n│               └── ...\r\n├── public/                      (optional)\r\n│   ├── ts/                      (source)\r\n│   │   ├── utils.ts\r\n│   │   ├── api.ts\r\n│   │   └── ...\r\n│   └── js/                      (output)\r\n│       ├── utils.js\r\n│       ├── api.js\r\n│       └── ...\r\n├── tsconfig.json\r\n└── package.json\r\n```\r\n\r\n### DocType TypeScript (Bundled)\r\n\r\nPlace TypeScript files in `ts/` folder next to your DocType. All `.ts` files will be bundled into a single `<doctype_name>.js` file.\r\n\r\n### Public TypeScript (Individual Files)\r\n\r\nPlace TypeScript files in `public/ts/` folder. Each `.ts` file will be compiled to a corresponding `.js` file in `public/js/` folder **without bundling**. This is perfect for:\r\n- Utility libraries\r\n- Shared modules\r\n- API clients\r\n- Independent scripts\r\n\r\nExample: `public/ts/utils.ts` → `public/js/utils.js`\r\n\r\n## Optional: Add to package.json\r\n\r\nFor convenience, you can add scripts to your `package.json`:\r\n\r\n```json\r\n{\r\n  \"scripts\": {\r\n    \"build\": \"frappe-build\",\r\n    \"watch\": \"frappe-watch\",\r\n    \"typecheck\": \"frappe-typecheck\"\r\n  }\r\n}\r\n```\r\n\r\nThen run: `npm run watch`\r\n\r\n## How it works\r\n\r\n### DocType Compilation (Bundled)\r\n1. Scans your app for DocTypes with `ts/` folders\r\n2. Creates a temporary bundle entry that imports all `.ts` files\r\n3. Bundles with esbuild into `<doctype_name>.js`\r\n4. Cleans up temporary files\r\n\r\n### Public Folder Compilation (Individual)\r\n1. Scans your app for `public/ts/` folders\r\n2. Compiles each `.ts` file individually (no bundling)\r\n3. Outputs to `public/js/` folder maintaining the same filename\r\n4. Each TypeScript file becomes its own JavaScript file\r\n\r\nBoth modes run in parallel and support watch mode with optional TypeScript type-checking.\r\n\r\n## Requirements\r\n\r\n- Node.js >= 18\r\n- TypeScript >= 5.0\r\n- Frappe app structure\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md"}