How to use the just-scripts.resolveCwd function in just-scripts

To help you get started, we’ve selected a few just-scripts 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 OfficeDev / office-ui-fabric-react / scripts / tasks / copy.js View on Github external
function expandSourcePath(pattern) {
  if (!pattern) {
    return null;
  }

  // just returns the relative paths
  if (pattern.startsWith('.')) {
    return pattern;
  }

  // tries to resolve the packages, handling scoped packages
  const splitPattern = pattern.split('/');
  const packageName = pattern[0] == '@' ? `${splitPattern[0]}/${splitPattern[1]}` : splitPattern[0];

  try {
    const resolvedPackageJson = resolveCwd(`${packageName}/package.json`);

    if (!resolvedPackageJson) {
      // returns pattern if the packageName didn't contain a package.json (not really a package)
      return pattern;
    }

    return pattern.replace(packageName, path.dirname(resolvedPackageJson));
  } catch (e) {
    console.error(e);
  }
}
github OfficeDev / office-ui-fabric-react / scripts / just.config.js View on Github external
task('dev', series('clean', 'copy', 'sass', 'webpack-dev-server'));

  task('build:node-lib', series('clean', 'copy', series(condition('validate', () => !argv().min), 'ts:commonjs-only'))).cached();

  task(
    'build',
    series(
      'clean',
      'copy',
      'sass',
      parallel(
        condition('validate', () => !argv().min),
        series(
          'ts',
          parallel(
            condition('webpack', () => !argv().min && !!resolveCwd('webpack.config.js')),
            condition('lint-imports', () => !argv().min)
          )
        )
      )
    )
  ).cached();

  task('no-op', () => {}).cached();
};
github microsoft / fluent-ui-react / scripts / config / jest / jest.fluent-ui-react.js View on Github external
const { defaults: tsjPreset } = require('ts-jest/presets')
const { resolveCwd } = require('just-scripts')
const path = require('path')

module.exports = {
  transform: {
    ...tsjPreset.transform,
  },
  testRegex: '/test/.*-test\\.tsx?$',
  globals: {
    'ts-jest': {
      isolatedModules: true,
      tsConfig: resolveCwd('tsconfig.json'),
      packageJson: resolveCwd('package.json'),
    },
  },
  coverageDirectory: './coverage/',
  coverageReporters: ['json', 'lcov'],
  setupFilesAfterEnv: [path.join(__dirname, 'jestSetup.fluent-ui-react.js')],
  verbose: false,
}
github OfficeDev / office-ui-fabric-react / scripts / jest / jest-resources.js View on Github external
  resolveMergeStylesSerializer: () => resolveCwd('@uifabric/jest-serializer-merge-styles'),
  createRawConfig: () => ({
github microsoft / fluent-ui-react / scripts / config / jest / jest.fluent-ui-react.js View on Github external
const { defaults: tsjPreset } = require('ts-jest/presets')
const { resolveCwd } = require('just-scripts')
const path = require('path')

module.exports = {
  transform: {
    ...tsjPreset.transform,
  },
  testRegex: '/test/.*-test\\.tsx?$',
  globals: {
    'ts-jest': {
      isolatedModules: true,
      tsConfig: resolveCwd('tsconfig.json'),
      packageJson: resolveCwd('package.json'),
    },
  },
  coverageDirectory: './coverage/',
  coverageReporters: ['json', 'lcov'],
  setupFilesAfterEnv: [path.join(__dirname, 'jestSetup.fluent-ui-react.js')],
  verbose: false,
}