lukeed / taskr

A fast, concurrency-focused task automation tool.
MIT License
2.53k stars 74 forks source link

time to run task keep increasing #223

Closed devmondo closed 7 years ago

devmondo commented 7 years ago

hi,

with this below time keep increasing with each compile step so it starts with 200 ms and keep going up to 1 second, 2 seconds,etc... i checked to see if only one files is passed and indeed it is

const paths = {
    clientScripts: [`src/client/**/*.js`],
    serverScripts: [`src/server/**/*.js`],
    html: `src/client/**/*.html`
}

let babelOptions = {
    presets: [`es2015`, `stage-1`, `stage-3`],
    plugins: [`transform-es2015-modules-commonjs`,
        `transform-decorators-legacy`,
        // `transform-es2015-typeof-symbol`,
        `typecheck`,
        `syntax-flow`,
        `transform-flow-strip-types`,
        [`transform-runtime`, {
            "polyfill": false,
            "regenerator": true
        }]
    ],
    sourceMaps: `inline`,
    sourceRoot: `./`
}

export default async function () {
 await this.watch(paths.clientScripts, `clientJs`);
}

export async function clientJs(file) {
    let source = file ? file : paths.clientScripts;
    let target = file ? `dist/` : `dist/client/`;
    await  this.source(source)
        .babel(babelOptions)
        .target(target);
}
lukeed commented 7 years ago

Hi @devmondo. Unfortunately with 2.0 right around the corner, I won't be supporting 1.4.x anymore.

Fly 2.0 is a massive improvement in many ways. It's only in beta still because I'm upgrading "essential" plugins to the 2.0 syntax.

Hope it's not too much of a bother in the interim.

devmondo commented 7 years ago

@lukeed thank you very much for the always prompt support :) i am waiting eagerly for 2.0 hope it is coming soon !

lukeed commented 7 years ago

@devmondo Let me know a list of plugins you're actively using (besides babel) and I'll let you know when those have been converted.

devmondo commented 7 years ago

@lukeed thanks man, nothing special really

besides above i dont have anything special and everything is working fine except this slow time and windows path issue here #216

lukeed commented 7 years ago

@devmondo Ah, then you can actually go ahead and start using fly@beta; the only real difference is that .concat got moved to its own plugin.

lukeed commented 7 years ago

@devmondo Oh, and passing files to tasks changed a bit too. (There will be an upgrade guide -- haven't gotten to it yet).

exports.default = function * () {
  yield this.watch(globs, ['task1', 'task2']); // <= will be ran serially
};

exports.task1 = function * (o) {
  // o.val: any returned (or initial) value
  // o.src: a single FILE PATH, via .watch() ****
  yield this.source(o.src || 'src/foo.bar')
    .babel().target('dist');
}
devmondo commented 7 years ago

@lukeed

i uninstalled fly and fly-babel and installed fly@beta and fly-babel again and here is my code below

const paths = {
    clientScripts: [`src/client/**/*.js`],
    serverScripts: [`src/server/**/*.js`],
    html: `src/client/**/*.html`
}

export default async function () {
    isWatch = true;
    isProd = false;

    await this.watch(paths.clientScripts, [`clientJs`]);
    await this.watch(paths.serverScripts, [`serverJs`]);
}

export async function clientJs(o) {
     await  this.source(o.src || o.val)
        .babel(babelOptions)
        .target(target);

}

maybe i am doing something wrong, but i get this error

TypeError: this.filter is not a function
  -     at Fly.module.exports (C:\projects\test\node_modules\fly-babel\index.js 9:15)
hzlmn commented 7 years ago

@devmondo fly-babel currently written in old manner (not for v2). Basically API for plugins changed a little bit with v2. Luke will fix it soon I think.

devmondo commented 7 years ago

@hzlmn thanks for explanation man

hzlmn commented 7 years ago

@devmondo My bad, Luke has already changed it here but seems like not released. If you want to try it right now, you can just install module from git

devmondo commented 7 years ago

@lukeed @hzlmn thank you

installing fly-babel through get made things work but only using the generators yield syntax, using async/await syntax gives an error task is not a function.

and i traced down the time accumulation issue, it is webstorm, i guess there is some kind of conflict between it and the filewatcher used in fly?

hzlmn commented 7 years ago

@devmondo Could you give a stacktrace, or better a screenshot of this error ?

devmondo commented 7 years ago

@hzlmn sure

stack:
    - TypeError: task is not a function
-     at Fly.<anonymous> (C:\projects\test\node_modules\fly\lib\api\start.js 42:16)
-     at undefined.next (native)
-     at undefined.tryCatcher (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\util.js 16:23)
-     at PromiseSpawn._promiseFulfilled (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\generators.js 97:49)
-     at Fly.start (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\generators.js 201:15)
-     at Fly.<anonymous> (C:\projects\test\node_modules\fly\lib\boot.js 6:12)
-     at C:\projects\test\node_modules\fly\lib\api\serial.js 13:22
-     at undefined.next (native)
-     at undefined.tryCatcher (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\util.js 16:23)
-     at PromiseSpawn._promiseFulfilled (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\generators.js 97:49)
-     at C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\generators.js 201:15
-     at tryCatcher (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\util.js 16:23)
-     at Object.gotValue (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\reduce.js 157:18)
-     at Object.gotAccum (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\reduce.js 144:25)
-     at Object.tryCatcher (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\util.js 16:23)
-     at Promise._settlePromiseFromHandler (C:\projects\test\node_modules\fly\node_modules\bluebird\js\release\promise.js 510:31)
message: task is not a function
export default async function () {
    await this.watch(paths.clientScripts, ['clientJs']);
};

export async function clientJs(o) {
       await this.source(o.src || paths.clientScripts)
        .babel(babelOptions)
        .target('dist/client/');
 }
hzlmn commented 7 years ago

@devmondo interesting... will look on this at home.

lukeed commented 7 years ago

@devmondo @hzlmn Hi guys, sorry I've been walking around the city today (on holiday).

Yeah, I guess I forgot to publish fly-babel. I'll do that now.

And I haven't tackled fly-esnext yet. You can't make async/await interchangeable with gen/yield anymore -- it truly is a "versus" situation, so I'll add a little elbow grease to get that tied together.

I should've mentioned that... my bad. Was rushing out the door.

Here's a related chokidar+webstorm issue.

devmondo commented 7 years ago

@lukeed thanks a lot for the update as mentioned here https://github.com/paulmillr/chokidar/issues/445#issuecomment-193290880 can we pass option to chokdir ?

and have a great weekend guys :)

lukeed commented 7 years ago

@devmondo Can you try setting it to true locally & let me know how it goes? You're running Win and Webstorm, both of which I can't use right now.

A la chokidar repo:

CHOKIDAR_USEPOLLING=1 npm run fly
devmondo commented 7 years ago

@lukeed holy god!!!! it went from 1 second to 200 - 250 ms stable!!!!!! and i made sure to modify file and save it multiple times aggressively. so yeah your suggestion works!

lukeed commented 7 years ago

@devmondo hahaha, good!... I'll look into it more. Not sure (yet) if usePolling should always be true on Windows, or if it's just your Webstorm + Windows environment.