sample/gulp/gulpfile.js
function createProjectWithConfig(zipFile, configXml) {
	return createProject(zipFile)
	.then((project) => {
		return updateConfig(configXml, project)
		.then(() => {
			return project;
		})
		.catch((errorFromUpdate) => {
			deleteProject(project)
			.then(() => {
				console.error("The project with ID: " + project.id + " was not created because it wasn't possible to upload the custom XML.");
				throw errorFromUpdate;
			})
			.catch((errorFromDelete) => {
				console.error("The project with ID: " + project.id + " was created but it wasn't possible to upload the custom XML.");
				console.trace(errorFromDelete);
				throw errorFromDelete;
			});
		});
	})
	.catch((error) => {
		console.trace(error);
		throw error;
	});
}
function createProjectWithConfig(zipFile, configXml) {
	return createProject(zipFile)
	.then((project) => {
		return updateConfig(configXml, project)
		.then(() => {
			return project;
		})
		.catch((errorFromUpdate) => {
			deleteProject(project)
			.then(() => {
				console.error("The project with ID: " + project.id + " was not created because it wasn't possible to upload the custom XML.");
				throw errorFromUpdate;
			})
			.catch((errorFromDelete) => {
				console.error("The project with ID: " + project.id + " was created but it wasn't possible to upload the custom XML.");
				console.trace(errorFromDelete);
				throw errorFromDelete;
			});
		});
	})
	.catch((error) => {
		console.trace(error);
		throw error;
	});
}
function createProjectWithConfig ( zipFile , configXml ) { return createProject ( zipFile ) . then ( ( project ) => { return updateConfig ( configXml , project ) . then ( ( ) => { return project ; } ) . catch ( ( errorFromUpdate ) => { deleteProject ( project ) . then ( ( ) => { console . error ( "The project with ID: " + project . id + " was not created because it wasn't possible to upload the custom XML." ) ; throw errorFromUpdate ; } ) . catch ( ( errorFromDelete ) => { console . error ( "The project with ID: " + project . id + " was created but it wasn't possible to upload the custom XML." ) ; console . trace ( errorFromDelete ) ; throw errorFromDelete ; } ) ; } ) ; } ) . catch ( ( error ) => { console . trace ( error ) ; throw error ; } ) ; }
Creates a new Cocoon Project from a zip file and a config XML
@param {File} zipFile
@param {string} configXml
@return {Promise<Project>}
Creates a new Cocoon Project from a zip file and a config XML