sinto 1.10.2 → 1.11.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 +27 -61
- package/package.json +1 -1
- package/sin.js +1 -17
- package/addts/addts.js +0 -43
- package/addts/tsconfigContent.js +0 -13
- package/javafx/appContent.js +0 -46
- package/javafx/generate.js +0 -33
- package/javafx/gitignoreContent.js +0 -8
- package/javafx/launchContent.js +0 -17
- package/javafx/setJavafxPath.js +0 -51
- package/javafx/settingsContent.js +0 -10
package/README.md
CHANGED
|
@@ -53,14 +53,15 @@ This command is generate public directory from src directory.
|
|
|
53
53
|
* sin serve - Start development server
|
|
54
54
|
* sin build - Start public generation
|
|
55
55
|
* sin rmno - Delete node_modules directory
|
|
56
|
-
* sin api -
|
|
56
|
+
* sin api - Adding fake REST API with hai-server
|
|
57
|
+
* sin pup - Adding Puppeteer test with Mocha
|
|
58
|
+
|
|
59
|
+
Standalone server generators:
|
|
60
|
+
|
|
57
61
|
* sin webpack - Generate Webpack project
|
|
58
|
-
* sin
|
|
59
|
-
* sin addts - Generate tsconfig.json and add dependencies
|
|
60
|
-
* sin ts - Initialize TypeScript Node.js project
|
|
62
|
+
* sin ts - Generate TypeScript Node.js project
|
|
61
63
|
* sin web - Generate HTML and empty CSS files
|
|
62
64
|
* sin esbuild - Generate esbuild project
|
|
63
|
-
* sin javafx - Generate JavaFX project
|
|
64
65
|
|
|
65
66
|
For web application, the default task manager is gulp. Development serve is browser-sync.
|
|
66
67
|
|
|
@@ -85,34 +86,6 @@ app01/
|
|
|
85
86
|
`-README.md
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
## Webpack project generator
|
|
89
|
-
|
|
90
|
-
The sin webpack command generate a webpack project.
|
|
91
|
-
|
|
92
|
-
Using:
|
|
93
|
-
|
|
94
|
-
```cmd
|
|
95
|
-
sin webpack
|
|
96
|
-
npm i
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Generated directories and files:
|
|
100
|
-
|
|
101
|
-
```txt
|
|
102
|
-
app01/
|
|
103
|
-
|-assets/
|
|
104
|
-
|-dist/
|
|
105
|
-
| `-index.html
|
|
106
|
-
|-src/
|
|
107
|
-
| |-js/
|
|
108
|
-
| | `-index.js
|
|
109
|
-
| `-scss/
|
|
110
|
-
| `-style.scss
|
|
111
|
-
|-package.json
|
|
112
|
-
|-README.md
|
|
113
|
-
`-webpack.config.js
|
|
114
|
-
```
|
|
115
|
-
|
|
116
89
|
## Puppeteer test with Mocha
|
|
117
90
|
|
|
118
91
|
The **sin pup** command generate a Puppeteer test with Mocha default test file.
|
|
@@ -156,23 +129,35 @@ Write the tests in test directory and run the tests:
|
|
|
156
129
|
npm test
|
|
157
130
|
```
|
|
158
131
|
|
|
159
|
-
##
|
|
160
|
-
|
|
161
|
-
### TypeScript config and dependencies
|
|
162
|
-
|
|
163
|
-
The **sin addts** command generate a tsconfig.json and add dependencies to package.json.
|
|
132
|
+
## Webpack project generator
|
|
164
133
|
|
|
165
|
-
The
|
|
134
|
+
The sin webpack command generate a webpack project.
|
|
166
135
|
|
|
167
136
|
Using:
|
|
168
137
|
|
|
169
138
|
```cmd
|
|
170
|
-
sin
|
|
171
|
-
sin addts
|
|
139
|
+
sin webpack
|
|
172
140
|
npm i
|
|
173
141
|
```
|
|
174
142
|
|
|
175
|
-
|
|
143
|
+
Generated directories and files:
|
|
144
|
+
|
|
145
|
+
```txt
|
|
146
|
+
app01/
|
|
147
|
+
|-assets/
|
|
148
|
+
|-dist/
|
|
149
|
+
| `-index.html
|
|
150
|
+
|-src/
|
|
151
|
+
| |-js/
|
|
152
|
+
| | `-index.js
|
|
153
|
+
| `-scss/
|
|
154
|
+
| `-style.scss
|
|
155
|
+
|-package.json
|
|
156
|
+
|-README.md
|
|
157
|
+
`-webpack.config.js
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## TypeScript
|
|
176
161
|
|
|
177
162
|
The **sin ts** command generate a TypeScript Node.js project.
|
|
178
163
|
|
|
@@ -262,22 +247,3 @@ npm run build
|
|
|
262
247
|
```
|
|
263
248
|
|
|
264
249
|
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.
|
package/package.json
CHANGED
package/sin.js
CHANGED
|
@@ -9,7 +9,6 @@ const { createApi } = require('./haiserver/apigen');
|
|
|
9
9
|
const { createWebpack } = require('./webpack/generate');
|
|
10
10
|
const { createEsbuildProject } = require('./esbuild/generate');
|
|
11
11
|
const { createPuppeteerTest } = require('./gentest/generate');
|
|
12
|
-
const { supplementTypescript } = require('./addts/addts');
|
|
13
12
|
const { initTypescriptProject } = require('./gents/gents');
|
|
14
13
|
const { createIndexHtmlCssFile } = require('./htmlcss/htmlcss');
|
|
15
14
|
|
|
@@ -18,7 +17,7 @@ const program = new Command();
|
|
|
18
17
|
program
|
|
19
18
|
.name('sin')
|
|
20
19
|
.description('Project handler')
|
|
21
|
-
.version('1.
|
|
20
|
+
.version('1.11.0');
|
|
22
21
|
|
|
23
22
|
program
|
|
24
23
|
.command('init')
|
|
@@ -70,13 +69,6 @@ program
|
|
|
70
69
|
await createPuppeteerTest();
|
|
71
70
|
})
|
|
72
71
|
|
|
73
|
-
program
|
|
74
|
-
.command('addts')
|
|
75
|
-
.description('Supplement with TypeScript')
|
|
76
|
-
.action(() => {
|
|
77
|
-
supplementTypescript();
|
|
78
|
-
})
|
|
79
|
-
|
|
80
72
|
program
|
|
81
73
|
.command('ts')
|
|
82
74
|
.description('Initialize TypeScript Node.js project')
|
|
@@ -98,14 +90,6 @@ program
|
|
|
98
90
|
.option('-t, --typescript', 'TypeScript application (default)')
|
|
99
91
|
.action((options) => {
|
|
100
92
|
createEsbuildProject(options);
|
|
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
93
|
})
|
|
110
94
|
|
|
111
95
|
program.parse();
|
package/addts/addts.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const tsconfigContent = require('./tsconfigContent.js');
|
|
2
|
-
const { createFile } = require('../tools/tools.js');
|
|
3
|
-
const jsonfile = require('jsonfile');
|
|
4
|
-
const { addDevDep } = require('../tools/dep.js');
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
|
|
8
|
-
const supplementTypescript = () => {
|
|
9
|
-
writeConfigFile();
|
|
10
|
-
showMsg();
|
|
11
|
-
addDependencies();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const writeConfigFile = () => {
|
|
15
|
-
const dir = process.cwd();
|
|
16
|
-
const path = `${dir}/tsconfig.json`;
|
|
17
|
-
jsonfile.writeFileSync(path, tsconfigContent, { spaces: 2 });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const showMsg = () => {
|
|
21
|
-
console.log(`
|
|
22
|
-
Install dependencies with npm or pnpm command:
|
|
23
|
-
|
|
24
|
-
pnpm install
|
|
25
|
-
`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const addDependencies = () => {
|
|
29
|
-
|
|
30
|
-
const dir = process.cwd();
|
|
31
|
-
const path = `${dir}/package.json`;
|
|
32
|
-
|
|
33
|
-
if (!fs.existsSync(path)) {
|
|
34
|
-
console.log('package.json file does not exist.');
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
addDevDep(path, ['typescript']);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
module.exports.supplementTypescript = supplementTypescript;
|
package/addts/tsconfigContent.js
DELETED
package/javafx/appContent.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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
|
package/javafx/generate.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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;
|
package/javafx/launchContent.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
package/javafx/setJavafxPath.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
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
|