src/bin/cli.js
function readConfig() {

	// Checks if the package file contains a configuration.
	const pkgConfigPromise = new Promise((resolve, reject) => {

		fs.readFile(path.join(process.cwd(), "package.json")).then((data) => {

			try {

				resolve(JSON.parse(data).inlineImport);

			} catch(error) {

				reject(error);

			}

		}).catch((error) => {

			// There's no configuration in package.json.
			resolve();

		});

	});

	// Looks for a configuration file.
	const configFilePromise = new Promise((resolve, reject) => {

		fs.readFile(path.join(process.cwd(), argv.config)).then((data) => {

			try {

				resolve(JSON.parse(data));

			} catch(error) {

				reject(error);

			}

		}).catch((error) => {

			if(error.code === "ENOENT") {

				reject("No configuration found (" + argv.config + ")");

			} else {

				reject("Failed to read the configuration file (" + error + ")");

			}

		});

	});

	return new Promise((resolve, reject) => {

		pkgConfigPromise.then((config) => {

			return (config !== undefined) ? Promise.resolve(config) : configFilePromise;

		}).then(resolve).catch(reject);

	});

}
function readConfig() {

	// Checks if the package file contains a configuration.
	const pkgConfigPromise = new Promise((resolve, reject) => {

		fs.readFile(path.join(process.cwd(), "package.json")).then((data) => {

			try {

				resolve(JSON.parse(data).inlineImport);

			} catch(error) {

				reject(error);

			}

		}).catch((error) => {

			// There's no configuration in package.json.
			resolve();

		});

	});

	// Looks for a configuration file.
	const configFilePromise = new Promise((resolve, reject) => {

		fs.readFile(path.join(process.cwd(), argv.config)).then((data) => {

			try {

				resolve(JSON.parse(data));

			} catch(error) {

				reject(error);

			}

		}).catch((error) => {

			if(error.code === "ENOENT") {

				reject("No configuration found (" + argv.config + ")");

			} else {

				reject("Failed to read the configuration file (" + error + ")");

			}

		});

	});

	return new Promise((resolve, reject) => {

		pkgConfigPromise.then((config) => {

			return (config !== undefined) ? Promise.resolve(config) : configFilePromise;

		}).then(resolve).catch(reject);

	});

}
Loads the configuration.

@return {Promise} A promise that returns the configuration.