Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Support gulp-generated files #1

Open
notpushkin opened this issue Feb 2, 2017 · 1 comment
Open

Support gulp-generated files #1

notpushkin opened this issue Feb 2, 2017 · 1 comment
Assignees

Comments

@notpushkin
Copy link
Owner

notpushkin commented Feb 2, 2017

Ones that don't exist on disk (i. e. when files are concatenated or renamed in the current pipe, or when).

This would probably require rewriting the asar/lib/filesystem module in such a way that it doesn't deal with fs directly. Even better would be to make a backend for node-archiver (that's what I'm doing now) or something.

Branch: generated-files

@notpushkin notpushkin self-assigned this Feb 2, 2017
notpushkin pushed a commit that referenced this issue Feb 2, 2017
@notpushkin
Copy link
Owner Author

notpushkin commented Feb 2, 2017

Current implementation is flawed. For example, see the asar branch of Songbee/desktop. Everything works well, except that it outputs original files somehow (instead of compiled ones) and they're shifted a bit:

$ gulp
$ cd dist
$ asar e songbee.asar .
$ head -n 8 src/main.js
ort electron, { app, BrowserWindow, Menu, Tray } from "electron";
import path from "path";
import url from "url";

import Manager from "./backend";
global.backend = new Manager();

let mainWindow, tray; // keep a reference

$ tail -n 4 src/main.js
app.on("will-quit", () => {
  global.backend.quit();
});
imp

Here's the gulp task for reference:

gulp.task("build", () => {
  const f = {
    noModules: filter(["!node_modules/**/*"], { restore: true }),
    js: filter(["**/*.js"], { restore: true })
  };

  gulp.src([
    "./package.json",
    "./node_modules*/**",
    "./src*/**",

    // Do not include Electron and READMEs (which are surprisingly big)
    "!./node_modules/.bin/**",
    "!./node_modules/electron*/**",
    "!./node_modules/gulp*/**",
    "!./node_modules/gulp*",
    "!./**/README*",
  ]).pipe(f.noModules)
    .pipe(f.js)
      .pipe(sourcemaps.init())
        .pipe(babel())
      .pipe(sourcemaps.write())
    .pipe(f.js.restore)
    .pipe(f.noModules.restore)
    .pipe(asar("songbee.asar"))
    .pipe(gulp.dest("./dist"));
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant