Skip to content

Commit

Permalink
Merge pull request #1353 from opencomponents/compile-client-on-dev
Browse files Browse the repository at this point in the history
always compile client on dev
  • Loading branch information
ricardo-devis-agullo authored Jan 19, 2024
2 parents ff3744f + 264302b commit 8d77e20
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"multer": "^1.4.3",
"nice-cache": "^0.0.5",
"oc-client": "^4.0.1",
"oc-client-browser": "^1.7.4",
"oc-client-browser": "^1.7.5",
"oc-empty-response-handler": "^1.0.2",
"oc-get-unix-utc-timestamp": "^1.0.6",
"oc-s3-storage-adapter": "^2.1.1",
Expand All @@ -128,4 +128,4 @@
"universalify": "^2.0.0",
"yargs": "^17.7.2"
}
}
}
1 change: 1 addition & 0 deletions src/cli/facade/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const dev = ({ local, logger }: { logger: Logger; local: Local }) =>
baseUrl,
prefix: opts.prefix || '',
dependencies: dependencies.modules,
compileClient: true,
discovery: true,
env: { name: 'local' },
fallbackRegistryUrl,
Expand Down
14 changes: 10 additions & 4 deletions src/registry/routes/static-redirector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ export default function staticRedirector(repository: Repository) {

if (req.route.path === clientPath) {
if (res.conf.local) {
filePath = path.join(
__dirname,
'../../components/oc-client/_package/src/oc-client.js'
);
if (res.conf.compiledClient) {
res.type('application/javascript');
res.send(res.conf.compiledClient.dev);
return;
} else {
filePath = path.join(
__dirname,
'../../components/oc-client/_package/src/oc-client.js'
);
}
} else {
if (res.conf.compiledClient) {
res.type('application/javascript');
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export type PublishAuthConfig =

export interface Config {
baseUrl: string;
compiledClient?: { code: string; map: string };
compiledClient?: { code: string; map: string; dev: string };
baseUrlFunc?: (opts: { host?: string; secure: boolean }) => string;
beforePublish: (req: Request, res: Response, next: NextFunction) => void;
customHeadersToSkipOnWeakVersion: string[];
Expand Down

0 comments on commit 8d77e20

Please sign in to comment.