Skip to content

Commit

Permalink
extra cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
theoephraim committed Dec 3, 2024
1 parent 9fc3280 commit 5d40b1d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/cli/lib/init-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export async function initDmnoForService(workspaceInfo: ScannedWorkspaceInfo, se
let recommendedServiceName: string | undefined;
if (workspaceInfo.isMonorepo) {
if (service.isRoot) recommendedServiceName = 'root';
else recommendedServiceName = service.name.replace(/^@[^/]+\//, '');
// not passing a `recommendedServiceName` results in the scaffolded file having a comment instead explaining it will inherit from package.json
}
// we used to prompt the user here to pick/confirm the service name, but it was a bit confusing

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/cli/lib/schema-scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function generateDmnoConfigInitialCode(opts: {
opts.isRoot && ' settings: {\n redactSensitiveLogs: true,\n interceptSensitiveLeakRequests: true,\n preventClientLeaks: true,\n },',
opts.serviceName
? ` name: '${opts.serviceName}',`
: (opts.isMonorepo ? ' // no name specified - inherit from package.json' : undefined),
: (opts.isMonorepo ? ' // no `name` specified - will inherit from package.json' : undefined),
!opts.isRoot && ' pick: [],',
' schema: {',
...schemaConfigAsCode.split('\n').map((line) => ` ${line}`),
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config-engine/config-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export class DmnoService {
}
this.serviceName = this.rawConfig.name;
} else {
this.serviceName = opts.isRoot ? 'root' : this.packageName;
this.serviceName = this.packageName;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/config-engine/type-generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function generateServiceTypes(service: DmnoService, writeToFile = f
// write global file which defines a DMNO_CONFIG global
// this used in our config.mts files and in front-end apps where we inject rollup rewrites
await fs.promises.writeFile(`${typeGenFolderPath}/global.d.ts`, `${AUTOGENERATED_FILE_BANNER}
import { DmnoGeneratedConfigSchema } from './schema.d';
import type { DmnoGeneratedConfigSchema } from './schema.d.ts';
declare global {
/** ${service.serviceName} config global obj */
Expand All @@ -40,7 +40,7 @@ declare global {
// write global file which defines a DMNO_CONFIG global
// this used in our config.mts files and in front-end apps where we inject rollup rewrites
await fs.promises.writeFile(`${typeGenFolderPath}/global-public.d.ts`, `${AUTOGENERATED_FILE_BANNER}
import { DmnoGeneratedPublicConfigSchema } from './schema.d';
import type { DmnoGeneratedPublicConfigSchema } from './schema.d.ts';
declare global {
/** ${service.serviceName} config global obj - public (non-sensitive) items only */
Expand Down

0 comments on commit 5d40b1d

Please sign in to comment.