How to have npm install a typescript dependency from a GitHub url?How can I remove a commit on GitHub?How can I determine the URL that a local Git repository was originally cloned from?How can I update NodeJS and NPM to the next versions?How do I update a GitHub forked repository?Find the version of an installed npm packageHow do I update each dependency in package.json to the latest version?How to install an npm package from GitHub directly?What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?What is the --save option for npm install?Why does “npm install” rewrite package-lock.json?

Aliens crash on Earth and go into stasis to wait for technology to fix their ship

How to fry ground beef so it is well-browned

If a planet has 3 moons, is it possible to have triple Full/New Moons at once?

Don’t seats that recline flat defeat the purpose of having seatbelts?

Why did C use the -> operator instead of reusing the . operator?

Does a large simulator bay have standard public address announcements?

Check if a string is entirely made of the same substring

"The cow" OR "a cow" OR "cows" in this context

Contradiction proof for inequality of P and NP?

Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?

Critique of timeline aesthetic

Pre-plastic human skin alternative

Rivers without rain

Relationship between strut and baselineskip

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

"You've called the wrong number" or "You called the wrong number"

What does ゆーか mean?

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

555 timer FM transmitter

How to display Aura JS Errors Lightning Out

Two field separators (colon and space) in awk

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

How to write a column outside the braces in a matrix?

How come there are so many candidates for the 2020 Democratic party presidential nomination?



How to have npm install a typescript dependency from a GitHub url?


How can I remove a commit on GitHub?How can I determine the URL that a local Git repository was originally cloned from?How can I update NodeJS and NPM to the next versions?How do I update a GitHub forked repository?Find the version of an installed npm packageHow do I update each dependency in package.json to the latest version?How to install an npm package from GitHub directly?What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?What is the --save option for npm install?Why does “npm install” rewrite package-lock.json?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








8















