sinto 1.6.1 → 1.7.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 CHANGED
@@ -61,6 +61,7 @@ This command is generate public directory from src directory.
61
61
  * sin rmno - Delete node_modules directory
62
62
  * sin ts - Generate tsconfig.json and add dependencies
63
63
  * sin web - Generate HTML and empty CSS files
64
+ * sin esbuild - Generate esbuild project
64
65
 
65
66
  The Default task manager is gulp. Development serve is browser-sync.
66
67
 
@@ -169,3 +170,47 @@ sin init
169
170
  sin ts
170
171
  npm i
171
172
  ```
173
+
174
+ ## ESBuild project generator
175
+
176
+ The sin esbuild command generate a esbuild project.
177
+
178
+ Using:
179
+
180
+ ```cmd
181
+ sin esbuild
182
+ pnpm i
183
+ pnpm dev
184
+ pnpm start
185
+ ```
186
+
187
+ Generated directories and files:
188
+
189
+ ```txt
190
+ app01/
191
+ |-public/
192
+ | |-index.html
193
+ | `-style.css
194
+ |-src/
195
+ | `-index.js
196
+ |-package.json
197
+ `-README.md
198
+ ```
199
+
200
+ Update the src/app.ts your index file.
201
+
202
+ Example:
203
+
204
+ * src/app.ts
205
+ * src/index.ts
206
+ * src/app.js
207
+ * src/index.js
208
+ * src/script.js
209
+
210
+ To build production run next command:
211
+
212
+ ```cmd
213
+ pnpm build
214
+ ```
215
+
216
+ This command is generate dist directory from src directory. The build command not copy the public directory.
@@ -0,0 +1,19 @@
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.ts --outdir=public --bundle --watch",
9
+ "build": "npx esbuild src/app.ts --outdir=dist --bundle --minify"
10
+ },
11
+ "dependencies": {
12
+ "bootstrap": "^5.3.3"
13
+ },
14
+ "devDependencies": {
15
+ "esbuild": "^0.23.1",
16
+ "browser-sync": "^3.0.2"
17
+ }
18
+ }
19
+
@@ -0,0 +1,18 @@
1
+
2
+ module.exports = `
3
+ <!DOCTYPE html>
4
+ <html lang="hu">
5
+ <head>
6
+ <meta charset="UTF-8">
7
+ <title>Sinto esbuild</title>
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <h1>Sinto</h1>
12
+ <p>The website generated by Sinto.</p>
13
+
14
+ </div>
15
+ <script src="app.js"></script>
16
+ </body>
17
+ </html>
18
+ `
@@ -0,0 +1,47 @@
1
+ const { debug } = require('../config.json')
2
+ const { createFile, createDirectory } = require('../tools/tools.js');
3
+ const jsonfile = require('jsonfile');
4
+
5
+ const swcPackageContent = require('./contents/esbuildPackage.json');
6
+ const indexHtmlContent = require('./contents/indexHtml.js');
7
+ const defaultBsconfigContent = require('./generators/genBsconfig.js');
8
+
9
+ const createEsbuildProject = () => {
10
+ const dir = process.cwd();
11
+
12
+ createDirectory(`${dir}/src`);
13
+ createDirectory(`${dir}/public`);
14
+ createDirectory(`${dir}/public/assets`);
15
+
16
+ createFile(`${dir}/public/index.html`, indexHtmlContent);
17
+ createFile(`${dir}/public/style.css`, '');
18
+ createFile(`${dir}/src/app.ts`, '');
19
+
20
+ createFile(`${dir}/README.md`, '# Sinto ESBuild client\n');
21
+
22
+ createPackageJsonFile(dir);
23
+ createBsconfigFile(dir);
24
+
25
+ console.log('ESBuild client created.');
26
+ console.log('Run next commands:');
27
+ console.log(' pnpm i');
28
+ console.log(' pnpm dev');
29
+ console.log(' pnpm start');
30
+ }
31
+
32
+ const createPackageJsonFile = (directory) => {
33
+ const packageJsonPath = `${directory}/package.json`;
34
+ jsonfile.writeFileSync(packageJsonPath, swcPackageContent, { spaces: 2 });
35
+ if(debug) {
36
+ console.log('package.json file created.');
37
+ }
38
+ }
39
+
40
+ const createBsconfigFile = (dir) => {
41
+ const bsconfigPath = `${dir}/bs-config.json`;
42
+ jsonfile.writeFileSync(bsconfigPath, defaultBsconfigContent, { spaces: 2 });
43
+ if(debug)
44
+ console.log('bs-config.json file created.');
45
+ }
46
+
47
+ module.exports.createEsbuildProject = createEsbuildProject;
@@ -0,0 +1,13 @@
1
+
2
+ const bsconfigContent =
3
+ {
4
+ server: [
5
+ "public",
6
+ "node_modules/bootstrap/dist/css",
7
+ "node_modules/bootstrap/dist/js"
8
+ ],
9
+ port: 3000,
10
+ watch: true
11
+ };
12
+
13
+ module.exports = bsconfigContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinto",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Website project development manager",
5
5
  "bin": {
6
6
  "sin": "sin.js"
package/sin.js CHANGED
@@ -7,6 +7,7 @@ const { build } = require('./build/build');
7
7
  const { rmno } = require('./rmno/rmno');
8
8
  const { createApi } = require('./haiserver/apigen');
9
9
  const { createWebpack } = require('./webpack/generate');
10
+ const { createEsbuildProject } = require('./esbuild/generate');
10
11
  const { createPuppeteerTest } = require('./gentest/generate');
11
12
  const { supplementTypescript } = require('./gents/gents');
12
13
  const { createIndexHtmlCssFile } = require('./htmlcss/htmlcss');
@@ -16,7 +17,7 @@ const program = new Command();
16
17
  program
17
18
  .name('sin')
18
19
  .description('Project handler')
19
- .version('1.6.1');
20
+ .version('1.7.0');
20
21
 
21
22
  program
22
23
  .command('init')
@@ -82,4 +83,11 @@ program
82
83
  createIndexHtmlCssFile();
83
84
  })
84
85
 
86
+ program
87
+ .command('esbuild')
88
+ .description('ESBuild client')
89
+ .action(() => {
90
+ createEsbuildProject();
91
+ });
92
+
85
93
  program.parse();