@wexample/js-pseudocode 0.1.8 → 0.1.10
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/README.md +1 -1
- package/package.json +17 -1
- package/.github/workflows/publish.yml +0 -24
- package/.iml +0 -7
- package/.wex/config.yml +0 -3
- package/.wex/python/app_manager/.python-version +0 -1
- package/.wex/python/app_manager/__main__.py +0 -34
- package/.wex/python/app_manager/app_workdir.py +0 -44
- package/.wex/python/app_manager/pyproject.toml +0 -11
- package/.wex/python/app_manager/requirements.txt +0 -223
- package/tests/class_basic_calculator.test.js +0 -48
- package/tests/class_basic_calculator.test.ts +0 -26
- package/tests/constant_using_const.test.js +0 -33
- package/tests/constant_using_const.test.ts +0 -26
- package/tests/function_basic.test.js +0 -39
- package/tests/function_basic.test.ts +0 -26
- package/tests/function_complex.test.js +0 -40
- package/tests/function_complex.test.ts +0 -26
- package/tests/resources/item/class/basic_calculator.js.txt +0 -19
- package/tests/resources/item/class/basic_calculator.yml +0 -23
- package/tests/resources/item/constant/constant_using_const.js.txt +0 -4
- package/tests/resources/item/constant/constant_using_const.yml +0 -16
- package/tests/resources/item/constant/constant_using_define.ts +0 -0
- package/tests/resources/item/constant/constant_using_define.yml +0 -16
- package/tests/resources/item/function/basic_function.js.txt +0 -10
- package/tests/resources/item/function/basic_function.yml +0 -14
- package/tests/resources/item/function/complex_function.js.txt +0 -11
- package/tests/resources/item/function/complex_function.yml +0 -19
- package/tests/utils/testHelpers.ts +0 -9
- package/tsconfig.json +0 -13
- package/version.txt +0 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wexample/js-pseudocode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"src"
|
|
7
|
+
],
|
|
5
8
|
"scripts": {
|
|
6
9
|
"test": "node --loader ts-node/esm tests/constant_using_const.test.ts && node --loader ts-node/esm tests/function_basic.test.ts && node --loader ts-node/esm tests/function_complex.test.ts && node --loader ts-node/esm tests/class_basic_calculator.test.ts"
|
|
7
10
|
},
|
|
@@ -14,6 +17,19 @@
|
|
|
14
17
|
"dependencies": {
|
|
15
18
|
"js-yaml": "4.1.0"
|
|
16
19
|
},
|
|
20
|
+
"exports": {
|
|
21
|
+
"./*": {
|
|
22
|
+
"types": "./src/*",
|
|
23
|
+
"default": "./src/*"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"typesVersions": {
|
|
27
|
+
"*": {
|
|
28
|
+
"*": [
|
|
29
|
+
"src/*"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
17
33
|
"publishConfig": {
|
|
18
34
|
"access": "public"
|
|
19
35
|
},
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
name: Publish to npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "v*"
|
|
7
|
-
workflow_dispatch: {}
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
id-token: write
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
publish:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
|
|
19
|
-
- uses: actions/setup-node@v4
|
|
20
|
-
with:
|
|
21
|
-
node-version: "24"
|
|
22
|
-
registry-url: "https://registry.npmjs.org"
|
|
23
|
-
|
|
24
|
-
- run: npm publish --access public
|
package/.iml
DELETED
package/.wex/config.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.12
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Main entry point for the application."""
|
|
3
|
-
from wexample_wex_core.common.app_manager_kernel import AppManagerKernel
|
|
4
|
-
|
|
5
|
-
if __name__ == "__main__":
|
|
6
|
-
try:
|
|
7
|
-
from wexample_wex_addon_dev_python.python_addon_manager import (
|
|
8
|
-
PythonAddonManager,
|
|
9
|
-
)
|
|
10
|
-
from wexample_wex_core.addons.default.default_addon_manager import (
|
|
11
|
-
DefaultAddonManager,
|
|
12
|
-
)
|
|
13
|
-
from wexample_wex_core.addons.git.git_addon_manager import (
|
|
14
|
-
GitAddonManager,
|
|
15
|
-
)
|
|
16
|
-
from wexample_wex_core.common.kernel import Kernel
|
|
17
|
-
from wexample_wex_addon_filestate.filestate_addon_manager import FilestateAddonManager
|
|
18
|
-
from wexample_wex_addon_app.app_addon_manager import AppAddonManager
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
-
AppManagerKernel(
|
|
22
|
-
entrypoint_path=__file__,
|
|
23
|
-
)
|
|
24
|
-
.setup(addons=[
|
|
25
|
-
AppAddonManager,
|
|
26
|
-
DefaultAddonManager,
|
|
27
|
-
GitAddonManager,
|
|
28
|
-
])
|
|
29
|
-
.exec_argv()
|
|
30
|
-
)
|
|
31
|
-
except Exception as e:
|
|
32
|
-
from wexample_app.helpers.debug import debug_handle_app_error
|
|
33
|
-
|
|
34
|
-
debug_handle_app_error(e)
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from wexample_config.const.types import DictConfig
|
|
4
|
-
from wexample_wex_addon_dev_javascript.workdir.javascript_package_workdir import JavascriptPackageWorkdir
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class AppWorkdir(JavascriptPackageWorkdir):
|
|
8
|
-
def get_public_remote_repository_url(self) -> str | None:
|
|
9
|
-
from wexample_helpers.helpers.string import string_to_kebab_case
|
|
10
|
-
|
|
11
|
-
name_config = self.get_runtime_config().search("global.name")
|
|
12
|
-
return f"https://github.com/wexample/{string_to_kebab_case(name_config.get_str())}"
|
|
13
|
-
|
|
14
|
-
def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
|
|
15
|
-
from wexample_helpers.helpers.string import string_to_kebab_case
|
|
16
|
-
|
|
17
|
-
raw_value = super().prepare_value(raw_value=raw_value)
|
|
18
|
-
name_config = self.get_runtime_config().search("global.name")
|
|
19
|
-
|
|
20
|
-
def _build_remote_github(target: AppWorkdir) -> str:
|
|
21
|
-
return f"git@github.com:wexample/{string_to_kebab_case(name_config.get_str())}.git"
|
|
22
|
-
|
|
23
|
-
def _build_remote_gitlab(target: AppWorkdir) -> str:
|
|
24
|
-
return f"ssh://git@gitlab.wexample.com:4567/wexample-javascript/{string_to_kebab_case(name_config.get_str())}.git"
|
|
25
|
-
|
|
26
|
-
raw_value["git"] = {
|
|
27
|
-
"main_branch": "main",
|
|
28
|
-
"remote": [
|
|
29
|
-
{
|
|
30
|
-
"name": "origin",
|
|
31
|
-
"type": "gitlab",
|
|
32
|
-
"url": _build_remote_gitlab,
|
|
33
|
-
"create_remote": True,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"name": "github",
|
|
37
|
-
"type": "github",
|
|
38
|
-
"url": _build_remote_github,
|
|
39
|
-
"create_remote": True,
|
|
40
|
-
},
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return raw_value
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# This file is autogenerated by pip-compile with Python 3.12
|
|
3
|
-
# by the following command:
|
|
4
|
-
#
|
|
5
|
-
# pip-compile --output-file=/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/requirements.txt /home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml
|
|
6
|
-
#
|
|
7
|
-
annotated-types==0.7.0
|
|
8
|
-
# via pydantic
|
|
9
|
-
astroid==4.0.2
|
|
10
|
-
# via pylint
|
|
11
|
-
attrs==25.4.0
|
|
12
|
-
# via
|
|
13
|
-
# cattrs
|
|
14
|
-
# wexample-api
|
|
15
|
-
# wexample-app
|
|
16
|
-
# wexample-config
|
|
17
|
-
# wexample-file
|
|
18
|
-
# wexample-filestate
|
|
19
|
-
# wexample-filestate-git
|
|
20
|
-
# wexample-filestate-python
|
|
21
|
-
# wexample-helpers
|
|
22
|
-
# wexample-helpers-git
|
|
23
|
-
# wexample-helpers-yaml
|
|
24
|
-
# wexample-prompt
|
|
25
|
-
# wexample-wex-addon-app
|
|
26
|
-
# wexample-wex-addon-dev-python
|
|
27
|
-
# wexample-wex-addon-filestate
|
|
28
|
-
# wexample-wex-core
|
|
29
|
-
autoflake==2.3.1
|
|
30
|
-
# via wexample-filestate-python
|
|
31
|
-
black==25.11.0
|
|
32
|
-
# via wexample-filestate-python
|
|
33
|
-
cattrs==25.3.0
|
|
34
|
-
# via
|
|
35
|
-
# wexample-api
|
|
36
|
-
# wexample-app
|
|
37
|
-
# wexample-config
|
|
38
|
-
# wexample-file
|
|
39
|
-
# wexample-filestate
|
|
40
|
-
# wexample-filestate-git
|
|
41
|
-
# wexample-filestate-python
|
|
42
|
-
# wexample-helpers
|
|
43
|
-
# wexample-helpers-git
|
|
44
|
-
# wexample-helpers-yaml
|
|
45
|
-
# wexample-prompt
|
|
46
|
-
# wexample-wex-addon-app
|
|
47
|
-
# wexample-wex-addon-dev-python
|
|
48
|
-
# wexample-wex-addon-filestate
|
|
49
|
-
# wexample-wex-core
|
|
50
|
-
certifi==2025.11.12
|
|
51
|
-
# via requests
|
|
52
|
-
charset-normalizer==3.4.4
|
|
53
|
-
# via requests
|
|
54
|
-
click==8.3.1
|
|
55
|
-
# via
|
|
56
|
-
# black
|
|
57
|
-
# wexample-wex-core
|
|
58
|
-
colorama==0.4.6
|
|
59
|
-
# via wexample-prompt
|
|
60
|
-
dill==0.4.0
|
|
61
|
-
# via pylint
|
|
62
|
-
dotenv==0.9.9
|
|
63
|
-
# via wexample-app
|
|
64
|
-
flynt==1.0.6
|
|
65
|
-
# via wexample-filestate-python
|
|
66
|
-
gitdb==4.0.12
|
|
67
|
-
# via gitpython
|
|
68
|
-
gitpython==3.1.45
|
|
69
|
-
# via wexample-helpers-git
|
|
70
|
-
idna==3.11
|
|
71
|
-
# via requests
|
|
72
|
-
inquirerpy==0.3.4
|
|
73
|
-
# via wexample-prompt
|
|
74
|
-
isort==7.0.0
|
|
75
|
-
# via
|
|
76
|
-
# pylint
|
|
77
|
-
# wexample-filestate-python
|
|
78
|
-
jinja2==3.1.6
|
|
79
|
-
# via
|
|
80
|
-
# app-manager (/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml)
|
|
81
|
-
# wexample-wex-addon-dev-python
|
|
82
|
-
libcst==1.8.6
|
|
83
|
-
# via wexample-filestate-python
|
|
84
|
-
markupsafe==3.0.3
|
|
85
|
-
# via jinja2
|
|
86
|
-
mccabe==0.7.0
|
|
87
|
-
# via pylint
|
|
88
|
-
mypy-extensions==1.1.0
|
|
89
|
-
# via black
|
|
90
|
-
networkx==3.6
|
|
91
|
-
# via wexample-wex-addon-dev-python
|
|
92
|
-
nodeenv==1.9.1
|
|
93
|
-
# via pyright
|
|
94
|
-
packaging==25.0
|
|
95
|
-
# via
|
|
96
|
-
# black
|
|
97
|
-
# wexample-filestate-python
|
|
98
|
-
pathspec==0.12.1
|
|
99
|
-
# via black
|
|
100
|
-
pfzy==0.3.4
|
|
101
|
-
# via inquirerpy
|
|
102
|
-
platformdirs==4.5.0
|
|
103
|
-
# via
|
|
104
|
-
# black
|
|
105
|
-
# pylint
|
|
106
|
-
prompt-toolkit==3.0.52
|
|
107
|
-
# via inquirerpy
|
|
108
|
-
pydantic==2.12.5
|
|
109
|
-
# via wexample-config
|
|
110
|
-
pydantic-core==2.41.5
|
|
111
|
-
# via pydantic
|
|
112
|
-
pyflakes==3.4.0
|
|
113
|
-
# via autoflake
|
|
114
|
-
pylint==4.0.3
|
|
115
|
-
# via wexample-wex-addon-dev-python
|
|
116
|
-
pyright==1.1.407
|
|
117
|
-
# via wexample-wex-addon-dev-python
|
|
118
|
-
python-dotenv==1.2.1
|
|
119
|
-
# via
|
|
120
|
-
# dotenv
|
|
121
|
-
# wexample-app
|
|
122
|
-
# wexample-filestate
|
|
123
|
-
pytokens==0.3.0
|
|
124
|
-
# via black
|
|
125
|
-
pyupgrade==3.21.2
|
|
126
|
-
# via wexample-filestate-python
|
|
127
|
-
pyyaml==6.0.3
|
|
128
|
-
# via
|
|
129
|
-
# libcst
|
|
130
|
-
# wexample-helpers-yaml
|
|
131
|
-
readchar==4.2.1
|
|
132
|
-
# via wexample-prompt
|
|
133
|
-
requests==2.32.5
|
|
134
|
-
# via
|
|
135
|
-
# wexample-api
|
|
136
|
-
# wexample-filestate-git
|
|
137
|
-
smmap==5.0.2
|
|
138
|
-
# via gitdb
|
|
139
|
-
tokenize-rt==6.2.0
|
|
140
|
-
# via pyupgrade
|
|
141
|
-
tomli==2.3.0
|
|
142
|
-
# via wexample-filestate-python
|
|
143
|
-
tomlkit==0.13.3
|
|
144
|
-
# via
|
|
145
|
-
# pylint
|
|
146
|
-
# wexample-filestate
|
|
147
|
-
typing-extensions==4.15.0
|
|
148
|
-
# via
|
|
149
|
-
# cattrs
|
|
150
|
-
# pydantic
|
|
151
|
-
# pydantic-core
|
|
152
|
-
# pyright
|
|
153
|
-
# typing-inspection
|
|
154
|
-
typing-inspection==0.4.2
|
|
155
|
-
# via pydantic
|
|
156
|
-
urllib3==2.5.0
|
|
157
|
-
# via requests
|
|
158
|
-
wcwidth==0.2.14
|
|
159
|
-
# via
|
|
160
|
-
# prompt-toolkit
|
|
161
|
-
# wexample-prompt
|
|
162
|
-
wexample-api==0.0.80
|
|
163
|
-
# via
|
|
164
|
-
# wexample-filestate-git
|
|
165
|
-
# wexample-filestate-python
|
|
166
|
-
wexample-app==0.0.68
|
|
167
|
-
# via wexample-wex-core
|
|
168
|
-
wexample-config==0.0.94
|
|
169
|
-
# via wexample-filestate
|
|
170
|
-
wexample-event==0.0.76
|
|
171
|
-
# via wexample-filestate
|
|
172
|
-
wexample-file==0.0.49
|
|
173
|
-
# via
|
|
174
|
-
# app-manager (/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml)
|
|
175
|
-
# wexample-filestate
|
|
176
|
-
wexample-filestate==0.0.71
|
|
177
|
-
# via
|
|
178
|
-
# app-manager (/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml)
|
|
179
|
-
# wexample-app
|
|
180
|
-
# wexample-filestate-git
|
|
181
|
-
# wexample-filestate-python
|
|
182
|
-
# wexample-wex-core
|
|
183
|
-
wexample-filestate-git==0.0.57
|
|
184
|
-
# via wexample-wex-core
|
|
185
|
-
wexample-filestate-python==0.0.56
|
|
186
|
-
# via wexample-wex-addon-dev-python
|
|
187
|
-
wexample-helpers==0.0.85
|
|
188
|
-
# via
|
|
189
|
-
# wexample-api
|
|
190
|
-
# wexample-config
|
|
191
|
-
# wexample-event
|
|
192
|
-
# wexample-file
|
|
193
|
-
# wexample-helpers-git
|
|
194
|
-
# wexample-helpers-yaml
|
|
195
|
-
# wexample-prompt
|
|
196
|
-
wexample-helpers-git==0.0.93
|
|
197
|
-
# via
|
|
198
|
-
# wexample-filestate-git
|
|
199
|
-
# wexample-wex-core
|
|
200
|
-
wexample-helpers-yaml==0.0.110
|
|
201
|
-
# via
|
|
202
|
-
# wexample-app
|
|
203
|
-
# wexample-filestate
|
|
204
|
-
wexample-prompt==0.0.94
|
|
205
|
-
# via
|
|
206
|
-
# wexample-api
|
|
207
|
-
# wexample-filestate
|
|
208
|
-
wexample-wex-addon-app==0.0.53
|
|
209
|
-
# via
|
|
210
|
-
# app-manager (/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml)
|
|
211
|
-
# wexample-wex-addon-dev-python
|
|
212
|
-
wexample-wex-addon-dev-python==0.0.61
|
|
213
|
-
# via app-manager (/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml)
|
|
214
|
-
wexample-wex-addon-filestate==0.0.15
|
|
215
|
-
# via app-manager (/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml)
|
|
216
|
-
wexample-wex-core==6.0.65
|
|
217
|
-
# via
|
|
218
|
-
# app-manager (/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PACKAGES/JAVASCRIPT/packages/js-pseudocode/.wex/python/app_manager/pyproject.toml)
|
|
219
|
-
# wexample-wex-addon-app
|
|
220
|
-
# wexample-wex-addon-dev-python
|
|
221
|
-
# wexample-wex-addon-filestate
|
|
222
|
-
xmltodict==1.0.2
|
|
223
|
-
# via wexample-filestate
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.js';
|
|
4
|
-
|
|
5
|
-
const pyFixtureDir =
|
|
6
|
-
'/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PIP/pip/pseudocode/tests/resources/item/class';
|
|
7
|
-
|
|
8
|
-
function normalizeEol(s) {
|
|
9
|
-
return s.replace(/\r\n/g, '\n');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const expectedJs = normalizeEol(`/**
|
|
13
|
-
* A class that performs basic arithmetic operations.
|
|
14
|
-
*/
|
|
15
|
-
class Calculator {
|
|
16
|
-
constructor() {
|
|
17
|
-
// Stores the result of the last operation performed.
|
|
18
|
-
this.lastResult = 0;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Calculate the sum of two ints.
|
|
22
|
-
*
|
|
23
|
-
* @param a - The first operand.
|
|
24
|
-
* @param b - The second operand.
|
|
25
|
-
* @returns: The sum of the two numbers.
|
|
26
|
-
*/
|
|
27
|
-
add(a, b) {
|
|
28
|
-
// TODO: Implement method body
|
|
29
|
-
}
|
|
30
|
-
}`);
|
|
31
|
-
|
|
32
|
-
function assertEqual(a, b, msg) {
|
|
33
|
-
if (a !== b) {
|
|
34
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
35
|
-
console.error('Expected:\n' + b);
|
|
36
|
-
console.error('Actual:\n' + a);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const yml = readFileSync(join(pyFixtureDir, 'basic_calculator.yml'), 'utf-8');
|
|
42
|
-
const code = new CodeGenerator().generate(yml);
|
|
43
|
-
assertEqual(
|
|
44
|
-
normalizeEol(code.trim()),
|
|
45
|
-
expectedJs,
|
|
46
|
-
'YAML -> JS class generation matches expected JS'
|
|
47
|
-
);
|
|
48
|
-
console.log('OK');
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.ts';
|
|
4
|
-
import { normalizeEol, readExpected } from './utils/testHelpers.ts';
|
|
5
|
-
|
|
6
|
-
const resDir = join(process.cwd(), 'tests', 'resources', 'item', 'class');
|
|
7
|
-
|
|
8
|
-
const expectedJs = readExpected(join(resDir, 'basic_calculator.js.txt'));
|
|
9
|
-
|
|
10
|
-
function assertEqual(a: string, b: string, msg?: string) {
|
|
11
|
-
if (a !== b) {
|
|
12
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
13
|
-
console.error('Expected:\n' + b);
|
|
14
|
-
console.error('Actual:\n' + a);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const yml = readFileSync(join(resDir, 'basic_calculator.yml'), 'utf-8');
|
|
20
|
-
const code = new CodeGenerator().generate(yml);
|
|
21
|
-
assertEqual(
|
|
22
|
-
normalizeEol(code.trim()),
|
|
23
|
-
expectedJs,
|
|
24
|
-
'YAML -> JS class generation matches expected JS'
|
|
25
|
-
);
|
|
26
|
-
console.log('OK');
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.js';
|
|
4
|
-
|
|
5
|
-
const phpFixtureDir =
|
|
6
|
-
'/home/weeger/Desktop/WIP/WEB/WEXAMPLE/COMPOSER/packages/wexample/php-pseudocode/tests/resources/item/constant';
|
|
7
|
-
|
|
8
|
-
function normalizeEol(s) {
|
|
9
|
-
return s.replace(/\r\n/g, '\n');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const expectedJs = normalizeEol(`// Maximum number of retries for API calls
|
|
13
|
-
const MAX_RETRIES = 3;
|
|
14
|
-
// Base URL for the API
|
|
15
|
-
const API_BASE_URL = "https://api.example.com";`);
|
|
16
|
-
|
|
17
|
-
function assertEqual(a, b, msg) {
|
|
18
|
-
if (a !== b) {
|
|
19
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
20
|
-
console.error('Expected:\n' + b);
|
|
21
|
-
console.error('Actual:\n' + a);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const yml = readFileSync(join(phpFixtureDir, 'constant_using_const.yml'), 'utf-8');
|
|
27
|
-
const code = new CodeGenerator().generate(yml);
|
|
28
|
-
assertEqual(
|
|
29
|
-
normalizeEol(code.trim()),
|
|
30
|
-
expectedJs,
|
|
31
|
-
'YAML -> JS constants generation matches expected JS'
|
|
32
|
-
);
|
|
33
|
-
console.log('OK');
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.ts';
|
|
4
|
-
import { normalizeEol, readExpected } from './utils/testHelpers.ts';
|
|
5
|
-
|
|
6
|
-
const resDir = join(process.cwd(), 'tests', 'resources', 'item', 'constant');
|
|
7
|
-
|
|
8
|
-
const expectedJs = readExpected(join(resDir, 'constant_using_const.js.txt'));
|
|
9
|
-
|
|
10
|
-
function assertEqual(a: string, b: string, msg?: string) {
|
|
11
|
-
if (a !== b) {
|
|
12
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
13
|
-
console.error('Expected:\n' + b);
|
|
14
|
-
console.error('Actual:\n' + a);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const yml = readFileSync(join(resDir, 'constant_using_const.yml'), 'utf-8');
|
|
20
|
-
const code = new CodeGenerator().generate(yml);
|
|
21
|
-
assertEqual(
|
|
22
|
-
normalizeEol(code.trim()),
|
|
23
|
-
expectedJs,
|
|
24
|
-
'YAML -> JS constants generation matches expected JS'
|
|
25
|
-
);
|
|
26
|
-
console.log('OK');
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.js';
|
|
4
|
-
|
|
5
|
-
const pyFixtureDir =
|
|
6
|
-
'/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PIP/pip/pseudocode/tests/resources/item/function';
|
|
7
|
-
|
|
8
|
-
function normalizeEol(s) {
|
|
9
|
-
return s.replace(/\r\n/g, '\n');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const expectedJs = normalizeEol(`/**
|
|
13
|
-
* Calculate the sum of two ints.
|
|
14
|
-
*
|
|
15
|
-
* @param a - The first operand.
|
|
16
|
-
* @param b - The second operand.
|
|
17
|
-
* @returns: The sum of the two numbers.
|
|
18
|
-
*/
|
|
19
|
-
function add(a, b) {
|
|
20
|
-
// TODO: Implement function body
|
|
21
|
-
}`);
|
|
22
|
-
|
|
23
|
-
function assertEqual(a, b, msg) {
|
|
24
|
-
if (a !== b) {
|
|
25
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
26
|
-
console.error('Expected:\n' + b);
|
|
27
|
-
console.error('Actual:\n' + a);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const yml = readFileSync(join(pyFixtureDir, 'basic_function.yml'), 'utf-8');
|
|
33
|
-
const code = new CodeGenerator().generate(yml);
|
|
34
|
-
assertEqual(
|
|
35
|
-
normalizeEol(code.trim()),
|
|
36
|
-
expectedJs,
|
|
37
|
-
'YAML -> JS function generation matches expected JS'
|
|
38
|
-
);
|
|
39
|
-
console.log('OK');
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.ts';
|
|
4
|
-
import { normalizeEol, readExpected } from './utils/testHelpers.ts';
|
|
5
|
-
|
|
6
|
-
const resDir = join(process.cwd(), 'tests', 'resources', 'item', 'function');
|
|
7
|
-
|
|
8
|
-
const expectedJs = readExpected(join(resDir, 'basic_function.js.txt'));
|
|
9
|
-
|
|
10
|
-
function assertEqual(a: string, b: string, msg?: string) {
|
|
11
|
-
if (a !== b) {
|
|
12
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
13
|
-
console.error('Expected:\n' + b);
|
|
14
|
-
console.error('Actual:\n' + a);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const yml = readFileSync(join(resDir, 'basic_function.yml'), 'utf-8');
|
|
20
|
-
const code = new CodeGenerator().generate(yml);
|
|
21
|
-
assertEqual(
|
|
22
|
-
normalizeEol(code.trim()),
|
|
23
|
-
expectedJs,
|
|
24
|
-
'YAML -> JS function generation matches expected JS'
|
|
25
|
-
);
|
|
26
|
-
console.log('OK');
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.js';
|
|
4
|
-
|
|
5
|
-
const pyFixtureDir =
|
|
6
|
-
'/home/weeger/Desktop/WIP/WEB/WEXAMPLE/PIP/pip/pseudocode/tests/resources/item/function';
|
|
7
|
-
|
|
8
|
-
function normalizeEol(s) {
|
|
9
|
-
return s.replace(/\r\n/g, '\n');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const expectedJs = normalizeEol(`/**
|
|
13
|
-
* Process an array of data with optional configuration.
|
|
14
|
-
*
|
|
15
|
-
* @param data - The data to process
|
|
16
|
-
* @param config - Optional configuration parameters
|
|
17
|
-
* @param callback - Optional callback for custom processing
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
function processData(data, config, callback) {
|
|
21
|
-
// TODO: Implement function body
|
|
22
|
-
}`);
|
|
23
|
-
|
|
24
|
-
function assertEqual(a, b, msg) {
|
|
25
|
-
if (a !== b) {
|
|
26
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
27
|
-
console.error('Expected:\n' + b);
|
|
28
|
-
console.error('Actual:\n' + a);
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const yml = readFileSync(join(pyFixtureDir, 'complex_function.yml'), 'utf-8');
|
|
34
|
-
const code = new CodeGenerator().generate(yml);
|
|
35
|
-
assertEqual(
|
|
36
|
-
normalizeEol(code.trim()),
|
|
37
|
-
expectedJs,
|
|
38
|
-
'YAML -> JS complex function generation matches expected JS'
|
|
39
|
-
);
|
|
40
|
-
console.log('OK');
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { CodeGenerator } from '../src/index.ts';
|
|
4
|
-
import { normalizeEol, readExpected } from './utils/testHelpers.ts';
|
|
5
|
-
|
|
6
|
-
const resDir = join(process.cwd(), 'tests', 'resources', 'item', 'function');
|
|
7
|
-
|
|
8
|
-
const expectedJs = readExpected(join(resDir, 'complex_function.js.txt'));
|
|
9
|
-
|
|
10
|
-
function assertEqual(a: string, b: string, msg?: string) {
|
|
11
|
-
if (a !== b) {
|
|
12
|
-
console.error('Assertion failed:', msg || 'values differ');
|
|
13
|
-
console.error('Expected:\n' + b);
|
|
14
|
-
console.error('Actual:\n' + a);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const yml = readFileSync(join(resDir, 'complex_function.yml'), 'utf-8');
|
|
20
|
-
const code = new CodeGenerator().generate(yml);
|
|
21
|
-
assertEqual(
|
|
22
|
-
normalizeEol(code.trim()),
|
|
23
|
-
expectedJs,
|
|
24
|
-
'YAML -> JS complex function generation matches expected JS'
|
|
25
|
-
);
|
|
26
|
-
console.log('OK');
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A class that performs basic arithmetic operations.
|
|
3
|
-
*/
|
|
4
|
-
class Calculator {
|
|
5
|
-
constructor() {
|
|
6
|
-
// Stores the result of the last operation performed.
|
|
7
|
-
this.lastResult = 0;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Calculate the sum of two ints.
|
|
11
|
-
*
|
|
12
|
-
* @param a - The first operand.
|
|
13
|
-
* @param b - The second operand.
|
|
14
|
-
* @returns: The sum of the two numbers.
|
|
15
|
-
*/
|
|
16
|
-
add(a, b) {
|
|
17
|
-
// TODO: Implement method body
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
items:
|
|
2
|
-
- name: Calculator
|
|
3
|
-
type: class
|
|
4
|
-
description: "A class that performs basic arithmetic operations."
|
|
5
|
-
properties:
|
|
6
|
-
- name: lastResult
|
|
7
|
-
type: int
|
|
8
|
-
description: "Stores the result of the last operation performed."
|
|
9
|
-
default: 0
|
|
10
|
-
methods:
|
|
11
|
-
- type: method
|
|
12
|
-
name: add
|
|
13
|
-
description: "Calculate the sum of two ints."
|
|
14
|
-
parameters:
|
|
15
|
-
- type: int
|
|
16
|
-
name: a
|
|
17
|
-
description: 'The first operand.'
|
|
18
|
-
- type: int
|
|
19
|
-
name: b
|
|
20
|
-
description: "The second operand."
|
|
21
|
-
return:
|
|
22
|
-
type: int
|
|
23
|
-
description: "The sum of the two numbers."
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
generator:
|
|
2
|
-
php:
|
|
3
|
-
constantDeclaration: "const"
|
|
4
|
-
|
|
5
|
-
items:
|
|
6
|
-
- type: constant
|
|
7
|
-
name: MAX_RETRIES
|
|
8
|
-
value: 3
|
|
9
|
-
description: "Maximum number of retries for API calls"
|
|
10
|
-
- type: constant
|
|
11
|
-
name: API_BASE_URL
|
|
12
|
-
value: "https://api.example.com"
|
|
13
|
-
description: "Base URL for the API"
|
|
14
|
-
generator:
|
|
15
|
-
php:
|
|
16
|
-
constantDeclaration: "define"
|
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
generator:
|
|
2
|
-
php:
|
|
3
|
-
constantDeclaration: "define"
|
|
4
|
-
|
|
5
|
-
items:
|
|
6
|
-
- type: constant
|
|
7
|
-
name: PI
|
|
8
|
-
value: 3.14159
|
|
9
|
-
description: "Mathematical constant for circle calculations."
|
|
10
|
-
- type: constant
|
|
11
|
-
name: DEFAULT_GREETING
|
|
12
|
-
value: "Hello, World!"
|
|
13
|
-
description: "Default greeting message."
|
|
14
|
-
generator:
|
|
15
|
-
php:
|
|
16
|
-
constantDeclaration: "const"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
items:
|
|
2
|
-
- type: function
|
|
3
|
-
name: add
|
|
4
|
-
description: "Calculate the sum of two ints."
|
|
5
|
-
parameters:
|
|
6
|
-
- name: a
|
|
7
|
-
type: int
|
|
8
|
-
description: "The first operand."
|
|
9
|
-
- name: b
|
|
10
|
-
type: int
|
|
11
|
-
description: "The second operand."
|
|
12
|
-
return:
|
|
13
|
-
type: int
|
|
14
|
-
description: "The sum of the two numbers."
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Process an array of data with optional configuration.
|
|
3
|
-
*
|
|
4
|
-
* @param data - The data to process
|
|
5
|
-
* @param config - Optional configuration parameters
|
|
6
|
-
* @param callback - Optional callback for custom processing
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
function processData(data, config, callback) {
|
|
10
|
-
// TODO: Implement function body
|
|
11
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
items:
|
|
2
|
-
- type: function
|
|
3
|
-
name: processData
|
|
4
|
-
description: "Process an array of data with optional configuration."
|
|
5
|
-
parameters:
|
|
6
|
-
- name: data
|
|
7
|
-
type: array
|
|
8
|
-
description: "The data to process"
|
|
9
|
-
- name: config
|
|
10
|
-
type: array
|
|
11
|
-
description: "Optional configuration parameters"
|
|
12
|
-
default: []
|
|
13
|
-
- name: callback
|
|
14
|
-
type: callable
|
|
15
|
-
description: "Optional callback for custom processing"
|
|
16
|
-
optional: true
|
|
17
|
-
default: null
|
|
18
|
-
return:
|
|
19
|
-
type: array
|
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"allowImportingTsExtensions": true
|
|
11
|
-
},
|
|
12
|
-
"include": ["src", "tests"]
|
|
13
|
-
}
|
package/version.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.8
|