{"id":15561442,"url":"https://github.com/jeevanjames/codewriter","last_synced_at":"2025-07-03T11:02:48.096Z","repository":{"id":57202542,"uuid":"104795247","full_name":"JeevanJames/codewriter","owner":"JeevanJames","description":"Fluent Node library for generating code blocks.","archived":false,"fork":false,"pushed_at":"2019-12-16T17:32:38.000Z","size":82,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-22T23:40:08.374Z","etag":null,"topics":["builder","code","code-builder","code-generator","code-writer","code-writing","generator","writer"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JeevanJames.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":"2017-09-25T19:50:45.000Z","updated_at":"2019-12-16T17:32:40.000Z","dependencies_parsed_at":"2022-09-15T13:21:04.017Z","dependency_job_id":null,"html_url":"https://github.com/JeevanJames/codewriter","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/JeevanJames/codewriter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2Fcodewriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2Fcodewriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2Fcodewriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2Fcodewriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JeevanJames","download_url":"https://codeload.github.com/JeevanJames/codewriter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2Fcodewriter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263314102,"owners_count":23447290,"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":["builder","code","code-builder","code-generator","code-writer","code-writing","generator","writer"],"created_at":"2024-10-02T16:08:12.632Z","updated_at":"2025-07-03T11:02:48.070Z","avatar_url":"https://github.com/JeevanJames.png","language":"TypeScript","readme":"# CodeWriter\nCodeWriter is a fluent Node library that can be used to generate code blocks. It is typically used by code generation tools to simplify the task of building the generated code.\n\nCodeWriter is similar to concepts like `StringBuilder`'s or `StringWriter`'s in other languages. Instead of using string concatenation to build the generated code, CodeWriter adds support for code-specific concepts like indentation and language-specific comments.\n\n## Installation\n```sh\nnpm install --save-dev codewriter\n```\n\n## Usage\n\n### JavaScript\n```js\nconst CodeWriter = require('codewriter');\n\nconst options = { indentSize: 4 };\nconst writer = new CodeWriter(options);\n// Use CodeWriter methods to build the code\nconst code = writer.toCode();\n```\n\n### Typescript\nCodeWriter ships with a Typescript definition file, which provides strong-typing and compile-time support.\n```ts\nimport { CodeWriter, CodeWriterOptions } from 'codewriter';\n\nconst options: CodeWriterOptions = { indentSize: 4 };\nconst writer = new CodeWriter(options);\n// Use CodeWriter methods to build the code\nconst code: string = writer.toCode();\n```\n\n## Options\nCodeWriter allows some options to be specified in the constructor to customize how the code is generated.\n\n[Options reference](docs/options.md)\n\n[Sample options for generating JavaScript code](docs/options-example.md)\n\nThrough the [`OptionsLibrary`](docs/options-library.md) class, CodeWriter also provides predefined options for certain common languages and language families.\n\n## Examples\n[Generate empty C# console program](docs/example-csharp-empty-console.md)\n\n## API reference\n[JSDoc Documentation](docs/API.md)\n\nYou can view the source code comments directly from [GitHub](https://github.com/JeevanJames/codewriter/blob/master/src/index.ts).\n\nIf you are using Typescript, you can install the package locally to get code completion support from supported IDE's and editors.\n\n## Building the code\n```sh\n# Clone repo from GitHub\ngit clone https://github.com/JeevanJames/codewriter.git .\n\n# Install dependencies\nnpm install\n\n# Build code\nnpm run build\n\n# Continuously watch for code changes and build\nnpm run watch\n\n# Lint code\nnpm run lint\n\n# The codebase has a test-harness directory that contains an index.ts file.\n# You can update this file to quickly test code against the framework.\n# To run the test-harness, run the following command:\nnpm run test-harness\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeevanjames%2Fcodewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeevanjames%2Fcodewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeevanjames%2Fcodewriter/lists"}