{"id":48393973,"url":"https://github.com/osscameroon/js-generator","last_synced_at":"2026-04-06T01:15:52.854Z","repository":{"id":37986364,"uuid":"324260708","full_name":"osscameroon/js-generator","owner":"osscameroon","description":"Generates JavaScript from HTML","archived":false,"fork":false,"pushed_at":"2025-11-27T16:43:27.000Z","size":4386,"stargazers_count":22,"open_issues_count":90,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-30T08:56:34.141Z","etag":null,"topics":["dom","generates-js","html","html-custom-tags","java","javascript","jsoup","maven"],"latest_commit_sha":null,"homepage":"https://osscameroon.github.io/js-generator/","language":"Java","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/osscameroon.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-12-25T00:51:24.000Z","updated_at":"2025-11-27T16:32:14.000Z","dependencies_parsed_at":"2023-02-07T14:02:24.259Z","dependency_job_id":"3313d320-91ec-45a7-a7f6-918ca68f4467","html_url":"https://github.com/osscameroon/js-generator","commit_stats":{"total_commits":373,"total_committers":11,"mean_commits":33.90909090909091,"dds":0.353887399463807,"last_synced_commit":"55189292b903083702ce532407621cf4a986c6e1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/osscameroon/js-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscameroon%2Fjs-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscameroon%2Fjs-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscameroon%2Fjs-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscameroon%2Fjs-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osscameroon","download_url":"https://codeload.github.com/osscameroon/js-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscameroon%2Fjs-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31455614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","generates-js","html","html-custom-tags","java","javascript","jsoup","maven"],"created_at":"2026-04-06T01:15:52.786Z","updated_at":"2026-04-06T01:15:52.849Z","avatar_url":"https://github.com/osscameroon.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API\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\": \".jsgenerator.js\",\n  \"commentConversionModeActivated\": true,\n  \"querySelectorAdded\": true,\n  \"contents\": [\n    \"string\"\n  ]\n}\n```\n\u003e **NOTE:** The `\"contents\"` field is mandatory for `POST /convert` and forbidden for `POST /convert/files`\n\n\n---\n\nUsing [`curl`](https://curl.se/):\n\n+ `POST /convert`\n```shell\n# You can also pass as many HTML content as you want\n# Response will be of 'application/json' content type\ncurl -H 'content-type: application/json' -X POST --data '{\"contents\": [\"\u003cdiv\u003ejs-jsgenerator\u003c/div\u003e\"]}' http://localhost:8080/convert\n\n#Response\n{\"content\":[{\"filename\":\"inline.0.jsgenerator.js\",\"content\":\"let targetElement_001 = document.querySelector(`:root \u003e body`);\\r\\n\\r\\n\\r\\nlet div_001 = document.createElement('div');\\r\\nlet text_001 = document.createTextNode(`js-generator`);\\r\\ndiv_001.appendChild(text_001);\\r\\ntargetElement_001.appendChild(div_001);\\r\\n\"}],\"status\":\"SUCCESS\"}\n```\n\n+ `POST /convert/files`\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\ncurl -s -X POST -H 'content-type: multipart/form-data' -F files=@illustrations/sample.html -F \"options={ \\\"querySelectorAdded\\\": true, \\\"variableDeclaration\\\": \\\"VAR\\\" }; type=application/json\" http://localhost:8080/convert/files\n\n# -s flag is added in order to prevent curl to mix response and progress meter\n#if not added, this will happen: 100  5280  100  4275  100  1005   117k  28194 --:--:-- --:--:-- --:--:--  147kment.createTextNode(`    `);\n\n#Response\n\n--d2a-7NlH3rlmcFC3loiJxDxom6iojCunhkzzH\nContent-Disposition: form-data; name=\"inline.0.jsgenerator.js\"\nContent-Type: application/octet-stream\nContent-Length: 4069\n\nvar targetElement_001 = document.querySelector(`:root \u003e body`);\n\n\nvar html_001 = document.createElement('html');\nvar text_001 = document.createTextNode(`    `);\nhtml_001.appendChild(text_001);\n\nvar head_001 = document.createElement('head');\nvar text_002 = document.createTextNode(`        `);\nhead_001.appendChild(text_002);\n\nvar meta_001 = document.createElement('meta');\nmeta_001.setAttribute(`charset`, `utf-8`);\nhead_001.appendChild(meta_001);\nvar text_003 = document.createTextNode(`        `);\nhead_001.appendChild(text_003);\n\nvar title_001 = document.createElement('title');\nvar text_004 = document.createTextNode(`Sample`);\ntitle_001.appendChild(text_004);\nhead_001.appendChild(title_001);\nvar text_005 = document.createTextNode(`        `);\nhead_001.appendChild(text_005);\n\nvar link_001 = document.createElement('link');\nlink_001.setAttribute(`rel`, `stylesheet`);\nlink_001.setAttribute(`href`, ``);\nhead_001.appendChild(link_001);\nvar text_006 = document.createTextNode(`    `);\nhead_001.appendChild(text_006);\nhtml_001.appendChild(head_001);\nvar text_007 = document.createTextNode(`    `);\nhtml_001.appendChild(text_007);\n\nvar body_001 = document.createElement('body');\nvar text_008 = document.createTextNode(`        `);\nbody_001.appendChild(text_008);\n\nvar div_001 = document.createElement('div');\ndiv_001.setAttribute(`id`, `container`);\nvar text_009 = document.createTextNode(`            `);\ndiv_001.appendChild(text_009);\n\nvar div_002 = document.createElement('div');\ndiv_002.setAttribute(`id`, `header`);\nvar text_010 = document.createTextNode(`                `);\ndiv_002.appendChild(text_010);\n\nvar h1_001 = document.createElement('h1');\nvar text_011 = document.createTextNode(`Sample`);\nh1_001.appendChild(text_011);\ndiv_002.appendChild(h1_001);\nvar text_012 = document.createTextNode(`                `);\ndiv_002.appendChild(text_012);\n\nvar img_001 = document.createElement('img');\nimg_001.setAttribute(`src`, `kanye.jpg`);\nimg_001.setAttribute(`alt`, `kanye`);\ndiv_002.appendChild(img_001);\nvar text_013 = document.createTextNode(`            `);\ndiv_002.appendChild(text_013);\ndiv_001.appendChild(div_002);\nvar text_014 = document.createTextNode(`            `);\ndiv_001.appendChild(text_014);\n\nvar div_003 = document.createElement('div');\ndiv_003.setAttribute(`id`, `main`);\nvar text_015 = document.createTextNode(`                `);\ndiv_003.appendChild(text_015);\n\nvar h2_001 = document.createElement('h2');\nvar text_016 = document.createTextNode(`Main`);\nh2_001.appendChild(text_016);\ndiv_003.appendChild(h2_001);\nvar text_017 = document.createTextNode(`                `);\ndiv_003.appendChild(text_017);\n\nvar p_001 = document.createElement('p');\nvar text_018 = document.createTextNode(`This is the main content.`);\np_001.appendChild(text_018);\ndiv_003.appendChild(p_001);\nvar text_019 = document.createTextNode(`                `);\ndiv_003.appendChild(text_019);\n\nvar img_002 = document.createElement('img');\nimg_002.setAttribute(`src`, ``);\nimg_002.setAttribute(`alt`, ``);\ndiv_003.appendChild(img_002);\nvar text_020 = document.createTextNode(`            `);\ndiv_003.appendChild(text_020);\ndiv_001.appendChild(div_003);\nvar text_021 = document.createTextNode(`            `);\ndiv_001.appendChild(text_021);\n\nvar div_004 = document.createElement('div');\ndiv_004.setAttribute(`id`, `footer`);\nvar text_022 = document.createTextNode(`                `);\ndiv_004.appendChild(text_022);\n\nvar p_002 = document.createElement('p');\nvar text_023 = document.createTextNode(`Copyright - 2019`);\np_002.appendChild(text_023);\ndiv_004.appendChild(p_002);\nvar text_024 = document.createTextNode(`            `);\ndiv_004.appendChild(text_024);\ndiv_001.appendChild(div_004);\nvar text_025 = document.createTextNode(`        `);\ndiv_001.appendChild(text_025);\nbody_001.appendChild(div_001);\nvar text_026 = document.createTextNode(`    `);\nbody_001.appendChild(text_026);\nhtml_001.appendChild(body_001);\ntargetElement_001.appendChild(html_001);\n\n--d2a-7NlH3rlmcFC3loiJxDxom6iojCunhkzzH--\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosscameroon%2Fjs-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosscameroon%2Fjs-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosscameroon%2Fjs-generator/lists"}