Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add addJapaPlugin to Codemods #63

Merged
merged 5 commits into from
Nov 23, 2023
Merged

Conversation

Julien-R44
Copy link
Member

@Julien-R44 Julien-R44 commented Nov 15, 2023

addJapaPlugin will modify the boostrap/tests.ts file to add a new plugin to the export const plugins array.

Can be used as follows:

await codemods.addJapaPlugin('sessionApiClient(app)', {
  module: '@adonisjs/session/plugins/api_client',
  identifier: 'sessionApiClient',
  isNamed: true,
})

The first parameter is the text to be inserted into the array of plugins
The second parameter is the import to add to the top of the file. This can be a named import or not.

The above code will result in :

import app from '@adonisjs/core/services/app'
import { assert } from '@japa/assert'
import { sessionApiClient } from '@adonisjs/session/plugins/api_client'

export const plugins: Config['plugins'] = [
  assert(),
  sessionApiClient(app)
]

Also added two settings for all transformation done with ts-morph : Use single quote instead of doubles, and also remove semicolons with formatText

@thetutlage thetutlage merged commit e18c64e into next Nov 23, 2023
@thetutlage thetutlage deleted the feat/codemods-add-japa-plugin branch November 23, 2023 04:48
@thetutlage
Copy link
Member

Thanks 👍

Julien-R44 added a commit that referenced this pull request Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants