Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Importable gulp tasks! #4

Closed
wants to merge 20 commits into from
Closed

Importable gulp tasks! #4

wants to merge 20 commits into from

Conversation

BobNisco
Copy link

It's what we've all been waiting for, importable gulp tasks! We no longer need to have splintered gulp tasks that all do the same thing in our various OneJS repos (and eventually 3rd party repos that want to build OneJS easily).

Overview of changes

Slight breaking change in order to make this work, we needed to modify the way gulp-common-js exposes its modules. Previously, if someone wanted to include OneJsCompiler they would do

var oneJsCompiler = require('gulp-onejs-compiler');

Now since we're exposing both the compiler and gulp tasks, it needs to be further qualified

var oneJsCompiler = require('gulp-onejs-compiler').compiler;

Exposed gulp tasks
Now you can easily use our gulp tasks with just a few lines

var gulp = require('gulp');
var oneJs= require('gulp-onejs-compiler');
var karma = require('karma').server;

oneJs.gulpTasks.all({
    gulp: gulp,
    rootDir: __dirname,
    karma: karma
});

After including those few lines, you can run things like gulp to run the default task of building, or gulp test, gulp dist, etc.!

All we're doing is passing our gulp, local root path, and karma instance, and now we have all of the tasks defined in ./tasks/*.js of this repo available on the gulp instance on any project.

This means by default, the user has capabilities to build amd/commonjs modules, test with karma, automate a release of their package and STILL have the ability to write their own gulp tasks in the gulp file or even overwrite our tasks.

Now, we can update these tasks, push out an update to compiler and let all users benefit from it!

Directory structure
After many email threads, we came up with a directory structure. You can see it in index.js (module.exports.gulpTasks.paths). All gulp tasks use these paths/glob helpers to make everything super normalized from OneJS project to the next.

Future work

  • Minify could be better. Right now it just minifies it all into 1 file. Look into integrating https://github.com/SteveSanderson/gulp-requirejs-bundler but this is not high pri right now and will NOT be a part of this pull request
  • Namespacing in directories is not a problem we've solved yet. We will need to modify these tasks to include namespacing when we decide on an approach in the near future.

@xirzec
Copy link

xirzec commented Nov 21, 2014

This is great stuff, thank you so much for investing time in cleaning this up.

@dzearing
Copy link
Member

readme will need updating

@dzearing
Copy link
Member

I'm not sure i sent this:

Would it make more sense to do this:

  1. Move onejs-compiler to onejs. The compiler tends to rev with the library.
  2. Rename this plugin to gulp-onejs-build.

Then it would be more generalized to onejs build stack, which is what this is becoming. Maybe that could be staged, since it would imply some dependency adjustments in the appropriate projects.

@BobNisco
Copy link
Author

@dzearing 1. Didn't @jdhuntington say he was planning on doing that?
2. Renaming it makes sense. I wouldn't want to stage it, I'd rather just "rip the band-aid off" and update everything in one fell swoop. We're still in the early stages and breaking changes are to be expected. We'll bump to semver 1.2.x to indicate this change.

@jdhuntington
Copy link

Moving onejs-compiler into onejs is something I'd like to do, but it will require not merging OneJSToolkit/onejs#44 , as doing both would create a circular dependency.

@BobNisco
Copy link
Author

@jdhuntington could you move onejs-compiler into onejs first? Then I can update the other repos/PRs that depend on it, and ensure we don't have circular dependencies.

@BobNisco
Copy link
Author

Closing this as we have decided to leave this plugin alone and keep it as a standalone. All the new importable gulp tasks are in https://github.com/OneJSToolkit/gulp-onejs-build

@BobNisco BobNisco closed this Nov 26, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants