How to use the liferay-npm-build-tools-common/lib/project.jar 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-loader-css-loader / src / index.js View on Github external
function getHref(filePath, extension, pathModule) {
	let webContextPath;

	if (project.jar.supported) {
		webContextPath = project.jar.webContextPath;
	} else {
		const bnd = fs
			.readFileSync(project.dir.join('bnd.bnd').asNative)
			.toString();

		const lines = bnd.split('\n');

		const webContextPathLine = lines.find(line =>
			line.startsWith('Web-ContextPath:')
		);

		webContextPath = webContextPathLine.substring(16).trim();
	}

	project.sources
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / scripts / deploy.js View on Github external
export default function() {
	const liferayDirPath = cfg.getLiferayDir();

	const outputDir = project.jar.outputDir;
	const jarName = project.jar.outputFilename;

	fs.copyFileSync(
		outputDir.join(jarName).asNative,
		path.join(liferayDirPath, 'osgi', 'modules', jarName)
	);

	console.log(`Deployed ${jarName} to ${liferayDirPath}`);
}
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / scripts / deploy.js View on Github external
export default function() {
	const liferayDirPath = cfg.getLiferayDir();

	const outputDir = project.jar.outputDir;
	const jarName = project.jar.outputFilename;

	fs.copyFileSync(
		outputDir.join(jarName).asNative,
		path.join(liferayDirPath, 'osgi', 'modules', jarName)
	);

	console.log(`Deployed ${jarName} to ${liferayDirPath}`);
}
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / jar / index.js View on Github external
function getPortletInstanceConfigurationJson() {
	if (!project.jar.configurationFile) {
		return undefined;
	}

	const filePath = project.jar.configurationFile.asNative;
	const configurationJson = fs.readJSONSync(filePath);

	if (
		!configurationJson.portletInstance ||
		!configurationJson.portletInstance.fields ||
		Object.keys(configurationJson.portletInstance.fields).length == 0
	) {
		return undefined;
	}

	return configurationJson.portletInstance;
}
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / jar / index.js View on Github external
const minimumExtenderVersion = getMinimumExtenderVersion();

		if (minimumExtenderVersion) {
			filter =
				`(&` +
				`(osgi.extender=liferay.frontend.js.portlet)` +
				`(version>=${minimumExtenderVersion})` +
				`)`;
		} else {
			filter = `(osgi.extender=liferay.frontend.js.portlet)`;
		}

		contents += `Require-Capability: osgi.extender;filter:="${filter}"\n`;
	}

	Object.entries(project.jar.customManifestHeaders).forEach(
		([key, value]) => {
			contents += `${key}: ${value}\n`;
		}
	);

	zip.folder('META-INF').file('MANIFEST.MF', contents);
}
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / scripts / build / create-react-app.js View on Github external
const jsFilePaths = fs
		.readdirSync(jsDirPath)
		.filter(jsFilePath => jsFilePath.endsWith('.js'));

	const jsRuntimeFilePath = jsFilePaths.find(jsFilePath =>
		jsFilePath.startsWith('runtime')
	);

	renderer.render('index.js', {
		jsFiles: [
			...jsFilePaths.filter(jsFile => jsFile !== jsRuntimeFilePath),
			jsRuntimeFilePath,
		],
		pkgJson,
		webContextPath: project.jar.webContextPath,
	});
}
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / jar / index.js View on Github external
const minimumExtenderVersion = getMinimumExtenderVersion();

		if (minimumExtenderVersion) {
			filter =
				`(&` +
				`(osgi.extender=liferay.frontend.js.portlet)` +
				`(version>=${minimumExtenderVersion})` +
				`)`;
		} else {
			filter = `(osgi.extender=liferay.frontend.js.portlet)`;
		}

		contents += `Require-Capability: osgi.extender;filter:="${filter}"\n`;
	}

	Object.entries(project.jar.customManifestHeaders).forEach(
		([key, value]) => {
			contents += `${key}: ${value}\n`;
		}
	);

	zip.folder('META-INF').file('MANIFEST.MF', contents);
}
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / loader / adapt-static-urls.ts View on Github external
const matches = regexp.exec(content);

		if (!matches) {
			return;
		}

		log.info(
			'adapt-static-urls',
			`Adapted ${matches.length} occurrences of URL '${filePosixPath}'`
		);

		modifiedContent = modifiedContent.replace(
			regexp,
			(prependSlash ? '/' : '') +
				`o${project.jar.webContextPath}/${prefix}${filePosixPath}`
		);
	});
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / index.ts View on Github external
			.then(() => (project.jar.supported ? createJar() : undefined))
			.then(() => {