File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import ConfigureCommand from '@adonisjs/core/commands/configure'
16
16
import { stubsRoot } from './stubs/main.js'
17
+ import { FileSystem } from './src/filesystem.js'
17
18
18
19
export async function configure ( command : ConfigureCommand ) {
20
+ const filesystem = new FileSystem ( )
19
21
const codemods = await command . createCodemods ( )
20
22
21
23
await codemods . updateRcFile ( ( rcFile ) => {
22
24
rcFile . addCommand ( '@bitkidd/adonisjs-credentials/commands' )
23
25
} )
24
26
25
27
await codemods . makeUsingStub ( stubsRoot , 'start.stub' , { } )
28
+
29
+ try {
30
+ const oldGitIgnoreFile = await filesystem . read ( { path : `${ command . app . makePath ( ) } /.gitignore` } )
31
+ const keyRuleExists = oldGitIgnoreFile . includes ( '*.key' )
32
+
33
+ if ( keyRuleExists ) {
34
+ command . logger . action ( 'update .gitignore file' ) . skipped ( )
35
+ } else {
36
+ const newGitIgnoreFile = `${ oldGitIgnoreFile } \n*.key\n`
37
+
38
+ await filesystem . write ( {
39
+ path : `${ command . app . makePath ( ) } /.gitignore` ,
40
+ data : newGitIgnoreFile ,
41
+ } )
42
+
43
+ command . logger . action ( 'update .gitignore file' ) . succeeded ( )
44
+ }
45
+ } catch ( error ) {
46
+ command . logger . action ( 'update .gitignore file' ) . failed ( error )
47
+ }
26
48
}
You can’t perform that action at this time.
0 commit comments