File tree Expand file tree Collapse file tree 5 files changed +10
-2
lines changed
packages/nx-semantic-release/src
executors/semantic-release Expand file tree Collapse file tree 5 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -138,9 +138,10 @@ $ nx semantic-release app-c --repositoryUrl "https://github.com/TheUnderScorer/n
138138
139139| Token | Expands into |
140140| --------------- | --------------------------------------------------------------------------------------------- |
141- | ${PROJECT_DIR} | Resolves to the current project direcory (ex. `/Users/theunderscorer/nx-monorepo/apps/app-a`) |
141+ | ${RELATIVE_PROJECT_DIR} | Resolves to the current project relative directory within the current workspace (ex. `apps/app-a`) |
142+ | ${PROJECT_DIR} | Resolves to the current project directory (ex. `/Users/theunderscorer/nx-monorepo/apps/app-a`) |
142143| ${PROJECT_NAME} | Resolves to the current project name (ex. `app-a`) |
143- | ${WORKSPACE_DIR}| Resolves to the current workspace direcory (ex. `/Users/theunderscorer/nx-monorepo`) |
144+ | ${WORKSPACE_DIR}| Resolves to the current workspace directory (ex. `/Users/theunderscorer/nx-monorepo`) |
144145
145146
146147Every available option support tokens - this included nested objects and arrays.
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const requiredOptions: SemanticReleaseOptions = {
1414
1515const mockTokens : ConfigTokensDict = {
1616 projectDir : 'apps/app-a' ,
17+ relativeProjectDir : 'apps/app-a' ,
1718 projectName : 'app-a' ,
1819 workspaceDir : '.' ,
1920} ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { SemanticReleaseOptions } from '../executors/semantic-release/semantic-r
22import deepMap from 'deep-map' ;
33
44export interface ConfigTokensDict {
5+ relativeProjectDir : string ;
56 projectDir : string ;
67 projectName : string ;
78 workspaceDir : string ;
@@ -13,6 +14,7 @@ export function applyTokensToSemanticReleaseOptions(
1314) {
1415 const replaceTokens = ( value : string ) : string => {
1516 return value
17+ . replaceAll ( '${RELATIVE_PROJECT_DIR}' , tokens . relativeProjectDir )
1618 . replaceAll ( '${PROJECT_DIR}' , tokens . projectDir )
1719 . replaceAll ( '${PROJECT_NAME}' , tokens . projectName )
1820 . replaceAll ( '${WORKSPACE_DIR}' , tokens . workspaceDir ) ;
Original file line number Diff line number Diff line change 1+ import path from "path" ;
12import {
23 createProjectGraphAsync ,
34 ExecutorContext ,
@@ -140,6 +141,7 @@ export function resolveOptions(
140141
141142 return applyTokensToSemanticReleaseOptions ( mergedOptions , {
142143 projectName : context . projectName as string ,
144+ relativeProjectDir : path . relative ( context . cwd , getDefaultProjectRoot ( context ) ) ,
143145 projectDir : getDefaultProjectRoot ( context ) ,
144146 workspaceDir : workspaceRoot ,
145147 } ) ;
Original file line number Diff line number Diff line change 1+ import path from "path" ;
12import { SemanticReleaseOptions } from '../../executors/semantic-release/semantic-release' ;
23import {
34 Tree ,
@@ -27,6 +28,7 @@ export async function setupProject(
2728 const semanticReleaseConfig = applyTokensToSemanticReleaseOptions ( options , {
2829 projectName,
2930 projectDir : projectConfig . root ,
31+ relativeProjectDir : path . relative ( workspaceRoot , projectConfig . root ) ,
3032 workspaceDir : workspaceRoot ,
3133 } ) ;
3234
You can’t perform that action at this time.
0 commit comments