sinto 1.8.1 → 1.10.0
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 +55 -18
- package/esbuild/contents/esbuildPackage.json +8 -2
- package/esbuild/contents/esbuildPackageJs.json +25 -0
- package/esbuild/contents/gitignoreContent.js +7 -0
- package/esbuild/contents/indexHtml.js +13 -0
- package/esbuild/generate.js +37 -9
- package/javafx/appContent.js +46 -0
- package/javafx/generate.js +33 -0
- package/javafx/gitignoreContent.js +8 -0
- package/javafx/launchContent.js +17 -0
- package/javafx/setJavafxPath.js +51 -0
- package/javafx/settingsContent.js +10 -0
- package/package.json +3 -2
- package/sin.js +13 -4
package/README.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
# Sinto
|
|
1
|
+
# Sinto project management
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Development in the src directory.
|
|
6
|
-
* Publishing from the public directory.
|
|
3
|
+
A generateable web application using JavaScirpt and TypeScript, and a JavaFX form application for VSCode.
|
|
7
4
|
|
|
8
5
|
GitHub:
|
|
9
6
|
|
|
@@ -63,12 +60,13 @@ This command is generate public directory from src directory.
|
|
|
63
60
|
* sin ts - Initialize TypeScript Node.js project
|
|
64
61
|
* sin web - Generate HTML and empty CSS files
|
|
65
62
|
* sin esbuild - Generate esbuild project
|
|
63
|
+
* sin javafx - Generate JavaFX project
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
For web application, the default task manager is gulp. Development serve is browser-sync.
|
|
68
66
|
|
|
69
67
|
## Fake REST API server
|
|
70
68
|
|
|
71
|
-
The sin api command generate fake REST API project directory.
|
|
69
|
+
The sin api command generate fake REST API project directory with hai-server.
|
|
72
70
|
|
|
73
71
|
Using:
|
|
74
72
|
|
|
@@ -209,9 +207,31 @@ Using:
|
|
|
209
207
|
|
|
210
208
|
```cmd
|
|
211
209
|
sin esbuild
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
npm i
|
|
211
|
+
npm run dev
|
|
212
|
+
npm start
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Generated directories and files:
|
|
216
|
+
|
|
217
|
+
```txt
|
|
218
|
+
app01/
|
|
219
|
+
|-public/
|
|
220
|
+
| |-index.html
|
|
221
|
+
| `-style.css
|
|
222
|
+
|-src/
|
|
223
|
+
| `-index.ts
|
|
224
|
+
|-package.json
|
|
225
|
+
`-README.md
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Or, create JavaScript client:
|
|
229
|
+
|
|
230
|
+
```cmd
|
|
231
|
+
sin esbuild -j
|
|
232
|
+
npm i
|
|
233
|
+
npm run dev
|
|
234
|
+
npm start
|
|
215
235
|
```
|
|
216
236
|
|
|
217
237
|
Generated directories and files:
|
|
@@ -227,20 +247,37 @@ app01/
|
|
|
227
247
|
`-README.md
|
|
228
248
|
```
|
|
229
249
|
|
|
230
|
-
|
|
250
|
+
To development run next command:
|
|
231
251
|
|
|
232
|
-
|
|
252
|
+
```cmd
|
|
253
|
+
npm run dev
|
|
254
|
+
```
|
|
233
255
|
|
|
234
|
-
|
|
235
|
-
* src/index.ts
|
|
236
|
-
* src/app.js
|
|
237
|
-
* src/index.js
|
|
238
|
-
* src/script.js
|
|
256
|
+
This command is generate in public directory an app.js file from src directory.
|
|
239
257
|
|
|
240
258
|
To build production run next command:
|
|
241
259
|
|
|
242
260
|
```cmd
|
|
243
|
-
|
|
261
|
+
npm run build
|
|
244
262
|
```
|
|
245
263
|
|
|
246
264
|
This command is generate dist directory from src directory. The build command not copy the public directory.
|
|
265
|
+
|
|
266
|
+
## JavaFX project generator
|
|
267
|
+
|
|
268
|
+
The **sin javafx** command generate a JavaFX project. The generated project willl be a package generated with **No build tools** for VSCode.
|
|
269
|
+
|
|
270
|
+
Steps to use:
|
|
271
|
+
|
|
272
|
+
* Create project directory. For example: **mkdir app01**
|
|
273
|
+
* Change directory to project directory. For example: **cd app01**
|
|
274
|
+
* Create a JavaFX project with the **sin javafx** command.
|
|
275
|
+
* Copy to lib dirctory JavaFX libraries.
|
|
276
|
+
* Open project directory with VSCode: code .
|
|
277
|
+
* Add Configuration with VSCode: **Run** > **Add Configuration..**
|
|
278
|
+
* Save the .vscode/launch.json file.
|
|
279
|
+
* Run project with VSCode: **Run** > **Run** This will fail.
|
|
280
|
+
* Set the JavaFX path. For example: **sin javafx -p lib/javafx**
|
|
281
|
+
* Open the mainScedne.fmxl file, and add components, and save.
|
|
282
|
+
|
|
283
|
+
Change the path to your JavaFX path.
|
|
@@ -6,14 +6,20 @@
|
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
7
|
"start": "browser-sync start --config bs-config.json",
|
|
8
8
|
"dev": "npx esbuild src/app.ts --outdir=public --bundle --watch",
|
|
9
|
-
"build": "npx esbuild src/app.ts --outdir=dist --bundle --minify"
|
|
9
|
+
"build:src": "npx esbuild src/app.ts --outdir=dist --bundle --minify",
|
|
10
|
+
"build:htmlcss": "cpx public/**/*.{html,css,png} dist",
|
|
11
|
+
"build:bscss": "cpx node_modules/bootstrap/dist/css/bootstrap.css dist",
|
|
12
|
+
"build:bsjs": "cpx node_modules/bootstrap/dist/js/bootstrap.js dist",
|
|
13
|
+
"build": "npm-run-all build:*"
|
|
10
14
|
},
|
|
11
15
|
"dependencies": {
|
|
12
16
|
"bootstrap": "^5.3.3"
|
|
13
17
|
},
|
|
14
18
|
"devDependencies": {
|
|
15
19
|
"esbuild": "^0.23.1",
|
|
16
|
-
"browser-sync": "^3.0.2"
|
|
20
|
+
"browser-sync": "^3.0.2",
|
|
21
|
+
"cpx": "^1.5.0",
|
|
22
|
+
"npm-run-all": "^4.1.5"
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sinto-project",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A project created by the Sinto command",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
+
"start": "browser-sync start --config bs-config.json",
|
|
8
|
+
"dev": "npx esbuild src/app.js --outdir=public --bundle --watch",
|
|
9
|
+
"build:src": "npx esbuild src/app.js --outdir=dist --bundle --minify",
|
|
10
|
+
"build:htmlcss": "cpx public/**/*.{html,css,png} dist",
|
|
11
|
+
"build:bscss": "cpx node_modules/bootstrap/dist/css/bootstrap.css dist",
|
|
12
|
+
"build:bsjs": "cpx node_modules/bootstrap/dist/js/bootstrap.js dist",
|
|
13
|
+
"build": "npm-run-all build:*"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"bootstrap": "^5.3.3"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"esbuild": "^0.23.1",
|
|
20
|
+
"browser-sync": "^3.0.2",
|
|
21
|
+
"cpx": "^1.5.0",
|
|
22
|
+
"npm-run-all": "^4.1.5"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
module.exports = `
|
|
3
|
+
<!--
|
|
4
|
+
File: index.html
|
|
5
|
+
Author: Vezetéknév Keresztnév
|
|
6
|
+
Copyright: 2024, Vezetéknév Keresztnév
|
|
7
|
+
Group: Csoportnév
|
|
8
|
+
Date: 2024-12-02
|
|
9
|
+
Github: https://github.com/valami12345/
|
|
10
|
+
Licenc: MIT
|
|
11
|
+
-->
|
|
12
|
+
|
|
3
13
|
<!DOCTYPE html>
|
|
4
14
|
<html lang="hu">
|
|
5
15
|
<head>
|
|
6
16
|
<meta charset="UTF-8">
|
|
7
17
|
<title>Sinto esbuild</title>
|
|
18
|
+
<link rel="stylesheet" href="bootstrap.css">
|
|
19
|
+
<link rel="stylesheet" href="style.css">
|
|
8
20
|
</head>
|
|
9
21
|
<body>
|
|
10
22
|
<div class="container">
|
|
@@ -12,6 +24,7 @@ module.exports = `
|
|
|
12
24
|
<p>The website generated by Sinto.</p>
|
|
13
25
|
|
|
14
26
|
</div>
|
|
27
|
+
<script src="bootstrap.js"></script>
|
|
15
28
|
<script src="app.js"></script>
|
|
16
29
|
</body>
|
|
17
30
|
</html>
|
package/esbuild/generate.js
CHANGED
|
@@ -3,10 +3,28 @@ const { createFile, createDirectory } = require('../tools/tools.js');
|
|
|
3
3
|
const jsonfile = require('jsonfile');
|
|
4
4
|
|
|
5
5
|
const swcPackageContent = require('./contents/esbuildPackage.json');
|
|
6
|
+
const swcPackageJsContent = require('./contents/esbuildPackageJs.json');
|
|
6
7
|
const indexHtmlContent = require('./contents/indexHtml.js');
|
|
7
8
|
const defaultBsconfigContent = require('./generators/genBsconfig.js');
|
|
9
|
+
const gitignoreContent = require('./contents/gitignoreContent');
|
|
10
|
+
|
|
11
|
+
const createEsbuildProject = (options) => {
|
|
12
|
+
if(options.javascript === true && options.typescript === true) {
|
|
13
|
+
console.log('JavaScript or TypeScript project?');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let typescript = true;
|
|
17
|
+
if(options.javascript === false && options.typescript === false) {
|
|
18
|
+
console.log('TypeScript project creating...');
|
|
19
|
+
}
|
|
20
|
+
if(options.javascript === true) {
|
|
21
|
+
console.log('JavaScript project creating...');
|
|
22
|
+
typescript = false;
|
|
23
|
+
}
|
|
24
|
+
if(options.typescript === true) {
|
|
25
|
+
console.log('TypeScript project creating...');
|
|
26
|
+
}
|
|
8
27
|
|
|
9
|
-
const createEsbuildProject = () => {
|
|
10
28
|
const dir = process.cwd();
|
|
11
29
|
|
|
12
30
|
createDirectory(`${dir}/src`);
|
|
@@ -14,24 +32,34 @@ const createEsbuildProject = () => {
|
|
|
14
32
|
createDirectory(`${dir}/public/assets`);
|
|
15
33
|
|
|
16
34
|
createFile(`${dir}/public/index.html`, indexHtmlContent);
|
|
17
|
-
createFile(`${dir}/public/style.css`, '');
|
|
18
|
-
|
|
35
|
+
createFile(`${dir}/public/style.css`, '');
|
|
36
|
+
|
|
37
|
+
if(typescript) {
|
|
38
|
+
createFile(`${dir}/src/app.ts`, '');
|
|
39
|
+
}else {
|
|
40
|
+
createFile(`${dir}/src/app.js`, '');
|
|
41
|
+
}
|
|
19
42
|
|
|
20
43
|
createFile(`${dir}/README.md`, '# Sinto ESBuild client\n');
|
|
21
44
|
|
|
22
|
-
createPackageJsonFile(dir);
|
|
45
|
+
createPackageJsonFile(dir, typescript);
|
|
23
46
|
createBsconfigFile(dir);
|
|
47
|
+
createFile(`${dir}/.gitignore`, gitignoreContent);
|
|
24
48
|
|
|
25
49
|
console.log('ESBuild client created.');
|
|
26
50
|
console.log('Run next commands:');
|
|
27
|
-
console.log('
|
|
28
|
-
console.log('
|
|
29
|
-
console.log('
|
|
51
|
+
console.log(' npm i');
|
|
52
|
+
console.log(' npm run dev');
|
|
53
|
+
console.log(' npm start');
|
|
30
54
|
}
|
|
31
55
|
|
|
32
|
-
const createPackageJsonFile = (directory) => {
|
|
56
|
+
const createPackageJsonFile = (directory, typescript) => {
|
|
33
57
|
const packageJsonPath = `${directory}/package.json`;
|
|
34
|
-
|
|
58
|
+
if(typescript) {
|
|
59
|
+
jsonfile.writeFileSync(packageJsonPath, swcPackageContent, { spaces: 2 });
|
|
60
|
+
}else {
|
|
61
|
+
jsonfile.writeFileSync(packageJsonPath, swcPackageJsContent, { spaces: 2 });
|
|
62
|
+
}
|
|
35
63
|
if(debug) {
|
|
36
64
|
console.log('package.json file created.');
|
|
37
65
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const appContent = `
|
|
2
|
+
import javafx.application.Application;
|
|
3
|
+
import javafx.fxml.FXMLLoader;
|
|
4
|
+
import javafx.scene.Parent;
|
|
5
|
+
import javafx.scene.Scene;
|
|
6
|
+
import javafx.stage.Stage;
|
|
7
|
+
|
|
8
|
+
import java.io.IOException;
|
|
9
|
+
|
|
10
|
+
public class App extends Application {
|
|
11
|
+
|
|
12
|
+
private static Scene scene;
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public void start(Stage stage) throws IOException {
|
|
16
|
+
scene = new Scene(loadFxml("mainScene"), 640, 480);
|
|
17
|
+
stage.setScene(scene);
|
|
18
|
+
stage.show();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static void setRoot(String fileName) throws IOException {
|
|
22
|
+
scene.setRoot(loadFxml(fileName));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private static Parent loadFxml(String fileName) {
|
|
26
|
+
try {
|
|
27
|
+
return tryLoadFxml(fileName);
|
|
28
|
+
} catch (IOException e) {
|
|
29
|
+
System.err.println("Unable to load FXML file: " + fileName);
|
|
30
|
+
System.err.println(e.getMessage());
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private static Parent tryLoadFxml(String fileName) throws IOException {
|
|
36
|
+
FXMLLoader loader = new FXMLLoader(App.class.getResource(fileName + ".fxml"));
|
|
37
|
+
return loader.load();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public static void main(String[] args) {
|
|
41
|
+
launch();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
module.exports = appContent
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const { createFile, createDirectory } = require('../tools/tools.js');
|
|
2
|
+
const appContent = require('./appContent');
|
|
3
|
+
const settingsContent = require('./settingsContent');
|
|
4
|
+
const launchContent = require('./launchContent');
|
|
5
|
+
const gitignoreContent = require('./gitignoreContent');
|
|
6
|
+
const { exit } = require('browser-sync');
|
|
7
|
+
const { setJavafxPath } = require('./setJavafxPath');
|
|
8
|
+
|
|
9
|
+
const createJavafxProject = (argv) => {
|
|
10
|
+
|
|
11
|
+
if (argv.path != undefined) {
|
|
12
|
+
setJavafxPath(argv.path);
|
|
13
|
+
exit(0);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const dir = process.cwd();
|
|
17
|
+
createDirectory(`${dir}/.vscode`);
|
|
18
|
+
createDirectory(`${dir}/lib`);
|
|
19
|
+
createDirectory(`${dir}/src`);
|
|
20
|
+
createFile(`${dir}/src/App.java`, appContent);
|
|
21
|
+
createFile(`${dir}/.vscode/settings.json`, settingsContent);
|
|
22
|
+
|
|
23
|
+
createFile(`${dir}/src/mainScene.fxml`, '');
|
|
24
|
+
|
|
25
|
+
createFile(`${dir}/README.md`, '# Sinto JavaFX project\n');
|
|
26
|
+
createFile(`${dir}/.vscode/launch.json`, launchContent);
|
|
27
|
+
|
|
28
|
+
createFile(`${dir}/.gitignore`, gitignoreContent);
|
|
29
|
+
createFile(`${dir}/lib/.gitkeep`, '');
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports.createJavafxProject = createJavafxProject;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const launchContent = `
|
|
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
|
+
"type": "java",
|
|
10
|
+
"name": "Current File",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"mainClass": "\${file}"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
module.exports = launchContent
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const {debug} = require('../config.json');
|
|
2
|
+
const { read } = require("fs-extra");
|
|
3
|
+
const jsonfile = require('jsonfile');
|
|
4
|
+
const hjson = require('hjson');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const setJavafxPath = (path) => {
|
|
8
|
+
const dir = process.cwd();
|
|
9
|
+
|
|
10
|
+
readJsonFile(`${dir}/.vscode/launch.json`).then((data) => {
|
|
11
|
+
var obj = hjson.parse(data);
|
|
12
|
+
obj.configurations.forEach( conf => {
|
|
13
|
+
conf.vmArgs = `--module-path ${path} --add-modules javafx.controls,javafx.fxml`;
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var newData = hjson.stringify(obj, {space: 2, quotes: 'all', separator: true});
|
|
18
|
+
console.log('newData: ', newData);
|
|
19
|
+
writeJsonFile(`${dir}/.vscode/launch.json`, newData);
|
|
20
|
+
console.log('launch.json updated.');
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function readJsonFile(filePath) {
|
|
25
|
+
try {
|
|
26
|
+
|
|
27
|
+
const data = await fs.promises.readFile(filePath, 'utf8');
|
|
28
|
+
if(debug) {
|
|
29
|
+
console.log(`Readed JSON file`);
|
|
30
|
+
}
|
|
31
|
+
return data;
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.error(`Error! Failed to read ${filePath}`);
|
|
34
|
+
console.error(err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function writeJsonFile(path, data) {
|
|
39
|
+
try {
|
|
40
|
+
await fs.promises.writeFile(path, data);
|
|
41
|
+
if(debug) {
|
|
42
|
+
console.log(`Written new JSON file: ${path}`);
|
|
43
|
+
console.log(obj);
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error('Error! Failed to write package.json:');
|
|
47
|
+
console.error(err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports.setJavafxPath = setJavafxPath
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sinto",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"description": "Project development manager for web and JavaFX",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sin": "sin.js"
|
|
7
7
|
},
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"commander": "^12.1.0",
|
|
16
16
|
"fs-extra": "^11.2.0",
|
|
17
17
|
"gulp": "^5.0.0",
|
|
18
|
+
"hjson": "^3.2.2",
|
|
18
19
|
"jsonfile": "^6.1.0",
|
|
19
20
|
"yargs": "^17.7.2"
|
|
20
21
|
},
|
package/sin.js
CHANGED
|
@@ -18,7 +18,7 @@ const program = new Command();
|
|
|
18
18
|
program
|
|
19
19
|
.name('sin')
|
|
20
20
|
.description('Project handler')
|
|
21
|
-
.version('1.
|
|
21
|
+
.version('1.10.0');
|
|
22
22
|
|
|
23
23
|
program
|
|
24
24
|
.command('init')
|
|
@@ -84,7 +84,6 @@ program
|
|
|
84
84
|
initTypescriptProject();
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
-
|
|
88
87
|
program
|
|
89
88
|
.command('web')
|
|
90
89
|
.description('HTML és üres CSS fájl')
|
|
@@ -95,8 +94,18 @@ program
|
|
|
95
94
|
program
|
|
96
95
|
.command('esbuild')
|
|
97
96
|
.description('ESBuild client')
|
|
98
|
-
.
|
|
99
|
-
|
|
97
|
+
.option('-j, --javascript', 'JavaScript application')
|
|
98
|
+
.option('-t, --typescript', 'TypeScript application (default)')
|
|
99
|
+
.action((options) => {
|
|
100
|
+
createEsbuildProject(options);
|
|
100
101
|
});
|
|
101
102
|
|
|
103
|
+
program
|
|
104
|
+
.command('javafx')
|
|
105
|
+
.description('JavaFX project No build tools')
|
|
106
|
+
.option('-p, --path [path]', 'Path to javafx')
|
|
107
|
+
.action(( options ) => {
|
|
108
|
+
createJavafxProject(options);
|
|
109
|
+
})
|
|
110
|
+
|
|
102
111
|
program.parse();
|