Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single quotes omitted from output of replace in npm script #14

Closed
douglassboshkoff opened this issue Jan 8, 2020 · 6 comments · Fixed by #15
Closed

Single quotes omitted from output of replace in npm script #14

douglassboshkoff opened this issue Jan 8, 2020 · 6 comments · Fixed by #15

Comments

@douglassboshkoff
Copy link

We were using version 1.1.1 of replace in our project in the following npm script.

"replace:envConfigs": "replace '__APP_VERSION__' \"'$npm_package_version'\" ./dist/lib-esm -r --include='*.js'"

We used this to fill in the application version in the following line of code.
const version = __APP_VERSION__;

After updating to replace 1.1.3, our build broke.

Output of replace 1.1.1
var version = '0.1.11';

Output of replace 1.1.3
var version = 0.1.11;

Is this a bug or user error? If a user error, how should we modify our build script.

@ALMaclaine
Copy link
Owner

I just pushed v1.1.4, i dont think it fixed it but will you try.

@Dwarfess @goto-bus-stop do you know what happend here?

@ALMaclaine
Copy link
Owner

this looks a little weird to me though

\"'$npm_package_version'\"

why are you escaping the "

I don't have a strong opinion about what the "correct" usage should be, especially in cases like this. Open to opinions.

Maybe you can try const version = '__APP_VERSION__'; in the mean time.

@goto-bus-stop
Copy link

looks like command line arguments handling changed—most likely cause would be 1c320b0

@goto-bus-stop
Copy link

Probably caused by this change in yargs-parser v12 (used by yargs v13): yargs/yargs-parser#153
This PR is supposed to address that: yargs/yargs-parser#222

@goto-bus-stop
Copy link

I think the simplest solution is to downgrade for the time being: #15

@ALMaclaine
Copy link
Owner

okay v1.1.5 is published

thank you everyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants