@statusfy/core
Advanced tools
Comparing version 0.0.1-alpha.1 to 0.1.0-alpha.0
@@ -16,9 +16,2 @@ export const statusesInfo = ($t) => { | ||
const colors = { | ||
'under-maintenance': 'grey-darker', | ||
'degraded-performance': 'indigo', | ||
'partial-outage': 'orange', | ||
'major-outage': 'red', | ||
'operational': 'green' | ||
} | ||
const icons = { | ||
@@ -35,3 +28,2 @@ 'under-maintenance': 'clock', | ||
i18nKeys, | ||
colors, | ||
icons | ||
@@ -46,5 +38,4 @@ } | ||
title: statuses.i18nKeys[status], | ||
color: statuses.colors[status], | ||
icon: statuses.icons[status] | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
const path = require('path') | ||
const fs = require('fs') | ||
const defaultsDeep = require('lodash/defaultsDeep') | ||
const { logger, fse } = require('@statusfy/shared-utils') | ||
const { logger, fse, path } = require('@statusfy/common') | ||
const createServer = require('../../../server') | ||
@@ -7,0 +6,0 @@ const buildContent = require('./build') |
@@ -5,3 +5,3 @@ // Based on https://github.com/nuxt/nuxt.js/blob/dev/bin/nuxt-build | ||
const generateConfig = require('./config/generate') | ||
const { logger } = require('@statusfy/shared-utils') | ||
const { logger } = require('@statusfy/common') | ||
@@ -8,0 +8,0 @@ module.exports = async function build (sourceDir, cliOptions = {}) { |
module.exports = { | ||
title: 'Statusfy Demo', | ||
description: 'A marvelous open source Status Page system', | ||
baseUrl: '/', | ||
@@ -18,3 +20,5 @@ defaultLocale: 'en', | ||
isStatic: false | ||
} | ||
}, | ||
serviceWorker: true, | ||
manifest: true | ||
} |
@@ -1,5 +0,4 @@ | ||
const path = require('path') | ||
const fs = require('fs') | ||
const defaultsDeep = require('lodash/defaultsDeep') | ||
const { esm, logger, style } = require('@statusfy/shared-utils') | ||
const { esm, logger, style, path } = require('@statusfy/common') | ||
@@ -10,3 +9,3 @@ const loadConfig = require('./load') | ||
module.exports = function generateConfig (sourceDir, cliOptions) { | ||
const nuxtConfig = esm(path.join(__dirname, '../../nuxt.config.js')) | ||
const nuxtConfig = Object.assign({}, esm(path.join(__dirname, '../../nuxt.config.js'))) | ||
const loadedConfig = loadConfig(sourceDir) | ||
@@ -89,9 +88,31 @@ | ||
// PWA Module | ||
nuxtConfig.manifest.name = siteConfig.title | ||
nuxtConfig.manifest.short_name = siteConfig.title | ||
nuxtConfig.manifest.description = siteConfig.description | ||
nuxtConfig.manifest.lang = siteConfig.defaultLocale | ||
if (siteConfig.serviceWorker === true) { | ||
nuxtConfig.workbox.cacheId = siteConfig.name | ||
nuxtConfig.workbox.globDirectory = path.resolve(nuxtConfig.buildDir, 'dist', 'client') | ||
nuxtConfig.workbox.runtimeCaching.forEach(runtime => { | ||
if (runtime.strategyOptions) { | ||
runtime.strategyOptions.cacheName = `${siteConfig.name}_${runtime.strategyOptions.cacheName}` | ||
} | ||
}) | ||
} else { | ||
const nuxtiPwaModuleConfig = nuxtConfig.modules.find(item => item[0] === '@nuxtjs/pwa')[1] | ||
nuxtiPwaModuleConfig.workbox = false | ||
delete nuxtConfig.workbox | ||
} | ||
if (siteConfig.manifest === true) { | ||
nuxtConfig.manifest.name = siteConfig.title | ||
nuxtConfig.manifest.short_name = siteConfig.title | ||
nuxtConfig.manifest.description = siteConfig.description | ||
nuxtConfig.manifest.lang = siteConfig.defaultLocale | ||
} else { | ||
const nuxtiPwaModuleConfig = nuxtConfig.modules.find(item => item[0] === '@nuxtjs/pwa')[1] | ||
nuxtiPwaModuleConfig.manifest = false | ||
delete nuxtConfig.manifest | ||
} | ||
nuxtConfig.meta.ogHost = siteConfig.baseUrl | ||
nuxtConfig.workbox.cacheId = siteConfig.name | ||
nuxtConfig.workbox.globDirectory = path.resolve(nuxtConfig.buildDir, 'dist', 'client') | ||
@@ -103,8 +124,2 @@ const customIconPath = path.join(sourceDir, 'assets', 'icon.png') | ||
nuxtConfig.workbox.runtimeCaching.forEach(runtime => { | ||
if (runtime.strategyOptions) { | ||
runtime.strategyOptions.cacheName = `${siteConfig.name}_${runtime.strategyOptions.cacheName}` | ||
} | ||
}) | ||
// Google Analytics Module | ||
@@ -111,0 +126,0 @@ if (siteConfig.ga && !nuxtConfig.dev) { |
@@ -1,2 +0,1 @@ | ||
const path = require('path') | ||
const defaultsDeep = require('lodash/defaultsDeep') | ||
@@ -6,3 +5,3 @@ | ||
const validateConfig = require('./validate') | ||
const { logger, fse, chalk, toml, yaml, slugify } = require('@statusfy/shared-utils') | ||
const { logger, fse, chalk, toml, yaml, slugify, path } = require('@statusfy/common') | ||
@@ -20,3 +19,3 @@ function parseConfig (filePath) { | ||
data = yaml.safeLoad(content) | ||
data = yaml.parse(content) | ||
break | ||
@@ -23,0 +22,0 @@ |
const url = require('url') | ||
const { chalk, validator } = require('@statusfy/shared-utils') | ||
const { chalk, validator } = require('@statusfy/common') | ||
@@ -4,0 +4,0 @@ const validFrontMatterFormats = ['yaml', 'yml', 'toml', 'json'] |
const { readdir, stat, readFile } = require('fs') | ||
const { promisify } = require('util') | ||
const path = require('path') | ||
const LRU = require('lru-cache') | ||
@@ -12,3 +11,3 @@ const spawn = require('cross-spawn') | ||
const createMarkdown = require('@statusfy/markdown') | ||
const { logger, hash } = require('@statusfy/shared-utils') | ||
const { logger, hash, path } = require('@statusfy/common') | ||
@@ -15,0 +14,0 @@ const moment = MomentRange.extendMoment(Moment) |
@@ -1,5 +0,4 @@ | ||
const path = require('path') | ||
const nodemon = require('nodemon') | ||
const { logger } = require('@statusfy/shared-utils') | ||
const { logger, path } = require('@statusfy/common') | ||
@@ -6,0 +5,0 @@ module.exports = async function dev (sourceDir, cliOptions = {}) { |
@@ -1,6 +0,5 @@ | ||
const { join } = require('path') | ||
const { Nuxt, Builder, Generator } = require('nuxt') | ||
const generateConfig = require('./config/generate') | ||
const { logger } = require('@statusfy/shared-utils') | ||
const { logger, path } = require('@statusfy/common') | ||
const { fixHomePages } = require('./utils/fixes') | ||
@@ -11,3 +10,3 @@ | ||
const outDir = cliOptions.outDir || join(sourceDir, 'dist') | ||
const outDir = cliOptions.outDir || path.join(sourceDir, 'dist') | ||
const { nuxtConfig, siteConfig } = generateConfig(sourceDir, cliOptions) | ||
@@ -14,0 +13,0 @@ nuxtConfig.generate.dir = outDir |
@@ -1,2 +0,1 @@ | ||
const { join } = require('path') | ||
const fs = require('fs') | ||
@@ -6,7 +5,7 @@ const template = require('lodash/template') | ||
const localeCode = require('locale-code') | ||
const { chalk, logger, fse, tomlify, yaml, slugify } = require('@statusfy/shared-utils') | ||
const { chalk, logger, fse, tomlify, yaml, slugify, path } = require('@statusfy/common') | ||
const pkg = require('../package.json') | ||
const configTemplate = template(fs.readFileSync(join(__dirname, 'init', 'template-config.json.tpl'), 'utf-8')) | ||
const packageTemplate = template(fs.readFileSync(join(__dirname, 'init', 'template-package.json.tpl'), 'utf-8')) | ||
const configTemplate = template(fs.readFileSync(path.join(__dirname, 'init', 'template-config.json.tpl'), 'utf-8')) | ||
const packageTemplate = template(fs.readFileSync(path.join(__dirname, 'init', 'template-package.json.tpl'), 'utf-8')) | ||
@@ -84,3 +83,3 @@ module.exports = async function generate (sourceDir, cliOptions = {}) { | ||
checkFiles.forEach(file => { | ||
if (fs.existsSync(join(outDir, file))) { | ||
if (fs.existsSync(path.join(outDir, file))) { | ||
logger.error('Make sure your destination directory is empty.', outDir) | ||
@@ -121,3 +120,3 @@ process.exit(0) | ||
configContent = `module.exports = ${JSON.stringify(config, null, ' ')}` | ||
configPath = join(outDir, 'config.js') | ||
configPath = path.join(outDir, 'config.js') | ||
break | ||
@@ -127,3 +126,3 @@ | ||
configContent = yaml.safeDump(config) | ||
configPath = join(outDir, 'config.yml') | ||
configPath = path.join(outDir, 'config.yml') | ||
break | ||
@@ -133,3 +132,3 @@ | ||
configContent = tomlify.toToml(config, { space: 2 }) | ||
configPath = join(outDir, 'config.toml') | ||
configPath = path.join(outDir, 'config.toml') | ||
break | ||
@@ -145,7 +144,7 @@ | ||
fse.copySync( | ||
join(__dirname, 'init', 'README-locales.md'), | ||
join(outDir, 'locales', 'README.md') | ||
path.join(__dirname, 'init', 'README-locales.md'), | ||
path.join(outDir, 'locales', 'README.md') | ||
) | ||
fse.outputJsonSync( | ||
join(outDir, 'locales', `${config.defaultLocale}.json`), | ||
path.join(outDir, 'locales', `${config.defaultLocale}.json`), | ||
{ | ||
@@ -160,4 +159,4 @@ title: config.title, | ||
fse.copySync( | ||
join(__dirname, 'init', 'README-content.md'), | ||
join(outDir, 'content', 'README.md') | ||
path.join(__dirname, 'init', 'README-content.md'), | ||
path.join(outDir, 'content', 'README.md') | ||
) | ||
@@ -167,3 +166,3 @@ | ||
fse.outputJsonSync( | ||
join(outDir, 'package.json'), | ||
path.join(outDir, 'package.json'), | ||
JSON.parse(packageTemplate({ | ||
@@ -181,4 +180,4 @@ options: { | ||
fse.copySync( | ||
join(__dirname, 'init', '.gitignore'), | ||
join(outDir, '.gitignore') | ||
path.join(__dirname, 'init', '.gitignore'), | ||
path.join(outDir, '.gitignore') | ||
) | ||
@@ -185,0 +184,0 @@ |
const fs = require('fs') | ||
const path = require('path') | ||
const inquirer = require('inquirer') | ||
const opener = require('opener') | ||
const { logger, fse, frontMatter, slugify } = require('@statusfy/shared-utils') | ||
const { logger, fse, frontMatter, slugify, path } = require('@statusfy/common') | ||
const loadConfig = require('./config/load') | ||
@@ -8,0 +7,0 @@ |
@@ -1,3 +0,2 @@ | ||
const { join } = require('path') | ||
const { fse } = require('@statusfy/shared-utils') | ||
const { fse, path } = require('@statusfy/common') | ||
@@ -8,4 +7,4 @@ // Nuxt bug: Fix the home page file of each locale | ||
if (locale.code !== siteConfig.defaultLocale) { | ||
const from = join(destDir, locale.code, '.html') | ||
const to = join(destDir, `${locale.code}.html`) | ||
const from = path.join(destDir, locale.code, '.html') | ||
const to = path.join(destDir, `${locale.code}.html`) | ||
@@ -12,0 +11,0 @@ fse.moveSync(from, to) |
@@ -1,3 +0,1 @@ | ||
const path = require('path') | ||
const portfinder = require('portfinder') | ||
@@ -8,3 +6,3 @@ const bs = require('browser-sync').create() | ||
const generateConfig = require('../config/generate') | ||
const { logger } = require('@statusfy/shared-utils') | ||
const { logger, path } = require('@statusfy/common') | ||
@@ -11,0 +9,0 @@ const start = async () => { |
@@ -1,2 +0,2 @@ | ||
const path = require('path') | ||
const { path } = require('@statusfy/common') | ||
@@ -83,3 +83,6 @@ const pkg = require('./package') | ||
// Doc: https://pwa.nuxtjs.org/ | ||
'@nuxtjs/pwa' | ||
['@nuxtjs/pwa', { | ||
workbox: true, | ||
manifest: true | ||
}] | ||
], | ||
@@ -86,0 +89,0 @@ /* |
{ | ||
"name": "@statusfy/core", | ||
"version": "0.0.1-alpha.1", | ||
"version": "0.1.0-alpha.0", | ||
"description": "Core of Statusfy", | ||
"author": "Julio Marquez", | ||
"license": "BSD-3-Clause", | ||
"author": { | ||
"name": "Bazzite", | ||
"email": "support@bazzite.com", | ||
"url": "https://www.bazzite.com" | ||
}, | ||
"license": "Apache-2.0", | ||
"main": "lib/index.js", | ||
@@ -38,7 +42,8 @@ "publishConfig": { | ||
"@nuxtjs/pwa": "^2.5.0", | ||
"@statusfy/markdown": "^0.0.1-alpha.1", | ||
"@statusfy/shared-utils": "^0.0.1-alpha.1", | ||
"@statusfy/common": "^0.1.0-alpha.0", | ||
"@statusfy/markdown": "^0.1.0-alpha.0", | ||
"body-parser": "^1.18.3", | ||
"browser-sync": "^2.26.0", | ||
"cors": "^2.8.4", | ||
"cross-env": "^5.2.0", | ||
"cross-spawn": "^6.0.5", | ||
@@ -70,3 +75,3 @@ "dayjs": "^1.7.7", | ||
"@mapbox/stylelint-processor-arbitrary-tags": "^0.2.0", | ||
"@statusfy/test-utils": "^0.0.1-alpha.1", | ||
"@statusfy/test-utils": "^0.1.0-alpha.0", | ||
"babel-core": "^7.0.0-0", | ||
@@ -86,3 +91,3 @@ "eslint-config-standard": "^12.0.0", | ||
}, | ||
"gitHead": "136a2edf273fda558d12957e78e63f67cfade10b" | ||
"gitHead": "7484c0b0696613f59a33893b0ac895d3396d6656" | ||
} |
@@ -1,5 +0,4 @@ | ||
const join = require('path').join | ||
const { postcss } = require('@statusfy/shared-utils') | ||
const { postcss, path } = require('@statusfy/common') | ||
const tailwindJS = join(__dirname, 'tailwind.js') | ||
const tailwindJS = path.join(__dirname, 'tailwind.js') | ||
@@ -6,0 +5,0 @@ module.exports = { |
const createApp = require('./app') | ||
const { logger } = require('@statusfy/shared-utils') | ||
const { logger } = require('@statusfy/common') | ||
@@ -4,0 +4,0 @@ module.exports = async function createServer (siteConfig, nuxtConfig, host, port, apiPrefix = '') { |
@@ -1,2 +0,2 @@ | ||
const path = require('path') | ||
const { path } = require('@statusfy/common') | ||
@@ -3,0 +3,0 @@ const loadConfig = require('../lib/config/load') |
@@ -34,14 +34,8 @@ /* | ||
const { style } = require('@statusfy/shared-utils') | ||
const { style } = require('@statusfy/common') | ||
const { colors, globalGuidelines } = style | ||
const { colors } = style | ||
module.exports = { | ||
/* | ||
Global Guidelines | ||
*/ | ||
globalGuidelines: globalGuidelines, | ||
/* | ||
|----------------------------------------------------------------------------- | ||
@@ -560,3 +554,3 @@ | Colors https://tailwindcss.com/docs/colors | ||
backgroundAttachment: false, | ||
backgroundColors: [], | ||
backgroundColors: false, | ||
backgroundPosition: false, | ||
@@ -566,3 +560,3 @@ backgroundRepeat: false, | ||
borderCollapse: false, | ||
borderColors: [], | ||
borderColors: false, | ||
borderRadius: [], | ||
@@ -597,3 +591,3 @@ borderStyle: false, | ||
textAlign: [], | ||
textColors: [], | ||
textColors: false, | ||
textSizes: [], | ||
@@ -600,0 +594,0 @@ textStyle: false, |
@@ -1,4 +0,4 @@ | ||
import path, { isAbsolute } from 'path' | ||
import isString from 'lodash.isstring' | ||
import cloneDeepWith from 'lodash.clonedeepwith' | ||
import { path } from '@statusfy/common' | ||
@@ -20,13 +20,18 @@ import generateConfig from '@/core/lib/config/generate' | ||
// Check absolute dirs | ||
expect(isAbsolute(nuxtConfig.buildDir)).toBeTruthy() | ||
expect(isAbsolute(nuxtConfig.generate.dir)).toBeTruthy() | ||
expect(isAbsolute(nuxtConfig.icon.iconSrc)).toBeTruthy() | ||
expect(isAbsolute(nuxtConfig.rootDir)).toBeTruthy() | ||
// expect(isAbsolute(nuxtConfig.srcDir)).toBeTruthy() | ||
expect(isAbsolute(nuxtConfig.statusfy.assets.mainLogo)).toBeTruthy() | ||
expect(path.isAbsolute(nuxtConfig.buildDir)).toBeTruthy() | ||
expect(path.isAbsolute(nuxtConfig.generate.dir)).toBeTruthy() | ||
expect(path.isAbsolute(nuxtConfig.icon.iconSrc)).toBeTruthy() | ||
expect(path.isAbsolute(nuxtConfig.rootDir)).toBeTruthy() | ||
// expect(path.isAbsolute(nuxtConfig.srcDir)).toBeTruthy() | ||
expect(path.isAbsolute(nuxtConfig.statusfy.assets.mainLogo)).toBeTruthy() | ||
if (nuxtConfig.statusfy.publicFilesPath) { | ||
expect(isAbsolute(nuxtConfig.statusfy.publicFilesPath)).toBeTruthy() | ||
expect(path.isAbsolute(nuxtConfig.statusfy.publicFilesPath)).toBeTruthy() | ||
} | ||
expect(isAbsolute(nuxtConfig.statusfy.siteConfig.sourceDir)).toBeTruthy() | ||
expect(isAbsolute(nuxtConfig.workbox.globDirectory)).toBeTruthy() | ||
expect(path.isAbsolute(nuxtConfig.statusfy.siteConfig.sourceDir)).toBeTruthy() | ||
if (nuxtConfig.workbox) { | ||
expect(path.isAbsolute(nuxtConfig.workbox.globDirectory)).toBeTruthy() | ||
} | ||
for (const dir of nuxtConfig.modulesDir) { | ||
@@ -40,7 +45,7 @@ expect(isString(dir)).toBeTruthy() | ||
nuxtConfig = cloneDeepWith(nuxtConfig, (value) => { | ||
if (isString(value) && isAbsolute(value)) { | ||
if (isString(value) && path.isAbsolute(value)) { | ||
const relativePath = path.normalize(relative(value)) | ||
if (relativePath.split('../').length <= 3) { | ||
return path.normalize(relative(value)) | ||
return path.toUnix(path.normalize(relative(value))) | ||
} | ||
@@ -47,0 +52,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import path from 'path' | ||
import { path } from '@statusfy/common' | ||
@@ -3,0 +3,0 @@ import generateConfig from '@/core/lib/config/generate' |
@@ -1,2 +0,1 @@ | ||
const path = require('path') | ||
const { promisify } = require('util') | ||
@@ -6,3 +5,3 @@ const fs = require('fs') | ||
const renameP = promisify(fs.rename) | ||
const { logger, fse, generateDemoContent } = require('@statusfy/shared-utils') | ||
const { logger, fse, generateDemoContent, path } = require('@statusfy/common') | ||
@@ -25,3 +24,3 @@ const tempPath = path.resolve(__dirname, '.tmp') | ||
const dest = path.join(tempPath, key) | ||
const configFile = path.resolve(__dirname, `config/fragments/${key}.js`) | ||
const configFile = path.resolve(__dirname, `config/fragments/config/${key}.js`) | ||
@@ -28,0 +27,0 @@ await fse.copy(tempBasePath, dest) |
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
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
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
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
194521
115
3051
32
+ Addedcross-env@^5.2.0
+ Added@statusfy/common@0.1.3(transitive)
+ Added@statusfy/markdown@0.1.3(transitive)
- Removed@statusfy/markdown@0.0.1-alpha.1(transitive)
- Removed@statusfy/shared-utils@0.0.1-alpha.1(transitive)