Consider the following scenario:



  • There is a code library. The library is written in TypeScript and the typescript code is published in GitHub. The package.json file has a build script which creates JavaScript files based on the TypeScript code and a publish script which then places the resulting JS files on npm.

  • I make a fork of the GitHub repo, make some modifications to the typescript files and push those changes to GitHub. (I also open a PR to the original GitHub repo but there is a time lage before these changes can be merged.)

  • I wish to consume these code changes in a downstream NPM package so in the downstream packages I change the reference (in the downstream's package.json file) to the modified package to the GitHub URL of my fork and do an npm install.

This doesn't work because:



  • The package.json file of the modified package does not list the typescript files in the dist field, only the automatically generated JS files so the TypeScript files are not pulled during the npm install.

  • The compiled JS files aren't present since they aren't checked in to GitHub.

How can I solve this? Is there a way that I can modify the behavoir of npm install so that it fetches files in the repo that aren't in dist and then runs the build script during the install?










share|improve this question






















  • I can only think of maintaining a separate build branch (a branch with same name as a folder would sometimes confuses Git, so avoid dist).

    – Franklin Yu
    Aug 30 '18 at 14:38

















8















Consider the following scenario:



  • There is a code library. The library is written in TypeScript and the typescript code is published in GitHub. The package.json file has a build script which creates JavaScript files based on the TypeScript code and a publish script which then places the resulting JS files on npm.

  • I make a fork of the GitHub repo, make some modifications to the typescript files and push those changes to GitHub. (I also open a PR to the original GitHub repo but there is a time lage before these changes can be merged.)

  • I wish to consume these code changes in a downstream NPM package so in the downstream packages I change the reference (in the downstream's package.json file) to the modified package to the GitHub URL of my fork and do an npm install.

This doesn't work because:



  • The package.json file of the modified package does not list the typescript files in the dist field, only the automatically generated JS files so the TypeScript files are not pulled during the npm install.

  • The compiled JS files aren't present since they aren't checked in to GitHub.

How can I solve this? Is there a way that I can modify the behavoir of npm install so that it fetches files in the repo that aren't in dist and then runs the build script during the install?










share|improve this question






















  • I can only think of maintaining a separate build branch (a branch with same name as a folder would sometimes confuses Git, so avoid dist).

    – Franklin Yu
    Aug 30 '18 at 14:38













8












8








8








Consider the following scenario:



  • There is a code library. The library is written in TypeScript and the typescript code is published in GitHub. The package.json file has a build script which creates JavaScript files based on the TypeScript code and a publish script which then places the resulting JS files on npm.

  • I make a fork of the GitHub repo, make some modifications to the typescript files and push those changes to GitHub. (I also open a PR to the original GitHub repo but there is a time lage before these changes can be merged.)

  • I wish to consume these code changes in a downstream NPM package so in the downstream packages I change the reference (in the downstream's package.json file) to the modified package to the GitHub URL of my fork and do an npm install.

This doesn't work because:



  • The package.json file of the modified package does not list the typescript files in the dist field, only the automatically generated JS files so the TypeScript files are not pulled during the npm install.

  • The compiled JS files aren't present since they aren't checked in to GitHub.

How can I solve this? Is there a way that I can modify the behavoir of npm install so that it fetches files in the repo that aren't in dist and then runs the build script during the install?










share|improve this question














Consider the following scenario:



  • There is a code library. The library is written in TypeScript and the typescript code is published in GitHub. The package.json file has a build script which creates JavaScript files based on the TypeScript code and a publish script which then places the resulting JS files on npm.

  • I make a fork of the GitHub repo, make some modifications to the typescript files and push those changes to GitHub. (I also open a PR to the original GitHub repo but there is a time lage before these changes can be merged.)

  • I wish to consume these code changes in a downstream NPM package so in the downstream packages I change the reference (in the downstream's package.json file) to the modified package to the GitHub URL of my fork and do an npm install.

This doesn't work because:



  • The package.json file of the modified package does not list the typescript files in the dist field, only the automatically generated JS files so the TypeScript files are not pulled during the npm install.

  • The compiled JS files aren't present since they aren't checked in to GitHub.

How can I solve this? Is there a way that I can modify the behavoir of npm install so that it fetches files in the repo that aren't in dist and then runs the build script during the install?







typescript github npm npm-install






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 28 '18 at 9:12









Jacob HorbulykJacob Horbulyk

4912623




4912623












  • I can only think of maintaining a separate build branch (a branch with same name as a folder would sometimes confuses Git, so avoid dist).

    – Franklin Yu
    Aug 30 '18 at 14:38

















  • I can only think of maintaining a separate build branch (a branch with same name as a folder would sometimes confuses Git, so avoid dist).

    – Franklin Yu
    Aug 30 '18 at 14:38
















I can only think of maintaining a separate build branch (a branch with same name as a folder would sometimes confuses Git, so avoid dist).

– Franklin Yu
Aug 30 '18 at 14:38





I can only think of maintaining a separate build branch (a branch with same name as a folder would sometimes confuses Git, so avoid dist).

– Franklin Yu
Aug 30 '18 at 14:38












1 Answer
1






active

oldest

votes


















1














The docs for the prepack script suggest that it is run after a dependency is installed from a git repo. Try putting something like this in the package.json of the git dependency:




"scripts":
"prepack": "call the build script"




This should build the package after you npm install it, which sounds like what you want to do. I'm not sure if there are any other problems you are having beyond that.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51078974%2fhow-to-have-npm-install-a-typescript-dependency-from-a-github-url%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    The docs for the prepack script suggest that it is run after a dependency is installed from a git repo. Try putting something like this in the package.json of the git dependency:




    "scripts":
    "prepack": "call the build script"




    This should build the package after you npm install it, which sounds like what you want to do. I'm not sure if there are any other problems you are having beyond that.






    share|improve this answer



























      1














      The docs for the prepack script suggest that it is run after a dependency is installed from a git repo. Try putting something like this in the package.json of the git dependency:




      "scripts":
      "prepack": "call the build script"




      This should build the package after you npm install it, which sounds like what you want to do. I'm not sure if there are any other problems you are having beyond that.






      share|improve this answer

























        1












        1








        1







        The docs for the prepack script suggest that it is run after a dependency is installed from a git repo. Try putting something like this in the package.json of the git dependency:




        "scripts":
        "prepack": "call the build script"




        This should build the package after you npm install it, which sounds like what you want to do. I'm not sure if there are any other problems you are having beyond that.






        share|improve this answer













        The docs for the prepack script suggest that it is run after a dependency is installed from a git repo. Try putting something like this in the package.json of the git dependency:




        "scripts":
        "prepack": "call the build script"




        This should build the package after you npm install it, which sounds like what you want to do. I'm not sure if there are any other problems you are having beyond that.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 9 at 9:08









        NicholasNicholas

        33119




        33119





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51078974%2fhow-to-have-npm-install-a-typescript-dependency-from-a-github-url%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved