diff --git a/scully.config.js b/scully.config.js index dd13232ee..c904243db 100644 --- a/scully.config.js +++ b/scully.config.js @@ -1,12 +1,13 @@ /** load the plugin */ -const {extraRoutesPlugin} = require('./extraPlugin/extra-plugin.js') +const {extraRoutesPlugin} = require('./extraPlugin/extra-plugin.js'); /** register the plugin */ registerPlugin('router', 'extra', extraRoutesPlugin); - exports.config = { /** projectRoot is mandatory! */ projectRoot: './projects/sampleBlog/src/app', + /** outFolder is where the static distribution files end up */ + outFolder: './dist/static', routes: { '/demo/:id': { diff --git a/scully/scully.ts b/scully/scully.ts index 799a8d98c..7e0a56802 100644 --- a/scully/scully.ts +++ b/scully/scully.ts @@ -78,7 +78,6 @@ let _options = {}; spawn('node', [join(scullyConfig.homeFolder, './node_modules/.bin/scully'), 'serve'], { detached: true, }).on('close', err => { - console.log(err); if (+err > 0) { spawn( 'node', diff --git a/scully/utils/config.ts b/scully/utils/config.ts index 4ce13d2a8..524716c41 100644 --- a/scully/utils/config.ts +++ b/scully/utils/config.ts @@ -3,7 +3,7 @@ import {jsonc} from 'jsonc'; import {join} from 'path'; import {findAngularJsonPath} from './findAngularJsonPath'; import {ScullyConfig} from './interfacesandenums'; -import {logError} from './log'; +import {logError, logWarn, yellow} from './log'; import {validateConfig} from './validateConfig'; import {compileConfig} from './compileConfig'; @@ -45,10 +45,10 @@ const loadIt = async () => { distFolder, appPort: /** 1864 */ 'herodevs'.split('').reduce((sum, token) => (sum += token.charCodeAt(0)), 1000), staticport: /** 1771 */ 'scully'.split('').reduce((sum, token) => (sum += token.charCodeAt(0)), 1000), - }, - await updateScullyConfig(compiledConfig) + } // compiledConfig ) as ScullyConfig; + await updateScullyConfig(compiledConfig); return scullyConfig; }; export const loadConfig = loadIt(); @@ -56,6 +56,13 @@ export const loadConfig = loadIt(); export const updateScullyConfig = async (config: Partial) => { /** note, an invalid config will abort the entire program. */ const newConfig = Object.assign({}, scullyConfig, config); + if (config.outFolder === undefined) { + logWarn( + `The option outFolder isn't configures, we are using "${yellow(scullyConfig.outFolder)} by default now"` + ); + } else { + config.outFolder = join(angularRoot, config.outFolder); + } const validatedConfig = await validateConfig(newConfig as ScullyConfig); if (validatedConfig) { const mergedRoutes = {...scullyConfig.routes, ...validatedConfig.routes};