@fnet/cli 0.111.0 → 0.111.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.
Files changed (155) hide show
  1. package/README.md +145 -0
  2. package/dist/fnet/index.DBSKvJyG.js +1 -0
  3. package/dist/fnet/index.DrwlOzAe.js +1 -0
  4. package/dist/fnet/index.js +1 -1
  5. package/dist/fnode/index.53yND1Av.js +1 -0
  6. package/dist/fnode/index.B1zLg4Y2.js +1 -0
  7. package/dist/fnode/index.B2LXSSn7.js +1 -0
  8. package/dist/fnode/index.BBrItYB9.js +1 -0
  9. package/dist/fnode/index.BSQp_bJN.js +1 -0
  10. package/dist/fnode/index.Bqzc7Bx8.js +1 -0
  11. package/dist/fnode/index.BwhWziH6.js +1 -0
  12. package/dist/fnode/index.CLlKzCGk.js +1 -0
  13. package/dist/fnode/index.Chvv_TJm.js +1 -0
  14. package/dist/fnode/index.D4KQB1ot.js +1 -0
  15. package/dist/fnode/index.DItyYiZ_.js +1 -0
  16. package/dist/fnode/index.DrwlOzAe.js +1 -0
  17. package/dist/fnode/index.js +1 -1
  18. package/dist/frun/index.js +126 -0
  19. package/package.json +8 -9
  20. package/template/fnet/bun/fnet/flows.yaml.njk +1 -0
  21. package/template/fnet/bun/fnet.yaml.njk +1 -0
  22. package/template/fnet/bun/src/app/index.html.njk +67 -0
  23. package/template/fnet/bun/src/app/index.js.njk +36 -0
  24. package/template/fnet/bun/src/cli/index.js.njk +44 -0
  25. package/template/fnet/bun/src/default/blocks/assign.js.njk +40 -0
  26. package/template/fnet/bun/src/default/blocks/call.js.njk +92 -0
  27. package/template/fnet/bun/src/default/blocks/for.js.njk +81 -0
  28. package/template/fnet/bun/src/default/blocks/form.js.njk +65 -0
  29. package/template/fnet/bun/src/default/blocks/jump.js.njk +31 -0
  30. package/template/fnet/bun/src/default/blocks/modules.js.njk +50 -0
  31. package/template/fnet/bun/src/default/blocks/operation.js.njk +24 -0
  32. package/template/fnet/bun/src/default/blocks/raise.js.njk +25 -0
  33. package/template/fnet/bun/src/default/blocks/return.js.njk +27 -0
  34. package/template/fnet/bun/src/default/blocks/steps.js.njk +56 -0
  35. package/template/fnet/bun/src/default/blocks/switch.js.njk +73 -0
  36. package/template/fnet/bun/src/default/blocks/tryexcept.js.njk +65 -0
  37. package/template/fnet/bun/src/default/engine.js.njk +79 -0
  38. package/template/fnet/bun/src/default/macros/block-body-header.js.njk +7 -0
  39. package/template/fnet/bun/src/default/macros/block-footer.js.njk +3 -0
  40. package/template/fnet/bun/src/default/macros/block-header.js.njk +14 -0
  41. package/template/fnet/bun/src/default/macros/block-library-header.js.njk +19 -0
  42. package/template/fnet/bun/src/default/macros/block-modules-header.js.njk +8 -0
  43. package/template/fnet/bun/src/default/macros/block-modules.js.njk +29 -0
  44. package/template/fnet/bun/src/default/macros/block-next-header.js.njk +6 -0
  45. package/template/fnet/bun/src/default/macros/block-next.js.njk +20 -0
  46. package/template/fnet/bun/src/default/macros/block-run-form.js.njk +32 -0
  47. package/template/fnet/bun/src/default/macros/block-run-header.js.njk +39 -0
  48. package/template/fnet/bun/src/default/macros/page.js.njk +8 -0
  49. package/template/fnet/bun/src/default/macros/workflow-header.js.njk +7 -0
  50. package/template/fnet/bun/src/default/to.args.js.njk +120 -0
  51. package/template/fnet/bun/src/default/workflow.js.njk +117 -0
  52. package/template/fnet/core/assert.js +6 -0
  53. package/template/fnet/core/message.js +3 -0
  54. package/template/fnet/core/object.js +43 -0
  55. package/template/fnet/core/print.js +1 -0
  56. package/template/fnet/core/sleep.js +5 -0
  57. package/template/fnet/node/.gitignore.njk +8 -0
  58. package/template/fnet/node/fnet/flows.yaml.njk +1 -0
  59. package/template/fnet/node/fnet.yaml.njk +1 -0
  60. package/template/fnet/node/package.json.njk +90 -0
  61. package/template/fnet/node/readme.md.njk +21 -0
  62. package/template/fnet/node/rollup.config.mjs.njk +363 -0
  63. package/template/fnet/node/rollup_config_external.njk +8 -0
  64. package/template/fnet/node/rollup_config_onwarn.njk +9 -0
  65. package/template/fnet/node/rollup_config_output_banner.njk +3 -0
  66. package/template/fnet/node/rollup_config_output_footer.njk +5 -0
  67. package/template/fnet/node/rollup_config_output_globals.njk +9 -0
  68. package/template/fnet/node/rollup_config_output_name.njk +3 -0
  69. package/template/fnet/node/rollup_config_plugins.njk +90 -0
  70. package/template/fnet/node/src/app/index.html.njk +67 -0
  71. package/template/fnet/node/src/app/index.js.njk +36 -0
  72. package/template/fnet/node/src/cli/index.js.njk +44 -0
  73. package/template/fnet/node/src/default/blocks/assign.js.njk +40 -0
  74. package/template/fnet/node/src/default/blocks/call.js.njk +92 -0
  75. package/template/fnet/node/src/default/blocks/for.js.njk +81 -0
  76. package/template/fnet/node/src/default/blocks/form.js.njk +65 -0
  77. package/template/fnet/node/src/default/blocks/jump.js.njk +31 -0
  78. package/template/fnet/node/src/default/blocks/modules.js.njk +50 -0
  79. package/template/fnet/node/src/default/blocks/operation.js.njk +24 -0
  80. package/template/fnet/node/src/default/blocks/raise.js.njk +25 -0
  81. package/template/fnet/node/src/default/blocks/return.js.njk +27 -0
  82. package/template/fnet/node/src/default/blocks/steps.js.njk +56 -0
  83. package/template/fnet/node/src/default/blocks/switch.js.njk +73 -0
  84. package/template/fnet/node/src/default/blocks/tryexcept.js.njk +65 -0
  85. package/template/fnet/node/src/default/engine.js.njk +79 -0
  86. package/template/fnet/node/src/default/macros/block-body-header.js.njk +7 -0
  87. package/template/fnet/node/src/default/macros/block-footer.js.njk +3 -0
  88. package/template/fnet/node/src/default/macros/block-header.js.njk +14 -0
  89. package/template/fnet/node/src/default/macros/block-library-header.js.njk +19 -0
  90. package/template/fnet/node/src/default/macros/block-modules-header.js.njk +8 -0
  91. package/template/fnet/node/src/default/macros/block-modules.js.njk +29 -0
  92. package/template/fnet/node/src/default/macros/block-next-header.js.njk +6 -0
  93. package/template/fnet/node/src/default/macros/block-next.js.njk +20 -0
  94. package/template/fnet/node/src/default/macros/block-run-form.js.njk +32 -0
  95. package/template/fnet/node/src/default/macros/block-run-header.js.njk +39 -0
  96. package/template/fnet/node/src/default/macros/page.js.njk +8 -0
  97. package/template/fnet/node/src/default/macros/workflow-header.js.njk +7 -0
  98. package/template/fnet/node/src/default/to.args.js.njk +120 -0
  99. package/template/fnet/node/src/default/workflow.js.njk +117 -0
  100. package/template/fnet/node/tsconfig.json.njk +16 -0
  101. package/template/fnet/project/.gitignore.njk +7 -0
  102. package/template/fnet/project/.vscode/launch.json +41 -0
  103. package/template/fnet/project/.vscode/tasks.json +46 -0
  104. package/template/fnet/project/fnet/flows.yaml.njk +4 -0
  105. package/template/fnet/project/fnet/targets.yaml.njk +7 -0
  106. package/template/fnet/project/fnet.yaml.njk +3 -0
  107. package/template/fnode/bun/.gitignore.njk +8 -0
  108. package/template/fnode/bun/build.js.njk +156 -0
  109. package/template/fnode/bun/fnode.yaml.njk +1 -0
  110. package/template/fnode/bun/package.json.njk +89 -0
  111. package/template/fnode/bun/readme.md.njk +21 -0
  112. package/template/fnode/bun/src/app/index-js-with-react-host.njk +50 -0
  113. package/template/fnode/bun/src/app/index-js-without-react-host.njk +23 -0
  114. package/template/fnode/bun/src/app/index.html.njk +67 -0
  115. package/template/fnode/bun/src/app/index.js.njk +9 -0
  116. package/template/fnode/bun/src/cli/index.js.njk +81 -0
  117. package/template/fnode/bun/src/default/engine.js.njk +17 -0
  118. package/template/fnode/bun/src/default/to.args.js.njk +120 -0
  119. package/template/fnode/bun/tsconfig.json.njk +16 -0
  120. package/template/fnode/node/.gitignore.njk +8 -0
  121. package/template/fnode/node/fnode.yaml.njk +1 -0
  122. package/template/fnode/node/package.json.njk +90 -0
  123. package/template/fnode/node/readme.md.njk +21 -0
  124. package/template/fnode/node/rollup.config.mjs.njk +363 -0
  125. package/template/fnode/node/rollup_config_external.njk +8 -0
  126. package/template/fnode/node/rollup_config_onwarn.njk +9 -0
  127. package/template/fnode/node/rollup_config_output_banner.njk +3 -0
  128. package/template/fnode/node/rollup_config_output_footer.njk +5 -0
  129. package/template/fnode/node/rollup_config_output_globals.njk +9 -0
  130. package/template/fnode/node/rollup_config_output_name.njk +3 -0
  131. package/template/fnode/node/rollup_config_plugins.njk +90 -0
  132. package/template/fnode/node/src/app/index-js-with-react-host.njk +50 -0
  133. package/template/fnode/node/src/app/index-js-without-react-host.njk +23 -0
  134. package/template/fnode/node/src/app/index.html.njk +67 -0
  135. package/template/fnode/node/src/app/index.js.njk +9 -0
  136. package/template/fnode/node/src/cli/index.js.njk +81 -0
  137. package/template/fnode/node/src/default/engine.js.njk +17 -0
  138. package/template/fnode/node/src/default/to.args.js.njk +120 -0
  139. package/template/fnode/node/tsconfig.json.njk +16 -0
  140. package/template/fnode/project/.gitignore.njk +11 -0
  141. package/template/fnode/project/.vscode/launch.json.njk +78 -0
  142. package/template/fnode/project/.vscode/tasks.json.njk +46 -0
  143. package/template/fnode/project/fnet/targets.yaml.njk +25 -0
  144. package/template/fnode/project/fnode.yaml.njk +12 -0
  145. package/template/fnode/python/.gitignore.njk +7 -0
  146. package/template/fnode/python/fnode.yaml.njk +1 -0
  147. package/template/fnode/python/package.json.njk +4 -0
  148. package/template/fnode/python/pyproject.toml.njk +3 -0
  149. package/template/fnode/python/readme.md.njk +12 -0
  150. package/template/fnode/python/setup.py.njk +19 -0
  151. package/template/fnode/python/src/cli/index.py.njk +25 -0
  152. package/template/schemas/to-npm.yaml +14 -0
  153. package/dist/fnet/index.DZbefC4O.js +0 -1
  154. package/dist/fnode/index.DrdnDArw.js +0 -1
  155. package/readme.md +0 -50
