Giter Site home page Giter Site logo

require-self's People

Contributors

avivahl avatar masarakki avatar yortus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

require-self's Issues

relative path?

I'm wondering if it would make sense for require-self to generate a relative path to the module rather than absolute? That way, the user can move their repo around on disk without having to re-run require-self.

Include this kind of feature directly in node

I feel the feature of this module is something that is missing from node.js itself.
Do you have any idea if there is any open issue to solve that situation directly in node so this module is not needed ?

doesn't work w/ scoped references

My module has a name like this: "name":"@myCompany/my-module"

in this case require-self should be exporting ../../ instead of just ..

Using require-self with npm module using Babel

If I try to use require-self with Babel or mocha, while having "main" point to "lib/index.js" and using Babel to transpile ./src to ./lib, my requires load from ./lib whereas the source of my tests still sits in ./src. And this is not what I intend...

I've applied Artem Govorov's suggestion to patch require() in order to get my tests running.

Do you see an other way to get mocha work with my setup?

tsDeclPath is not defined

Using require-self with 0.2.2 does not work with an error.

The actual error log is as follows:

/home/travis/build/kenchan0130/babel-preset-google-apps-script/node_modules/require-self/bin/require-self:23
    throw e;
    ^
ReferenceError: tsDeclPath is not defined
    at Object.<anonymous> (/home/travis/build/kenchan0130/babel-preset-google-apps-script/node_modules/require-self/bin/require-self:20:29)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

You can also see it at https://travis-ci.org/github/kenchan0130/babel-preset-google-apps-script/builds/657483044.

Version

Node.js: v8, v10, v12
require-self: 0.2.2

about prepublish script and changing behaviour

Hi,

As explained in NPM doc, prepublish script will soon change a little.
Having this in mind, I wonder if you should change the readme file to add require-self to postInstall or prepare hook instead of prepublish ?
I think the most common use would be postInstall, what do you feel about that ?

Using require-self in prepare script when publishing

Thanks for this package! It serves a useful niche purpose.

I just wanted to discuss the proper usage. I'm rather new to the JavaScript/Node.js world, so I welcome any constructive feedback.

The README.md says to use require-self in the prepare script in the package.json:

"devDependencies": {
  "require-self": "^0.2.3"
},
"scripts": {
  "prepare": "require-self"
}

After that, I used the setup-node GitHub Action to publish my package to the npmjs registry. When I did, I ran into this problem:

npm publish
  shell: /bin/bash -e {0}
  env:
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: ***

> [email protected] prepare .
> require-self

sh: 1: require-self: not found

On reflection, I guess this error makes sense. But then it seems like using require-self in the prepare script would require running npm install before npm publish to make sure require-self is found. It doesn't seem like npm install should be necessary at that point.

Is my understanding correct? Is it typical to run npm install just before npm publish, or is that a situation created by the thing that require-self does?

As an aside, my current solution is to not have require-self in the prepare script but to run it directly after npm install and before npm test in CI (stoicism-compendium/retext-spell-file#20).

New other way to do the same thing directly with npm

Hi,
I've been using require-self for a few years, but still found it a hack, that should be solved directly in npm.
Happy to say I think I've found a way to replace this:
for a module called myModule simply put "myModule": "file:.", in your dev dependencies.
This creates a symlink to the parent folder, the same as what require self is doing.

I think that's a good solution for the problem require-self is solving.

Typescript declaration

First off, thanks for this project, it saved me tons of manual steps. This isn't really an issue, but might be worth adding to the README. I just wanted to post this incase anyone else uses this repo within a typescript project.

In order for the import to provide the proper declarations you need to add a declaration to your project typings:

<root>/typings/index.d.ts

declare module 'foobar';

where foobar is the name from your package.json

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.