mvila / serverless-plugin-scripts

Add scripting capabilities to the Serverless Framework
123 stars 15 forks source link

Scripts whitespace removed in new serverless versions #5

Closed Limess closed 6 years ago

Limess commented 6 years ago

Since serverless 1.27.0, the scripts ran by this plugin have all whitespace removed.

i.e.

  deploy:
      finalise: >
          cp -rf public/favicon.ico dist &&
          aws s3 sync dist s3://some-url

runs

cp-rfpublic/favicon.icodist&&awss3syncdists3://some-url
mvila commented 6 years ago

Hi @Limess,

I am sorry but I couldn't reproduce your issue with Serverless 1.27.3. Also, I double-checked my code, and I couldn't find anything that could remove the whitespace. I just take the command strings (as parsed by Serverless) and execute them with execSync. So I guess the root of the problem might be somewhere else.

Limess commented 6 years ago

Thanks @mvila. Agreed that it doesn't seem related to this plugin - but it's definitely impacted our usage of it across a few projects.

I haven't had time to dig into what is causing this in the main serverless library, will try to if I have the chance.

For reference, the above example is a slight simplification. We're currently using a yaml anchor to share the above command, i.e.:

  custom:
    deployScript: &deploy_script >
      cp -rf public/favicon.ico dist &&
      aws s3 sync dist s3://some-url

...

  deploy:
      finalise: *deploy_script

which worked in the older serverless versions.

mvila commented 6 years ago

Okay, @Limess, I close this issue, but please let me know if you can find an explanation.