Skip to content

Commit

Permalink
feat(nx-ghpages): add support for writing CNAME file
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Jul 27, 2024
1 parent d349830 commit 3a098f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/nx-ghpages/src/executors/deploy/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export default async function deployExecutor(options: BuildExecutorSchema) {
};
}

if (options.CNAME) {
logger.info(`Creating CNAME file for ${options.CNAME} in ${directory}`);
writeFileSync(join(directory, 'CNAME'), options.CNAME);
}

logger.info('Setting up git remote');

if (!(await exists(join(directory, '.git')))) {
Expand Down
1 change: 1 addition & 0 deletions packages/nx-ghpages/src/executors/deploy/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export interface BuildExecutorSchema {
baseBranch: string;
syncWithBaseBranch: boolean;
syncStrategy: 'rebase' | 'merge';
CNAME: string;
}
3 changes: 3 additions & 0 deletions packages/nx-ghpages/src/executors/deploy/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"description": "Git command to use to sync the gh-pages branch with the base branch",
"enum": ["rebase", "merge"],
"default": "rebase"
"CNAME": {
"type": "string",
"description": "Custom domain to use for the gh-pages branch. Applied by creating a CNAME file in the root of the gh-pages branch"
}
},
"required": ["remote", "directory"]
Expand Down

0 comments on commit 3a098f0

Please sign in to comment.