Skip to content

Commit

Permalink
feat(scully): work when whatch mode in scully and on ng build are bot…
Browse files Browse the repository at this point in the history
…h enabled (#584)
  • Loading branch information
SanderElias authored May 26, 2020
1 parent a73558d commit 37b73a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/scully/src/lib/systemPlugins/storeRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ import { HandledRoute } from '../routerPlugins/addOptionalRoutesPlugin';
import { scullyConfig } from '../utils/config';
import { createFolderFor } from '../utils/createFolderFor';
import { log, logError, yellow } from '../utils/log';
import { watch } from '../utils/cli-options';

const routesFileName = '/assets/scully-routes.json';

export async function storeRoutes(routes: HandledRoute[]) {
const files = [
/** in the angular source folder */
join(scullyConfig.homeFolder, scullyConfig.sourceRoot, routesFileName),
/** in the scully outfolder */
join(scullyConfig.outDir, routesFileName),
/** in the angular dist folder */
join(scullyConfig.homeFolder, scullyConfig.distFolder, routesFileName)
];
if (!watch) {
files.push(
/** in the angular source folder */
join(scullyConfig.homeFolder, scullyConfig.sourceRoot, routesFileName)
);
}
try {
const jsonResult = JSON.stringify(
routes.map(r => ({ route: r.route || '/', ...r.data }))
Expand Down

0 comments on commit 37b73a0

Please sign in to comment.