Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { path, postcss } = require("@statusfy/common");
const pkg = require("./package");
const langDir = "locales/";
const mainColor = "#000000";
const iconSizes = [16, 120, 144, 152, 192, 384, 512];
const modulesDir = [path.join(__dirname, "node_modules")];
const tailwindJS = path.resolve(__dirname, "tailwind.js");
// Hack: allow to execute using lerna/yarn workspaces on testing
if (process.env.STATUSFY_LERNA) {
modulesDir.push(
path.relative(
__dirname,
path.join(__dirname, "..", "..", "..", "node_modules")
)
);
}
/**
* @type { import("@nuxt/types").Configuration }
*/
const config = {
srcDir: path.join(__dirname, "./client/"),
statusfyOptions.locales.forEach(locale => {
const localePath = path.resolve(
__dirname,
"../../",
statusfyOptions.langDir,
`${locale.code}.js`
);
let defaultLocaleContent = {};
let userLocaleContent = {};
// Default locale
const defaultLocalePath = path.resolve(
__dirname,
"../../",
"locales",
`${locale.code}-default.json`
);
if (fs.existsSync(defaultLocalePath)) {
defaultLocaleContent = require(defaultLocalePath);
}
// User locale
const userLocalePath = path.join(
statusfyOptions.sourceDir,
"locales",
`${locale.code}.json`
);
if (fs.existsSync(userLocalePath)) {
extend(config, ctx) {
// Run ESLint on save
if (ctx.isDev && process.client) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
// Markdown
config.module.rules.push({
test: /\.md$/,
loader: path.resolve(__dirname, './webpack/markdown-loader.js'),
include: path.resolve(__dirname, './content'),
options: {
markdown
}
})
},
/*
extend(config, ctx) {
// Run ESLint on save
if (ctx.isDev && process.client) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
// Markdown
config.module.rules.push({
test: /\.md$/,
loader: path.resolve(__dirname, './webpack/markdown-loader.js'),
include: path.resolve(__dirname, './content'),
options: {
markdown
}
})
},
/*
console.log(chalk.red(`Please upgrade your Node version.`))
process.exit(1)
}
const {
init,
dev,
build,
generate,
start,
newIncident,
deleteIncident,
updateIncident
} = require('@statusfy/core/lib')
const sourceDir = path.resolve('.')
program
.version(pkg.version)
.usage(' [options]')
program
.command('init')
.description('Create a base project')
.option('-d, --dir ', 'specify the installation directory')
.action(({ dir }) => {
const outDir = dir ? path.resolve(dir) : null
wrapCommand(init)(sourceDir, { outDir })
})
program
.command('dev')
const prepare = () => {
generateDemoContent(
path.resolve(__dirname, '../content'),
new Date(),
50
)
}
chainWebpack (config) {
config.resolve.alias.set('@assets', path.resolve(__dirname, 'public/assets'))
config.resolve.alias.set('@public', path.resolve(__dirname, 'public'))
},
extendPageData($page) {
.action(({ dir }) => {
const outDir = dir ? path.resolve(dir) : null
wrapCommand(init)(sourceDir, { outDir })
})
const getIncidentsFromProject = async contentDir => {
const files = await fse.readdir(contentDir);
const incidentsList = [];
for (let i = 0; i < files.length; i++) {
const f = path.resolve(contentDir, files[i]);
const ext = path.extname(f);
const fileName = path.basename(f);
if (ext === ".md") {
const fileContent = await fse.readFile(f);
const { data } = grayMatter.parse(fileContent);
incidentsList.push({
value: {
name: fileName,
path: f
},
name: `${fileName} > ${chalk.yellow(data.title)} (${chalk.green(
new Date(data.date).toUTCString()
)})`
});
.action(({ dest, analyze }) => {
const outDir = dest ? path.resolve(dest) : null
wrapCommand(generate)(sourceDir, { outDir, analyze })
})