Skip to content

Commit

Permalink
fix: replace all occurences of a token in an option, not only the fir…
Browse files Browse the repository at this point in the history
…st one
  • Loading branch information
tinesoft committed Mar 26, 2023
1 parent 57f00f5 commit 320877a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ You may see other tokens like `${nextRelease.version}`, those are tokens that ar
> [
> '@semantic-release/exec',
> {
> prepareCmd: 'cp ${WORKSPACE_DIR}/src ${WORKSPACE_DIR}/dist',
> prepareCmd: 'cp LICENSE dist/packages/${PROJECT_NAME} && cp README.md dist/packages/${PROJECT_NAME}',
> execCwd: '${WORKSPACE_DIR}',
> fakeStringArrayOption: ['${WORKSPACE_DIR}/src', '${WORKSPACE_DIR}/dist'],
> fakeBooleanOption: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/nx-semantic-release/src/config/apply-tokens.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('applyTokensToSemanticReleaseOptions', () => {
[
'@semantic-release/exec',
{
prepareCmd: 'cp LICENSE dist/packages/${PROJECT_NAME}',
prepareCmd: 'cp LICENSE dist/packages/${PROJECT_NAME} && cp README.md dist/packages/${PROJECT_NAME}',
execCwd: '${WORKSPACE_DIR}',
fakeStringArrayOption: ['${WORKSPACE_DIR}/src', '${WORKSPACE_DIR}/dist'],
fakeBooleanOption: true,
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('applyTokensToSemanticReleaseOptions', () => {
[
'@semantic-release/exec',
{
prepareCmd: 'cp LICENSE dist/packages/app-a',
prepareCmd: 'cp LICENSE dist/packages/app-a && cp README.md dist/packages/app-a',
execCwd: '.',
fakeStringArrayOption: ['./src', './dist'],
fakeBooleanOption: true,
Expand Down
6 changes: 3 additions & 3 deletions packages/nx-semantic-release/src/config/apply-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export function applyTokensToSemanticReleaseOptions(
) {
const replaceTokens = (value: string): string => {
return value
.replace('${PROJECT_DIR}', tokens.projectDir)
.replace('${PROJECT_NAME}', tokens.projectName)
.replace('${WORKSPACE_DIR}', tokens.workspaceDir);
.replaceAll('${PROJECT_DIR}', tokens.projectDir)
.replaceAll('${PROJECT_NAME}', tokens.projectName)
.replaceAll('${WORKSPACE_DIR}', tokens.workspaceDir);
};

[
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"target": "es2020",
"target": "es2021",
"module": "esnext",
"lib": ["es2020", "dom"],
"lib": ["es2021", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
Expand Down

0 comments on commit 320877a

Please sign in to comment.