@statusfy/core
Advanced tools
Comparing version 0.1.0-alpha.0 to 0.1.0-alpha.1
// Based on https://github.com/nuxt/nuxt.js/blob/dev/bin/nuxt-build | ||
const { Nuxt, Builder } = require('nuxt') | ||
const generateConfig = require('./config/generate') | ||
const { logger } = require('@statusfy/common') | ||
const generateConfig = require('./config/generate') | ||
module.exports = async function build (sourceDir, cliOptions = {}) { | ||
@@ -33,6 +34,8 @@ process.env.NODE_ENV = 'production' | ||
builder | ||
.build() | ||
.then(close) | ||
.catch(err => logger.fatal(err)) | ||
try { | ||
await builder.build() | ||
close() | ||
} catch (error) { | ||
logger.fatal(error) | ||
} | ||
} |
@@ -43,2 +43,4 @@ const fs = require('fs') | ||
// Statusfy module configuration | ||
nuxtConfig.statusfy.version = nuxtConfig.manifest.version | ||
nuxtConfig.statusfy.dev = nuxtConfig.dev | ||
nuxtConfig.statusfy.locales = siteConfig.locales | ||
@@ -54,3 +56,4 @@ nuxtConfig.statusfy.sourceDir = sourceDir | ||
for (let ext of validLogoExtension) { | ||
const filePath = path.join(sourceDir, 'assets', 'img', `logo.${ext}`) | ||
const filePath = path.join(sourceDir, 'theme', 'default', 'img', `logo.${ext}`) | ||
if (fs.existsSync(filePath)) { | ||
@@ -119,3 +122,3 @@ nuxtConfig.statusfy.assets.mainLogo = filePath | ||
const customIconPath = path.join(sourceDir, 'assets', 'icon.png') | ||
const customIconPath = path.join(sourceDir, 'theme', 'default', 'img', 'icon.png') | ||
if (fs.existsSync(customIconPath)) { | ||
@@ -125,13 +128,20 @@ nuxtConfig.icon.iconSrc = customIconPath | ||
// Google Analytics Module | ||
if (siteConfig.ga && !nuxtConfig.dev) { | ||
// Doc: https://github.com/nuxt-community/analytics-module#usage | ||
nuxtConfig.modules.push('@nuxtjs/google-analytics') | ||
// Custom Styles | ||
const validStylesExtension = ['css', 'less', 'sass', 'scss', 'styl', 'stylus'] | ||
const stylesPath = [] | ||
// Google Analytics | ||
nuxtConfig['google-analytics'] = { | ||
id: siteConfig.ga | ||
for (let ext of validStylesExtension) { | ||
const filePath = path.join(sourceDir, 'theme', 'default', `style.${ext}`) | ||
if (fs.existsSync(filePath)) { | ||
stylesPath.push(filePath) | ||
} | ||
} | ||
if (stylesPath.length > 0) { | ||
logger.info('Loading Styles from: ', stylesPath.map(p => path.relative(sourceDir, p)).join('\n')) | ||
nuxtConfig.css.push(...stylesPath) | ||
} | ||
return { | ||
@@ -138,0 +148,0 @@ nuxtConfig, |
@@ -11,2 +11,4 @@ const defaultsDeep = require('lodash/defaultsDeep') | ||
logger.info(`Reading configuration from ${chalk.yellow(`config${extension}`)}`) | ||
if (extension !== '.js') { | ||
@@ -17,4 +19,2 @@ const content = fse.readFileSync(filePath, 'utf-8') | ||
case '.yml': | ||
logger.debug(`Reading configuration from ${chalk.yellow('config.yml')}`) | ||
data = yaml.parse(content) | ||
@@ -24,4 +24,2 @@ break | ||
case '.toml': | ||
logger.debug(`Reading configuration from ${chalk.yellow('config.toml')}`) | ||
data = toml.parse(content) | ||
@@ -31,4 +29,2 @@ break | ||
} else { | ||
logger.debug(`Reading configuration from ${chalk.yellow('config.js')}`) | ||
data = require(filePath) | ||
@@ -35,0 +31,0 @@ } |
@@ -11,3 +11,3 @@ const { readdir, stat, readFile } = require('fs') | ||
const createMarkdown = require('@statusfy/markdown') | ||
const { logger, hash, path } = require('@statusfy/common') | ||
const { logger, hash, path, fse } = require('@statusfy/common') | ||
@@ -70,27 +70,33 @@ const moment = MomentRange.extendMoment(Moment) | ||
try { | ||
const files = (await readdirP(dirPath)).map(f => path.join(dirPath, f)) | ||
const exists = await fse.pathExists(dirPath) | ||
for (let i = 0; i < files.length; i++) { | ||
const filePath = files[i] | ||
const isFile = (await statP(filePath)).isFile() | ||
if (!exists) { | ||
logger.warn('Content Directory not found:', dirPath) | ||
} else { | ||
try { | ||
const files = (await readdirP(dirPath)).map(f => path.join(dirPath, f)) | ||
if (isFile && path.extname(filePath) === '.md') { | ||
const fileName = path.relative(dirPath, filePath) | ||
const fileContent = (await readFileP(filePath)).toString('utf8') | ||
const incident = new Incident(fileContent, fileName).getData() | ||
for (let i = 0; i < files.length; i++) { | ||
const filePath = files[i] | ||
const isFile = (await statP(filePath)).isFile() | ||
if (!incident.modified) { | ||
try { | ||
incident.modified = new Date(getGitLastUpdatedTimeStamp(filePath)).toISOString() | ||
} catch (error) { | ||
incident.modified = null | ||
if (isFile && path.extname(filePath) === '.md') { | ||
const fileName = path.relative(dirPath, filePath) | ||
const fileContent = (await readFileP(filePath)).toString('utf8') | ||
const incident = new Incident(fileContent, fileName).getData() | ||
if (!incident.modified) { | ||
try { | ||
incident.modified = new Date(getGitLastUpdatedTimeStamp(filePath)).toISOString() | ||
} catch (error) { | ||
incident.modified = null | ||
} | ||
} | ||
allIncidents.push(incident) | ||
} | ||
allIncidents.push(incident) | ||
} | ||
} catch (error) { | ||
logger.error(error) | ||
} | ||
} catch (error) { | ||
logger.error(error) | ||
} | ||
@@ -97,0 +103,0 @@ |
@@ -31,3 +31,3 @@ const nodemon = require('nodemon') | ||
}).on('restart', (files) => { | ||
logger.info('Restarting Server due to changes in: ', files) | ||
logger.info('Restarting Server due to changes in: \n', files.join('\n')) | ||
}).on('crash', () => { | ||
@@ -34,0 +34,0 @@ logger.debug('nodemon crashed for some reason') |
@@ -27,10 +27,10 @@ const { Nuxt, Builder, Generator } = require('nuxt') | ||
generator | ||
.generate(generateOptions) | ||
.then(() => { | ||
fixHomePages(siteConfig, outDir) | ||
try { | ||
await generator.generate(generateOptions) | ||
process.exit(0) | ||
}) | ||
.catch(err => logger.fatal(err)) | ||
fixHomePages(siteConfig, outDir) | ||
process.exit(0) | ||
} catch (error) { | ||
logger.fatal(error) | ||
} | ||
} |
@@ -12,3 +12,3 @@ const { path } = require('@statusfy/common') | ||
// Hack: allow to execute using lerna/yarn workspaces | ||
// Hack: allow to execute using lerna/yarn workspaces on testing | ||
if (process.env.STATUSFY_LERNA) { | ||
@@ -15,0 +15,0 @@ modulesDir.push(path.relative(__dirname, path.join(__dirname, '..', '..', '..', 'node_modules'))) |
{ | ||
"name": "@statusfy/core", | ||
"version": "0.1.0-alpha.0", | ||
"version": "0.1.0-alpha.1", | ||
"description": "Core of Statusfy", | ||
@@ -16,5 +16,7 @@ "author": { | ||
"scripts": { | ||
"lint:scripts": "eslint --fix --ext .js,.vue --ignore-path .gitignore . lib/ client/ test/", | ||
"lint:scripts": "eslint --ext .js,.vue --ignore-path .gitignore . lib/ client/ test/", | ||
"lint:scripts:fix": "npm run lint:scripts -- --fix", | ||
"lint:css": "stylelint 'client/**/*.{css,vue}'", | ||
"lint": "npm run lint:scripts && npm run lint:css", | ||
"lint:fix": "npm run lint:scripts:fix && npm run lint:css", | ||
"prepare-test": "cross-env NODE_ENV=test node test/prepare.js", | ||
@@ -41,6 +43,5 @@ "svg": "vsvg -s ./client/assets/icons -t ./client/components/icons --es6" | ||
"@nuxtjs/axios": "^5.3.3", | ||
"@nuxtjs/google-analytics": "^2.0.2", | ||
"@nuxtjs/pwa": "^2.5.0", | ||
"@statusfy/common": "^0.1.0-alpha.0", | ||
"@statusfy/markdown": "^0.1.0-alpha.0", | ||
"@statusfy/common": "^0.1.0-alpha.1", | ||
"@statusfy/markdown": "^0.1.0-alpha.1", | ||
"body-parser": "^1.18.3", | ||
@@ -71,2 +72,3 @@ "browser-sync": "^2.26.0", | ||
"v-tooltip": "^2.0.0-rc.33", | ||
"vue-multianalytics": "^1.9.7", | ||
"vue-svgicon": "^3.2.0" | ||
@@ -77,3 +79,3 @@ }, | ||
"@mapbox/stylelint-processor-arbitrary-tags": "^0.2.0", | ||
"@statusfy/test-utils": "^0.1.0-alpha.0", | ||
"@statusfy/test-utils": "^0.1.0-alpha.1", | ||
"babel-core": "^7.0.0-0", | ||
@@ -93,3 +95,3 @@ "eslint-config-standard": "^12.0.0", | ||
}, | ||
"gitHead": "7484c0b0696613f59a33893b0ac895d3396d6656" | ||
"gitHead": "8db9635054c7eb394994f6ebe2243665fa17f3c5" | ||
} |
@@ -48,3 +48,5 @@ const { Router } = require('express') | ||
if (data.page > data.total_pages) { | ||
if (data.count === 0) { | ||
send.json(data) | ||
} else if (data.page > data.total_pages) { | ||
send.notFound() | ||
@@ -51,0 +53,0 @@ } else { |
@@ -5,3 +5,5 @@ module.exports = { | ||
baseUrl: 'https://demo.statusfy.co', | ||
ga: 'UA-XXXXXXXXX-Y', | ||
analytics: { | ||
ga: 'UA-XXXXXXXXX-Y' | ||
}, | ||
defaultLocale: 'en', | ||
@@ -8,0 +10,0 @@ locales: [ |
@@ -13,3 +13,3 @@ const { promisify } = require('util') | ||
await fse.emptyDir(tempPath) | ||
await fse.copy(demoPath, tempBasePath) | ||
await fse.copy(demoPath, tempBasePath, { filter: (src, _) => !src.includes('test') }) | ||
await renameP(tempBasePath, path.resolve(tempPath, 'advanced')) | ||
@@ -16,0 +16,0 @@ await fse.emptyDir(path.resolve(tempBasePath, 'content')) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197373
3066
+ Addedvue-multianalytics@^1.9.7
+ Addedvue-multianalytics@1.11.7(transitive)
- Removed@nuxtjs/google-analytics@^2.0.2
- Removed@nuxtjs/google-analytics@2.4.0(transitive)
- Removedvue-analytics@5.22.1(transitive)