File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 "start" : " run-p copy:assets watch serve" ,
1515 "docs" : " cd docs && npm run start" ,
1616 "storybook" : " cd storybook && npm run storybook" ,
17- "serve" : " live-server build --watch=build/tmp/ --cors --quiet" ,
17+ "serve" : " run-p serve:*" ,
18+ "serve:app" : " live-server build --watch=build/tmp/ --cors --quiet" ,
19+ "serve:sandbox" : " live-server src/livecodes/html/sandbox/ --port=8085 --cors --quiet --no-browser" ,
1820 "watch" : " nodemon --watch src -e \" *\" --ignore src/livecodes/i18n/locale-paths.ts ./scripts/build.js --dev" ,
1921 "prebuild" : " npm run i18n-exclude pre" ,
2022 "postbuild" : " npm run i18n-exclude post" ,
Original file line number Diff line number Diff line change @@ -3,17 +3,21 @@ import { sandboxVersion } from '../html/sandbox/index';
33const cfPagesBaseUrl = 'https://livecodes-sandbox.pages.dev' ;
44const ghPagesBaseUrl = 'https://live-codes.github.io/livecodes-sandbox/dist' ;
55const selfHostedBaseUrl = `https://${ process . env . SANDBOX_HOST_NAME } :${ process . env . SANDBOX_PORT } ` ;
6+ const localBaseUrl = 'http://127.0.0.1:8085' ;
67
78const serviceBaseUrl =
8- process . env . SELF_HOSTED === 'true'
9- ? selfHostedBaseUrl
10- : process . env . CI === 'true'
11- ? ghPagesBaseUrl
12- : cfPagesBaseUrl ;
9+ location . hostname === 'localhost' || location . hostname === '127.0.0.1'
10+ ? localBaseUrl
11+ : process . env . SELF_HOSTED === 'true'
12+ ? selfHostedBaseUrl
13+ : process . env . CI === 'true'
14+ ? ghPagesBaseUrl
15+ : cfPagesBaseUrl ;
1316const version = sandboxVersion ;
17+ const ext = serviceBaseUrl === localBaseUrl ? '.html' : '' ;
1418
1519export const sandboxService = {
1620 getResultUrl : ( ) => `${ serviceBaseUrl } /${ version } /` ,
17- getCompilerUrl : ( ) => `${ serviceBaseUrl } /${ version } /compiler` ,
21+ getCompilerUrl : ( ) => `${ serviceBaseUrl } /${ version } /compiler${ ext } ` ,
1822 getOrigin : ( ) => new URL ( serviceBaseUrl ) . origin ,
1923} ;
You can’t perform that action at this time.
0 commit comments