How to use the @statusfy/common.path.relative function in @statusfy/common

To help you get started, we’ve selected a few @statusfy/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bazzite / statusfy / packages / @statusfy / core / nuxt.config.js View on Github external
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/"),
  modulesDir,
  mode: "universal",
  /*
   ** Environment variables
   */
github bazzite / statusfy / packages / @statusfy / core / nuxt.config.js View on Github external
const { path } = 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")];

// 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")
    )
  );
}

module.exports = {
  srcDir: path.join(__dirname, "./client/"),
  modulesDir,
  mode: "universal",
  /*
  ** Environment variables
  */
  env: {
    isDev: process.env.NODE_ENV !== "production"
  },
github bazzite / statusfy / packages / @statusfy / core / lib / new-incident.js View on Github external
} else {
          filePath = path.join(contentPath, locale.code, fileName + ".md");
        }

        if (fs.existsSync(filePath)) {
          logger.error(
            `An incident with a similar title already exists.\n${filePath}`
          );
          error = true;
        } else {
          fse.outputFileSync(
            filePath,
            `${content}\n\n`
          );

          createdFiles.push(path.relative(contentPath, filePath));

          if (answers.open) {
            opener(filePath);
          }
        }
      });
github bazzite / statusfy / packages / @statusfy / core / lib / content / database.js View on Github external
if (!exists) {
    logger.warn(`Content Directory not found: ${dirPath}`);
  } else {
    try {
      const files = (await readdirP(dirPath)).map(f => path.join(dirPath, f));

      for (let i = 0; i < files.length; i++) {
        const filePath = files[i];
        const isFile = (await statP(filePath)).isFile();

        if (
          isFile &&
          path.extname(filePath) === ".md" &&
          path.basename(filePath).toLowerCase() !== "readme.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);
        }
      }