Why is my TGZ file getting truncated when I call “npm pack” against my artifact?












0















Here is the scripts section of my package.json for the component I'm publishing:



"scripts": {
"build-ng": "ngc -p tsconfig.json",
"clean-src": "rimraf src/*.d.ts src/*.js* src/**/*.json src/**/*.ngfactory.ts src/*.ngfactory.ts src/**/*.js*",
"clean": "npm run cleanup && rimraf pack",
"build-aot": "npm run cleanup && npm run build-ng && npm run pack && npm run cleanup",
"cleanup": "rimraf dist && npm run clean-src && rimraf assets",
"webpack": "webpack",
"add-assets": "copyfiles -u 4 ./node_modules/@rti/rti-lib/assets/**/*.* ./assets/ && copyfiles -u 2 ./src/assets/**/*.* ./assets",
"pack": "webpack --config webpack.aot.js",
"prepare": "npm run build-aot && npm run add-assets",
"prepublishOnly": "npm version prerelease --preid=snapshot",
"publish": "git add package.json && git commit -m "Package version Changed" && git push"
},


When this item is built and published (using "npm install" and "npm publish"), the tgz file is 5mb. If I browse to the artifact in Artifactory, I see a file that is roughly 5mb.



When the server component builds, it uses a Maven plug-in to download the tgz using "npm pack @rti/rti-app@latest". It then unpacks and repacks the tgz including some other artifacts.



At this point, the server builds correctly. If I build the server again, it also succeeds. However, if I build the server a third time, the tgz file is then truncated to 1,900 bytes. Publishing the client restores the artifact, and things work again. As long as the server isn't built three times in a row before the client is built, everything keeps working.



I've narrowed it down to this specific "npm pack" operation.



<configuration>
<executable>${npmexe}</executable>
<workingDirectory>target/</workingDirectory>
<arguments>
<argument>pack</argument>
<argument>@rti/rti-app@latest</argument>
</arguments>
</configuration>


It's easier to repro by just doing the same operation.



So, to summarize:




  1. From the rti-app directory: Publish @rti/rti-app by "npm install && npm publish".

  2. From the server directory: "npm pack @rti/rti-app@latest"

  3. dir rti*tgz : You'll see a file that is > 5mb.

  4. npm pack @rti/rti-app@latest

  5. dir rti*tgz : You'll still see a file that is > 5mb.

  6. npm pack @rti/rti-app@latest

  7. dir rti*tgz : Now, you'll see a file that is 1,900 bytes.

  8. I've reproed this multiple times just to make absolutely sure that these steps are causing it.


I know that the whole design of this is convoluted and over-complicated. Our packaging needs to be redesigned and simplified, but there's no time for that now. I just need it to work.



Everything I've read says that "npm pack" is the best way to download the tgz file for an NPM artifact. I imagine that overriding the "pack" item in "scripts" is the key to this bad behavior. Would removing "pack" and moving the "webpack --config webpack.aot.js" be something I should look at?



I don't recall this problem when we were using Sinopia.










