{"id":15069576,"url":"https://github.com/ngcodex/js-generator","last_synced_at":"2025-10-05T06:31:24.412Z","repository":{"id":160868164,"uuid":"544921901","full_name":"NGcodeX/js-generator","owner":"NGcodeX","description":"Generates JavaScript code from HTML or Custom tags","archived":false,"fork":true,"pushed_at":"2024-06-17T11:03:32.000Z","size":1383,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-09-30T13:05:52.837Z","etag":null,"topics":["dom","generate-js","html5","java","javascript","javase","jsoup","maven"],"latest_commit_sha":null,"homepage":"https://osscameroon.github.io/js-generator/","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"osscameroon/js-generator","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NGcodeX.png","metadata":{"files":{"readme":"README.api.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-10-03T13:23:26.000Z","updated_at":"2024-06-17T11:03:35.000Z","dependencies_parsed_at":"2023-10-15T00:23:51.114Z","dependency_job_id":null,"html_url":"https://github.com/NGcodeX/js-generator","commit_stats":{"total_commits":368,"total_committers":12,"mean_commits":"30.666666666666668","dds":"0.36684782608695654","last_synced_commit":"f2b391c6beeafa1e3383e8e083ecc7bacf59678b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGcodeX%2Fjs-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGcodeX%2Fjs-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGcodeX%2Fjs-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGcodeX%2Fjs-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NGcodeX","download_url":"https://codeload.github.com/NGcodeX/js-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235370461,"owners_count":18979093,"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":["dom","generate-js","html5","java","javascript","javase","jsoup","maven"],"created_at":"2024-09-25T01:43:16.664Z","updated_at":"2025-10-05T06:31:19.086Z","avatar_url":"https://github.com/NGcodeX.png","language":"Java","readme":"# API\n\nUsing [`httpie`](https://httpie.io/):\n```shell\n# You can also pass as many HTML content as you want\n# Response will be of 'application/json' content type\nhttp -vf :8080/convert \\\n  extension='.js' \\\n  contents[]='\u003chr/\u003e' \\\n  contents[]='\u003cbutton disabled\u003eclick me, please :sob:\u003c/button\u003e'\n\nHTTP/1.1 200 \nContent-Type: application/json\n\n{\n  \"status\": \"SUCCESS\"\n  \"content\": [\n    {\n      \"content\": \"const targetElement_000 = document.querySelector(`:root \u003e body`);\\r\\n\\r\\n\\r\\nconst hr_000 = document.createElement('hr');\\r\\ntargetElement_000.appendChild(hr_000);\\r\\n\",\n      \"filename\": \"inline.0.js\"\n    },\n    {\n      \"content\": \"const targetElement_001 = document.querySelector(`:root \u003e body`);\\r\\n\\r\\n\\r\\nconst button_000 = document.createElement('button');\\r\\nbutton_000.setAttribute(`disabled`, `true`);\\r\\nconst text_000 = document.createTextNode(`click me, please :sob:`);\\r\\nbutton_000.appendChild(text_000);\\r\\ntargetElement_001.appendChild(button_000);\\r\\n\",\n      \"filename\": \"inline.1.js\"\n    }\n  ]\n}\n```\n\nOr, give the following two files contents:\n\u003e ```json\n\u003e { \"extension\":  \".js\" } // ./multipart-options.json\n\u003e ```\n\u003e\n\u003e ```html\n\u003e \u003c!DOCTYPE html\u003e\n\u003e \u003c!-- ./sample.html --\u003e\n\u003e \u003chtml\u003e\n\u003e   \u003chead\u003e\n\u003e     ...\n\u003e   ...\n\u003e ...\n\u003e ```\n\n```shell\n# You can call the API with multiple **files** and at most one **options**\n# Response will be of 'multipart/form-data' content type\nhttp -vf :8080/convert/files \\\n  'files@./sample.html;type=multipart/form-data' \\\n  'options@multipart-options.json;type=application/json'\n\nHTTP/1.1 200 \nContent-Type: multipart/form-data;boundary=3N0wqEqnb7AC3WD8M1cYYG-vLfHDND_JdE90\n\n--3N0wqEqnb7AC3WD8M1cYYG-vLfHDND_JdE90\nContent-Disposition: form-data; name=\"0.sample.html.js\"\nContent-Type: application/octet-stream\nContent-Length: 4156\n\nconst targetElement_000 = document.querySelector(`:root \u003e body`);\n[... truncated for brievity]\n```\n\n---\n\nAfter starting the `jsgenerator-api` as described in the [README.md](./README.md), you can read:\n\n+ OpenAPI spec. at: [http://localhost:8080/openapi.yaml](http://localhost:8080/openapi.yaml)\n+ OpenAPI UI at: [http://localhost:8080](http://localhost:8080)\n\nTwo endpoints are exposed:\n+ `POST /convert`\n+ `POST /convert/files`\n\nBoth accept options as follow:\n```json\n{\n  \"targetElementSelector\": \":root \u003e body\",\n  \"pattern\": \"inline-filename-pattern\",\n  \"variableNameStrategy\": \"TYPE_BASED\",\n  \"variableDeclaration\": \"LET\",\n  \"extension\": \".extension\",\n  \"contents\": [\n    \"string\"\n  ]\n}\n```\n\u003e **NOTE:** The `\"content\"` field is mandatory for `POST /convert` and forbidden for `POST /convert/files`","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngcodex%2Fjs-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngcodex%2Fjs-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngcodex%2Fjs-generator/lists"}