Skip to content

Commit bf42d6f

Browse files
authored
fix: Fix dependencies. Improve docs (#18)
1 parent ccb7d9c commit bf42d6f

File tree

7 files changed

+5694
-7262
lines changed

7 files changed

+5694
-7262
lines changed

components/cspell-config/dictionaries/tech.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ automerge
22
cacheable
33
frontmatter
44
nrwl
5+
syncrc

components/markdown-confluence-sync/CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
#### Deprecated
1212
#### Removed
1313

14-
## [1.0.0-beta.1]
14+
## [1.0.0-beta.2] - 2024-11-26
15+
16+
### Added
17+
18+
* feat: Log possible error when trying to parse a markdown file
19+
* docs: Add markdown frontmatter examples
20+
* docs: Add examples of supported config files
21+
* docs: Add link to Confluence Sync documentation
22+
23+
### Fixed
24+
25+
* fix: Fix missed dependencies that were defined as devDependencies
26+
* fix: Add missing supported configuration options to TypeScript typings
27+
28+
## [1.0.0-beta.1] [YANKED]
1529

1630
### Added
1731

components/markdown-confluence-sync/README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,28 @@ In order to be able to sync the markdown files with Confluence, you need to have
5151

5252
### Compatibility
5353

54-
> [!WARNING]
54+
> [!IMPORTANT]
5555
> This library has been tested only with Confluence 8.5.x. It may work with other versions, but it has not been tested.
5656
5757
## Features
5858

5959
The library reads the markdown files in a given folder and create/delete/update the corresponding Confluence pages following the same hierarchical structure under a provided Confluence page depending on the [synchronization mode](#sync-modes) to use.
6060

61-
Markdown documents to be synced __must have a `title` property, and a `sync_to_confluence` property set to `true` in the [frontmatter metadata](https://jekyllrb.com/docs/front-matter/).__
61+
> [!IMPORTANT]
62+
> Markdown documents to be synced __must have [frontmatter metadata](https://jekyllrb.com/docs/front-matter/)__ with at least next properties:
63+
> * `title` property, used to give a title to the page in Confluence.
64+
> * `sync_to_confluence` property set to `true`
65+
66+
```markdown
67+
---
68+
title: Page title
69+
sync_to_confluence: true
70+
---
71+
72+
# Page content
73+
74+
Hello, world! I'm a markdown file to be synced with Confluence.
75+
```
6276

6377
The library has __two modes for syncing__:
6478
* `tree` sync mode - Mirrors the hierarchical pages structure from given folder under a Confluence root page. Some files are used for [representing indices in the hierarchy](#index-files).
@@ -102,6 +116,19 @@ The library provides an NPM binary named `markdown-confluence-sync`. To use it,
102116
}
103117
```
104118

119+
All the markdown files to be synced must have frontmatter properties "title" and "sync_to_confluence" set to `true`. For example:
120+
121+
```markdown
122+
---
123+
title: Page title
124+
sync_to_confluence: true
125+
---
126+
127+
# Page content
128+
129+
Hello, world! I'm a markdown file to be synced with Confluence.
130+
```
131+
105132
As a starting point, you can create a `markdown-confluence-sync.config.js` file in the root of your project with the following content (read the [Configuration](#configuration) section for more information and other configuration methods):
106133

107134
```js title="markdown-confluence-sync.config.js"
@@ -196,6 +223,9 @@ repository/
196223
└── package.json
197224
```
198225

226+
> [!TIP]
227+
> You can also read the [Confluence Sync package documentation](https://github.com/Telefonica/cross-confluence-tools/tree/main/components/confluence-sync) for further info about the process of syncing to Confluence.
228+
199229
### Flat mode
200230

201231
The `flat` mode syncs all markdown files matching a [glob pattern](https://github.com/isaacs/node-glob#glob-primer) just under the root Confluence page. It does not create a nested hierarchy.
@@ -247,10 +277,19 @@ The namespace for the configuration of this library is `markdown-confluence-sync
247277

248278
### Configuration file
249279

250-
As mentioned above, the library supports defining the config in a configuration file. It supports many patterns for naming the file, as well as file formats. Read the [`@mocks-server/config` package](https://github.com/mocks-server/main/tree/master/packages/config) for further info about the supported patterns and formats. Just take into account that the namespace for the configuration is `markdown-confluence-sync`, so, a possible configuration file may be named `markdown-confluence-sync.config.js`.
280+
As mentioned above, the library supports defining the config in a configuration file. It supports [many patterns for naming the file, as well as file formats](https://github.com/mocks-server/main/tree/master/packages/config#configuration-sources).
281+
282+
Just take into account that the namespace for the configuration is `markdown-confluence-sync`, so, possible configuration files may be:
283+
284+
* `markdown-confluence-sync.config.js`.
285+
* `.markdown-confluence-syncrc.yaml`.
286+
* `.markdown-confluence-syncrc.json`.
287+
288+
> [!TIP]
289+
> Read the [`@mocks-server/config` docs](https://github.com/mocks-server/main/tree/master/packages/config#configuration-sources) for further info about all supported file names and formats of the configuration file.
251290
252291
```js title="markdown-confluence-sync.config.js"
253-
export default {
292+
module.exports = {
254293
docsDir: "docs",
255294
confluence: {
256295
url: "https://my-confluence.es",

components/markdown-confluence-sync/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tid-xcut/markdown-confluence-sync",
33
"description": "Creates/updates/deletes Confluence pages based on markdown files in a directory. Supports Mermaid diagrams and per-page configuration using frontmatter metadata. Works great with Docusaurus",
4-
"version": "1.0.0-beta.1",
4+
"version": "1.0.0-beta.2",
55
"license": "Apache-2.0",
66
"author": "Telefónica Innovación Digital",
77
"repository": {
@@ -71,12 +71,15 @@
7171
"@mocks-server/logger": "2.0.0-beta.2",
7272
"@tid-xcut/confluence-sync": "workspace:*",
7373
"fs-extra": "11.2.0",
74+
"glob": "10.3.10",
7475
"handlebars": "4.7.8",
7576
"hast": "1.0.0",
7677
"hast-util-to-string": "2.0.0",
7778
"mdast-util-mdx": "3.0.0",
7879
"mdast-util-mdx-jsx": "3.1.3",
7980
"mdast-util-to-markdown": "2.1.1",
81+
"rehype": "12.0.1",
82+
"rehype-parse": "8.0.5",
8083
"rehype-raw": "5.1.0",
8184
"rehype-stringify": "9.0.4",
8285
"remark": "14.0.3",
@@ -116,10 +119,6 @@
116119
"@types/which": "3.0.4",
117120
"babel-plugin-transform-import-meta": "2.2.1",
118121
"cross-fetch": "4.0.0",
119-
"glob": "10.3.10",
120-
"rehype": "12.0.1",
121-
"rehype-parse": "8.0.5",
122-
"remark-stringify": "10.0.3",
123122
"start-server-and-test": "2.0.8",
124123
"tmp": "0.2.3",
125124
"ts-dedent": "2.2.0",

components/markdown-confluence-sync/src/lib/confluence/ConfluenceSync.types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ declare global {
3333
spaceKey?: SpaceKeyOptionValue;
3434
/** Confluence root page id */
3535
rootPageId?: RootPageIdOptionValue;
36+
/** Customize Confluence page titles by adding a prefix to all of them for improved organization and clarity */
37+
rootPageName?: RootPageNameOptionValue;
38+
/** Notice message to add at the beginning of the Confluence pages */
39+
noticeMessage?: NoticeMessageOptionValue;
40+
/** Template string to use for the notice message. */
41+
noticeTemplate?: NoticeTemplateOptionValue;
3642
/** Confluence dry run */
3743
dryRun?: DryRunOptionValue;
3844
};

components/markdown-confluence-sync/src/lib/docusaurus/pages/DocusaurusDocPage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ export const DocusaurusDocPage: DocusaurusDocPageConstructor = class DocusaurusD
3535
implements DocusaurusDocPageInterface
3636
{
3737
protected _vFile: VFile;
38+
protected _logger?: LoggerInterface;
3839

3940
constructor(path: string, options?: DocusaurusDocPageOptions) {
41+
this._logger = options?.logger;
42+
4043
if (!existsSync(join(path))) {
4144
throw new PathNotExistException(`Path ${path} does not exist`);
4245
}
@@ -49,6 +52,7 @@ export const DocusaurusDocPage: DocusaurusDocPageConstructor = class DocusaurusD
4952
try {
5053
this._vFile = this._parseFile(path, options);
5154
} catch (e) {
55+
this._logger?.error((e as Error).toString());
5256
throw new InvalidMarkdownFormatException(
5357
`Invalid markdown format: ${path}`,
5458
{ cause: e },

0 commit comments

Comments
 (0)