Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: doc-gen & models #195

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
publish-gh-pages:
needs: build
needs: publish-gpr
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
28 changes: 14 additions & 14 deletions doc-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@ const fs = require("fs");
const glob = require("glob");

async function docgen(filePath, fileName) {
const componentInfo = await vueDocs.parse(`./src/components/${filePath}/${fileName}`, {
alias: { "@": path.resolve(__dirname, "./src/") },
const componentInfo = await vueDocs.parse(path.join(".", "src", "components", filePath, fileName), {
alias: { "@": path.resolve(__dirname, path.join(".", "src")) },
modules: [path.resolve(__dirname, ".")],
validExtends: (fullFilePath) => !/[\\/]node_modules[\\/]/.test(fullFilePath),
jsx: true
});
delete componentInfo.sourceFiles;
fs.mkdir(`./public/docs/${filePath}`, { recursive: true }, () => {
fs.mkdir(path.join(".", "public", "docs", filePath), { recursive: true }, () => {
});
fs.writeFile(
`./public/docs/${filePath}/${fileName.replace("vue", "json")}`,
path.join(".", "public", "docs", filePath, fileName.replace("vue", "json")),
JSON.stringify(componentInfo, null, 2),
() => {
}
);
}

const prefix = __dirname + "/src/components/";
glob(prefix + "**/*.vue", {}, (err, files) => {
const prefix = path.join(__dirname, "src", "components");
glob(prefix + path.sep + "**/*.vue", {}, (err, files) => {
files.map((f) => {
const parts = f.replace(prefix, "").split("/");
const parts = path.normalize(f).replace(prefix, "").split(path.sep);
const fileName = parts.pop();
const filePath = parts.join("/");
docgen(filePath, fileName).then(() => console.log(`generated ${filePath}/${fileName.replace("vue", "json")}`));
const filePath = path.join(path.sep, ...parts, path.sep);
docgen(filePath, fileName).then(() => console.log(`generated ${filePath}${fileName.replace("vue", "json")}`));
});
});

const commonSource = __dirname + "/src/common/";
const commonDest = __dirname + "/public/files/";
glob(commonSource + "**/!(*.spec).ts", {}, (err, files) => {
const commonSource = path.join(__dirname, "src", "common");
const commonDest = path.join(__dirname, "public", "files");
glob(commonSource + path.sep + "**/!(*.spec).ts", {}, (err, files) => {
files.map((f) => {
const parts = f.replace(commonSource, "").split("/");
const parts = path.normalize(f).replace(commonSource, "").split(path.sep);
const fileName = parts.pop();
const filePath = `${commonDest}${parts.join("/")}/`;
const filePath = `${commonDest}${path.join(path.sep, ...parts, path.sep)}`;
fs.mkdir(filePath, { recursive: true }, () => {
});
console.log(`copied from ${f} to ${filePath}${fileName}`);
Expand Down
1 change: 1 addition & 0 deletions src/common/models/NeonTreeMenuSectionModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { NeonTreeMenuLinkModel } from './NeonTreeMenuLinkModel';
export interface NeonTreeMenuSectionModel {
label: string;
key: string;
href?: string;
children?: NeonTreeMenuLinkModel[];
expanded?: boolean;
disabled?: boolean;
Expand Down
10 changes: 5 additions & 5 deletions src/common/utils/NeonNumberUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export class NeonNumberUtils {
const formatOptions =
options && (options.decimals || options.minimumFractionDigits || options.style || options.currency)
? {
minimumFractionDigits: options.decimals || options.minimumFractionDigits,
maximumFractionDigits: options.decimals,
style: options.style,
currency: options.currency,
}
minimumFractionDigits: options.decimals || options.minimumFractionDigits,
maximumFractionDigits: options.decimals,
style: options.style,
currency: options.currency,
}
: {};
const formatted = Number(options && options.percentage ? 100 * value : value).toLocaleString(
locale || navigator.language,
Expand Down
Loading