Giter Site home page Giter Site logo

Comments (7)

LeZuse avatar LeZuse commented on June 15, 2024

Hi, you are totally correct both with the core concept and lacking documentation. :/ Sorry about that!
We generate build.log using gulp-webpack in our gulp task:

import fs from 'fs';
import gulp from 'gulp';
import gutil from 'gulp-util';
import webpack from 'gulp-webpack';
import revision from 'git-rev';

import configFactory from "./webpack-production.config.js";

const VERSIONS = ['editor', 'viewer'];

let running = 0;

function allFinishedCallback(callback) {
  running--;
  if (running < 1) { callback(); }
}

gulp.task('webpack', callback => {
  revision.short(rev => {

    VERSIONS.forEach(version => {
      gutil.log('Building version', version);

      const config = configFactory({
        revision: rev,
        // ...other props...
      }, version);

      running++;

      gulp.src('src/js/app.js')
        .pipe(webpack(config, null, (err, stats) => {
          if (!err) {
            fs.writeFileSync(`build.${version}.log`, stats.toString());
            console.log('Build', version, stats.hash, 'done.');
          }
        }))
        .pipe(gulp.dest('dist/assets/'))
        .on('end', allFinishedCallback.bind(this, callback));
    });
  })
});

Build log is basically the output of webpack build task:

Hash: c00ad65585e3907e0eaf
Version: webpack 1.12.12
Time: 250760ms
                                       Asset       Size  Chunks             Chunk Names
        46a42a2968ec13389ecd8f0693c39f2d.png    4.08 kB          [emitted]
        ec6e7bba569b5ad40e3c55a09e2c4536.svg    71.3 kB          [emitted]
        48a5db854d708f87e08becc002eb2397.png     6.7 kB          [emitted]
        d1e5ba5eac8d1a3ab0692ffe8eac5f1f.png    13.7 kB          [emitted]
        aa8a31e5a6f9bba6678858f5db6bcf15.png    3.49 kB          [emitted]
        c62d3bb14c81b4e6d0aac9a9492a6b8d.png    6.14 kB          [emitted]
... and so on ...

from webpack-deploy.

LeZuse avatar LeZuse commented on June 15, 2024

I am planning to somehow get rid of the build hash dependency, but haven't found any easy way to do that yet.

from webpack-deploy.

espenhogbakk avatar espenhogbakk commented on June 15, 2024

Thanks for the reply. Just of curiosity, what do you use the git revision for in configFactory?

from webpack-deploy.

LeZuse avatar LeZuse commented on June 15, 2024

We bake it into the build as a constant. That way the runtime knows which version it is running.

from webpack-deploy.

LeZuse avatar LeZuse commented on June 15, 2024

@espenhogbakk Any luck with the setup?

from webpack-deploy.

espenhogbakk avatar espenhogbakk commented on June 15, 2024

Made it work, but required some hacking here and there.

from webpack-deploy.

LeZuse avatar LeZuse commented on June 15, 2024

Glad to hear! I will make some improvements soon as we have some new
requirements in our team.

On Tue, Jun 7, 2016 at 1:15 PM Espen Høgbakk [email protected]
wrote:

Made it work, but required some hacking here and there.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#24 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAIkaUMZphQdOcccjbVwzPZzSACaItL4ks5qJVLMgaJpZM4HvNFq
.

from webpack-deploy.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.