Skip to content

Commit 477badc

Browse files
switch compile client default to true
1 parent b866a53 commit 477badc

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/registry/domain/options-sanitiser.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ type CompileOptions = Omit<
1414
export interface RegistryOptions<T = any>
1515
extends Partial<Omit<Config<T>, 'beforePublish'>> {
1616
baseUrl: string;
17+
/**
18+
* Set the options for the oc-client-browser
19+
* Set it to false to disable the compilation of the client
20+
* @default true
21+
*/
1722
compileClient?: boolean | CompileOptions;
1823
}
1924

@@ -65,9 +70,11 @@ export default function optionsSanitiser(input: RegistryOptions): Config {
6570
options.templates = [];
6671
}
6772

68-
if (options.compileClient) {
73+
if (options.compileClient || options.compileClient !== false) {
6974
const clientOptions =
70-
typeof options.compileClient === 'boolean' ? {} : options.compileClient;
75+
typeof options.compileClient === 'boolean'
76+
? {}
77+
: (options.compileClient ?? {});
7178

7279
const compiled = compileSync({
7380
templates: options.templates,

test/unit/registry-domain-options-sanitiser.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ describe('registry : domain : options-sanitiser', () => {
137137

138138
describe('when templates', () => {
139139
describe('is provided', () => {
140-
const options = { baseUrl: 'dummy', templates: [{ name: 'hi' }] };
140+
const options = {
141+
baseUrl: 'dummy',
142+
templates: [{ name: 'hi' }],
143+
compileClient: false
144+
};
141145
it('should not modify it', () => {
142146
expect(sanitise(options).templates).to.deep.equal([{ name: 'hi' }]);
143147
});

0 commit comments

Comments
 (0)