@fnet/cli 0.129.0 → 0.130.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/dist/fbin/index.js +1 -1
- package/dist/fnet/{index.DkEl8VOr.js → index.DOYkqsYT.js} +1 -1
- package/dist/fnet/index.js +1 -1
- package/dist/fnode/index.D9RmDejw.js +1 -0
- package/dist/fnode/index.js +1 -1
- package/dist/fservice/index.js +1 -1
- package/package.json +1 -1
- package/template/{fnode/bun → fnet/node}/build.js.njk +39 -46
- package/template/fnet/node/package.json.njk +17 -11
- package/template/fnode/node/build.js.njk +149 -0
- package/template/fnode/node/package.json.njk +20 -12
- package/template/fnode/project/fnet/targets.yaml.njk +2 -2
- package/template/schemas/to-npm.yaml +1 -1
- package/dist/fnode/index.AkoGqRzv.js +0 -1
- package/dist/fnode/index.BqI7rTjk.js +0 -1
- package/dist/fnode/index.CuZwF16z.js +0 -1
- package/template/fnode/bun/.gitignore.njk +0 -8
- package/template/fnode/bun/package.json.njk +0 -93
- package/template/fnode/bun/readme.md.njk +0 -21
- package/template/fnode/bun/src/app/index-js-with-react-host.njk +0 -50
- package/template/fnode/bun/src/app/index-js-without-react-host.njk +0 -23
- package/template/fnode/bun/src/app/index.html.njk +0 -67
- package/template/fnode/bun/src/app/index.js.njk +0 -9
- package/template/fnode/bun/src/cli/index.js.njk +0 -82
- package/template/fnode/bun/src/default/engine.js.njk +0 -17
- package/template/fnode/bun/src/default/input.args.js.njk +0 -122
- package/template/fnode/bun/tsconfig.json.njk +0 -16
|
@@ -1,67 +0,0 @@
|
|
|
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>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
{% if atom.doc.features.cli.enabled===true %}
|
|
2
|
-
|
|
3
|
-
{% if atom.doc.features.project.format==='esm' %}
|
|
4
|
-
|
|
5
|
-
import argv from '../default/input.args.js';
|
|
6
|
-
import { schema as inputSchema } from '../default/validate_input.js';
|
|
7
|
-
|
|
8
|
-
{% if atom.doc.features.cli.extend===true %}
|
|
9
|
-
|
|
10
|
-
import Node from '../../../cli';
|
|
11
|
-
const run=async ()=>await Node(await argv());
|
|
12
|
-
run()
|
|
13
|
-
.then(() => {
|
|
14
|
-
{# process.exit(0); #}
|
|
15
|
-
})
|
|
16
|
-
.catch((error) => {
|
|
17
|
-
console.error(error.message);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
{% else %}
|
|
22
|
-
import Node from '../../../src';
|
|
23
|
-
const run=async ()=>await Node(await argv());
|
|
24
|
-
|
|
25
|
-
run()
|
|
26
|
-
.then((result) => {
|
|
27
|
-
if (typeof result !== 'undefined')
|
|
28
|
-
{
|
|
29
|
-
// TODO: REMOVE THIS LINE
|
|
30
|
-
const stdout_format=process.argv.slice(2).indexOf()!==-1? process.argv.slice(2)[process.argv.slice(2).indexOf('--stdout_format')+1]:null;
|
|
31
|
-
if(stdout_format==='json') console.log(JSON.stringify(result,null,2));
|
|
32
|
-
else console.log(result);
|
|
33
|
-
}
|
|
34
|
-
{# process.exit(0); #}
|
|
35
|
-
})
|
|
36
|
-
.catch((error) => {
|
|
37
|
-
console.error(error.message);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
});
|
|
40
|
-
{% endif %}
|
|
41
|
-
|
|
42
|
-
{% elif atom.doc.features.project.format==='cjs' %}
|
|
43
|
-
|
|
44
|
-
const argv = require('../default/input.args.js');
|
|
45
|
-
|
|
46
|
-
{% if atom.doc.features.cli.extend===true %}
|
|
47
|
-
|
|
48
|
-
const Node = require('../../../cli');
|
|
49
|
-
const run = async () => await Node(await argv());
|
|
50
|
-
|
|
51
|
-
run()
|
|
52
|
-
.then(() => {
|
|
53
|
-
{# process.exit(0); #}
|
|
54
|
-
})
|
|
55
|
-
.catch((error) => {
|
|
56
|
-
console.error(error.message);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
{% else %}
|
|
61
|
-
const Node = require('../../../src');
|
|
62
|
-
const run = async () => await Node(await argv());
|
|
63
|
-
|
|
64
|
-
run()
|
|
65
|
-
.then((result) => {
|
|
66
|
-
if (typeof result !== 'undefined') {
|
|
67
|
-
// TODO: REMOVE THIS LINE
|
|
68
|
-
const stdout_format=process.argv.slice(2).indexOf()!==-1? process.argv.slice(2)[process.argv.slice(2).indexOf('--stdout_format')+1]:null;
|
|
69
|
-
if (stdout_format === 'json') console.log(JSON.stringify(result, null, 2));
|
|
70
|
-
else console.log(result);
|
|
71
|
-
}
|
|
72
|
-
{# process.exit(0); #}
|
|
73
|
-
})
|
|
74
|
-
.catch((error) => {
|
|
75
|
-
console.error(error.message);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
});
|
|
78
|
-
{% endif %}
|
|
79
|
-
|
|
80
|
-
{% endif %}
|
|
81
|
-
|
|
82
|
-
{% endif %}
|
|
@@ -1,17 +0,0 @@
|
|
|
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 %}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
{% if atom.doc.features.project.format === 'esm' %}
|
|
2
|
-
import fnetArgs from '@fnet/args';
|
|
3
|
-
import validate,{schema as inputSchema} from "./validate_input";
|
|
4
|
-
|
|
5
|
-
{% elif atom.doc.features.project.format === 'cjs' %}
|
|
6
|
-
const fnetArgs = require('@fnet/args');
|
|
7
|
-
const validate,{schema as inputSchema} = require("./validate_input");
|
|
8
|
-
{% endif %}
|
|
9
|
-
|
|
10
|
-
{% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
|
|
11
|
-
|
|
12
|
-
const get_fargs = (argv) => {
|
|
13
|
-
const fargsIndex = argv.indexOf('--fargs');
|
|
14
|
-
if (fargsIndex !== -1 && argv[fargsIndex + 1]) return argv[fargsIndex + 1];
|
|
15
|
-
{% if atom.doc.features.cli.fargs.default %}
|
|
16
|
-
else return "{{atom.doc.features.cli.fargs.default}}";
|
|
17
|
-
{% endif %}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const get_ftags = (argv) => {
|
|
21
|
-
const ftags = [];
|
|
22
|
-
for (let i = 0; i < argv.length; i++) {
|
|
23
|
-
if (argv[i] === '--ftag' && argv[i + 1]) {
|
|
24
|
-
ftags.push(argv[i + 1]);
|
|
25
|
-
i++;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
{% if atom.doc.features.cli.fargs.tags %}
|
|
30
|
-
return ftags.length > 0 ? ftags : {{atom.doc.features.cli.fargs.tags | dump | safe}};
|
|
31
|
-
{% else %}
|
|
32
|
-
return ftags.length > 0 ? ftags : undefined;
|
|
33
|
-
{% endif %}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
{% endif %}
|
|
37
|
-
|
|
38
|
-
{% if atom.doc.features.project.format === 'esm' %}
|
|
39
|
-
|
|
40
|
-
export default async () => {
|
|
41
|
-
|
|
42
|
-
let schema = inputSchema;
|
|
43
|
-
let initial;
|
|
44
|
-
|
|
45
|
-
{% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
|
|
46
|
-
const fargs = get_fargs(process.argv.slice(2));
|
|
47
|
-
const ftags = get_ftags(process.argv.slice(2));
|
|
48
|
-
|
|
49
|
-
if (fargs) {
|
|
50
|
-
const { default: fnetConfig } = await import("@fnet/config");
|
|
51
|
-
const config = await fnetConfig({ name: fargs, tags: ftags });
|
|
52
|
-
if (config?.data) {
|
|
53
|
-
initial=config.data;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
{% endif %}
|
|
57
|
-
|
|
58
|
-
const packageCallback = async () => {
|
|
59
|
-
const { default: url } = await import("node:url");
|
|
60
|
-
const { default: path } = await import("node:path");
|
|
61
|
-
const { default: fs } = await import("node:fs");
|
|
62
|
-
let currentDir = path.dirname(url.fileURLToPath(import.meta.url));
|
|
63
|
-
let firstPackageJson = path.join(currentDir, "package.json");
|
|
64
|
-
while (currentDir !== path.parse(currentDir).root && !fs.existsSync(firstPackageJson)) {
|
|
65
|
-
currentDir = path.dirname(currentDir);
|
|
66
|
-
firstPackageJson = path.join(currentDir, "package.json");
|
|
67
|
-
}
|
|
68
|
-
if (!fs.existsSync(firstPackageJson)) return {
|
|
69
|
-
name: "Unknown",
|
|
70
|
-
version: "Unknown"
|
|
71
|
-
}
|
|
72
|
-
else return await JSON.parse(fs.readFileSync(firstPackageJson, "utf8"));
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return await fnetArgs({schema,initial,validate,packageCallback});
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
{% elif atom.doc.features.project.format === 'cjs' %}
|
|
79
|
-
|
|
80
|
-
module.exports = async () => {
|
|
81
|
-
|
|
82
|
-
let schema = inputSchema;
|
|
83
|
-
let initial;
|
|
84
|
-
|
|
85
|
-
{% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
|
|
86
|
-
const fargs = get_fargs(process.argv.slice(2));
|
|
87
|
-
const ftags = get_ftags(process.argv.slice(2));
|
|
88
|
-
|
|
89
|
-
if (fargs) {
|
|
90
|
-
const { default: fnetConfig } = await import("@fnet/config");
|
|
91
|
-
const config = await fnetConfig({ name: fargs, tags: ftags });
|
|
92
|
-
if (config?.data) {
|
|
93
|
-
initial=config.data;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
{% endif %}
|
|
97
|
-
|
|
98
|
-
const packageCallback = async () => {
|
|
99
|
-
const path = require("node:path");
|
|
100
|
-
const fs = require("node:fs");
|
|
101
|
-
|
|
102
|
-
let currentDir = __dirname;
|
|
103
|
-
let firstPackageJson = path.join(currentDir, "package.json");
|
|
104
|
-
|
|
105
|
-
while (currentDir !== path.parse(currentDir).root && !fs.existsSync(firstPackageJson)) {
|
|
106
|
-
currentDir = path.dirname(currentDir);
|
|
107
|
-
firstPackageJson = path.join(currentDir, "package.json");
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (!fs.existsSync(firstPackageJson)) {
|
|
111
|
-
return {
|
|
112
|
-
name: "Unknown",
|
|
113
|
-
version: "Unknown"
|
|
114
|
-
};
|
|
115
|
-
} else {
|
|
116
|
-
return JSON.parse(fs.readFileSync(firstPackageJson, "utf8"));
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return await fnetArgs({schema,initial,validate,packageCallback});
|
|
121
|
-
};
|
|
122
|
-
{% endif %}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|