-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Chore: Implement @matthiesenxyz/astrodtsbuilder for DTS generation (#…
…301) * Create draft PR for #286 [skip ci] * Update dependencies to include @matthiesenxyz/astrodtsbuilder for DTS generation * Apply suggestions from code review Co-authored-by: Louis Escher <[email protected]> * lint * Update packages/studiocms_core/src/stubs/dts.ts Co-authored-by: Louis Escher <[email protected]> * lint * update renovate config --------- Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com> Co-authored-by: Adam Matthiesen <[email protected]> Co-authored-by: Louis Escher <[email protected]>
- Loading branch information
1 parent
a6b780e
commit ebc297f
Showing
23 changed files
with
499 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@studiocms/imagehandler": patch | ||
"@studiocms/dashboard": patch | ||
"@studiocms/renderers": patch | ||
"@studiocms/auth": patch | ||
"@studiocms/core": patch | ||
--- | ||
|
||
Update `.d.ts` file generation (non breaking) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,11 @@ | |
"customManagers:biomeVersions" | ||
], | ||
"dependencyDashboard": true, | ||
"lockFileMaintenance": { | ||
"enabled": true | ||
}, | ||
"postUpdateOptions": ["pnpmDedupe"], | ||
"ignorePaths": ["**/node_modules/**", "**/bower_components/**"], | ||
"labels": ["dependencies"], | ||
"additionalBranchPrefix": "{{parentDir}}-", | ||
"gitIgnoredAuthors": ["github+renovate@astro-studiocms.xyz"], | ||
"gitIgnoredAuthors": ["[email protected]"], | ||
"prHourlyLimit": 3, | ||
"rangeStrategy": "bump", | ||
"reviewers": ["team:exalted"], | ||
|
@@ -25,7 +22,10 @@ | |
}, | ||
{ | ||
"matchDepTypes": ["packageManager", "engines"], | ||
"labels": ["dependencies"], | ||
"enabled": false | ||
}, | ||
{ | ||
"matchFileNames": [".node-version"], | ||
"enabled": false | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ jobs: | |
token: ${{ secrets.DEPENDENCY_UPDATE_GITHUB_TOKEN }} | ||
use-conventional-commits: true | ||
author-name: Renovate Changesets | ||
author-email: github+renovate@astro-studiocms.xyz | ||
author-email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
import fileFactory from '@matthiesenxyz/integration-utils/fileFactory'; | ||
import DTSBuilder from '@matthiesenxyz/astrodtsbuilder'; | ||
|
||
const authConfigDTS = fileFactory(); | ||
const authConfig = DTSBuilder(); | ||
|
||
authConfigDTS.addLines('// This file is generated by StudioCMS\n\n'); | ||
|
||
authConfigDTS.addLines(`declare module 'studiocms:auth/config' {`); | ||
authConfigDTS.addLines( | ||
` const AuthSecurityConfig: import('@studiocms/core').usernameAndPasswordConfig;` | ||
authConfig.addSingleLineNote( | ||
'This file is generated by StudioCMS and should not be modified manually.' | ||
); | ||
authConfigDTS.addLines(' export default AuthSecurityConfig;'); | ||
authConfigDTS.addLines('}'); | ||
|
||
const DTSFile = authConfigDTS.text(); | ||
authConfig.addModule('studiocms:auth/config', { | ||
defaultExport: { | ||
singleLineDescription: 'Auth Security Config for Username and Password Authentication.', | ||
typeDef: `{ | ||
salt: string | Uint8Array; | ||
opts: { | ||
N: number; | ||
r: number; | ||
p: number; | ||
dkLen?: number; | ||
asyncTick?: number; | ||
maxmem?: number; | ||
onProgress?: (progress: number) => void; | ||
}; | ||
}`, | ||
}, | ||
}); | ||
|
||
const dtsFile = authConfig.makeAstroInjectedType('auth-config.d.ts'); | ||
|
||
export default DTSFile; | ||
export default dtsFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,36 @@ | ||
import fileFactory from '@matthiesenxyz/integration-utils/fileFactory'; | ||
import DTSBuilder from '@matthiesenxyz/astrodtsbuilder'; | ||
import { createResolver } from 'astro-integration-kit'; | ||
|
||
const { resolve } = createResolver(import.meta.url); | ||
|
||
const authHelperDTS = fileFactory(); | ||
|
||
authHelperDTS.addLines('// This file is generated by StudioCMS\n\n'); | ||
|
||
authHelperDTS.addLines(`declare module 'studiocms:auth/helpers' {`); | ||
|
||
authHelperDTS.addLines(` | ||
/** | ||
* # Auth Helper Function | ||
* | ||
* @param locals The Astro.locals object | ||
* @returns The current user data and session information | ||
* | ||
* @example | ||
* --- | ||
* import { authHelper } from 'studiocms:auth/helpers' | ||
* | ||
* const { id, username, name, email, avatar, githubURL, permissionLevel, currentUserSession } = await authHelper(Astro.locals) | ||
* --- | ||
*/ | ||
export const authHelper: typeof import('${resolve('../helpers/authHelper.ts')}').default;`); | ||
|
||
authHelperDTS.addLines('}'); | ||
|
||
const DTSFile = authHelperDTS.text(); | ||
|
||
export default DTSFile; | ||
const authHelper = DTSBuilder(); | ||
|
||
authHelper.addSingleLineNote( | ||
'This file is generated by StudioCMS and should not be modified manually.' | ||
); | ||
|
||
authHelper.addModule('studiocms:auth/helpers', { | ||
namedExports: [ | ||
{ | ||
multiLineDescription: [ | ||
'# Auth Helper Function', | ||
'', | ||
'@param locals The Astro.locals object', | ||
'@returns The current user data and session information', | ||
'', | ||
'@example', | ||
'---', | ||
"import { authHelper } from 'studiocms:auth/helpers'", | ||
'', | ||
'const { id, username, name, email, avatar, githubURL, permissionLevel, currentUserSession } = await authHelper(Astro.locals)', | ||
'---', | ||
], | ||
name: 'authHelper', | ||
typeDef: `typeof import('${resolve('../helpers/authHelper.ts')}').default`, | ||
}, | ||
], | ||
}); | ||
|
||
const dtsFile = authHelper.makeAstroInjectedType('auth-helper.d.ts'); | ||
|
||
export default dtsFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.