@fnet/cli 0.111.0 → 0.111.2
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/dist/fnet/index.DBSKvJyG.js +1 -0
- package/dist/fnet/index.DrwlOzAe.js +1 -0
- package/dist/fnet/index.js +1 -1
- package/dist/fnode/index.53yND1Av.js +1 -0
- package/dist/fnode/index.B1zLg4Y2.js +1 -0
- package/dist/fnode/index.B2LXSSn7.js +1 -0
- package/dist/fnode/index.BBrItYB9.js +1 -0
- package/dist/fnode/index.BSQp_bJN.js +1 -0
- package/dist/fnode/index.Bqzc7Bx8.js +1 -0
- package/dist/fnode/index.BwhWziH6.js +1 -0
- package/dist/fnode/index.CLlKzCGk.js +1 -0
- package/dist/fnode/index.Chvv_TJm.js +1 -0
- package/dist/fnode/index.D4KQB1ot.js +1 -0
- package/dist/fnode/index.DItyYiZ_.js +1 -0
- package/dist/fnode/index.DrwlOzAe.js +1 -0
- package/dist/fnode/index.js +1 -1
- package/dist/frun/index.js +126 -0
- package/package.json +8 -9
- package/readme.md +117 -25
- package/template/fnet/bun/fnet/flows.yaml.njk +1 -0
- package/template/fnet/bun/fnet.yaml.njk +1 -0
- package/template/fnet/bun/src/app/index.html.njk +67 -0
- package/template/fnet/bun/src/app/index.js.njk +36 -0
- package/template/fnet/bun/src/cli/index.js.njk +44 -0
- package/template/fnet/bun/src/default/blocks/assign.js.njk +40 -0
- package/template/fnet/bun/src/default/blocks/call.js.njk +92 -0
- package/template/fnet/bun/src/default/blocks/for.js.njk +81 -0
- package/template/fnet/bun/src/default/blocks/form.js.njk +65 -0
- package/template/fnet/bun/src/default/blocks/jump.js.njk +31 -0
- package/template/fnet/bun/src/default/blocks/modules.js.njk +50 -0
- package/template/fnet/bun/src/default/blocks/operation.js.njk +24 -0
- package/template/fnet/bun/src/default/blocks/raise.js.njk +25 -0
- package/template/fnet/bun/src/default/blocks/return.js.njk +27 -0
- package/template/fnet/bun/src/default/blocks/steps.js.njk +56 -0
- package/template/fnet/bun/src/default/blocks/switch.js.njk +73 -0
- package/template/fnet/bun/src/default/blocks/tryexcept.js.njk +65 -0
- package/template/fnet/bun/src/default/engine.js.njk +79 -0
- package/template/fnet/bun/src/default/macros/block-body-header.js.njk +7 -0
- package/template/fnet/bun/src/default/macros/block-footer.js.njk +3 -0
- package/template/fnet/bun/src/default/macros/block-header.js.njk +14 -0
- package/template/fnet/bun/src/default/macros/block-library-header.js.njk +19 -0
- package/template/fnet/bun/src/default/macros/block-modules-header.js.njk +8 -0
- package/template/fnet/bun/src/default/macros/block-modules.js.njk +29 -0
- package/template/fnet/bun/src/default/macros/block-next-header.js.njk +6 -0
- package/template/fnet/bun/src/default/macros/block-next.js.njk +20 -0
- package/template/fnet/bun/src/default/macros/block-run-form.js.njk +32 -0
- package/template/fnet/bun/src/default/macros/block-run-header.js.njk +39 -0
- package/template/fnet/bun/src/default/macros/page.js.njk +8 -0
- package/template/fnet/bun/src/default/macros/workflow-header.js.njk +7 -0
- package/template/fnet/bun/src/default/to.args.js.njk +120 -0
- package/template/fnet/bun/src/default/workflow.js.njk +117 -0
- package/template/fnet/core/assert.js +6 -0
- package/template/fnet/core/message.js +3 -0
- package/template/fnet/core/object.js +43 -0
- package/template/fnet/core/print.js +1 -0
- package/template/fnet/core/sleep.js +5 -0
- package/template/fnet/node/.gitignore.njk +8 -0
- package/template/fnet/node/fnet/flows.yaml.njk +1 -0
- package/template/fnet/node/fnet.yaml.njk +1 -0
- package/template/fnet/node/package.json.njk +90 -0
- package/template/fnet/node/readme.md.njk +21 -0
- package/template/fnet/node/rollup.config.mjs.njk +363 -0
- package/template/fnet/node/rollup_config_external.njk +8 -0
- package/template/fnet/node/rollup_config_onwarn.njk +9 -0
- package/template/fnet/node/rollup_config_output_banner.njk +3 -0
- package/template/fnet/node/rollup_config_output_footer.njk +5 -0
- package/template/fnet/node/rollup_config_output_globals.njk +9 -0
- package/template/fnet/node/rollup_config_output_name.njk +3 -0
- package/template/fnet/node/rollup_config_plugins.njk +90 -0
- package/template/fnet/node/src/app/index.html.njk +67 -0
- package/template/fnet/node/src/app/index.js.njk +36 -0
- package/template/fnet/node/src/cli/index.js.njk +44 -0
- package/template/fnet/node/src/default/blocks/assign.js.njk +40 -0
- package/template/fnet/node/src/default/blocks/call.js.njk +92 -0
- package/template/fnet/node/src/default/blocks/for.js.njk +81 -0
- package/template/fnet/node/src/default/blocks/form.js.njk +65 -0
- package/template/fnet/node/src/default/blocks/jump.js.njk +31 -0
- package/template/fnet/node/src/default/blocks/modules.js.njk +50 -0
- package/template/fnet/node/src/default/blocks/operation.js.njk +24 -0
- package/template/fnet/node/src/default/blocks/raise.js.njk +25 -0
- package/template/fnet/node/src/default/blocks/return.js.njk +27 -0
- package/template/fnet/node/src/default/blocks/steps.js.njk +56 -0
- package/template/fnet/node/src/default/blocks/switch.js.njk +73 -0
- package/template/fnet/node/src/default/blocks/tryexcept.js.njk +65 -0
- package/template/fnet/node/src/default/engine.js.njk +79 -0
- package/template/fnet/node/src/default/macros/block-body-header.js.njk +7 -0
- package/template/fnet/node/src/default/macros/block-footer.js.njk +3 -0
- package/template/fnet/node/src/default/macros/block-header.js.njk +14 -0
- package/template/fnet/node/src/default/macros/block-library-header.js.njk +19 -0
- package/template/fnet/node/src/default/macros/block-modules-header.js.njk +8 -0
- package/template/fnet/node/src/default/macros/block-modules.js.njk +29 -0
- package/template/fnet/node/src/default/macros/block-next-header.js.njk +6 -0
- package/template/fnet/node/src/default/macros/block-next.js.njk +20 -0
- package/template/fnet/node/src/default/macros/block-run-form.js.njk +32 -0
- package/template/fnet/node/src/default/macros/block-run-header.js.njk +39 -0
- package/template/fnet/node/src/default/macros/page.js.njk +8 -0
- package/template/fnet/node/src/default/macros/workflow-header.js.njk +7 -0
- package/template/fnet/node/src/default/to.args.js.njk +120 -0
- package/template/fnet/node/src/default/workflow.js.njk +117 -0
- package/template/fnet/node/tsconfig.json.njk +16 -0
- package/template/fnet/project/.gitignore.njk +7 -0
- package/template/fnet/project/.vscode/launch.json +41 -0
- package/template/fnet/project/.vscode/tasks.json +46 -0
- package/template/fnet/project/fnet/flows.yaml.njk +4 -0
- package/template/fnet/project/fnet/targets.yaml.njk +7 -0
- package/template/fnet/project/fnet.yaml.njk +3 -0
- package/template/fnode/bun/.gitignore.njk +8 -0
- package/template/fnode/bun/build.js.njk +156 -0
- package/template/fnode/bun/fnode.yaml.njk +1 -0
- package/template/fnode/bun/package.json.njk +89 -0
- package/template/fnode/bun/readme.md.njk +21 -0
- package/template/fnode/bun/src/app/index-js-with-react-host.njk +50 -0
- package/template/fnode/bun/src/app/index-js-without-react-host.njk +23 -0
- package/template/fnode/bun/src/app/index.html.njk +67 -0
- package/template/fnode/bun/src/app/index.js.njk +9 -0
- package/template/fnode/bun/src/cli/index.js.njk +81 -0
- package/template/fnode/bun/src/default/engine.js.njk +17 -0
- package/template/fnode/bun/src/default/to.args.js.njk +120 -0
- package/template/fnode/bun/tsconfig.json.njk +16 -0
- package/template/fnode/node/.gitignore.njk +8 -0
- package/template/fnode/node/fnode.yaml.njk +1 -0
- package/template/fnode/node/package.json.njk +90 -0
- package/template/fnode/node/readme.md.njk +21 -0
- package/template/fnode/node/rollup.config.mjs.njk +363 -0
- package/template/fnode/node/rollup_config_external.njk +8 -0
- package/template/fnode/node/rollup_config_onwarn.njk +9 -0
- package/template/fnode/node/rollup_config_output_banner.njk +3 -0
- package/template/fnode/node/rollup_config_output_footer.njk +5 -0
- package/template/fnode/node/rollup_config_output_globals.njk +9 -0
- package/template/fnode/node/rollup_config_output_name.njk +3 -0
- package/template/fnode/node/rollup_config_plugins.njk +90 -0
- package/template/fnode/node/src/app/index-js-with-react-host.njk +50 -0
- package/template/fnode/node/src/app/index-js-without-react-host.njk +23 -0
- package/template/fnode/node/src/app/index.html.njk +67 -0
- package/template/fnode/node/src/app/index.js.njk +9 -0
- package/template/fnode/node/src/cli/index.js.njk +81 -0
- package/template/fnode/node/src/default/engine.js.njk +17 -0
- package/template/fnode/node/src/default/to.args.js.njk +120 -0
- package/template/fnode/node/tsconfig.json.njk +16 -0
- package/template/fnode/project/.gitignore.njk +11 -0
- package/template/fnode/project/.vscode/launch.json.njk +78 -0
- package/template/fnode/project/.vscode/tasks.json.njk +46 -0
- package/template/fnode/project/fnet/targets.yaml.njk +25 -0
- package/template/fnode/project/fnode.yaml.njk +12 -0
- package/template/fnode/python/.gitignore.njk +7 -0
- package/template/fnode/python/fnode.yaml.njk +1 -0
- package/template/fnode/python/package.json.njk +4 -0
- package/template/fnode/python/pyproject.toml.njk +3 -0
- package/template/fnode/python/readme.md.njk +12 -0
- package/template/fnode/python/setup.py.njk +19 -0
- package/template/fnode/python/src/cli/index.py.njk +25 -0
- package/template/schemas/to-npm.yaml +14 -0
- package/dist/fnet/index.DZbefC4O.js +0 -1
- package/dist/fnode/index.DrdnDArw.js +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "fnet-build",
|
|
6
|
+
"type": "shell",
|
|
7
|
+
"command": "fnet build",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"label": "fnet-watch",
|
|
11
|
+
"type": "shell",
|
|
12
|
+
"command": "fnet watch",
|
|
13
|
+
"isBackground": true
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"label": "fnet-deploy",
|
|
17
|
+
"type": "shell",
|
|
18
|
+
"command": "fnet deploy",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "fnet-cli",
|
|
22
|
+
"type": "shell",
|
|
23
|
+
"command": "fnet cli",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"label": "fnet-app",
|
|
27
|
+
"type": "shell",
|
|
28
|
+
"command": "fnet app",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"label": "fnet-project-update",
|
|
32
|
+
"type": "shell",
|
|
33
|
+
"command": "fnet project -u",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"label": "fnet-npm-update",
|
|
37
|
+
"type": "shell",
|
|
38
|
+
"command": "fnet npm update",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"label": "fnet-npm-outdated",
|
|
42
|
+
"type": "shell",
|
|
43
|
+
"command": "fnet npm outdated",
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Build script for Bun projects
|
|
4
|
+
* This script uses Bun's built-in bundler instead of Rollup
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
8
|
+
import { join, dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import fs from 'node:fs';
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
|
|
14
|
+
async function ensureDir(dir) {
|
|
15
|
+
try {
|
|
16
|
+
await mkdir(dir, { recursive: true });
|
|
17
|
+
} catch (err) {
|
|
18
|
+
if (err.code !== 'EEXIST') throw err;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function buildOutput(name, config) {
|
|
23
|
+
console.log(`Building ${name}...`);
|
|
24
|
+
|
|
25
|
+
const outdir = config.outdir || join(__dirname, `dist/${name}`);
|
|
26
|
+
await ensureDir(outdir);
|
|
27
|
+
|
|
28
|
+
{% if atom.doc.features.app.enabled !== false %}
|
|
29
|
+
// Copy HTML file if it exists and this is an app build
|
|
30
|
+
if (name === 'app') {
|
|
31
|
+
try {
|
|
32
|
+
const htmlPath = './src/app/index.html';
|
|
33
|
+
if (fs.existsSync(htmlPath)) {
|
|
34
|
+
const htmlContent = await Bun.file(htmlPath).text();
|
|
35
|
+
await writeFile(join(outdir, 'index.html'), htmlContent);
|
|
36
|
+
}
|
|
37
|
+
} catch (err) {
|
|
38
|
+
if (err.code !== 'ENOENT') {
|
|
39
|
+
console.warn('Warning: Could not copy HTML file:', err.message);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
{% endif %}
|
|
44
|
+
|
|
45
|
+
// Build with Bun.build
|
|
46
|
+
const result = await Bun.build({
|
|
47
|
+
entrypoints: config.entrypoints || [`./src/${name}/index.js`],
|
|
48
|
+
outdir: outdir,
|
|
49
|
+
format: config.format || 'esm',
|
|
50
|
+
target: config.target || 'browser',
|
|
51
|
+
minify: config.minify !== undefined ? config.minify : false,
|
|
52
|
+
sourcemap: config.sourcemap || 'external',
|
|
53
|
+
|
|
54
|
+
// Mark npm dependencies as external to prevent bundling issues
|
|
55
|
+
external: (() => {
|
|
56
|
+
try {
|
|
57
|
+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
|
58
|
+
return [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})];
|
|
59
|
+
} catch (err) {
|
|
60
|
+
console.warn('Could not read package.json:', err.message);
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
})(),
|
|
64
|
+
|
|
65
|
+
// Add environment variables to help with module resolution
|
|
66
|
+
define: {
|
|
67
|
+
'process.env.NODE_PATH': JSON.stringify('./node_modules')
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
plugins: [
|
|
71
|
+
...(config.plugins || [])
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!result.success) {
|
|
76
|
+
console.error(`${name} build failed:`, result.logs);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function main() {
|
|
84
|
+
try {
|
|
85
|
+
{% if atom.doc.features.project.format === 'esm' or atom.doc.features.project.format === undefined %}
|
|
86
|
+
// Build default ESM
|
|
87
|
+
await buildOutput('default', {
|
|
88
|
+
format: "esm",
|
|
89
|
+
target: "browser",
|
|
90
|
+
minify: false,
|
|
91
|
+
sourcemap: "external",
|
|
92
|
+
entrypoints: ["./src/default/index.js"],
|
|
93
|
+
outdir: "./dist/default/esm"
|
|
94
|
+
});
|
|
95
|
+
{% endif %}
|
|
96
|
+
|
|
97
|
+
{% if atom.doc.features.project.format !== 'esm' %}
|
|
98
|
+
// Build default CJS
|
|
99
|
+
await buildOutput('defaultCjs', {
|
|
100
|
+
format: "cjs",
|
|
101
|
+
target: "node",
|
|
102
|
+
minify: false,
|
|
103
|
+
sourcemap: "external",
|
|
104
|
+
entrypoints: ["./src/default/index.js"],
|
|
105
|
+
outdir: "./dist/default/cjs"
|
|
106
|
+
});
|
|
107
|
+
{% endif %}
|
|
108
|
+
|
|
109
|
+
{% if atom.doc.features.cli.enabled !== false %}
|
|
110
|
+
// Build CLI if exists
|
|
111
|
+
try {
|
|
112
|
+
if (fs.existsSync('./src/cli/index.js')) {
|
|
113
|
+
await buildOutput('cli', {
|
|
114
|
+
format: "esm",
|
|
115
|
+
target: "node",
|
|
116
|
+
minify: false,
|
|
117
|
+
sourcemap: "external",
|
|
118
|
+
entrypoints: ["./src/cli/index.js"],
|
|
119
|
+
outdir: "{{ atom.doc.features.cli.dir | default('./dist/cli/esm') }}"
|
|
120
|
+
});
|
|
121
|
+
} else {
|
|
122
|
+
console.log('CLI not found, skipping CLI build');
|
|
123
|
+
}
|
|
124
|
+
} catch (err) {
|
|
125
|
+
console.log('Error building CLI:', err.message);
|
|
126
|
+
}
|
|
127
|
+
{% endif %}
|
|
128
|
+
|
|
129
|
+
{% if atom.doc.features.app.enabled !== false %}
|
|
130
|
+
// Build App if exists
|
|
131
|
+
try {
|
|
132
|
+
if (fs.existsSync('./src/app/index.js')) {
|
|
133
|
+
await buildOutput('app', {
|
|
134
|
+
format: "esm",
|
|
135
|
+
target: "browser",
|
|
136
|
+
minify: false,
|
|
137
|
+
sourcemap: "external",
|
|
138
|
+
entrypoints: ["./src/app/index.js"],
|
|
139
|
+
outdir: "{{ atom.doc.features.app.dir | default('./dist/app/esm') }}"
|
|
140
|
+
});
|
|
141
|
+
} else {
|
|
142
|
+
console.log('App not found, skipping App build');
|
|
143
|
+
}
|
|
144
|
+
} catch (err) {
|
|
145
|
+
console.log('Error building App:', err.message);
|
|
146
|
+
}
|
|
147
|
+
{% endif %}
|
|
148
|
+
|
|
149
|
+
console.log('Build completed successfully!');
|
|
150
|
+
} catch (err) {
|
|
151
|
+
console.error('Build failed:', err);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{content | safe}}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{atom.doc['npm::name'] or atom.doc['name'] or atom['id']}}",
|
|
3
|
+
"version": "{{atom.doc['npm::version'] or '0.1.0'}}",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist/*",
|
|
6
|
+
"fnet/input.yaml",
|
|
7
|
+
"fnet/output.yaml"
|
|
8
|
+
],
|
|
9
|
+
{# "sideEffects": false, #}
|
|
10
|
+
{% if atom.doc['npm::author'] %}
|
|
11
|
+
"author": "{{atom.doc['npm::author'] | safe}}",
|
|
12
|
+
{% endif %}
|
|
13
|
+
|
|
14
|
+
{% if atom.doc['npm::description'] %}
|
|
15
|
+
"description": "{{atom.doc['npm::description'] | safe}}",
|
|
16
|
+
{% endif %}
|
|
17
|
+
|
|
18
|
+
{% if atom.doc.features.project.format ==='cjs' %}
|
|
19
|
+
{% if atom.doc.features.rollup_output.esm.enabled === true%}
|
|
20
|
+
"main": "dist/default/esm/index.js",
|
|
21
|
+
"type":"module",
|
|
22
|
+
{% else %}
|
|
23
|
+
"main": "dist/default/cjs/index.cjs",
|
|
24
|
+
{% endif %}
|
|
25
|
+
{% if atom.doc.features.dts_enabled ===true %}
|
|
26
|
+
"types": "dist/default/types/index.d.ts",
|
|
27
|
+
{% endif %}
|
|
28
|
+
"exports":{
|
|
29
|
+
".":{
|
|
30
|
+
"import":"./dist/default/esm/index.js",
|
|
31
|
+
"require":"./dist/default/cjs/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{% else %}
|
|
35
|
+
"main": "dist/default/esm/index.js",
|
|
36
|
+
{% if atom.doc.features.dts_enabled ===true %}
|
|
37
|
+
"types": "dist/default/types/index.d.ts",
|
|
38
|
+
{% endif %}
|
|
39
|
+
"type":"module",
|
|
40
|
+
"exports":{
|
|
41
|
+
".":{
|
|
42
|
+
"import":"./dist/default/esm/index.js",
|
|
43
|
+
"require":"./dist/default/cjs/index.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{% endif %}
|
|
47
|
+
|
|
48
|
+
{% if atom.doc.repo.url %}
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "{{atom.doc.repo.type or 'git'}}",
|
|
51
|
+
"url": "{{atom.doc.repo.url}}"
|
|
52
|
+
},
|
|
53
|
+
{% endif %}
|
|
54
|
+
"license": "{{atom.doc.license or 'MIT'}}",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "bun ./build.js",
|
|
57
|
+
"watch": "bun --watch --watch-mode=poll --watch-ignore-dirs=node_modules,dist --watch-paths=./src ./build.js",
|
|
58
|
+
"serve": "bunx serve ./"
|
|
59
|
+
{% if atom.doc.features.cli.enabled %}
|
|
60
|
+
{% if atom.doc.features.project.format ==='cjs' %}
|
|
61
|
+
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs"
|
|
62
|
+
{% else %}
|
|
63
|
+
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/"
|
|
64
|
+
{% endif %}
|
|
65
|
+
{% endif %}
|
|
66
|
+
{% if atom.doc.features.app.enabled %}
|
|
67
|
+
,"app": "bunx serve {{atom.doc.features.app.dir}}/"
|
|
68
|
+
{% endif %}
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
{% for dep in packageDevDependencies %}
|
|
72
|
+
"{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
|
|
73
|
+
{% endfor%}
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
{% for dep in packageDependencies %}
|
|
77
|
+
"{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
|
|
78
|
+
{% endfor%}
|
|
79
|
+
}
|
|
80
|
+
{% if atom.doc.features.cli.enabled and atom.doc['npm::bin'] %}
|
|
81
|
+
,"bin":{
|
|
82
|
+
{% if atom.doc.features.project.format ==='cjs' %}
|
|
83
|
+
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.cjs"
|
|
84
|
+
{% else %}
|
|
85
|
+
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.js"
|
|
86
|
+
{% endif %}
|
|
87
|
+
}
|
|
88
|
+
{% endif %}
|
|
89
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{{content | safe}}
|
|
2
|
+
|
|
3
|
+
{% if howto %}
|
|
4
|
+
{{howto | safe}}
|
|
5
|
+
{% endif %}
|
|
6
|
+
|
|
7
|
+
{% if input %}
|
|
8
|
+
# Input Schema
|
|
9
|
+
|
|
10
|
+
```yaml
|
|
11
|
+
{{ input | safe}}
|
|
12
|
+
```
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% if output %}
|
|
16
|
+
# Output Schema
|
|
17
|
+
|
|
18
|
+
```yaml
|
|
19
|
+
{{ output | safe}}
|
|
20
|
+
```
|
|
21
|
+
{% endif %}
|
|
@@ -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,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 %}
|