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

Inability to use versionist installed modules under Linux (works on OSX) #82

Open
hedss opened this issue May 11, 2017 · 13 comments
Open

Comments

@hedss
Copy link
Contributor

hedss commented May 11, 2017

Versions used:

  • OSX - 10.11.6
  • Linux - Ubuntu 14.04
  • Node version: 7.10.0
  • Versionist version: 2.9.0

Run versionist on the following config file in a repo with no Node deps. (ie. no node_modules directory):

'use strict';

const semver = require('semver');

module.exports = {
        defaultInitialVersion: '2.0.3',
        changelogFile: 'CHANGELOG.md',
        editChangelog: true,
        editVersion: true,
        lowerCaseFooterTags: true,
        parseFooterTags: true,
        includeMergeCommits: false,
        getGitReferenceFromVersion: 'v-prefix'
};

Under OSX, it appears to pick semver from versionist's node_modules. Under Linux it doesn't failing to require the config file from the exports.load method:

exports.load = (file) => {
  try {
    console.log(file);
    return require(file);
  } catch (error) {
    if (error.code === 'MODULE_NOT_FOUND') {
      throw new Error(`Can't find ${file}`);
    } else if (error instanceof SyntaxError) {
      throw new Error(`Syntax error in configuration file: ${file}`);
    }

    throw error;
  }
};

Either we should work on both platforms, or we should specify that external packages to those built-in to Node cannot be used.

@lurch
Copy link
Contributor

lurch commented May 11, 2017

Bug / discrepancy between NodeJS on Linux and NodeJS on OSX?

@hedss
Copy link
Contributor Author

hedss commented May 11, 2017

Possibly, but I had a quick scan and couldn't find anything obvious. Will have another look later, but it's a pretty big bug if it is!

@lurch
Copy link
Contributor

lurch commented May 12, 2017

Off-Topic: I'm already suspecting there's a bug in the Windows version of .execFile in NodeJS which isn't present in the Linux version.

@hedss
Copy link
Contributor Author

hedss commented May 15, 2017

I've realised why this does and doesn't work. Node has a bottom-up approach to finding dependencies without a relative path (ie. the use of node_modules). If it finds the package in a parent node_modules hierarchy, then it'll work (and in fact that's what it was doing for me).

I think the upshot is we have to say 'you can't include non-core modules in your own versionist.conf.js files'.

@hedss hedss closed this as completed May 15, 2017
@lurch
Copy link
Contributor

lurch commented May 15, 2017

Ah, so this was actually a filesystem-layout issue rather than an OS-issue?

I think the upshot is we have to say 'you can't include non-core modules in your own versionist.conf.js files'.

...unless you have a local node_modules folder in your project?

@hedss
Copy link
Contributor Author

hedss commented May 15, 2017

...unless you have a local node_modules folder in your project?
The problem with that certainly for us, versionist gets called during the PR/merge where there is no node_modules present (VersionBot will clone a repository, it won't populate it with npm install).

I don't like the idea of only being able to version a fully populated repo instead of a cloned one. If this isn't the case, we need to discuss fundamentally how we should cope with cases like this.

cc @agherzan as we'll need to determine how to go forward here.

@agherzan
Copy link

Isn't this a major limitation? I'm not a npm expert, but what modules are in the npm core? I don't know how I would be able to implement the version file change for non package.json cases.

@hedss
Copy link
Contributor Author

hedss commented May 15, 2017

Going to re-open so we can continue to discuss this.

The problem is that even if versionist was able to do this reliably, you'd only ever be able to include modules that it itself depended on. So for any other modules, you'd still have to have a node_modules directory with any other dependency in your repo to allow it to import them.
That's why I don't feel it's particularly useful to do so.

What exactly needs to change to support meta-resin version updates? Knowing this would be useful so we can consider how else to go about it.

@hedss hedss reopened this May 15, 2017
@agherzan
Copy link

@lurch
Copy link
Contributor

lurch commented May 15, 2017

For cases where the version-bump can't be done in JS using core nodeJS libraries, could versionist instead call an external executable / shell-script? (or would that cause problems for VersionBot?)

@hedss
Copy link
Contributor Author

hedss commented May 15, 2017

I'm not at all keen on VersionBot doing any of the version bumping. versionist needs an API so it can be used as a module (now issued, #83).

Whilst there are ways we can go about this (git submodules, actual node_modules directory, etc.) I'm still very keen we stress that user defined changes should only use the core library. If we want to extend this, we need to do it in such a way that you can still just run versionist and not have to do anything extra.

@lurch
Copy link
Contributor

lurch commented May 16, 2017

I'm not at all keen on VersionBot doing any of the version bumping. versionist needs an API so it can be used as a module

Last I heard, there was talk of merging VersionBot and versionist together, rather than maintaining them as separate projects? Sorry I've not been keeping up ;-)

@hedss
Copy link
Contributor Author

hedss commented May 16, 2017

Ah, maybe that was an off the cuff. Nope, still separate projects but with a versionist API.

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

No branches or pull requests

3 participants