Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create API map for public lib methods #30

Open
KenEucker opened this issue Jan 6, 2018 · 1 comment
Open

Create API map for public lib methods #30

KenEucker opened this issue Jan 6, 2018 · 1 comment

Comments

@KenEucker
Copy link
Owner

Proposed solution:
The webApi should offer lib functionality through wrappers in api.js. Develop a shim that is to be the example of how to develop a shim for this lib.

This will allow developers to create custom client applications and complex tasks without having to interact directly with the library or even use nodejs as their implementation language. Simply connect to the API and execute commands by passing in the quasArgs via post.

What's happening:
The API currently only has one function: complete build from file.

What I expect to happen:
We should allow the option for quasar functions to be executed outside of the loaded tasks.

@KenEucker
Copy link
Owner Author

Consider writing a companion quasarClient.js shim library for the web that wraps calls in the required posts to the API and whatever else, for example logging could be done to the browser console as well as the serverside log. In the end, since this is also a javascript library, I would expect that tasks created using this client shim would have code that looks exactly like the serverside tasks.

Example business logic pulled from the page sample task:

const task = () => {
	return lib.copyFilesFromSourcesFolderToOutput(quasArgs)
		.then(() => {
			console.log("injecting assets!");
			quasArgs = lib.copyTemplateFilesToAssetsPath(quasArgs);
			return lib.injectCode(quasArgs)
		})
		.then(() => {
			console.log("moving files!");
			return lib.copyFilesFromAssetsFolderToOutput(quasArgs, ['**'])
		})
		.then(() => {
			console.log("output!");
			return lib.outputToHtmlFile(quasArgs)
		})
}

And now that I'm taking a look at it I'm not seeing a reason why the task sample files wouldn't work as is in the browser by simply using the quasarClient.js shim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant