How to use the liferay-npm-build-tools-common/lib/format.print 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-build-support / src / scripts / build / create-react-app.js View on Github external
function assertIndexJsIntegrity() {
	const indexJsPath = project.dir.join('src', 'index.js').asNative;

	const indexJsContent = fs.readFileSync(indexJsPath).toString();

	if (indexJsContent.indexOf(indexJsNoticeHeader) != -1) {
		print(msg.indexJsModified);

		const dotIndexJsPath = project.dir.join('src', '.index.js').asNative;

		if (fs.existsSync(dotIndexJsPath)) {
			print(msg.indexJsBackupPresent);
			console.log(
				fs
					.readFileSync(dotIndexJsPath)
					.toString()
					.split('\n')
					.map(line => `> ${line}`)
					.join('\n')
			);

			const prompt = readline.createInterface({
				input: process.stdin,
				output: process.stdout,
			});

			return new Promise((resolve, reject) => {
				print(msg.askWhetherToUseBackup);
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / scripts / build / create-react-app.js View on Github external
function assertIndexJsIntegrity() {
	const indexJsPath = project.dir.join('src', 'index.js').asNative;

	const indexJsContent = fs.readFileSync(indexJsPath).toString();

	if (indexJsContent.indexOf(indexJsNoticeHeader) != -1) {
		print(msg.indexJsModified);

		const dotIndexJsPath = project.dir.join('src', '.index.js').asNative;

		if (fs.existsSync(dotIndexJsPath)) {
			print(msg.indexJsBackupPresent);
			console.log(
				fs
					.readFileSync(dotIndexJsPath)
					.toString()
					.split('\n')
					.map(line => `> ${line}`)
					.join('\n')
			);

			const prompt = readline.createInterface({
				input: process.stdin,
github liferay / liferay-js-toolkit / packages / generator-liferay-js / src / adapt / index.js View on Github external
case ProjectType.ANGULAR_CLI:
				this._options = {
					preset: 'angular-cli',
					tuneProject: () => this._tuneAngularCliProject(),
				};

				print(msg.angularCliDetected);
				break;

			case ProjectType.CREATE_REACT_APP:
				this._options = {
					preset: 'create-react-app',
					tuneProject: () => this._tuneCreateReactAppProject(),
				};

				print(msg.createReactAppDetected);
				break;

			case ProjectType.VUE_CLI:
				this._options = {
					preset: 'vue-cli',
					tuneProject: () => this._tuneVueCliProject(),
				};

				print(msg.vueCliDetected);
				break;

			default:
				print(msg.unsupportedProjectType);
				process.exit(1);
		}
	}
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / scripts / build / index.js View on Github external
export default function() {
	switch (project.probe.type) {
		case ProjectType.ANGULAR_CLI:
			buildWith('build', ['--prod=true']);
			break;

		case ProjectType.CREATE_REACT_APP:
			buildWith('build');
			break;

		case ProjectType.VUE_CLI:
			buildWith('build', ['--prod=true']);
			break;

		default:
			print(msg.unsupportedProjectType);
			process.exit(1);
	}
}
github liferay / liferay-js-toolkit / packages / generator-liferay-js / src / adapt / index.js View on Github external
case ProjectType.CREATE_REACT_APP:
				this._options = {
					preset: 'create-react-app',
					tuneProject: () => this._tuneCreateReactAppProject(),
				};

				print(msg.createReactAppDetected);
				break;

			case ProjectType.VUE_CLI:
				this._options = {
					preset: 'vue-cli',
					tuneProject: () => this._tuneVueCliProject(),
				};

				print(msg.vueCliDetected);
				break;

			default:
				print(msg.unsupportedProjectType);
				process.exit(1);
		}
	}
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / scripts / build / create-react-app.js View on Github external
function restoreIndexJs() {
	const indexJsPath = project.dir.join('src', 'index.js').asNative;
	const dotIndexJsPath = project.dir.join('src', '.index.js').asNative;

	if (fs.existsSync(dotIndexJsPath)) {
		print(msg.restoringBackup);
		fs.copyFileSync(dotIndexJsPath, indexJsPath);
		fs.unlinkSync(dotIndexJsPath);
	}
}
github liferay / liferay-js-toolkit / packages / generator-liferay-js / src / adapt / index.js View on Github external
install() {
		print(msg.projectAdapted);

		const opts = {
			bower: false,
			npm: false,
			yarn: false,
			skipMessage: this.options['skip-install-message'],
			skipInstall: this.options['skip-install'],
		};

		opts[project.pkgManager] = true;

		this.installDependencies(opts);
	}
github liferay / liferay-js-toolkit / packages / generator-liferay-js / src / adapt / index.js View on Github external
initializing() {
		this.sourceRoot(path.join(__dirname, 'templates'));

		print(msg.welcome);

		switch (project.probe.type) {
			case ProjectType.ANGULAR_CLI:
				this._options = {
					preset: 'angular-cli',
					tuneProject: () => this._tuneAngularCliProject(),
				};

				print(msg.angularCliDetected);
				break;

			case ProjectType.CREATE_REACT_APP:
				this._options = {
					preset: 'create-react-app',
					tuneProject: () => this._tuneCreateReactAppProject(),
				};
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / scripts / build / create-react-app.js View on Github external
function backupIndexJs() {
	const indexJsPath = project.dir.join('src', 'index.js').asNative;
	const dotIndexJsPath = project.dir.join('src', '.index.js').asNative;

	print(msg.makingBackup);
	fs.copyFileSync(indexJsPath, dotIndexJsPath);
}