How to use the liferay-npm-build-tools-common/lib/globs.prefix function in liferay-npm-build-tools-common

To help you get started, we’ve selected a few liferay-npm-build-tools-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 liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / transform.js View on Github external
// Intercept presets and plugins to load them from here
	babelConfig.plugins = project.transform.getBabelPlugins(destPkg);
	babelConfig.presets = [];

	// Determine file globs
	const globs = ['**/*.js', '!node_modules/**/*'];

	if (destPkg.isRoot) {
		globs.push(...gl.negate(project.transform.babelIgnores));
	}

	// Run babel through files
	const prjRelPaths = findFiles(
		project.dir.asNative,
		gl.prefix(`${project.dir.asPosix}/${destPkg.dir.asPosix}/`, globs)
	);

	log.debug(
		`Babelifying ${prjRelPaths.length} files in package '${destPkg.id}'...`
	);

	return runInChunks(
		prjRelPaths,
		project.misc.maxParallelFiles,
		0,
		prjRelPath => babelifyFile(destPkg, prjRelPath, babelConfig)
	);
}
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / rules.js View on Github external
function processPackage(srcPkg) {
	log.debug(`Applying rules to package '${srcPkg.id}'...`);

	const sourceGlobs = srcPkg.isRoot
		? project.sources.map(source =>
				fs.statSync(project.dir.join(source).asNative).isDirectory()
					? `${source.asPosix}/**/*`
					: source.asPosix
		  )
		: ['**/*'];

	const globs = [...sourceGlobs, '!node_modules/**/*'];

	const sourcePrjRelPaths = findFiles(
		project.dir.asNative,
		gl.prefix(`${project.dir.asPosix}/${srcPkg.dir.asPosix}/`, globs)
	);

	const destPkg = srcPkg.clone({
		dir: getDestDir(srcPkg),
	});

	return runInChunks(
		sourcePrjRelPaths,
		project.misc.maxParallelFiles,
		0,
		prjRelPath => processFile(srcPkg, destPkg, prjRelPath)
	);
}
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / copy.js View on Github external
dir: getDestDir(srcPkg),
	});

	if (!manifest.isOutdated(destPkg)) {
		return Promise.resolve();
	}

	log.debug(`Copying package '${srcPkg.id}'...`);

	srcPkg.clean = false;

	const srcPkgRelPaths = srcPkg.isRoot
		? ['package.json']
		: findFiles(
				project.dir.join(srcPkg.dir).asNative,
				gl.prefix(`${project.dir.asPosix}/${srcPkg.dir.asPosix}/`, [
					`**/*`,
					`!node_modules/**/*`,
				])
		  );

	const srcPkgRelPathsToCopy = srcPkg.isRoot
		? srcPkgRelPaths
		: runCopyPlugins(
				srcPkg,
				destPkg,
				findFiles(
					project.dir.join(srcPkg.dir).asNative,
					gl.prefix(`${project.dir.asPosix}/${srcPkg.dir.asPosix}/`, [
						`**/*`,
						`!node_modules/**/*`,
						...gl.negate(project.copy.getExclusions(srcPkg)),
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / copy.js View on Github external
: findFiles(
				project.dir.join(srcPkg.dir).asNative,
				gl.prefix(`${project.dir.asPosix}/${srcPkg.dir.asPosix}/`, [
					`**/*`,
					`!node_modules/**/*`,
				])
		  );

	const srcPkgRelPathsToCopy = srcPkg.isRoot
		? srcPkgRelPaths
		: runCopyPlugins(
				srcPkg,
				destPkg,
				findFiles(
					project.dir.join(srcPkg.dir).asNative,
					gl.prefix(`${project.dir.asPosix}/${srcPkg.dir.asPosix}/`, [
						`**/*`,
						`!node_modules/**/*`,
						...gl.negate(project.copy.getExclusions(srcPkg)),
					])
				)
		  );

	report.packageCopy(srcPkg, srcPkgRelPaths, srcPkgRelPathsToCopy);

	if (srcPkgRelPathsToCopy.length === 0) {
		srcPkg.clean = true;
	}

	return Promise.all(
		srcPkgRelPathsToCopy.map(srcPkgRelPath =>
			copyFile(srcPkg, destPkg, srcPkgRelPath)