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

Resolves #2396 - create AdaptBuild API #2409

Closed
wants to merge 13 commits into from
Closed

Conversation

danielstorey
Copy link
Member

@danielstorey danielstorey commented Apr 9, 2019

#2396

Example implementations:

const AdaptBuild = require('./grunt/api'); // can be derived from package.json:main
const build = new AdaptBuild(); // implied options {outputConfig: 'event'}


// Promise based named task example
build.runTask('build-config').then((output) => {
    console.log(output);
});


// Event based example
build.on('build-config:output', (output) => {
    console.log(output);
});
build.runTask('build-config');


// Hard API example
// At present methods exist for buildConfig, styles & templates
build.buildConfig().then((output) => {
    console.log(output);
});
build.styles().then((output) => {
    console.log(output);
});
build.templates().then((output) => {
    console.log(output);
});

- Create 'setenv' task so grunt's behaviour can be modified accordingly
- Create 'output' helper to emit event if env === 'dev'
- Refactor all uses of grunt.file.write to use output helper
Created dev folder with a view to potentially adding more dev specific
modules here e.g. dev-server, client side dev tools etc
Helper will stringify if saving to a file and data is not a string
Otherwise data will be transmitted as is via grunt.event
grunt.config will be called for each allowed property in the api config
this eliminates the need for additional tasks and enables setting
additional properties which may be useful in the future
@olivermartinfoster olivermartinfoster deleted the issue/2396 branch May 4, 2020 11:31
@olivermartinfoster
Copy link
Contributor

closed as very stale

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

Successfully merging this pull request may close these issues.

3 participants