{"id":14156456,"url":"https://github.com/cdklabs/node-sscaff","last_synced_at":"2025-12-30T01:02:58.555Z","repository":{"id":37051500,"uuid":"243504587","full_name":"cdklabs/node-sscaff","owner":"cdklabs","description":"Stupid scaffolding: copies an entire directory with variable substitution","archived":false,"fork":false,"pushed_at":"2024-04-23T00:17:23.000Z","size":3641,"stargazers_count":19,"open_issues_count":0,"forks_count":3,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-04-23T10:32:25.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/cdklabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-02-27T11:36:39.000Z","updated_at":"2024-04-25T02:01:19.606Z","dependencies_parsed_at":"2024-01-02T01:39:04.356Z","dependency_job_id":"6929ba31-700c-4b2d-a958-c87061403b44","html_url":"https://github.com/cdklabs/node-sscaff","commit_stats":{"total_commits":582,"total_committers":11,"mean_commits":52.90909090909091,"dds":"0.16151202749140892","last_synced_commit":"8d9e55d72fbd1695ee94dd390a1110a14e8417c2"},"previous_names":[],"tags_count":667,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fnode-sscaff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fnode-sscaff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fnode-sscaff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fnode-sscaff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdklabs","download_url":"https://codeload.github.com/cdklabs/node-sscaff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":215735861,"owners_count":15923388,"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-08-17T08:05:29.770Z","updated_at":"2025-12-30T01:02:58.511Z","avatar_url":"https://github.com/cdklabs.png","language":"TypeScript","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"# sscaff\n\nStupid scaffolding: copies an entire directory with variable substitution and\npre/post node.js hooks.\n\n## Installation\n\n```shell\nyarn add sscaff\n```\n\nor:\n\n```shell\nnpm install sscaff\n```\n\n## Usage\n\nCreate a template directory with files and subdirectories. For example:\n\n```\nmy-first-template\n  {{name}}.txt\n    Hello, my name is {{name}}!\n```\n\nNow, use `sscaff` to create a copy and substitute:\n\n```ts\nimport { sscaff } from 'sscaff';\n\nawait sscaff('my-first-template', 'outdir', {\n  name: 'oliver'\n});\n```\n\nThis will create the following:\n\n```\noutdir\n  oliver.txt\n    Hello, my name is oliver!\n```\n\n## Built-in Substitutions\n\n* `{{ $base }}` will be substituted by the base name of the output directory\n  (e.g. `outdir` in the example above).\n* `{{ }}` will be substituted by the empty string. You can use this substitution\n  to \"salt\" a file name so it won't be recognized by the parent project. For\n  example, if you want your template to include a gitignore file, you should\n  call it `{{}}.gitignore` so it won't be recognized as a \"real\" gitignore in\n  the parent project.\n\n## Hooks\n\nIf the template directory has a file named `.hooks.sscaff.js`, and exports `pre`\nand/or `post` functions, those will be called before and after the creation of\nthe output, respectively.\n\nThese functions are both executed with the output directory as the working\ndirectory and accept the `variables` dictionary. Both functions can either be\nsynchronous or asynchronous.\n\nThe `pre` function may also modify the `variables` dictionary (i.e. add\nvariables, modify them, etc).\n\nFor example, let's add the following `.hooks.sscaff.js` file to\n`my-first-template` above.\n\n```js\nconst fs = require('fs').promises;\n\nexports.pre = variables =\u003e {\n  variables.orig = variables.name;\n  variables.name = variables.name[0].toUpperCase() + variables.name.slice(1);\n};\n\nexports.post = async (variables) =\u003e {\n  await fs.writeFile(variables.orig + '.bak', 'hello hello');\n};\n```\n\nThe resulting output will look like this now:\n\n```\noutdir\n  Oliver.txt\n    Hello, my name is Oliver!\n  oliver.bak\n    hello hello\n```\n\n## Contributions\n\nAll contributions are welcome, just raise an issue or submit a PR. Add a test, update readme. Do the right thing.\n\n## License\n\n[Apache 2.0](./LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdklabs%2Fnode-sscaff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdklabs%2Fnode-sscaff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdklabs%2Fnode-sscaff/lists"}