share|improve this question



























    0















    Here is the scripts section of my package.json for the component I'm publishing:



    "scripts": {
    "build-ng": "ngc -p tsconfig.json",
    "clean-src": "rimraf src/*.d.ts src/*.js* src/**/*.json src/**/*.ngfactory.ts src/*.ngfactory.ts src/**/*.js*",
    "clean": "npm run cleanup && rimraf pack",
    "build-aot": "npm run cleanup && npm run build-ng && npm run pack && npm run cleanup",
    "cleanup": "rimraf dist && npm run clean-src && rimraf assets",
    "webpack": "webpack",
    "add-assets": "copyfiles -u 4 ./node_modules/@rti/rti-lib/assets/**/*.* ./assets/ && copyfiles -u 2 ./src/assets/**/*.* ./assets",
    "pack": "webpack --config webpack.aot.js",
    "prepare": "npm run build-aot && npm run add-assets",
    "prepublishOnly": "npm version prerelease --preid=snapshot",
    "publish": "git add package.json && git commit -m "Package version Changed" && git push"
    },


    When this item is built and published (using "npm install" and "npm publish"), the tgz file is 5mb. If I browse to the artifact in Artifactory, I see a file that is roughly 5mb.



    When the server component builds, it uses a Maven plug-in to download the tgz using "npm pack @rti/rti-app@latest". It then unpacks and repacks the tgz including some other artifacts.



    At this point, the server builds correctly. If I build the server again, it also succeeds. However, if I build the server a third time, the tgz file is then truncated to 1,900 bytes. Publishing the client restores the artifact, and things work again. As long as the server isn't built three times in a row before the client is built, everything keeps working.



    I've narrowed it down to this specific "npm pack" operation.



    <configuration>
    <executable>${npmexe}</executable>
    <workingDirectory>target/</workingDirectory>
    <arguments>
    <argument>pack</argument>
    <argument>@rti/rti-app@latest</argument>
    </arguments>
    </configuration>


    It's easier to repro by just doing the same operation.



    So, to summarize:




    1. From the rti-app directory: Publish @rti/rti-app by "npm install && npm publish".

    2. From the server directory: "npm pack @rti/rti-app@latest"

    3. dir rti*tgz : You'll see a file that is > 5mb.

    4. npm pack @rti/rti-app@latest

    5. dir rti*tgz : You'll still see a file that is > 5mb.

    6. npm pack @rti/rti-app@latest

    7. dir rti*tgz : Now, you'll see a file that is 1,900 bytes.

    8. I've reproed this multiple times just to make absolutely sure that these steps are causing it.


    I know that the whole design of this is convoluted and over-complicated. Our packaging needs to be redesigned and simplified, but there's no time for that now. I just need it to work.



    Everything I've read says that "npm pack" is the best way to download the tgz file for an NPM artifact. I imagine that overriding the "pack" item in "scripts" is the key to this bad behavior. Would removing "pack" and moving the "webpack --config webpack.aot.js" be something I should look at?



    I don't recall this problem when we were using Sinopia.










    share|improve this question

























      0












      0








      0








      Here is the scripts section of my package.json for the component I'm publishing:



      "scripts": {
      "build-ng": "ngc -p tsconfig.json",
      "clean-src": "rimraf src/*.d.ts src/*.js* src/**/*.json src/**/*.ngfactory.ts src/*.ngfactory.ts src/**/*.js*",
      "clean": "npm run cleanup && rimraf pack",
      "build-aot": "npm run cleanup && npm run build-ng && npm run pack && npm run cleanup",
      "cleanup": "rimraf dist && npm run clean-src && rimraf assets",
      "webpack": "webpack",
      "add-assets": "copyfiles -u 4 ./node_modules/@rti/rti-lib/assets/**/*.* ./assets/ && copyfiles -u 2 ./src/assets/**/*.* ./assets",
      "pack": "webpack --config webpack.aot.js",
      "prepare": "npm run build-aot && npm run add-assets",
      "prepublishOnly": "npm version prerelease --preid=snapshot",
      "publish": "git add package.json && git commit -m "Package version Changed" && git push"
      },


      When this item is built and published (using "npm install" and "npm publish"), the tgz file is 5mb. If I browse to the artifact in Artifactory, I see a file that is roughly 5mb.



      When the server component builds, it uses a Maven plug-in to download the tgz using "npm pack @rti/rti-app@latest". It then unpacks and repacks the tgz including some other artifacts.



      At this point, the server builds correctly. If I build the server again, it also succeeds. However, if I build the server a third time, the tgz file is then truncated to 1,900 bytes. Publishing the client restores the artifact, and things work again. As long as the server isn't built three times in a row before the client is built, everything keeps working.



      I've narrowed it down to this specific "npm pack" operation.



      <configuration>
      <executable>${npmexe}</executable>
      <workingDirectory>target/</workingDirectory>
      <arguments>
      <argument>pack</argument>
      <argument>@rti/rti-app@latest</argument>
      </arguments>
      </configuration>


      It's easier to repro by just doing the same operation.



      So, to summarize:




      1. From the rti-app directory: Publish @rti/rti-app by "npm install && npm publish".

      2. From the server directory: "npm pack @rti/rti-app@latest"

      3. dir rti*tgz : You'll see a file that is > 5mb.

      4. npm pack @rti/rti-app@latest

      5. dir rti*tgz : You'll still see a file that is > 5mb.

      6. npm pack @rti/rti-app@latest

      7. dir rti*tgz : Now, you'll see a file that is 1,900 bytes.

      8. I've reproed this multiple times just to make absolutely sure that these steps are causing it.


      I know that the whole design of this is convoluted and over-complicated. Our packaging needs to be redesigned and simplified, but there's no time for that now. I just need it to work.



      Everything I've read says that "npm pack" is the best way to download the tgz file for an NPM artifact. I imagine that overriding the "pack" item in "scripts" is the key to this bad behavior. Would removing "pack" and moving the "webpack --config webpack.aot.js" be something I should look at?



      I don't recall this problem when we were using Sinopia.










      share|improve this question














      Here is the scripts section of my package.json for the component I'm publishing:



      "scripts": {
      "build-ng": "ngc -p tsconfig.json",
      "clean-src": "rimraf src/*.d.ts src/*.js* src/**/*.json src/**/*.ngfactory.ts src/*.ngfactory.ts src/**/*.js*",
      "clean": "npm run cleanup && rimraf pack",
      "build-aot": "npm run cleanup && npm run build-ng && npm run pack && npm run cleanup",
      "cleanup": "rimraf dist && npm run clean-src && rimraf assets",
      "webpack": "webpack",
      "add-assets": "copyfiles -u 4 ./node_modules/@rti/rti-lib/assets/**/*.* ./assets/ && copyfiles -u 2 ./src/assets/**/*.* ./assets",
      "pack": "webpack --config webpack.aot.js",
      "prepare": "npm run build-aot && npm run add-assets",
      "prepublishOnly": "npm version prerelease --preid=snapshot",
      "publish": "git add package.json && git commit -m "Package version Changed" && git push"
      },


      When this item is built and published (using "npm install" and "npm publish"), the tgz file is 5mb. If I browse to the artifact in Artifactory, I see a file that is roughly 5mb.



      When the server component builds, it uses a Maven plug-in to download the tgz using "npm pack @rti/rti-app@latest". It then unpacks and repacks the tgz including some other artifacts.



      At this point, the server builds correctly. If I build the server again, it also succeeds. However, if I build the server a third time, the tgz file is then truncated to 1,900 bytes. Publishing the client restores the artifact, and things work again. As long as the server isn't built three times in a row before the client is built, everything keeps working.



      I've narrowed it down to this specific "npm pack" operation.



      <configuration>
      <executable>${npmexe}</executable>
      <workingDirectory>target/</workingDirectory>
      <arguments>
      <argument>pack</argument>
      <argument>@rti/rti-app@latest</argument>
      </arguments>
      </configuration>


      It's easier to repro by just doing the same operation.



      So, to summarize:




      1. From the rti-app directory: Publish @rti/rti-app by "npm install && npm publish".

      2. From the server directory: "npm pack @rti/rti-app@latest"

      3. dir rti*tgz : You'll see a file that is > 5mb.

      4. npm pack @rti/rti-app@latest

      5. dir rti*tgz : You'll still see a file that is > 5mb.

      6. npm pack @rti/rti-app@latest

      7. dir rti*tgz : Now, you'll see a file that is 1,900 bytes.

      8. I've reproed this multiple times just to make absolutely sure that these steps are causing it.


      I know that the whole design of this is convoluted and over-complicated. Our packaging needs to be redesigned and simplified, but there's no time for that now. I just need it to work.



      Everything I've read says that "npm pack" is the best way to download the tgz file for an NPM artifact. I imagine that overriding the "pack" item in "scripts" is the key to this bad behavior. Would removing "pack" and moving the "webpack --config webpack.aot.js" be something I should look at?



      I don't recall this problem when we were using Sinopia.







      node.js npm artifactory






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 3:54









      JamieJamie

      8891020




      8891020
























          0






          active

          oldest

          votes











          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%2f53292971%2fwhy-is-my-tgz-file-getting-truncated-when-i-call-npm-pack-against-my-artifact%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f53292971%2fwhy-is-my-tgz-file-getting-truncated-when-i-call-npm-pack-against-my-artifact%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







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini