Skip to content

Commit

Permalink
backstage: update create-plugin script to include README
Browse files Browse the repository at this point in the history
This is primarily so that our git hook can automatically fill in
autogenerated docs where appropriate.
  • Loading branch information
ivomurrell committed Dec 3, 2024
1 parent c09dfd8 commit cded39f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/create-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@ fs.writeFileSync('tsconfig.json', JSON.stringify(tsconfig, null, 2))
console.log('📄 adding empty toolkit config')
fs.writeFileSync('.toolkitrc.yml', 'version: 2\n')

console.log('📖 adding simple README')
fs.writeFileSync(
'readme.md',
`#dotcom-tool-kit/${name}
## Installation & Usage
With Tool Kit [already set up](https://github.com/financial-times/dotcom-tool-kit#installing-and-using-tool-kit), install this plugin as a dev dependency:
\`\`\`sh
npm install --save-dev @dotcom-tool-kit/${name}
\`\`\`
And add it to your repo's \`.toolkitrc.yml\`:
\`\`\`yml
plugins:
- '@dotcom-tool-kit/${name}'
\`\`\`
<!-- begin autogenerated docs -->
<!-- end autogenerated docs -->
`
)

console.log('🔗 adding reference to root tsconfig')
const rootTsconfig = JSON.parse(fs.readFileSync('../../tsconfig.json'))
rootTsconfig.references.push({ path: directory })
Expand Down

0 comments on commit cded39f

Please sign in to comment.