Skip to content

Commit 08265cb

Browse files
committed
feat: add instructions
Check and add *.key exclusion in .gitignore file
1 parent a7149d9 commit 08265cb

File tree

5 files changed

+737
-3
lines changed

5 files changed

+737
-3
lines changed

instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Final check
2+
3+
Make sure to check your `.gitignore` file for a `*.key` exclusion rule, as this will not allow to commit your key files.
4+
You should not commit them, **JUST DON'T**!

instructions.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { promises as fsp } from 'fs'
2+
import * as sinkStatic from '@adonisjs/sink'
3+
4+
/**
5+
* Instructions to be executed when setting up the package.
6+
*/
7+
export default async function instructions(projectRoot: string, _, sink: typeof sinkStatic) {
8+
const gitignoreFilePath = `${projectRoot}/.gitignore`
9+
const gitignoreFile = await fsp.readFile(gitignoreFilePath)
10+
11+
if (!gitignoreFile.toString('utf-8').match(/\*.key/g)) {
12+
await fsp.appendFile(gitignoreFilePath, '\n*.key')
13+
sink.logger.success('Updated .gitignore file and added *.key exclusion')
14+
} else {
15+
sink.logger.success('Found a *.key exclusion in .gitignore file, awesome!')
16+
}
17+
}

0 commit comments

Comments
 (0)