Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware in build process #2

Closed
AlexFrazer opened this issue Jul 20, 2015 · 11 comments
Closed

Middleware in build process #2

AlexFrazer opened this issue Jul 20, 2015 · 11 comments

Comments

@AlexFrazer
Copy link

Would be nice if there was some way to append to the build process. For example, updating PList content.

@arboleya
Copy link
Owner

Hi, do you have any suggestion on how to do it?

Also, I'd be nice if you could elaborate a little more about your need, I didn't get the specifics.

@hems
Copy link

hems commented Jul 22, 2015

@arboleya he wants to add some extra commands ( like a makefile would do ) after the build, probably before the app is launched

@AlexFrazer would a makefile help you out?

#makefile

my_custom_build:
  echo 'do something'
  echo 'do somthing else'

then execute

make my_custom_build

@AlexFrazer
Copy link
Author

yeah pretty much. For example,

var pwd = path.resolve('.');
var build = path.join(pwd, 'meteor/.electron/.dist');

bundle:
  echo('electrifying app');
  electrify();
  echo('Copying icon');
  cp(path.join(pwd, 'meteor/public/favicon.ico'), path.join(build, 'resources/atom.icns'));

@hems
Copy link

hems commented Jul 22, 2015

@AlexFrazer can't you do that now?

just using a makefile or executing a shell command "electrify" ?

@AlexFrazer
Copy link
Author

I am having trouble executing the shell command "electrify". It seems to be a very odd process to manage in a build find.
Opening meteor, then opening meteor shell, then passing the command "electrify" isn't intuitive in an automated system, at least.
Can the npm package just include some bundling functionality?

var electrify = require('electrify');

target.bundle = function () {
  var METEOR = path.join(__dirname, 'meteor');
  electrify.bundle(METEOR);
}

@hems
Copy link

hems commented Jul 29, 2015

@AlexFrazer agreed on the meteor shell thing, but maybe there is a way of making this one-liner and i'm not aware.. maybe @arboleya has knows workaround for this?

@AlexFrazer
Copy link
Author

I have a workaround but it's not really the best...

Meteor.startup(function () {
  if (process.env.ELECTRIFY) {
    this.electrify();
    process.exit(0);
  }
});

Then in makefile:

target.bundle = function () {
  return exec('ELECTRIFY=true meteor --once');
}

just not exactly very friendly to do it that way

@arboleya
Copy link
Owner

@hems @AlexFrazer I thought you wanted to put something in the middle of the build system, but actually you want a post build thing.

Yes, it is a little odd and surely hard to automate. But not that hard.

At first I wanted a custom Meteor command such as meteor release electrify or something like that, there is a way to have custom commands, but it felt too complicated and nonsense.

As for the NPM package, currently it's needed only by the Electron application for the boot process, not for the Meteor package itself. As I wanted to have the Meteor thing completely independent from local NodeJS or global Npm packages, I ended up executing Meteor's server code through the interactive meteor shell, which was the only way I found.

Your workaround sounds reasonable but it looks like it doesn't work on windows, right?

Another approach would be to spawn meteor, then spawn meteor shell and manipulate the stdin and stdout to type electrify in the meteor shell and then send a SIGINT signal, something like that.

I'm redesigning things to accommodate plugins, I'll revisit this question in time, for sure.

I agree it's odd not to have a simple command to build the whole thing.

@arboleya
Copy link
Owner

@hems
Copy link

hems commented Aug 19, 2015

🎱

@AlexFrazer
Copy link
Author

Thank you good sir!

Mairu referenced this issue in Mairu/meteor-electrify Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants