@cas-smartdesign/messages-generator 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright 2020 CAS Software AG
2
+
3
+ This software is confidential and proprietary information of CAS Software AG. You shall not
4
+ disclose such Confidential Information and shall use it only in accordance with the terms of
5
+ the license agreement you entered into with CAS Software AG or SmartWe World AG.
6
+
7
+ To obtain a license (e.g. by joining the partner programs of CAS Software AG or SmartWe World AG)
8
+ please contact partnerinfo@cas.de or partnerinfo@smartwe.world.
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import path from "path";
3
+ import yargs from "yargs";
4
+ import generate from "../src/main.mjs";
5
+
6
+ const cwd = path.resolve();
7
+
8
+ const argv = yargs()
9
+ .usage("Usage: $0 --source [path/to/translations] --target [output/directory]")
10
+ .option("source", {
11
+ alias: "s",
12
+ description: "Directory where the SmartDesign translations files are stored",
13
+ type: "string",
14
+ default: cwd,
15
+ defaultDescription: "The default is the current working dir.",
16
+ })
17
+ .option("target", {
18
+ alias: "t",
19
+ description: "",
20
+ type: "string",
21
+ default: path.resolve(cwd, "messages"),
22
+ defaultDescription: "The default is a directory named 'messages' in the current working dir.",
23
+ })
24
+ .help()
25
+ .alias("help", "h")
26
+ .parse(process.argv.slice(2));
27
+
28
+ generate(path.resolve(argv.source), path.resolve(argv.target));
@@ -0,0 +1 @@
1
+ .markdown-body{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;margin:0;color:#1f2328;background-color:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;line-height:1.5;word-wrap:break-word}.markdown-body .octicon{display:inline-block;fill:currentColor;vertical-align:text-bottom}.markdown-body h1:hover .anchor .octicon-link:before,.markdown-body h2:hover .anchor .octicon-link:before,.markdown-body h3:hover .anchor .octicon-link:before,.markdown-body h4:hover .anchor .octicon-link:before,.markdown-body h5:hover .anchor .octicon-link:before,.markdown-body h6:hover .anchor .octicon-link:before{width:16px;height:16px;content:" ";display:inline-block;background-color:currentColor;-webkit-mask-image:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");mask-image:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>")}.markdown-body details,.markdown-body figcaption,.markdown-body figure{display:block}.markdown-body summary{display:list-item}.markdown-body [hidden]{display:none!important}.markdown-body a{background-color:transparent;color:#0969da;text-decoration:none}.markdown-body abbr[title]{border-bottom:none;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.markdown-body b,.markdown-body strong{font-weight:600}.markdown-body dfn{font-style:italic}.markdown-body h1{margin:.67em 0;font-weight:600;padding-bottom:.3em;font-size:2em;border-bottom:1px solid hsla(210,18%,87%,1)}.markdown-body mark{background-color:#fff8c5;color:#1f2328}.markdown-body small{font-size:90%}.markdown-body sub,.markdown-body sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.markdown-body sub{bottom:-.25em}.markdown-body sup{top:-.5em}.markdown-body img{border-style:none;max-width:100%;box-sizing:content-box;background-color:#fff}.markdown-body code,.markdown-body kbd,.markdown-body pre,.markdown-body samp{font-family:monospace;font-size:1em}.markdown-body figure{margin:1em 40px}.markdown-body hr{box-sizing:content-box;overflow:hidden;background:transparent;border-bottom:1px solid hsla(210,18%,87%,1);height:.25em;padding:0;margin:24px 0;background-color:#d0d7de;border:0}.markdown-body input{font:inherit;margin:0;overflow:visible;font-family:inherit;font-size:inherit;line-height:inherit}.markdown-body [type=button],.markdown-body [type=reset],.markdown-body [type=submit]{-webkit-appearance:button;appearance:button}.markdown-body [type=checkbox],.markdown-body [type=radio]{box-sizing:border-box;padding:0}.markdown-body [type=number]::-webkit-inner-spin-button,.markdown-body [type=number]::-webkit-outer-spin-button{height:auto}.markdown-body [type=search]::-webkit-search-cancel-button,.markdown-body [type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.markdown-body ::-webkit-input-placeholder{color:inherit;opacity:.54}.markdown-body ::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}.markdown-body a:hover{text-decoration:underline}.markdown-body ::placeholder{color:#6e7781;opacity:1}.markdown-body hr:before{display:table;content:""}.markdown-body hr:after{display:table;clear:both;content:""}.markdown-body table{border-spacing:0;border-collapse:collapse;display:block;width:max-content;max-width:100%;overflow:auto}.markdown-body td,.markdown-body th{padding:0}.markdown-body details summary{cursor:pointer}.markdown-body details:not([open])>*:not(summary){display:none!important}.markdown-body a:focus,.markdown-body [role=button]:focus,.markdown-body input[type=radio]:focus,.markdown-body input[type=checkbox]:focus{outline:2px solid #0969da;outline-offset:-2px;box-shadow:none}.markdown-body a:focus:not(:focus-visible),.markdown-body [role=button]:focus:not(:focus-visible),.markdown-body input[type=radio]:focus:not(:focus-visible),.markdown-body input[type=checkbox]:focus:not(:focus-visible){outline:solid 1px transparent}.markdown-body a:focus-visible,.markdown-body [role=button]:focus-visible,.markdown-body input[type=radio]:focus-visible,.markdown-body input[type=checkbox]:focus-visible{outline:2px solid #0969da;outline-offset:-2px;box-shadow:none}.markdown-body a:not([class]):focus,.markdown-body a:not([class]):focus-visible,.markdown-body input[type=radio]:focus,.markdown-body input[type=radio]:focus-visible,.markdown-body input[type=checkbox]:focus,.markdown-body input[type=checkbox]:focus-visible{outline-offset:0}.markdown-body kbd{display:inline-block;padding:3px 5px;font:11px ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;line-height:10px;color:#1f2328;vertical-align:middle;background-color:#f6f8fa;border:solid 1px rgba(175,184,193,.2);border-bottom-color:#afb8c133;border-radius:6px;box-shadow:inset 0 -1px #afb8c133}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}.markdown-body h2{font-weight:600;padding-bottom:.3em;font-size:1.5em;border-bottom:1px solid hsla(210,18%,87%,1)}.markdown-body h3{font-weight:600;font-size:1.25em}.markdown-body h4{font-weight:600;font-size:1em}.markdown-body h5{font-weight:600;font-size:.875em}.markdown-body h6{font-weight:600;font-size:.85em;color:#656d76}.markdown-body p{margin-top:0;margin-bottom:10px}.markdown-body blockquote{margin:0;padding:0 1em;color:#656d76;border-left:.25em solid #d0d7de}.markdown-body ul,.markdown-body ol{margin-top:0;margin-bottom:0;padding-left:2em}.markdown-body ol ol,.markdown-body ul ol{list-style-type:lower-roman}.markdown-body ul ul ol,.markdown-body ul ol ol,.markdown-body ol ul ol,.markdown-body ol ol ol{list-style-type:lower-alpha}.markdown-body dd{margin-left:0}.markdown-body tt,.markdown-body code,.markdown-body samp{font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:12px}.markdown-body pre{margin-top:0;margin-bottom:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:12px;word-wrap:normal}.markdown-body .octicon{display:inline-block;overflow:visible!important;vertical-align:text-bottom;fill:currentColor}.markdown-body input::-webkit-outer-spin-button,.markdown-body input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none;appearance:none}.markdown-body .mr-2{margin-right:8px!important}.markdown-body:before{display:table;content:""}.markdown-body:after{display:table;clear:both;content:""}.markdown-body>*:first-child{margin-top:0!important}.markdown-body>*:last-child{margin-bottom:0!important}.markdown-body a:not([href]){color:inherit;text-decoration:none}.markdown-body .absent{color:#d1242f}.markdown-body .anchor{float:left;padding-right:4px;margin-left:-20px;line-height:1}.markdown-body .anchor:focus{outline:none}.markdown-body p,.markdown-body blockquote,.markdown-body ul,.markdown-body ol,.markdown-body dl,.markdown-body table,.markdown-body pre,.markdown-body details{margin-top:0;margin-bottom:16px}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link{color:#1f2328;vertical-align:middle;visibility:hidden}.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor{text-decoration:none}.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link{visibility:visible}.markdown-body h1 tt,.markdown-body h1 code,.markdown-body h2 tt,.markdown-body h2 code,.markdown-body h3 tt,.markdown-body h3 code,.markdown-body h4 tt,.markdown-body h4 code,.markdown-body h5 tt,.markdown-body h5 code,.markdown-body h6 tt,.markdown-body h6 code{padding:0 .2em;font-size:inherit}.markdown-body summary h1,.markdown-body summary h2,.markdown-body summary h3,.markdown-body summary h4,.markdown-body summary h5,.markdown-body summary h6{display:inline-block}.markdown-body summary h1 .anchor,.markdown-body summary h2 .anchor,.markdown-body summary h3 .anchor,.markdown-body summary h4 .anchor,.markdown-body summary h5 .anchor,.markdown-body summary h6 .anchor{margin-left:-40px}.markdown-body summary h1,.markdown-body summary h2{padding-bottom:0;border-bottom:0}.markdown-body ul.no-list,.markdown-body ol.no-list{padding:0;list-style-type:none}.markdown-body ol[type="a s"]{list-style-type:lower-alpha}.markdown-body ol[type="A s"]{list-style-type:upper-alpha}.markdown-body ol[type="i s"]{list-style-type:lower-roman}.markdown-body ol[type="I s"]{list-style-type:upper-roman}.markdown-body ol[type="1"]{list-style-type:decimal}.markdown-body div>ol:not([type]){list-style-type:decimal}.markdown-body ul ul,.markdown-body ul ol,.markdown-body ol ol,.markdown-body ol ul{margin-top:0;margin-bottom:0}.markdown-body li>p{margin-top:16px}.markdown-body li+li{margin-top:.25em}.markdown-body dl{padding:0}.markdown-body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:600}.markdown-body dl dd{padding:0 16px;margin-bottom:16px}.markdown-body table th{font-weight:600}.markdown-body table th,.markdown-body table td{padding:6px 13px;border:1px solid #d0d7de}.markdown-body table td>:last-child{margin-bottom:0}.markdown-body table tr{background-color:#fff;border-top:1px solid hsla(210,18%,87%,1)}.markdown-body table tr:nth-child(2n){background-color:#f6f8fa}.markdown-body table img{background-color:transparent}.markdown-body img[align=right]{padding-left:20px}.markdown-body img[align=left]{padding-right:20px}.markdown-body .emoji{max-width:none;vertical-align:text-top;background-color:transparent}.markdown-body span.frame{display:block;overflow:hidden}.markdown-body span.frame>span{display:block;float:left;width:auto;padding:7px;margin:13px 0 0;overflow:hidden;border:1px solid #d0d7de}.markdown-body span.frame span img{display:block;float:left}.markdown-body span.frame span span{display:block;padding:5px 0 0;clear:both;color:#1f2328}.markdown-body span.align-center{display:block;overflow:hidden;clear:both}.markdown-body span.align-center>span{display:block;margin:13px auto 0;overflow:hidden;text-align:center}.markdown-body span.align-center span img{margin:0 auto;text-align:center}.markdown-body span.align-right{display:block;overflow:hidden;clear:both}.markdown-body span.align-right>span{display:block;margin:13px 0 0;overflow:hidden;text-align:right}.markdown-body span.align-right span img{margin:0;text-align:right}.markdown-body span.float-left{display:block;float:left;margin-right:13px;overflow:hidden}.markdown-body span.float-left span{margin:13px 0 0}.markdown-body span.float-right{display:block;float:right;margin-left:13px;overflow:hidden}.markdown-body span.float-right>span{display:block;margin:13px auto 0;overflow:hidden;text-align:right}.markdown-body code,.markdown-body tt{padding:.2em .4em;margin:0;font-size:85%;white-space:break-spaces;background-color:#afb8c133;border-radius:6px}.markdown-body code br,.markdown-body tt br{display:none}.markdown-body del code{text-decoration:inherit}.markdown-body samp{font-size:85%}.markdown-body pre code{font-size:100%}.markdown-body pre>code{padding:0;margin:0;word-break:normal;white-space:pre;background:transparent;border:0}.markdown-body .highlight{margin-bottom:16px}.markdown-body .highlight pre{margin-bottom:0;word-break:normal}.markdown-body .highlight pre,.markdown-body pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;color:#1f2328;background-color:#f6f8fa;border-radius:6px}.markdown-body pre code,.markdown-body pre tt{display:inline;max-width:auto;padding:0;margin:0;overflow:visible;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}.markdown-body .csv-data td,.markdown-body .csv-data th{padding:5px;overflow:hidden;font-size:12px;line-height:1;text-align:left;white-space:nowrap}.markdown-body .csv-data .blob-num{padding:10px 8px 9px;text-align:right;background:#fff;border:0}.markdown-body .csv-data tr{border-top:0}.markdown-body .csv-data th{font-weight:600;background:#f6f8fa;border-top:0}.markdown-body [data-footnote-ref]:before{content:"["}.markdown-body [data-footnote-ref]:after{content:"]"}.markdown-body .footnotes{font-size:12px;color:#656d76;border-top:1px solid #d0d7de}.markdown-body .footnotes ol{padding-left:16px}.markdown-body .footnotes ol ul{display:inline-block;padding-left:16px;margin-top:16px}.markdown-body .footnotes li{position:relative}.markdown-body .footnotes li:target:before{position:absolute;inset:-8px -8px -8px -24px;pointer-events:none;content:"";border:2px solid #0969da;border-radius:6px}.markdown-body .footnotes li:target{color:#1f2328}.markdown-body .footnotes .data-footnote-backref g-emoji{font-family:monospace}.markdown-body .pl-c{color:#57606a}.markdown-body .pl-c1,.markdown-body .pl-s .pl-v{color:#0550ae}.markdown-body .pl-e,.markdown-body .pl-en{color:#6639ba}.markdown-body .pl-smi,.markdown-body .pl-s .pl-s1{color:#24292f}.markdown-body .pl-ent{color:#116329}.markdown-body .pl-k{color:#cf222e}.markdown-body .pl-s,.markdown-body .pl-pds,.markdown-body .pl-s .pl-pse .pl-s1,.markdown-body .pl-sr,.markdown-body .pl-sr .pl-cce,.markdown-body .pl-sr .pl-sre,.markdown-body .pl-sr .pl-sra{color:#0a3069}.markdown-body .pl-v,.markdown-body .pl-smw{color:#953800}.markdown-body .pl-bu{color:#82071e}.markdown-body .pl-ii{color:#f6f8fa;background-color:#82071e}.markdown-body .pl-c2{color:#f6f8fa;background-color:#cf222e}.markdown-body .pl-sr .pl-cce{font-weight:700;color:#116329}.markdown-body .pl-ml{color:#3b2300}.markdown-body .pl-mh,.markdown-body .pl-mh .pl-en,.markdown-body .pl-ms{font-weight:700;color:#0550ae}.markdown-body .pl-mi{font-style:italic;color:#24292f}.markdown-body .pl-mb{font-weight:700;color:#24292f}.markdown-body .pl-md{color:#82071e;background-color:#ffebe9}.markdown-body .pl-mi1{color:#116329;background-color:#dafbe1}.markdown-body .pl-mc{color:#953800;background-color:#ffd8b5}.markdown-body .pl-mi2{color:#eaeef2;background-color:#0550ae}.markdown-body .pl-mdr{font-weight:700;color:#8250df}.markdown-body .pl-ba{color:#57606a}.markdown-body .pl-sg{color:#8c959f}.markdown-body .pl-corl{text-decoration:underline;color:#0a3069}.markdown-body g-emoji{display:inline-block;min-width:1ch;font-family:"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;font-size:1em;font-style:normal!important;font-weight:400;line-height:1;vertical-align:-.075em}.markdown-body g-emoji img{width:1em;height:1em}.markdown-body .task-list-item{list-style-type:none}.markdown-body .task-list-item label{font-weight:400}.markdown-body .task-list-item.enabled label{cursor:pointer}.markdown-body .task-list-item+.task-list-item{margin-top:4px}.markdown-body .task-list-item .handle{display:none}.markdown-body .task-list-item-checkbox{margin:0 .2em .25em -1.4em;vertical-align:middle}.markdown-body .contains-task-list:dir(rtl) .task-list-item-checkbox{margin:0 -1.6em .25em .2em}.markdown-body .contains-task-list{position:relative}.markdown-body .contains-task-list:hover .task-list-item-convert-container,.markdown-body .contains-task-list:focus-within .task-list-item-convert-container{display:block;width:auto;height:24px;overflow:visible;clip:auto}.markdown-body ::-webkit-calendar-picker-indicator{filter:invert(50%)}.markdown-body .markdown-alert{padding:8px 16px;margin-bottom:16px;color:inherit;border-left:.25em solid #d0d7de}.markdown-body .markdown-alert>:first-child{margin-top:0}.markdown-body .markdown-alert>:last-child{margin-bottom:0}.markdown-body .markdown-alert .markdown-alert-title{display:flex;font-weight:500;align-items:center;line-height:1}.markdown-body .markdown-alert.markdown-alert-note{border-left-color:#0969da}.markdown-body .markdown-alert.markdown-alert-note .markdown-alert-title{color:#0969da}.markdown-body .markdown-alert.markdown-alert-important{border-left-color:#8250df}.markdown-body .markdown-alert.markdown-alert-important .markdown-alert-title{color:#8250df}.markdown-body .markdown-alert.markdown-alert-warning{border-left-color:#9a6700}.markdown-body .markdown-alert.markdown-alert-warning .markdown-alert-title{color:#9a6700}.markdown-body .markdown-alert.markdown-alert-tip{border-left-color:#1f883d}.markdown-body .markdown-alert.markdown-alert-tip .markdown-alert-title{color:#1a7f37}.markdown-body .markdown-alert.markdown-alert-caution{border-left-color:#cf222e}.markdown-body .markdown-alert.markdown-alert-caution .markdown-alert-title{color:#d1242f}
@@ -0,0 +1,140 @@
1
+ var n=(r,o)=>()=>(o||r((o={exports:{}}).exports,o),o.exports);var e=n((m,t)=>{t.exports={}});var a=n((s,d)=>{d.exports={html:`<h1>SmartDesign - Elements</h1>
2
+ <p>A shared library of Web Components used by both the SmartDesign Web Client and SmartDesign Integrated Web Applications.</p>
3
+ <h1>Prerequisites</h1>
4
+ <p>The project setup and build configuration requires the followings to be installed.</p>
5
+ <ul>
6
+ <li>node 16.x <a href="https://nodejs.org/en/download/">download</a></li>
7
+ <li>pnpm 7.x <a href="https://pnpm.io/installation/">download</a></li>
8
+ </ul>
9
+ <h1>Install project dependencies</h1>
10
+ <ul>
11
+ <li>configure nexus credentials for nexus.cas.de</li>
12
+ <li>step into project root</li>
13
+ <li>execute pnpm <code>$&gt; pnpm i</code><ul>
14
+ <li>this installs dependencies across the workspace</li>
15
+ </ul>
16
+ </li>
17
+ </ul>
18
+ <h1>Linters / formatters</h1>
19
+ <p>The project has certain linting / formatting rules defined via stylelint and eslint and prettier.</p>
20
+ <p>The linters can be executed via <code>pnpm lint:check</code>, the formatter can be executed via <code>pnpm format:check</code>.
21
+ Both of these have a <code>fix</code> variant as well (<code>pnpm lint:fix</code> and <code>pnpm format:fix</code>), which also tries to automatically fix the linting/formatting errors.</p>
22
+ <p>It is advised to configure the necessary extensions for the IDE for automatic linting and formatting.</p>
23
+ <p>Note that the CI build is configured to fail if there are linting or formatting errors.</p>
24
+ <p>For a faster feedback, the linting / formatting can be executed automatically in a pre-commit hook.
25
+ This can be installed via <code>pnpm prepare-hooks</code>.</p>
26
+ <h2>Building individual packages</h2>
27
+ <p><strong>There is no project wide build configuration at the moment</strong></p>
28
+ <ul>
29
+ <li>open terminal in the desired package</li>
30
+ <li>execute the build script via <code>$&gt; pnpm build</code></li>
31
+ <li>during development time one can (and should) use <code>$&gt; pnpm dev</code> which starts a webpack-dev-server instance<ul>
32
+ <li>the es5 can be set as a target environment with --env es5 like <code>$&gt; pnpm dev --env es5=true</code> which makes it possible to test the elements for example also in IE 11</li>
33
+ </ul>
34
+ </li>
35
+ </ul>
36
+ <h2>Cross project dependencies</h2>
37
+ <ul>
38
+ <li>one may configure a dependency from within the workspace without any additional configuration<ul>
39
+ <li>e.g. sd-z-layout -&gt; sd-custom-element-loader</li>
40
+ </ul>
41
+ </li>
42
+ </ul>
43
+ <h2>Publishing</h2>
44
+ <p><strong>Publishing is handled automatically by the build pipeline, do not manually publish unless absolutely necessary</strong></p>
45
+ <p>The .npmrc contains an auth token for the @cas-smartdesign scope, thus <code>pnpm publish</code> works by default.</p>
46
+ <p>Note that pnpm checks if the current branch is your publish branch (<code>main</code>), clean, and up-to-date.</p>
47
+ <p>If you don&#39;t have the <code>main</code> branch tracked, do it via <code>$&gt; git checkout -t origin/main</code>, otherwise
48
+ use <code>$&gt; git checkout main &amp;&amp; git pull</code> to check out and update your local branch.</p>
49
+ <h2>Releasing versions</h2>
50
+ <p>Release versions should be prepared using the <code>npm version major|minor|patch --no-git-tag-version</code> command.
51
+ If a change affects all packages one might run <code>pnpm --recursive exec npm --no-git-tag-version version patch</code> to prepare a new version for all packages.</p>
52
+ <p>Releases are done by CI when the build pipeline succeeds on the main branch for all packages in the monorepo.</p>
53
+ <h2>Testing</h2>
54
+ <ul>
55
+ <li><p>Cypress</p>
56
+ <ul>
57
+ <li>For UI testing we recommend Cypress, for an example on how to setup for a package, see the radio-button package.</li>
58
+ <li>Note that if you want to use TypeScript and add a custom command, currently you have to add your command into the global cypress config (located inside the cypress folder in the root directory) and type it manually in the types.ts file.</li>
59
+ </ul>
60
+ </li>
61
+ <li><p>Jest</p>
62
+ <ul>
63
+ <li>For unit testing we recommend Jest, visit the web-api package to see an example how to use it.</li>
64
+ </ul>
65
+ </li>
66
+ </ul>
67
+ `,raw:`# SmartDesign - Elements\r
68
+ \r
69
+ A shared library of Web Components used by both the SmartDesign Web Client and SmartDesign Integrated Web Applications.\r
70
+ \r
71
+ # Prerequisites\r
72
+ \r
73
+ The project setup and build configuration requires the followings to be installed.\r
74
+ \r
75
+ - node 16.x [download](https://nodejs.org/en/download/)\r
76
+ - pnpm 7.x [download](https://pnpm.io/installation/)\r
77
+ \r
78
+ # Install project dependencies\r
79
+ \r
80
+ - configure nexus credentials for nexus.cas.de\r
81
+ - step into project root\r
82
+ - execute pnpm \`$> pnpm i\`\r
83
+ - this installs dependencies across the workspace\r
84
+ \r
85
+ # Linters / formatters\r
86
+ \r
87
+ The project has certain linting / formatting rules defined via stylelint and eslint and prettier.\r
88
+ \r
89
+ The linters can be executed via \`pnpm lint:check\`, the formatter can be executed via \`pnpm format:check\`.\r
90
+ Both of these have a \`fix\` variant as well (\`pnpm lint:fix\` and \`pnpm format:fix\`), which also tries to automatically fix the linting/formatting errors.\r
91
+ \r
92
+ It is advised to configure the necessary extensions for the IDE for automatic linting and formatting.\r
93
+ \r
94
+ Note that the CI build is configured to fail if there are linting or formatting errors.\r
95
+ \r
96
+ For a faster feedback, the linting / formatting can be executed automatically in a pre-commit hook.\r
97
+ This can be installed via \`pnpm prepare-hooks\`.\r
98
+ \r
99
+ ## Building individual packages\r
100
+ \r
101
+ **There is no project wide build configuration at the moment**\r
102
+ \r
103
+ - open terminal in the desired package\r
104
+ - execute the build script via \`$> pnpm build\`\r
105
+ - during development time one can (and should) use \`$> pnpm dev\` which starts a webpack-dev-server instance\r
106
+ - the es5 can be set as a target environment with --env es5 like \`$> pnpm dev --env es5=true\` which makes it possible to test the elements for example also in IE 11\r
107
+ \r
108
+ ## Cross project dependencies\r
109
+ \r
110
+ - one may configure a dependency from within the workspace without any additional configuration\r
111
+ - e.g. sd-z-layout -> sd-custom-element-loader\r
112
+ \r
113
+ ## Publishing\r
114
+ \r
115
+ **Publishing is handled automatically by the build pipeline, do not manually publish unless absolutely necessary**\r
116
+ \r
117
+ The .npmrc contains an auth token for the @cas-smartdesign scope, thus \`pnpm publish\` works by default.\r
118
+ \r
119
+ Note that pnpm checks if the current branch is your publish branch (\`main\`), clean, and up-to-date.\r
120
+ \r
121
+ If you don't have the \`main\` branch tracked, do it via \`$> git checkout -t origin/main\`, otherwise\r
122
+ use \`$> git checkout main && git pull\` to check out and update your local branch.\r
123
+ \r
124
+ ## Releasing versions\r
125
+ \r
126
+ Release versions should be prepared using the \`npm version major|minor|patch --no-git-tag-version\` command.\r
127
+ If a change affects all packages one might run \`pnpm --recursive exec npm --no-git-tag-version version patch\` to prepare a new version for all packages.\r
128
+ \r
129
+ Releases are done by CI when the build pipeline succeeds on the main branch for all packages in the monorepo.\r
130
+ \r
131
+ ## Testing\r
132
+ \r
133
+ - Cypress\r
134
+ \r
135
+ - For UI testing we recommend Cypress, for an example on how to setup for a package, see the radio-button package.\r
136
+ - Note that if you want to use TypeScript and add a custom command, currently you have to add your command into the global cypress config (located inside the cypress folder in the root directory) and type it manually in the types.ts file.\r
137
+ \r
138
+ - Jest\r
139
+ - For unit testing we recommend Jest, visit the web-api package to see an example how to use it.\r
140
+ `,filename:"readme.md"}});e();var i=a().html;document.querySelector("#markdown-container").innerHTML=i;
@@ -0,0 +1,26 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <title>Messages generator</title>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ <style>
9
+ .markdown-body {
10
+ box-sizing: border-box;
11
+ min-width: 200px;
12
+ max-width: 980px;
13
+ margin: 0 auto !important;
14
+ padding-bottom: 45px;
15
+ }
16
+ </style>
17
+ <link href="doc.css" rel="stylesheet" />
18
+ </head>
19
+
20
+ <body>
21
+ <div class="markdown-body">
22
+ <div id="markdown-container"></div>
23
+ </div>
24
+ <script type="module" src="./doc.js"></script>
25
+ </body>
26
+ </html>
@@ -0,0 +1,42 @@
1
+ {
2
+ "@vitest/coverage-v8@1.1.1": {
3
+ "licenses": "MIT",
4
+ "repository": "https://github.com/vitest-dev/vitest",
5
+ "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
6
+ },
7
+ "@vitest/ui@1.1.1": {
8
+ "licenses": "MIT",
9
+ "repository": "https://github.com/vitest-dev/vitest",
10
+ "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
11
+ },
12
+ "properties-to-json@0.2.1": {
13
+ "licenses": "MPL-2.0",
14
+ "repository": "https://github.com/ryanpcmcquen/propertiesToJSON",
15
+ "licenseUrl": "https://github.com/ryanpcmcquen/propertiesToJSON/raw/HEAD/LICENSE"
16
+ },
17
+ "resolve-pkg@2.0.0": {
18
+ "licenses": "MIT",
19
+ "repository": "https://github.com/sindresorhus/resolve-pkg",
20
+ "licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
21
+ },
22
+ "tsup@8.0.1": {
23
+ "licenses": "MIT",
24
+ "repository": "https://github.com/egoist/tsup",
25
+ "licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
26
+ },
27
+ "typescript@5.3.3": {
28
+ "licenses": "Apache-2.0",
29
+ "repository": "https://github.com/Microsoft/TypeScript",
30
+ "licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
31
+ },
32
+ "vitest@1.1.1": {
33
+ "licenses": "MIT",
34
+ "repository": "https://github.com/vitest-dev/vitest",
35
+ "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
36
+ },
37
+ "yargs@17.7.2": {
38
+ "licenses": "MIT",
39
+ "repository": "https://github.com/yargs/yargs",
40
+ "licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
41
+ }
42
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@cas-smartdesign/messages-generator",
3
+ "version": "1.6.1",
4
+ "description": "A CLI tool to convert usual SmartDesign translations into JSON based Messages",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "bin": {
7
+ "sd-messages-generator": "./bin/messages-generator.mjs"
8
+ },
9
+ "type": "module",
10
+ "dependencies": {
11
+ "properties-to-json": "0.2.1",
12
+ "yargs": "^17.7.2"
13
+ },
14
+ "files": [
15
+ "bin",
16
+ "dist",
17
+ "src",
18
+ "npm-third-party-licenses.json"
19
+ ],
20
+ "publishConfig": {
21
+ "registry": "https://registry.npmjs.org/",
22
+ "access": "public"
23
+ },
24
+ "devDependencies": {
25
+ "tsup": "^8.0.1",
26
+ "@cas-smartdesign/license-generator": "^1.6.1"
27
+ },
28
+ "scripts": {
29
+ "version": "pnpm version",
30
+ "build:no-license": "tsc --noEmit && tsup",
31
+ "build": "pnpm generate-license && pnpm build:no-license",
32
+ "generate-license": "sd-license-generator --es --r ../"
33
+ }
34
+ }
package/readme.md ADDED
@@ -0,0 +1,16 @@
1
+ # @cas-smartdesign/messages-generator
2
+
3
+ A CLI tool to convert usual SmartDesign translations into JSON based Messages.
4
+
5
+ The expected naming of the input translation files is `[name]_[ISO 639-1].properties` (for example <i>translations_de.properties</i>).
6
+
7
+ ## The following files are generated:
8
+
9
+ - `messages.ts`
10
+ - Contains a util which if initialized with a language the corresponding texts are provided from the dictionary.
11
+ - `dictionary.ts`
12
+ - Contains the generated JSON object from all the translations and the types based on the found translation files.
13
+
14
+ ## Options:
15
+
16
+ Start with `-h` or `--help` to list the possible options.
package/src/main.mjs ADDED
@@ -0,0 +1,55 @@
1
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import propertiesToJSON from "properties-to-json";
5
+ import { fileURLToPath } from "url";
6
+ import generateTypes from "./typegenerator.mjs";
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+
11
+ const langRegex = /^.*(_[a-z]{2})\.properties$/;
12
+
13
+ function generateDictionary(dictionary, targetDir) {
14
+ generateTypes(dictionary)
15
+ .then((types) => {
16
+ console.info("Types generated from messages:\n" + types);
17
+ const dictionaryContent = `/* eslint-disable */
18
+ ${types}
19
+ const messages = ${JSON.stringify(dictionary, null, "\t")};
20
+ export default messages;`;
21
+ fs.writeFileSync(path.resolve(targetDir, "dictionary.ts"), dictionaryContent);
22
+ })
23
+ .catch((err) => {
24
+ console.error("Could not generate types due to: " + err);
25
+ });
26
+ }
27
+
28
+ function generateMessages(targetDir) {
29
+ const messagesTemplate = path.resolve(__dirname, "template", "messages.ts");
30
+ fs.copyFileSync(messagesTemplate, path.resolve(targetDir, "messages.ts"));
31
+ }
32
+
33
+ export default function generate(sourceDir, targetDir) {
34
+ console.info("Search translation files in: " + sourceDir);
35
+ const dictionary = {};
36
+
37
+ fs.readdirSync(sourceDir, { withFileTypes: true }).forEach((file) => {
38
+ if (file.isFile() && langRegex.test(file.name)) {
39
+ console.info("Processing translation: " + file.name);
40
+
41
+ const language = file.name.match(langRegex)[1].substring(1);
42
+ console.info("Retrieved language from name: " + language);
43
+
44
+ const filePath = path.resolve(sourceDir, file.name);
45
+ const texts = propertiesToJSON(fs.readFileSync(filePath, "utf8"));
46
+ dictionary[language] = texts;
47
+ }
48
+ });
49
+
50
+ if (!fs.existsSync(targetDir)) {
51
+ fs.mkdirSync(targetDir);
52
+ }
53
+ generateDictionary(dictionary, targetDir);
54
+ generateMessages(targetDir);
55
+ }
@@ -0,0 +1,6 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
2
+ export interface Messages {
3
+ // generated automatically
4
+ }
5
+ const messages = {}; // generated automatically
6
+ export default messages;
@@ -0,0 +1,49 @@
1
+ import messages from "./dictionary";
2
+ import { Messages as MessageType } from "./dictionary";
3
+
4
+ export type KnownLanguage = keyof typeof messages;
5
+
6
+ export default class Messages {
7
+ private static memoizedTranslations: MessageType;
8
+ private static sessionLanguage: KnownLanguage;
9
+ private static defaultLanguage: KnownLanguage;
10
+
11
+ public static init(sessionLanguage: KnownLanguage, defaultLanguage?: KnownLanguage): void {
12
+ this.sessionLanguage = sessionLanguage;
13
+ this.defaultLanguage = defaultLanguage || sessionLanguage;
14
+ }
15
+
16
+ public static get(): MessageType {
17
+ if (Messages.memoizedTranslations) {
18
+ return Messages.memoizedTranslations;
19
+ }
20
+ if (!this.sessionLanguage) {
21
+ throw Error("Messages must be initialized with a language");
22
+ }
23
+ Messages.initializeMessages();
24
+ return Messages.memoizedTranslations;
25
+ }
26
+
27
+ public static format(format: string, ...parameters: string[]): string {
28
+ return format.replace(/{(\d+)}/g, function (match, num) {
29
+ return typeof parameters[num] !== "undefined" ? parameters[num] : match;
30
+ });
31
+ }
32
+
33
+ private static initializeMessages(): void {
34
+ let translations = messages[this.sessionLanguage];
35
+ if (this.sessionLanguage != this.defaultLanguage) {
36
+ const fallback = messages[this.defaultLanguage];
37
+ translations = new Proxy(translations || ({} as MessageType), {
38
+ get(target: typeof translations, name: keyof typeof translations) {
39
+ if (name in target) {
40
+ return target[name];
41
+ }
42
+ console.debug(`Message is not available in session language, fallback is used for ${String(name)}`);
43
+ return fallback[name] || name;
44
+ },
45
+ });
46
+ }
47
+ Messages.memoizedTranslations = translations as MessageType;
48
+ }
49
+ }
@@ -0,0 +1,10 @@
1
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
2
+ export default async function generateTypes(dictionary) {
3
+ const languages = Object.keys(dictionary);
4
+ if (languages.length > 0) {
5
+ const languageToUseForIndexType = languages.includes("de") ? "de" : languages.includes("en") ? "en" : languages[0];
6
+ return `export type Messages = typeof messages["${languageToUseForIndexType}"];`;
7
+ } else {
8
+ return "export type Messages = {};";
9
+ }
10
+ }