How to use the upath.normalize function in upath

To help you get started, we’ve selected a few upath 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 qooxdoo / qooxdoo-compiler / source / class / qx / tool / cli / commands / Serve.js View on Github external
makers.forEach(maker => {
          let target = maker.getTarget();
          let out = path.normalize("/" + target.getOutputDir());
          app.use(out, express.static(target.getOutputDir()));
          appsData.push({
            target: {
              type: target.getType(),
              outputDir: out
            },
            apps: maker.getApplications()
              .filter(app => app.getStandalone())
              .map(app => ({
                isBrowser: app.isBrowserApp(),
                name: app.getName(),
                type: app.getType(),
                title: app.getTitle() || app.getName(),
                appClass: app.getClassName(),
                description: app.getDescription(),
                outputPath: target.getProjectDir(app) // no trailing slash or link will break
github darukjs / daruk / src / core / daruk_loader.ts View on Github external
.forEach((file: string) => {
        let controller = uRequire(file);
        assert(
          isSubClass(controller, BaseContext),
          `[controller must export a subclass of Daruk.BaseController in path: ${file}`
        );
        let RoutePath = file.replace(normalize(path), '').replace(JsTsReg, '');
        // 验证类名必须是首字母大写的驼峰形式,并且和路由 path 匹配
        const validClassName = RoutePath
          // 斜线后面的字母大写, RoutePath 定会有 / 开头
          .replace(/\/([a-z])/g, (matches: string, capture: string) => {
            return capture.toLocaleUpperCase();
          })
          // 去除所有斜线
          .replace(/\//g, '');
        assert(
          validClassName === controller.name,
          `controller class name should be '${validClassName}' ( CamelCase style and match route path ) in path: ${file}`
        );

        // 认为 index 文件名对应的路由是 /
        RoutePath = RoutePath.replace(/\/index$/g, '/');
        routePath2ControllerMap[RoutePath] = controller;
github VladimirIvanin / insales-uploader / lib / file-system / assets.js View on Github external
_.forEach(list, function (_name, index) {

          var _tempIndex = index;
          var _fullPath = upath.normalize(folder + _name);
          _localPath.push(_fullPath)

          if ( _.isUndefined(assets[_fullPath]) ) {
            _errorList.push({
              name: _name,
              path: _fullPath
            })
          }

          if (_tempIndex === _listSize) {
            _count++
          }

          if (index === _listSize && _count === _folderSize) {
            var _omit = _.omit(assets, _localPath);
            var _omitSize = _.size(_omit) - 1;
github bundlebee / bundle-bee / app / src / components / OpenFolderButtons.jsx View on Github external
[webpackDist, parcelDist, rollupDist] = dists.map(dist =>
      upath.normalize(path.join(dirname, 'electronUserData', dist, 'package.json'))
    );
github jus / jus / lib / jus.js View on Github external
    .on('add', (filename) => createFile(path.normalize(filename)))
    .on('change', (filename) => updateFile(path.normalize(filename)))
github mpvue / mpvue-loader / lib / utils / resolve-src.js View on Github external
module.exports = function (...arv) {
  return upath.normalize(relative(...arv)).replace(/^src\//, '').replace(/node_modules\//g, 'modules/')
}
github lukasz-wronski / vscode-ftp-sync / modules / on-generate.js View on Github external
module.exports = function(document, getFtpSync, skipOnSaveCheck) {
  if (document.uri.fsPath.indexOf(ftpconfig.rootPath().fsPath) < 0) return;

  var config = ftpconfig.getConfig();

  //Should we bother to check for generated file uploads? (also check if the generated files path is set otherwise skip)
  if (config.generatedFiles.extensionsToInclude.length > 0) {
    //If it's not an auto uploaded generated file it won't start with that directory
    if (
      !upath.normalize(path.dirname(document.uri.fsPath)).startsWith(
        getFtpSync()
          .getConfig()
          .getGeneratedDir()
      )
    )
      return;
    //It's an auto upload generated file
    else {
      //Let's see if it's an extension we will be supporting!
      var extensionCheck = config.generatedFiles.extensionsToInclude.some(
        function(str) {
          return document.uri.fsPath.endsWith(str);
        }
      );

      if (!extensionCheck) return;
github peterqliu / threebox / node_modules / chokidar / index.js View on Github external
ignored = ignored.map(function (path) {
        if (typeof path !== 'string') return path;
        return upath.normalize(isAbsolute(path) ? path : sysPath.join(cwd, path));
      });
    }
github weixin / Miaow / node_modules / chokidar / index.js View on Github external
ignored = ignored.map(function (path) {
        if (typeof path !== 'string') return path;
        return upath.normalize(isAbsolute(path) ? path : sysPath.join(cwd, path));
      });
    }

upath

A proxy to `path`, replacing `\` with `/` for all results (supports UNC paths) & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions.

MIT
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis