How to use @userfrosting/merge-package-dependencies - 3 common examples

To help you get started, we’ve selected a few @userfrosting/merge-package-dependencies 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 VulcanJS / Vulcan / .vulcan / update_package.js View on Github external
' dependencies.');
  } else {
    console.log(appPackageJson.name + '@' + appPackageJson.version +
      ' \'package.json\' will be updated with Vulcan@' + vulcanPackageJson.version +
      ' dependencies.');
  }

  var backupDirPath = vulcanDirPath + 'bkp/';
  if (!fs.existsSync(backupDirPath)) {
    fs.mkdirSync(backupDirPath);
  }
  var backupFilePath = backupDirPath + 'package-' + Date.now() + '.json';
  console.log('Saving a backup of \'' + appDirPath + 'package.json\' in \'' + backupFilePath + '\'');
  fs.writeFileSync(backupFilePath, appPackageFile);

  var updatedAppPackageJson = mergePackages.npm(
    // IMPORTANT: parse again because mergePackages.npm mutates json
    JSON.parse(appPackageFile),
    [vulcanDirPath]
  );

  updatedAppPackageJson.vulcanVersion = vulcanPackageJson.version;

  [
    'dependencies',
    'devDependencies',
    'peerDependencies'
  ].forEach(function(key) {
    if (updatedAppPackageJson[key]) {
      updatedAppPackageJson[key] = sortObjectByKeyNameList(updatedAppPackageJson[key]);
    }
github digipolisantwerp / acpaas-ui_angular / scripts / helpers / deps.js View on Github external
const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json')));

	const isDirectory = source => lstatSync(source).isDirectory();
	const getDirectories = source => readdirSync(source).map(name => join(source, name)).filter(isDirectory);

	const packages = getDirectories(resolve(process.cwd(), 'packages')).map(path => {
		// We'll first try to read the legacy package.json file, under lib
		if (existsSync(`${path}/lib/`)) {
			return `${path}/lib/`;
		// If that doesn't work out, we're most likely dealing with the new Angular 6 structure,
		// where the package.json file is listed directly under the package directory
		} else if (existsSync(`${path}/src/`)) {
			return `${path}/`
		}
	});
	const result = mergePackages.npm(packageJson, packages);

	if (!preserve) {
		return {
			dependencies: result.dependencies || {},
			peerDependencies: result.peerDependencies || {},
		};
	}

	return result;
};
github digipolisantwerp / acpaas-ui_angular / scripts / helpers / deps.js View on Github external
module.exports.getNPMDependencies = ({ preserve = false } = {}) => {
	const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json')));

	const isDirectory = source => lstatSync(source).isDirectory();
	const getDirectories = source => readdirSync(source).map(name => join(source, name)).filter(isDirectory);

	const packages = getDirectories(resolve(process.cwd(), 'packages')).map(path => `${path}/`);

	const result = mergePackages.npm(packageJson, packages);

	if (!preserve) {
		return {
			dependencies: result.dependencies || {},
			peerDependencies: result.peerDependencies || {},
		};
	}

	return result;
};

@userfrosting/merge-package-dependencies

Merge NPM, Yarn or Bower package dependencies into one package, with semver rules respected.

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Popular @userfrosting/merge-package-dependencies functions