question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] 'watch' option for the 'build' task

See original GitHub issue

I’m submitting a feature request It will be helpfull if we could use watch also in the build command. (currently available only for run)

  • Library Version: v0.17.0

  • Operating System: Windows 10

  • Node Version: v4.4.7

  • NPM Version: 3.8.9

  • Browser: all

  • Language: all

Current behavior: we can’t use the watch option in the build command. so changes in the code don’t reflect back to the app.

Expected/desired behavior:

  • What is the expected behavior? allow the watch option also for the build command, thus allowing the developer to choose how to serve his app, while gaining the benefits of synchronization between the code and the app. the watch should behave just like it does in the run command. (listen to changes in the code, and rebundle the affected files). [the developer will need to manualy refresh the app in the browser to see the changes, because browserSync will not be active]
  • What is the motivation / use case for changing the behavior? the motivation behind this request is that we already have a server who takes care of serving the app. this server also server a webApi on the same address as the web project. so we need to be able to build our code in such a way that let us choose our own methode of serving the app, while actively listening to the changes in the code.

FYI: as a workaround, we are currently using run --watch, so the app is served by the aurelia-cli with watch on his default port, and then we also serve the same app with our server on our port. but we really could use an option to build with watch without serve.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
zamotanycommented, Aug 22, 2016

It’s a recuring theme here. aurelia-cli when executing tasks, searches for them in aurelia_project/tasks, so you can tailor them for your own needs. Those task are just simple gulp task. For example to add --watch option to build command replace build.js with this:

import gulp from 'gulp';
import transpile from './transpile';
import processMarkup from './process-markup';
import processCSS from './process-css';
import {build} from 'aurelia-cli';
import project from '../aurelia.json';
import {CLIOptions} from 'aurelia-cli';

function readProjectConfiguration() {
  return build.src(project);
}

function writeBundles() {
  return build.dest();
}

function onChange(path) {
  console.log(`File Changed: ${path}`);
}

export let buildTask = gulp.series(
  readProjectConfiguration,
  gulp.parallel(
    transpile,
    processMarkup,
    processCSS
  ),
  writeBundles
);

let watch = function() {
  gulp.watch(project.transpiler.source, buildTask).on('change', onChange);
  gulp.watch(project.markupProcessor.source, buildTask).on('change', onChange);
  gulp.watch(project.cssProcessor.source, buildTask).on('change', onChange)
}

let task;

if (CLIOptions.hasFlag('watch')) {
  task = gulp.series(
    buildTask,
    watch
  );
} else {
  task = buildTask;
}

export default task;

and in run.js replace

import build from './build';

with:

import {buildTask as build} from './build';

Actually, you don’t event have to know gulp, just look how other task are done, take some code snippets from them and join them together. The code above is just run.js with build.js combined together.

1reaction
AStokercommented, Oct 24, 2016

@avrahamcool, could you do me a favor and add “[Feature Request]” to the beginning of this issue? It would help with organizing the issues for us 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tasks in Visual Studio Code
Integrate with External Tools via Tasks. Lots of tools exist to automate tasks like linting, building, packaging, testing, or deploying software systems.
Read more >
Feature request: Watch mode · Issue #986 · vercel/turbo - GitHub
Describe the feature you'd like to request. It would be nice if turbo could run in "watch mode. Describe the solution you'd like....
Read more >
Feature Requests: What are they and how to manage them
Feature requests are a form of product feedback you may frequently encounter as a SaaS product manager. They typically come in the form...
Read more >
Customize pipeline configuration - GitLab Documentation
You can customize how pipelines run for your project. For an overview of pipelines, watch the video GitLab CI Pipeline, Artifacts, and Environments....
Read more >
Free Feature Request Tracking • Ducalis.io
Free feedback and feature requests tool. Run public roadmap. Prioritize requests. Integrate with vour task tracker.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found