How to use the canonical-path.resolve function in canonical-path

To help you get started, we’ve selected a few canonical-path 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 ionic-team / ionic-v1 / config / gulp-tasks / docs.js View on Github external
gulp.task('docs', function() {
    var docVersion = argv['doc-version'] || 'nightly';
    if (docVersion != 'nightly' && !semver.valid(docVersion)) {
      console.log('Usage: gulp docs --doc-version=(nightly|versionName)');
      return process.exit(1);
    }

    var config = dgeni.loadConfig(path.resolve(projectRoot, 'config/docs/docs.config.js'));
    config.set('currentVersion', docVersion);
    config.set(
      'rendering.outputFolder',
      argv.dist ? argv.dist : path.resolve(projectRoot, '..', 'ionic-site')
    );

    return dgeni.generator(config)().then(function() {
      gutil.log('Docs for', gutil.colors.cyan(docVersion), 'generated!');
    });
  });
github nikhilmodak / gulp-ngdocs / index.js View on Github external
var through2 = require('through2');
var extend = require('extend');
var _ = require('lodash');
var gutil = require('gulp-util');
var File = gutil.File;
var PluginError = gutil.PluginError;
var path = require('canonical-path');
var StringDecoder = require('string_decoder').StringDecoder;
var decoder = new StringDecoder('utf8');
var merge = require('merge-stream');

var setup = {sections: {}, pages: [], apis: {}};
var fakeDest = '_FAKE_DEST_';
var templates = path.resolve(__dirname, 'src/templates');
var nodeModules = path.resolve(__dirname, 'node_modules');
var flattenedNodeModules = path.resolve(__dirname, '../');

function copyTemplates() {
  return function () {
    return vfs.src(['**/*', '!**/*.tmpl'], {cwd: templates});
  };
}

function streamFile(src, dir, dest, name) {
  return function () {
    return vfs.src(src).pipe(through2.obj(function (file, enc, callback) {
      name = name === undefined ? path.normalize(file.path).split('/').pop() : name;
      this.push(new File({
        base: dest,
        cwd: dest,
        path: path.join(dest, dir, name),
        contents: file.contents
github angular / dgeni-packages / ngdoc / tag-defs / module.spec.js View on Github external
it("should not calculate module if the doc is not in 'api' area", function() {
     var tagDef = tagDefFactory();
     var relativePath = 'guide/concepts.ngdoc';
     expect(tagDef.defaultFn({ area: 'guide', fileInfo: { filePath: path.resolve(relativePath), relativePath: relativePath } })).toBeUndefined();
  });
github angular / angular / aio / tools / examples / example-boilerplate.spec.js View on Github external
it('should use copySync and chmodSync', () => {
      spyOn(fs, 'copySync');
      spyOn(fs, 'chmodSync');
      exampleBoilerPlate.copyFile('source/folder', 'destination/folder', 'some/file/path');
      expect(fs.copySync).toHaveBeenCalledWith(
        path.resolve('source/folder/some/file/path'),
        path.resolve('destination/folder/some/file/path'),
        { overwrite: true });
      expect(fs.chmodSync).toHaveBeenCalledWith(path.resolve('destination/folder/some/file/path'), 444);
    });
  });
github angular / angular / aio / tools / examples / example-boilerplate.spec.js View on Github external
it('should process all the example folders', () => {
      const examplesDir = path.resolve(__dirname, '../../content/examples');
      exampleBoilerPlate.add();
      expect(exampleBoilerPlate.getFoldersContaining)
          .toHaveBeenCalledWith(examplesDir, 'example-config.json', 'node_modules');
    });
github angular / dgeni-packages / base / processors / read-files.js View on Github external
function normalizeSourceInfo(basePath, sourceInfo) {

  if ( _.isString(sourceInfo) ) {
    sourceInfo = { include: sourceInfo };
  } else if ( !_.isObject(sourceInfo) ) {

    throw new Error('Invalid sourceFiles parameter. ' +
      'You must pass an array of items, each of which is either a string or an object of the form ' +
      '{ include: "...", basePath: "...", exclude: "...", fileReader: "..." }');
  }

  sourceInfo.basePath = path.resolve(basePath, sourceInfo.basePath || '.');
  sourceInfo.include = path.resolve(sourceInfo.basePath, sourceInfo.include);
  sourceInfo.exclude = sourceInfo.exclude && path.resolve(sourceInfo.basePath, sourceInfo.exclude);

  return sourceInfo;
}
github angular / angular.js / docs / docs.config.js View on Github external
var getVersion = function(component, sourceFolder, packageFile) {
    sourceFolder = sourceFolder || './bower_components';
    packageFile = packageFile || 'bower.json';

    return require(path.resolve(sourceFolder,component,packageFile)).version;
  };
github OnsenUI / OnsenUI / docs / package / index.js View on Github external
{
        include: 'bindings/angular1/directives/*.js',
        basePath: path.resolve(__dirname, '/bindings/angular1/directives')
      },
      {
        include: 'bindings/angular1/js/*.js',
        basePath: path.resolve(__dirname, '/bindings/angular1/js')
      },
      {
        include: 'docs/guides/*.ngdoc',
        basePath: path.resolve(__dirname, '/docs/guides')
      }
    ];

    templateFinder.templateFolders.unshift(
      path.resolve(__dirname, 'templates')
    );

    templateFinder.templatePatterns.unshift('${ doc.docType }.template.html');
  })
  .config(function(writeFilesProcessor, parseTagsProcessor, templateEngine, checkAnchorLinksProcessor) {
github gazbert / bxbot-ui-angular / protractor.config.js View on Github external
function Reporter(options) {
    var _defaultOutputFile = path.resolve(process.cwd(), './_test-output', 'protractor-results.txt');
    options.outputFile = options.outputFile || _defaultOutputFile;

    initOutputFile(options.outputFile);
    options.appDir = options.appDir || './';
    var _root = {appDir: options.appDir, suites: []};
    log('AppDir: ' + options.appDir, +1);
    var _currentSuite;

    this.suiteStarted = function (suite) {
        _currentSuite = {description: suite.description, status: null, specs: []};
        _root.suites.push(_currentSuite);
        log('Suite: ' + suite.description, +1);
    };

    this.suiteDone = function (suite) {
        var statuses = _currentSuite.specs.map(function (spec) {
github ReactiveX / rxjs / docs_app / tools / ng-packages-installer / index.js View on Github external
/*eslint-env es6*/
const chalk = require('chalk');
const fs = require('fs-extra');
const path = require('canonical-path');
const shelljs = require('shelljs');
const yargs = require('yargs');

const PACKAGE_JSON = 'package.json';
const LOCAL_MARKER_PATH = 'node_modules/_local_.json';
const PACKAGE_JSON_REGEX = /^[^/]+\/package\.json$/;

const ANGULAR_ROOT_DIR = path.resolve(__dirname, '../../..');
const ANGULAR_DIST_PACKAGES = path.resolve(ANGULAR_ROOT_DIR, 'dist/package');

/**
 * A tool that can install Angular dependencies for a project from NPM or from the
 * locally built distributables.
 *
 * This tool is used to change dependencies of the `aio` application and the example
 * applications.
 */
class NgPackagesInstaller {
  /**
   * Create a new installer for a project in the specified directory.
   *
   * @param {string} projectDir - the path to the directory containing the project.
   * @param {object} options - a hash of options for the install
   *                           * `debug` (`boolean`) - whether to display debug messages.

canonical-path

paths that always use forward slashes

MIT
Latest version published 6 years ago

Package Health Score

50 / 100
Full package analysis