@@ -0,0 +1,90 @@
1
+ plugins: await initPlugins({
2
+ delete:{ targets: [path.normalize(groupDir + '{{key}}')], runOnce: DEVELOPMENT },
3
+
4
+ format:"{{ value.format }}",
5
+
6
+ {% if value.babel===true %}
7
+ babel:{{value.babel_options | dump | safe}},
8
+ {% endif %}
9
+
10
+ {% if value.replace ===true %}
11
+ replace:{{value.replace_options | dump | safe}},
12
+ {% endif %}
13
+
14
+ {% if value.browser===true %}
15
+ browser:true,
16
+ {% endif %}
17
+
18
+ {% if value.browsersync===true and atom.doc.features.browsersync_enabled===true%}
19
+ browsersync: {{value.browsersync_options | dump | safe}},
20
+ {% endif %}
21
+
22
+ {% if value.alias_enabled===true %}
23
+ alias:{{value.alias | dump | safe}},
24
+ {% endif %}
25
+
26
+ {# OK #}
27
+ {% if value.css %}
28
+ postcss:{{value.css | dump | safe}},
29
+ {% endif %}
30
+
31
+ {# OK #}
32
+ {% if value.copy %}
33
+ copy:{{value.copy | dump | safe}},
34
+ {% endif %}
35
+
36
+ {# OK #}
37
+ {% if value.terser%}
38
+ terser:{{value.terser | dump | safe}},
39
+ {% endif %}
40
+
41
+ {# OK #}
42
+ {% if value.json %}
43
+ json:{{value.json | dump | safe}},
44
+ {% endif %}
45
+
46
+ {# OK #}
47
+ {% if value.wasm %}
48
+ wasm: {{value.wasm | dump | safe}},
49
+ {% endif %}
50
+
51
+ {# OK #}
52
+ {% if value.string %}
53
+ string:{{value.string | dump | safe}},
54
+ {% endif %}
55
+
56
+ {# OK #}
57
+ {% if value.image %}
58
+ image:{{value.image | dump | safe}},
59
+ {% endif %}
60
+
61
+ {# OK #}
62
+ {% if value.analyzer %}
63
+ analyzer:{{value.analyzer | dump | safe}},
64
+ {% endif %}
65
+
66
+ {# OK #}
67
+ {% if value.visualizer %}
68
+ visualizer:{{value.visualizer | dump | safe}},
69
+ {% endif %}
70
+
71
+ {# OK #}
72
+ {% if value.polyfill %}
73
+ polyfill:{{value.polyfill | dump | safe}},
74
+ {% endif %}
75
+
76
+ {# OK #}
77
+ {% if value.nunjucks %}
78
+ nunjucks:{{value.nunjucks | dump | safe}},
79
+ {% endif %}
80
+
81
+ {# OK #}
82
+ {% if value.workbox %}
83
+ workbox:{{value.workbox | dump | safe}},
84
+ {% endif %}
85
+
86
+ {# OK #}
87
+ {% if value.gzip %}
88
+ gzip:{{value.gzip | dump | safe}},
89
+ {% endif %}
90
+ }),
@@ -0,0 +1,50 @@
1
+ {% if not atom.doc.features.react_version or atom.doc.features.react_version > 17 %}
2
+ import React from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+ {% else %}
5
+ import React from 'react';
6
+ import ReactDOM from 'react-dom';
7
+ {% endif %}
8
+
9
+ {% if atom.doc.features.react_app_state_enabled===true %}
10
+ import { Provider } from "@fnet/react-app-state";
11
+ {% endif%}
12
+
13
+ {% if atom.doc.features.app.extend===true %}
14
+ import Library from '../../../app';
15
+ {% elif atom.doc.features.multiple===true %}
16
+ const Library = React.Fragment;
17
+ {% else %}
18
+ import Library from '../../../src';
19
+ {% endif%}
20
+
21
+ export default function App(props) {
22
+ return (
23
+ {% if atom.doc.features.react_app_state_enabled===true %}
24
+ <Provider>
25
+ {% endif %}
26
+ <Library {...props} />
27
+ {% if atom.doc.features.react_app_state_enabled===true %}
28
+ </Provider>
29
+ {% endif %}
30
+ )
31
+ }
32
+
33
+ {% if not atom.doc.features.react_version or atom.doc.features.react_version > 17 %}
34
+ const createApp = ({ container }) => {
35
+ return (props) => {
36
+ const root = createRoot(container);
37
+ root.render(<App {...props} />);
38
+ return ()=> root.unmount();
39
+ }
40
+ }
41
+ {% else %}
42
+ const createApp = ({ container }) => {
43
+ return (props) => {
44
+ ReactDOM.render(<App {...props} />, container);
45
+ return () => ReactDOM.unmountComponentAtNode(container);
46
+ }
47
+ }
48
+ {% endif %}
49
+
50
+ export { createApp };
@@ -0,0 +1,23 @@
1
+ {% if atom.doc.features.app.export===true %}
2
+ {% if atom.doc.features.app.extend===true %}
3
+ import init from '../../../app';
4
+ const createApp = ({ container }) => {
5
+ return init({container});
6
+ };
7
+ export { createApp };
8
+ {% else %}
9
+ import Node from "../default";
10
+ const createApp = ({ container }) => {
11
+ return (props) => Node({ ...props, container });
12
+ };
13
+ export { createApp };
14
+ {% endif %}
15
+ {% else %}
16
+ {% if atom.doc.features.app.extend===true %}
17
+ import run from '../../../app';
18
+ run();
19
+ {% else %}
20
+ import Node from "../default";
21
+ Node();
22
+ {% endif %}
23
+ {% endif %}
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{atom.doc.title or atom.doc.name}}</title>
8
+
9
+ {% if atom.doc.features.css.options.extract===true %}
10
+ <link rel="stylesheet" href="./index.css" />
11
+ {% endif %}
12
+
13
+ {% if atom.doc.features.app.format==='iife' %}
14
+ <script src="./index.js"></script>
15
+ {% endif %}
16
+
17
+ </head>
18
+ <body style="height:100vh;margin:0;padding:0;background-color: #eeeeee;">
19
+ <div id="container" style="height:100%;"></div>
20
+ {% if atom.doc.features.app.export===true %}
21
+ {% if atom.doc.features.app.format==='esm' %}
22
+ <script type="module">
23
+ import { createApp } from "./index.js";
24
+ const run = createApp({container: document.getElementById("container")});
25
+ {% if atom.doc.features.app.props %}
26
+ const dispose=run({{ atom.doc.features.app.props | dump | safe }});
27
+ {% else %}
28
+ const dispose=run();
29
+ {% endif %}
30
+ </script>
31
+ {% endif %}
32
+
33
+ {% if atom.doc.features.app.format==='iife' %}
34
+ <script>
35
+ const { createApp } = window['{{atom.doc.bundleName}}'];
36
+ const run = createApp({container: document.getElementById("container")});
37
+ {% if atom.doc.features.app.props %}
38
+ const dispose=run({{ atom.doc.features.app.props | dump | safe }});
39
+ {% else %}
40
+ const dispose=run();
41
+ {% endif %}
42
+ </script>
43
+ {% endif %}
44
+ {% endif %}
45
+
46
+ {% if atom.doc.features.workbox_enabled %}
47
+ {% if atom.doc.features.rollup_output.app.workbox.enabled %}
48
+ <!-- Service Worker Registration -->
49
+ <script>
50
+ if ('serviceWorker' in navigator) {
51
+ window.addEventListener('load', () => {
52
+ navigator
53
+ .serviceWorker
54
+ .register('./sw.js', {scope: './'}) // Optionally add scope
55
+ .then((registration) => {
56
+ console.log('Service Worker registered with scope:', registration.scope);
57
+ })
58
+ .catch((error) => {
59
+ console.log('Service Worker registration failed:', error);
60
+ });
61
+ });
62
+ }
63
+ </script>
64
+ {% endif%}
65
+ {% endif%}
66
+ </body>
67
+ </html>
@@ -0,0 +1,9 @@
1
+ {% if atom.doc.features.app.enabled===true %}
2
+
3
+ {% if atom.doc.features.app.react===true %}
4
+ {% include "index-js-with-react-host.njk" %}
5
+ {% else %}
6
+ {% include "index-js-without-react-host.njk" %}
7
+ {% endif %}
8
+
9
+ {% endif %}
@@ -0,0 +1,81 @@
1
+ {% if atom.doc.features.cli.enabled===true %}
2
+
3
+ {% if atom.doc.features.project.format==='esm' %}
4
+
5
+ import argv from '../default/to.args.js';
6
+
7
+ {% if atom.doc.features.cli.extend===true %}
8
+
9
+ import Node from '../../../cli';
10
+ const run=async ()=>await Node(await argv());
11
+ run()
12
+ .then(() => {
13
+ {# process.exit(0); #}
14
+ })
15
+ .catch((error) => {
16
+ console.error(error.message);
17
+ process.exit(1);
18
+ });
19
+
20
+ {% else %}
21
+ import Node from '../../../src';
22
+ const run=async ()=>await Node(await argv());
23
+
24
+ run()
25
+ .then((result) => {
26
+ if (typeof result !== 'undefined')
27
+ {
28
+ // TODO: REMOVE THIS LINE
29
+ const stdout_format=process.argv.slice(2).indexOf()!==-1? process.argv.slice(2)[process.argv.slice(2).indexOf('--stdout_format')+1]:null;
30
+ if(stdout_format==='json') console.log(JSON.stringify(result,null,2));
31
+ else console.log(result);
32
+ }
33
+ {# process.exit(0); #}
34
+ })
35
+ .catch((error) => {
36
+ console.error(error.message);
37
+ process.exit(1);
38
+ });
39
+ {% endif %}
40
+
41
+ {% elif atom.doc.features.project.format==='cjs' %}
42
+
43
+ const argv = require('../default/to.args.js');
44
+
45
+ {% if atom.doc.features.cli.extend===true %}
46
+
47
+ const Node = require('../../../cli');
48
+ const run = async () => await Node(await argv());
49
+
50
+ run()
51
+ .then(() => {
52
+ {# process.exit(0); #}
53
+ })
54
+ .catch((error) => {
55
+ console.error(error.message);
56
+ process.exit(1);
57
+ });
58
+
59
+ {% else %}
60
+ const Node = require('../../../src');
61
+ const run = async () => await Node(await argv());
62
+
63
+ run()
64
+ .then((result) => {
65
+ if (typeof result !== 'undefined') {
66
+ // TODO: REMOVE THIS LINE
67
+ const stdout_format=process.argv.slice(2).indexOf()!==-1? process.argv.slice(2)[process.argv.slice(2).indexOf('--stdout_format')+1]:null;
68
+ if (stdout_format === 'json') console.log(JSON.stringify(result, null, 2));
69
+ else console.log(result);
70
+ }
71
+ {# process.exit(0); #}
72
+ })
73
+ .catch((error) => {
74
+ console.error(error.message);
75
+ process.exit(1);
76
+ });
77
+ {% endif %}
78
+
79
+ {% endif %}
80
+
81
+ {% endif %}
@@ -0,0 +1,17 @@
1
+ {% if atom.doc.features.project.format === 'esm' %}
2
+ {% if atom.relativePath %}
3
+ export * from "{{atom.relativePath}}";
4
+ export { default } from "{{atom.relativePath}}";
5
+ {% else %}
6
+ export * from "../libs/{{atom.id or atom.doc.name}}";
7
+ export { default } from "../libs/{{atom.id or atom.doc.name}}";
8
+ {% endif %}
9
+ {% elif atom.doc.features.project.format === 'cjs' %}
10
+ {% if atom.relativePath %}
11
+ const moduleExports = require("{{atom.relativePath}}");
12
+ module.exports = { ...moduleExports, default: moduleExports.default || moduleExports };
13
+ {% else %}
14
+ const moduleExports = require("../libs/{{atom.id or atom.doc.name}}");
15
+ module.exports = { ...moduleExports, default: moduleExports.default || moduleExports };
16
+ {% endif %}
17
+ {% endif %}
@@ -0,0 +1,120 @@
1
+ {% if atom.doc.features.project.format === 'esm' %}
2
+ import fnetArgs from '@fnet/args';
3
+ import validate from "./validate_input";
4
+ {% elif atom.doc.features.project.format === 'cjs' %}
5
+ const fnetArgs = require('@fnet/args');
6
+ const validate = require("./validate_input");
7
+ {% endif %}
8
+
9
+ {% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
10
+
11
+ const get_fargs = (argv) => {
12
+ const fargsIndex = argv.indexOf('--fargs');
13
+ if (fargsIndex !== -1 && argv[fargsIndex + 1]) return argv[fargsIndex + 1];
14
+ {% if atom.doc.features.cli.fargs.default %}
15
+ else return "{{atom.doc.features.cli.fargs.default}}";
16
+ {% endif %}
17
+ };
18
+
19
+ const get_ftags = (argv) => {
20
+ const ftags = [];
21
+ for (let i = 0; i < argv.length; i++) {
22
+ if (argv[i] === '--ftag' && argv[i + 1]) {
23
+ ftags.push(argv[i + 1]);
24
+ i++;
25
+ }
26
+ }
27
+
28
+ {% if atom.doc.features.cli.fargs.tags %}
29
+ return ftags.length > 0 ? ftags : {{atom.doc.features.cli.fargs.tags | dump | safe}};
30
+ {% else %}
31
+ return ftags.length > 0 ? ftags : undefined;
32
+ {% endif %}
33
+ };
34
+
35
+ {% endif %}
36
+
37
+ {% if atom.doc.features.project.format === 'esm' %}
38
+
39
+ export default async () => {
40
+
41
+ let schema = {{options | dump | safe}};
42
+ let initial;
43
+
44
+ {% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
45
+ const fargs = get_fargs(process.argv.slice(2));
46
+ const ftags = get_ftags(process.argv.slice(2));
47
+
48
+ if (fargs) {
49
+ const { default: fnetConfig } = await import("@fnet/config");
50
+ const config = await fnetConfig({ name: fargs, tags: ftags });
51
+ if (config?.data) {
52
+ initial=config.data;
53
+ }
54
+ }
55
+ {% endif %}
56
+
57
+ const packageCallback = async () => {
58
+ const { default: url } = await import("node:url");
59
+ const { default: path } = await import("node:path");
60
+ const { default: fs } = await import("node:fs");
61
+ let currentDir = path.dirname(url.fileURLToPath(import.meta.url));
62
+ let firstPackageJson = path.join(currentDir, "package.json");
63
+ while (currentDir !== path.parse(currentDir).root && !fs.existsSync(firstPackageJson)) {
64
+ currentDir = path.dirname(currentDir);
65
+ firstPackageJson = path.join(currentDir, "package.json");
66
+ }
67
+ if (!fs.existsSync(firstPackageJson)) return {
68
+ name: "Unknown",
69
+ version: "Unknown"
70
+ }
71
+ else return await JSON.parse(fs.readFileSync(firstPackageJson, "utf8"));
72
+ };
73
+
74
+ return await fnetArgs({schema,initial,validate,packageCallback});
75
+ };
76
+
77
+ {% elif atom.doc.features.project.format === 'cjs' %}
78
+
79
+ module.exports = async () => {
80
+ let schema = {{options | dump | safe}};
81
+ let initial;
82
+
83
+ {% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
84
+ const fargs = get_fargs(process.argv.slice(2));
85
+ const ftags = get_ftags(process.argv.slice(2));
86
+
87
+ if (fargs) {
88
+ const { default: fnetConfig } = await import("@fnet/config");
89
+ const config = await fnetConfig({ name: fargs, tags: ftags });
90
+ if (config?.data) {
91
+ initial=config.data;
92
+ }
93
+ }
94
+ {% endif %}
95
+
96
+ const packageCallback = async () => {
97
+ const path = require("node:path");
98
+ const fs = require("node:fs");
99
+
100
+ let currentDir = __dirname;
101
+ let firstPackageJson = path.join(currentDir, "package.json");
102
+
103
+ while (currentDir !== path.parse(currentDir).root && !fs.existsSync(firstPackageJson)) {
104
+ currentDir = path.dirname(currentDir);
105
+ firstPackageJson = path.join(currentDir, "package.json");
106
+ }
107
+
108
+ if (!fs.existsSync(firstPackageJson)) {
109
+ return {
110
+ name: "Unknown",
111
+ version: "Unknown"
112
+ };
113
+ } else {
114
+ return JSON.parse(fs.readFileSync(firstPackageJson, "utf8"));
115
+ }
116
+ };
117
+
118
+ return await fnetArgs({schema,initial,validate,packageCallback});
119
+ };
120
+ {% endif %}
@@ -0,0 +1,16 @@
1
+ {
2
+ "include": [
3
+ "src/**/*.js"
4
+ ],
5
+ "compilerOptions": {
6
+ "outDir": "./types",
7
+ "declaration": true,
8
+ "allowJs": true,
9
+ "emitDeclarationOnly": true,
10
+ "target": "es5",
11
+ "strict": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "skipLibCheck": true,
14
+ "jsx": "react-jsx"
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ .DS_Store
2
+ .workspace
3
+ .fnet
4
+ .out
5
+ .package
6
+ .npmrc
7
+ .vscode
8
+ {% if runtime === 'node' %}
9
+ {% elif runtime === 'python' %}
10
+ __pycache__
11
+ {% endif %}
@@ -0,0 +1,78 @@
1
+ {% if runtime==='node' %}
2
+ {
3
+ // Use IntelliSense to learn about possible attributes.
4
+ // Hover to view descriptions of existing attributes.
5
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
6
+ "version": "0.2.0",
7
+ "configurations": [
8
+ {
9
+ "name": "debug-fnode-cli",
10
+ "type": "node",
11
+ "request": "launch",
12
+ "skipFiles": [
13
+ "<node_internals>/**"
14
+ ],
15
+ "program": "${workspaceFolder}/.workspace/dist/cli/esm/index.js",
16
+ "cwd": "${workspaceFolder}/.workspace",
17
+ "preLaunchTask": "fnode-watch",
18
+ "console": "integratedTerminal"
19
+ },
20
+ {
21
+ "name": "debug-fnode-app",
22
+ "type": "chrome",
23
+ "request": "launch",
24
+ "url": "http://localhost:3000/dist/app/esm/",
25
+ "webRoot": "${workspaceFolder}/.workspace",
26
+ "preLaunchTask": "fnode-watch",
27
+ // "userDataDir": false,
28
+ // "runtimeArgs": [
29
+ // "--profile-directory=<profile-name>",
30
+ // ]
31
+ },
32
+ ],
33
+ // "compounds": [
34
+ // {
35
+ // "name": "debug-fnode-all",
36
+ // "configurations": [
37
+ // "debug-fnode-cli",
38
+ // "debug-fnode-app"
39
+ // ]
40
+ // }
41
+ // ]
42
+ }
43
+ {% elif runtime==='python' %}
44
+ {
45
+ // Use IntelliSense to learn about possible attributes.
46
+ // Hover to view descriptions of existing attributes.
47
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
48
+ "version": "0.2.0",
49
+ "configurations": [
50
+ {
51
+ "name": "debug-fnode-cli",
52
+ "type": "debugpy",
53
+ "request": "launch",
54
+ "program": "${workspaceFolder}/.workspace/src/cli/index.py",
55
+ "console": "integratedTerminal",
56
+ "cwd": "${workspaceFolder}/.workspace",
57
+ "env": {
58
+ "PYTHONPATH": "${workspaceFolder}/.workspace/src"
59
+ },
60
+ {% if platform ==='win32' %}
61
+ "python": "${workspaceFolder}/.workspace/.conda/python.exe",
62
+ {% else %}
63
+ "python":"${workspaceFolder}/.workspace/.conda/bin/python",
64
+ {% endif %}
65
+ "args": []
66
+ }
67
+ ]
68
+ }
69
+ {% else %}
70
+ {
71
+ // Use IntelliSense to learn about possible attributes.
72
+ // Hover to view descriptions of existing attributes.
73
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
74
+ "version": "0.2.0",
75
+ "configurations": [
76
+ ]
77
+ }
78
+ {% endif %}
@@ -0,0 +1,46 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "label": "fnode-build",
6
+ "type": "shell",
7
+ "command": "fnode build",
8
+ },
9
+ {
10
+ "label": "fnode-watch",
11
+ "type": "shell",
12
+ "command": "fnode watch",
13
+ "isBackground": true
14
+ },
15
+ {
16
+ "label": "fnode-deploy",
17
+ "type": "shell",
18
+ "command": "fnode deploy",
19
+ },
20
+ {
21
+ "label": "fnode-cli",
22
+ "type": "shell",
23
+ "command": "fnode cli",
24
+ },
25
+ {
26
+ "label": "fnode-app",
27
+ "type": "shell",
28
+ "command": "fnode app",
29
+ },
30
+ {
31
+ "label": "fnode-project-update",
32
+ "type": "shell",
33
+ "command": "fnode project -u",
34
+ },
35
+ {
36
+ "label": "fnode-npm-update",
37
+ "type": "shell",
38
+ "command": "fnode npm update",
39
+ },
40
+ {
41
+ "label": "fnode-npm-outdated",
42
+ "type": "shell",
43
+ "command": "fnode npm outdated",
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,25 @@
1
+ {% if runtime ==='node' %}
2
+ npm-default:
3
+ type: npm
4
+ enabled: false
5
+ version: "{{npm.version or "0.1.0"}}"
6
+ params:
7
+ # bin: some-bin-name
8
+ name: "{{npm.name or "@fnet/"+name}}"
9
+ {% elif runtime==='bun' %}
10
+ bun-default:
11
+ type: bun
12
+ enabled: false
13
+ version: "{{npm.version or "0.1.0"}}"
14
+ params:
15
+ # bin: some-bin-name
16
+ name: "{{npm.name or "@fnet/"+name}}"
17
+ {% elif runtime==='python' %}
18
+ pypi-default:
19
+ type: pypi
20
+ enabled: false
21
+ version: "{{pip.version or "0.1.0"}}"
22
+ params:
23
+ # bin: some-bin-name
24
+ name: "{{pip.name or "@fnet/"+name}}"
25
+ {% endif %}
@@ -0,0 +1,12 @@
1
+ name: {{name}}
2
+
3
+ {% if runtime === 'node' %}
4
+ features:
5
+ iife: false
6
+ {% elif runtime === 'python' %}
7
+ features:
8
+ s::runtime.type: python
9
+ {% elif runtime === 'bun' %}
10
+ features:
11
+ s::runtime.type: bun
12
+ {% endif %}
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ .DS_Store
3
+ .fnet
4
+ .out
5
+ .package
6
+ .vscode
7
+ .output
@@ -0,0 +1 @@
1
+ {{content | safe}}
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "{{params.package_name}}",
3
+ "scripts":{{params.scripts | safe}}
4
+ }
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"