Skip to content

Commit

Permalink
Release 4.1.0 - Legonizer
Browse files Browse the repository at this point in the history
  • Loading branch information
JPugetGil authored and mathieuLivebardon committed Feb 19, 2024
1 parent 00d77b9 commit 8ff76c0
Show file tree
Hide file tree
Showing 36 changed files with 430 additions and 355 deletions.
80 changes: 80 additions & 0 deletions bin/generateArchitecture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const fs = require('fs');
const { exec } = require('child-process-promise');
const path = require('path');

const generateArchitectureDoc = () => {
const packages = [];
const peerDependencies = [];
const packagesFolder = './packages';

const dirents = fs.readdirSync(packagesFolder, { withFileTypes: true });
dirents.forEach((dirent) => {
if (dirent.isDirectory()) {
packages.push(dirent.name);

const packageContent = JSON.parse(
fs.readFileSync(packagesFolder + '/' + dirent.name + '/package.json')
);

const removeOrganizationName = (string) => {
return string.replace('@ud-viz/', '');
};

const namePackage = removeOrganizationName(packageContent.name);

for (const peerDepName in packageContent.peerDependencies) {
if (peerDepName.startsWith('@ud-viz/')) {
peerDependencies.push(
namePackage + '-->' + removeOrganizationName(peerDepName)
);
}
}
}
});

// @ud-viz packages architecture

const filePath = './docs/static/architecture.md';

fs.writeFileSync(filePath, '# @ud-viz packages architecture\n\n');

// mermaid graph generation
[
'```mermaid',
'flowchart TB',
'subgraph ud-viz/packages',
...packages,
'end',
...peerDependencies,
'```',
'>This file is auto generated',
].forEach((line) => {
fs.appendFileSync(filePath, '\n' + line, (err) => {
if (err) throw err;
});
});
};

const generatePackagesArchitectureDoc = async () => {
const packagesFolderPath = path.resolve(__dirname, '../packages');

fs.readdirSync(packagesFolderPath).forEach(async (packageName) => {
const packagePath = path.join(packagesFolderPath, packageName);
const lstat = fs.lstatSync(packagePath);
const isDirectory = lstat.isDirectory();

if (!isDirectory) {
return;
}

const autoMermaidCommand = `node ${packagesFolderPath}/utils_node/bin/autoMermaid.js -e ${packagePath}/src -o ${packagePath}/architecture.md`;

const result = await exec(autoMermaidCommand);

console.log(result.stdout);
console.error(result.stderr);
});
};

generatePackagesArchitectureDoc();
generateArchitectureDoc();
77 changes: 0 additions & 77 deletions bin/generateJsDoc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require('fs');
const { computeFileFormat } = require('@ud-viz/utils_shared');
const { exec } = require('child-process-promise');
const path = require('path');

const docScriptTag = (injectMermaidScriptTag) => {
console.info('include script tag in ./docs/static ', injectMermaidScriptTag);
Expand Down Expand Up @@ -71,81 +70,5 @@ const generateDoc = () => {
});
};

const generateArchitectureDoc = () => {
const packages = [];
const peerDependencies = [];
const packagesFolder = './packages';

const dirents = fs.readdirSync(packagesFolder, { withFileTypes: true });
dirents.forEach((dirent) => {
if (dirent.isDirectory()) {
packages.push(dirent.name);

const packageContent = JSON.parse(
fs.readFileSync(packagesFolder + '/' + dirent.name + '/package.json')
);

const removeOrganizationName = (string) => {
return string.replace('@ud-viz/', '');
};

const namePackage = removeOrganizationName(packageContent.name);

for (const peerDepName in packageContent.peerDependencies) {
if (peerDepName.startsWith('@ud-viz/')) {
peerDependencies.push(
namePackage + '-->' + removeOrganizationName(peerDepName)
);
}
}
}
});

// @ud-viz packages architecture

const filePath = './docs/static/architecture.md';

fs.writeFileSync(filePath, '# @ud-viz packages architecture\n\n');

// mermaid graph generation
[
'```mermaid',
'flowchart TB',
'subgraph ud-viz/packages',
...packages,
'end',
...peerDependencies,
'```',
'>This file is auto generated',
].forEach((line) => {
fs.appendFileSync(filePath, '\n' + line, (err) => {
if (err) throw err;
});
});
};

const generatePackagesArchitectureDoc = async () => {
const packagesFolderPath = path.resolve(__dirname, '../packages');

fs.readdirSync(packagesFolderPath).forEach(async (packageName) => {
const packagePath = path.join(packagesFolderPath, packageName);
const lstat = fs.lstatSync(packagePath);
const isDirectory = lstat.isDirectory();

if (!isDirectory) {
return;
}

const autoMermaidCommand = `node ${packagesFolderPath}/utils_node/bin/autoMermaid.js -e ${packagePath}/src -o ${packagePath}/architecture.md`;

const result = await exec(autoMermaidCommand);

console.log(result.stdout);
console.error(result.stderr);
});
};

generatePackagesArchitectureDoc();
generateArchitectureDoc();
docScriptTag(true);
generateDoc().then(() => docScriptTag(false));
19 changes: 19 additions & 0 deletions docs/static/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 4.1.0

## @ud-viz
- Created Documentation Github Action
- Generated documentation with Github Actions
- Improved the documentation

## @ud-viz/legonizer
- Created the package and its widget

## @ud-viz/game_shared
- update(NativeCommandManager.js): checkMaxAltitude and checkMinAltitude now use worldposition of object3D
- update(ControllerNativeCommandManager.js):stop using mode.type in controls function
- update(NativeCommandManager):add max and min altitude when move and move down
- update(ControllerNativeCommandManager):add new mode with up and down

## @ud-viz/widget_layer_choice
- feat(LayerChoice):Add focus button in layerchoice widget

# v4.0.3

## @ud-viz
Expand Down
2 changes: 1 addition & 1 deletion docs/static/ReleasePublish.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
....

```
4. Run `npm run docs`. Generate the documentation with [JSDoc](https://jsdoc.app/).
4. Run `npm run architecture`. Generate the architecture with [js script](../../bin/generateArchitecture.js).

5. Follow the [prior PR submission](./Contributing.md#prior-to-pr-submission)

Expand Down
4 changes: 4 additions & 0 deletions docs/static/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ widget_extensions_3d_tiles_temporal
widget_geocoding
widget_guided_tour
widget_layer_choice
widget_legonizer
widget_planar_controls
widget_slide_show
widget_sparql
Expand Down Expand Up @@ -73,6 +74,7 @@ show_room-->game_browser
show_room-->game_browser_template
show_room-->game_shared
show_room-->game_shared_template
show_room-->widget_legonizer
smdb-->utils_browser
smdb-->utils_shared
smdb-->widget_camera_positioner
Expand All @@ -83,6 +85,8 @@ widget_extensions_3d_tiles_temporal-->extensions_3d_tiles_temporal
widget_geocoding-->utils_browser
widget_geocoding-->utils_shared
widget_layer_choice-->utils_browser
widget_legonizer-->game_browser
widget_legonizer-->utils_browser
widget_planar_controls-->utils_browser
widget_slide_show-->utils_browser
widget_sparql-->utils_browser
Expand Down
Loading

0 comments on commit 8ff76c0

Please sign in to comment.