build: ensure build-packages-dist script works on macOS (#17247)
build: ensure build-packages-dist script works on macOS (#17247)

The `build-packages-dist` script does not seem to work on MacOS
because the `cp --no-preserve` flag is not supported by default.

This commit switches to a simple `chmod` call in order to make it
work in all Bash environments. Additionally the script has been updated
to clean previous `npm_package` outputs. This ensures that the version
placeholder is properly replaced in the release output.

This is necessary due to a bug in `rules_nodejs`. Read more here:
https://github.com/bazelbuild/rules_nodejs/issues/1219
DevVersion/material2,Jefiozie/material2,mmalerba/material2,DevVersion/material2,josephperrott/material2,Jefiozie/material2,andrewseguin/material2,Jefiozie/material2,angular/components,crisbeto/material2,crisbeto/material2,andrewseguin/material2,mmalerba/material2,Jefiozie/material2,DevVersion/material2,angular/components,DevVersion/material2,crisbeto/material2,DevVersion/material2,josephperrott/material2,mmalerba/material2,mmalerba/material2,angular/components,andrewseguin/material2,josephperrott/material2,Jefiozie/material2,andrewseguin/material2,crisbeto/material2,andrewseguin/material2,angular/components,josephperrott/material2,josephperrott/material2,mmalerba/material2