{"id":18585347,"url":"https://github.com/tyhopp/prepend-directive","last_synced_at":"2025-08-23T20:12:32.233Z","repository":{"id":57925237,"uuid":"529204063","full_name":"tyhopp/prepend-directive","owner":"tyhopp","description":"Prepend a directive to the top of a file","archived":false,"fork":false,"pushed_at":"2022-10-26T11:09:43.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-17T16:52:29.782Z","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/tyhopp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-26T09:56:15.000Z","updated_at":"2022-10-04T03:52:35.000Z","dependencies_parsed_at":"2023-01-20T13:31:44.099Z","dependency_job_id":null,"html_url":"https://github.com/tyhopp/prepend-directive","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyhopp%2Fprepend-directive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyhopp%2Fprepend-directive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyhopp%2Fprepend-directive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyhopp%2Fprepend-directive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyhopp","download_url":"https://codeload.github.com/tyhopp/prepend-directive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478193,"owners_count":22077676,"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-11-07T00:33:15.763Z","updated_at":"2025-05-16T06:09:02.023Z","avatar_url":"https://github.com/tyhopp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prepend-directive\n\nPrepend a directive to the top of a file.\n\nUseful as a [post build script](https://docs.npmjs.com/cli/v8/using-npm/scripts#pre--post-scripts) if your build tool (e.g. [microbundle](https://github.com/developit/microbundle)) strips comments and does not allow you to configure the behavior conditionally.\n\n## CLI interface\n\n```shell\nnpx prepend-directive@latest --directive=\\\"use strict\\\" --files=file-a.js,file-b.js\n```\n\n## Node CJS interface\n\n```js\nconst prependDirective = require(`prepend-directive`);\n\nprependDirective({\n  directive: `use strict`,\n  files: [`file-a.js`, `file-b.js`],\n  cwd: __dirname, // Optional\n});\n```\n\n### Before\n\nfile-a.js:\n\n```js\nconst a = () =\u003e `a`;\n```\n\nfile-b.js:\n\n```js\nconst b = () =\u003e `b`;\n```\n\n### After\n\nfile-a.js:\n\n```js\n\"use strict\"\nconst a = () =\u003e `a`;\n```\n\nfile-b.js:\n\n```js\n\"use strict\"\nconst b = () =\u003e `b`;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyhopp%2Fprepend-directive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyhopp%2Fprepend-directive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyhopp%2Fprepend-directive/lists"}