Son aktivite 3 weeks ago

mikemorris bu gisti düzenledi 3 weeks ago. Düzenlemeye git

1 file changed, 9 insertions, 3 deletions

ecosystem.config.cjs

@@ -5,8 +5,14 @@ module.exports = {
5 5 cwd : "/opt/builder"
6 6 },
7 7 {
8 - name : "tailwindcss-compiler",
9 - script : "/opt/builder/tailwindcss-compiler.js",
8 + name : "javascript-compiler",
9 + script : "/opt/builder/javascript-compiler.js",
10 10 cwd : "/opt/builder"
11 - }]
11 + },
12 + {
13 + name : "litjs-compiler",
14 + script : "/opt/builder/litjs-compiler.js",
15 + cwd : "/opt/builder"
16 + },
17 + ]
12 18 }

mikemorris bu gisti düzenledi 3 weeks ago. Düzenlemeye git

1 file changed, 0 insertions, 0 deletions

javascript-esbuild-compiler.js yeniden adlandırıldı litjs-compiler.js

Dosya değişiklik yapılmadan yeniden adlandırıldı

mikemorris bu gisti düzenledi 3 weeks ago. Düzenlemeye git

1 file changed, 6 insertions, 6 deletions

javascript-esbuild-compiler.js

@@ -17,7 +17,7 @@ function log(message) {
17 17 message = `[${datetime}] ${message}\n`;
18 18
19 19 fse.outputFileSync(
20 - '/logs/builder/javascript.log',
20 + '/logs/builder/javascript-lit.log',
21 21 message,
22 22 options
23 23 );
@@ -32,7 +32,7 @@ async function buildJavascript(path) {
32 32
33 33 var jsFolder = path;
34 34 jsFolder = jsFolder.split("/")[3];
35 - const outfile = `/www/js/${jsFolder}.js`
35 + const outfile = `/www/litjs/${jsFolder}.js`
36 36
37 37 const filename = path.split("/").slice(-1).toString()
38 38 const entryPoint = path.replace(filename, 'index.js')
@@ -60,16 +60,16 @@ async function buildJavascript(path) {
60 60 async function compileAll() {
61 61
62 62 const folders = fs
63 - .readdirSync('/app/js', { withFileTypes: true })
63 + .readdirSync('/app/litjs', { withFileTypes: true })
64 64 .filter(entry => entry.isDirectory())
65 65 .map(entry => entry.name);
66 66
67 67 for (const folder of folders) {
68 - const entryPoint = `/app/js/${folder}/index.js`;
68 + const entryPoint = `/app/litjs/${folder}/index.js`;
69 69 if (!fs.existsSync(entryPoint)) {
70 70 continue;
71 71 }
72 - await buildJavascript(`/app/js/${folder}/index.js`);
72 + await buildJavascript(`/app/litjs/${folder}/index.js`);
73 73 }
74 74
75 75 log('Done');
@@ -114,7 +114,7 @@ function startWatcher(watchFolders) {
114 114 async function go() {
115 115
116 116 const watchFolders = [
117 - '/app/js'
117 + '/app/litjs'
118 118 ];
119 119
120 120 if (process.argv[2] === 'compile-and-watch') {

mikemorris bu gisti düzenledi 4 weeks ago. Düzenlemeye git

1 file changed, 24 insertions, 27 deletions

javascript-esbuild-compiler.js

@@ -1,4 +1,5 @@
1 1 import chokidar from 'chokidar';
2 + import fs from 'fs';
2 3 import fse from 'fs-extra';
3 4 import esbuild from 'esbuild';
4 5
@@ -27,32 +28,30 @@ function log(message) {
27 28 // ====================================================================
28 29 // |
29 30 // ====================================================================
30 - async function buildJavascript(name) {
31 + async function buildJavascript(path) {
31 32
32 - const entryPoint = `/app/js/${name}/index.js`;
33 - const outfile = `/www/js/${name}.js`;
33 + var jsFolder = path;
34 + jsFolder = jsFolder.split("/")[3];
35 + const outfile = `/www/js/${jsFolder}.js`
34 36
35 - log(`Building ${name}`);
37 + const filename = path.split("/").slice(-1).toString()
38 + const entryPoint = path.replace(filename, 'index.js')
39 +
40 + log(`Building ${filename}`);
36 41 log(`Entry: ${entryPoint}`);
37 42 log(`Output: ${outfile}`);
38 43
39 44 await esbuild.build({
40 45 entryPoints: [entryPoint],
41 -
42 46 bundle: true,
43 -
44 47 outfile,
45 -
46 48 format: 'esm',
47 -
48 49 sourcemap: true,
49 -
50 50 target: ['es2022'],
51 -
52 51 logLevel: 'info'
53 52 });
54 53
55 - log(`Finished ${name}`);
54 + log(`Finished ${filename}`);
56 55 }
57 56
58 57 // ====================================================================
@@ -60,8 +59,18 @@ async function buildJavascript(name) {
60 59 // ====================================================================
61 60 async function compileAll() {
62 61
63 - await buildJavascript('component');
64 - await buildJavascript('app');
62 + const folders = fs
63 + .readdirSync('/app/js', { withFileTypes: true })
64 + .filter(entry => entry.isDirectory())
65 + .map(entry => entry.name);
66 +
67 + for (const folder of folders) {
68 + const entryPoint = `/app/js/${folder}/index.js`;
69 + if (!fs.existsSync(entryPoint)) {
70 + continue;
71 + }
72 + await buildJavascript(`/app/js/${folder}/index.js`);
73 + }
65 74
66 75 log('Done');
67 76 }
@@ -84,23 +93,11 @@ function startWatcher(watchFolders) {
84 93 );
85 94
86 95 watcher.on('all', async (event, filePath) => {
87 -
88 96 log(`${event}: ${filePath}`);
89 -
90 97 try {
91 -
92 - if (filePath.includes('/app/js/component/')) {
93 - await buildJavascript('component');
94 - }
95 -
96 - if (filePath.includes('/app/js/app/')) {
97 - await buildJavascript('app');
98 - }
99 -
98 + await buildJavascript(filePath);
100 99 } catch (error) {
101 -
102 100 log(`Build failed: ${error.message}`);
103 -
104 101 }
105 102
106 103 });
@@ -137,4 +134,4 @@ async function go() {
137 134 }
138 135 }
139 136
140 - go();
137 + go();

mikemorris bu gisti düzenledi 4 weeks ago. Düzenlemeye git

1 file changed, 1 insertion

package.json

@@ -8,6 +8,7 @@
8 8 "character-parser": "4.0.0",
9 9 "clean-html": "2.0.1",
10 10 "concat-files": "0.1.1",
11 + "esbuild" : "0.28.2",
11 12 "fast-glob": "3.3.1",
12 13 "fs-extra": "11.1.1",
13 14 "glob": "10.3.10",

mikemorris bu gisti düzenledi 4 weeks ago. Düzenlemeye git

2 files changed, 140 insertions, 109 deletions

javascript-compiler.js.original (dosya silindi)

@@ -1,109 +0,0 @@
1 - import chokidar from 'chokidar';
2 - import fs from 'fs'
3 - import fse from 'fs-extra';
4 - import path from 'path';
5 - import fg from 'fast-glob';
6 -
7 - // ====================================================================
8 - // |
9 - // ====================================================================
10 - function log(message) {
11 - const options = {
12 - encoding: "utf-8",
13 - flag: "a+",
14 - };
15 - const datetime = new Date().toISOString()
16 - message = `[${datetime}] ${message}\n`
17 - fse.outputFileSync('/logs/builder/javascript.log', message, options);
18 - console.log(message)
19 - }
20 -
21 - // ====================================================================
22 - // |
23 - // ====================================================================
24 - function concatJavascript(path) {
25 - log('-----------------------');
26 - log(path);
27 -
28 - var publicPath = path
29 - publicPath = publicPath.replace('/app/js','/www/js')
30 -
31 - var jsFolder = path;
32 - jsFolder = jsFolder.split("/")[3];
33 -
34 - const source = `/app/js/${jsFolder}`
35 - const destination = `/www/js/${jsFolder}.js`
36 - fs.readdir(source, (err, files) => {
37 - if (err) throw err;
38 -
39 - fse.ensureFileSync(destination)
40 - fs.writeFileSync(destination,'')
41 - var sortedfiles = files.sort()
42 - sortedfiles.forEach(file => {
43 - const filePath = `${source}/${file}`
44 - var contents = fs.readFileSync(filePath);
45 - const spacer = `\n// ====================================================================\n// |\n// |\n// | ${file}\n// |\n// |\n// ====================================================================\n`
46 - fs.appendFileSync(destination, spacer+contents)
47 - });
48 - });
49 -
50 - }
51 -
52 - // ====================================================================
53 - // |
54 - // ====================================================================
55 - function compileAll(glob) {
56 - return new Promise((resolve, reject) => {
57 - const javascriptFiles = fg.globSync(glob)
58 - for (const file of javascriptFiles) {
59 - concatJavascript(file);
60 - }
61 - log(`Done`)
62 - });
63 - }
64 -
65 - // ====================================================================
66 - // |
67 - // ====================================================================
68 - function startWatcher(watchFolders) {
69 -
70 - // https://github.com/paulmillr/chokidar
71 - const options = {
72 - awaitFinish: true,
73 - ignoreInitial: true,
74 - usePolling: true,
75 - interval: 100
76 - }
77 -
78 - const watcher = chokidar.watch(watchFolders, options).on('all', (event, path) => {
79 - log(event, path);
80 - });
81 -
82 - watcher
83 - .on('add', path => concatJavascript(path))
84 - .on('change', path => concatJavascript(path))
85 - .on('unlink', path => concatJavascript(path));
86 -
87 - watcher
88 - .on('ready', () => log('********** Watch is running **********'));
89 -
90 - }
91 -
92 - // ====================================================================
93 - // | MAIN
94 - // ====================================================================
95 - async function go() {
96 - const watchFolders = [
97 - '/app/js'
98 - ]
99 - if (process.argv[2] == 'compile-and-watch') {
100 - await compileAll('/app/js/*/**.js')
101 - startWatcher(watchFolders);
102 - } else if(process.argv[2] == 'compile-only') {
103 - await compileAll('/app/js/*/**.js')
104 - } else {
105 - startWatcher(watchFolders);
106 - }
107 - }
108 -
109 - go()

javascript-esbuild-compiler.js(dosya oluşturuldu)

@@ -0,0 +1,140 @@
1 + import chokidar from 'chokidar';
2 + import fse from 'fs-extra';
3 + import esbuild from 'esbuild';
4 +
5 + // ====================================================================
6 + // |
7 + // ====================================================================
8 + function log(message) {
9 + const options = {
10 + encoding: 'utf-8',
11 + flag: 'a+',
12 + };
13 +
14 + const datetime = new Date().toISOString();
15 +
16 + message = `[${datetime}] ${message}\n`;
17 +
18 + fse.outputFileSync(
19 + '/logs/builder/javascript.log',
20 + message,
21 + options
22 + );
23 +
24 + console.log(message);
25 + }
26 +
27 + // ====================================================================
28 + // |
29 + // ====================================================================
30 + async function buildJavascript(name) {
31 +
32 + const entryPoint = `/app/js/${name}/index.js`;
33 + const outfile = `/www/js/${name}.js`;
34 +
35 + log(`Building ${name}`);
36 + log(`Entry: ${entryPoint}`);
37 + log(`Output: ${outfile}`);
38 +
39 + await esbuild.build({
40 + entryPoints: [entryPoint],
41 +
42 + bundle: true,
43 +
44 + outfile,
45 +
46 + format: 'esm',
47 +
48 + sourcemap: true,
49 +
50 + target: ['es2022'],
51 +
52 + logLevel: 'info'
53 + });
54 +
55 + log(`Finished ${name}`);
56 + }
57 +
58 + // ====================================================================
59 + // |
60 + // ====================================================================
61 + async function compileAll() {
62 +
63 + await buildJavascript('component');
64 + await buildJavascript('app');
65 +
66 + log('Done');
67 + }
68 +
69 + // ====================================================================
70 + // |
71 + // ====================================================================
72 + function startWatcher(watchFolders) {
73 +
74 + const options = {
75 + awaitWriteFinish: true,
76 + ignoreInitial: true,
77 + usePolling: true,
78 + interval: 100
79 + };
80 +
81 + const watcher = chokidar.watch(
82 + watchFolders,
83 + options
84 + );
85 +
86 + watcher.on('all', async (event, filePath) => {
87 +
88 + log(`${event}: ${filePath}`);
89 +
90 + try {
91 +
92 + if (filePath.includes('/app/js/component/')) {
93 + await buildJavascript('component');
94 + }
95 +
96 + if (filePath.includes('/app/js/app/')) {
97 + await buildJavascript('app');
98 + }
99 +
100 + } catch (error) {
101 +
102 + log(`Build failed: ${error.message}`);
103 +
104 + }
105 +
106 + });
107 +
108 + watcher.on(
109 + 'ready',
110 + () => log('********** Watch is running **********')
111 + );
112 + }
113 +
114 + // ====================================================================
115 + // | MAIN
116 + // ====================================================================
117 + async function go() {
118 +
119 + const watchFolders = [
120 + '/app/js'
121 + ];
122 +
123 + if (process.argv[2] === 'compile-and-watch') {
124 +
125 + await compileAll();
126 +
127 + startWatcher(watchFolders);
128 +
129 + } else if (process.argv[2] === 'compile-only') {
130 +
131 + await compileAll();
132 +
133 + } else {
134 +
135 + startWatcher(watchFolders);
136 +
137 + }
138 + }
139 +
140 + go();

mikemorris bu gisti düzenledi 4 weeks ago. Düzenlemeye git

1 file changed, 109 insertions

javascript-compiler.js.original(dosya oluşturuldu)

@@ -0,0 +1,109 @@
1 + import chokidar from 'chokidar';
2 + import fs from 'fs'
3 + import fse from 'fs-extra';
4 + import path from 'path';
5 + import fg from 'fast-glob';
6 +
7 + // ====================================================================
8 + // |
9 + // ====================================================================
10 + function log(message) {
11 + const options = {
12 + encoding: "utf-8",
13 + flag: "a+",
14 + };
15 + const datetime = new Date().toISOString()
16 + message = `[${datetime}] ${message}\n`
17 + fse.outputFileSync('/logs/builder/javascript.log', message, options);
18 + console.log(message)
19 + }
20 +
21 + // ====================================================================
22 + // |
23 + // ====================================================================
24 + function concatJavascript(path) {
25 + log('-----------------------');
26 + log(path);
27 +
28 + var publicPath = path
29 + publicPath = publicPath.replace('/app/js','/www/js')
30 +
31 + var jsFolder = path;
32 + jsFolder = jsFolder.split("/")[3];
33 +
34 + const source = `/app/js/${jsFolder}`
35 + const destination = `/www/js/${jsFolder}.js`
36 + fs.readdir(source, (err, files) => {
37 + if (err) throw err;
38 +
39 + fse.ensureFileSync(destination)
40 + fs.writeFileSync(destination,'')
41 + var sortedfiles = files.sort()
42 + sortedfiles.forEach(file => {
43 + const filePath = `${source}/${file}`
44 + var contents = fs.readFileSync(filePath);
45 + const spacer = `\n// ====================================================================\n// |\n// |\n// | ${file}\n// |\n// |\n// ====================================================================\n`
46 + fs.appendFileSync(destination, spacer+contents)
47 + });
48 + });
49 +
50 + }
51 +
52 + // ====================================================================
53 + // |
54 + // ====================================================================
55 + function compileAll(glob) {
56 + return new Promise((resolve, reject) => {
57 + const javascriptFiles = fg.globSync(glob)
58 + for (const file of javascriptFiles) {
59 + concatJavascript(file);
60 + }
61 + log(`Done`)
62 + });
63 + }
64 +
65 + // ====================================================================
66 + // |
67 + // ====================================================================
68 + function startWatcher(watchFolders) {
69 +
70 + // https://github.com/paulmillr/chokidar
71 + const options = {
72 + awaitFinish: true,
73 + ignoreInitial: true,
74 + usePolling: true,
75 + interval: 100
76 + }
77 +
78 + const watcher = chokidar.watch(watchFolders, options).on('all', (event, path) => {
79 + log(event, path);
80 + });
81 +
82 + watcher
83 + .on('add', path => concatJavascript(path))
84 + .on('change', path => concatJavascript(path))
85 + .on('unlink', path => concatJavascript(path));
86 +
87 + watcher
88 + .on('ready', () => log('********** Watch is running **********'));
89 +
90 + }
91 +
92 + // ====================================================================
93 + // | MAIN
94 + // ====================================================================
95 + async function go() {
96 + const watchFolders = [
97 + '/app/js'
98 + ]
99 + if (process.argv[2] == 'compile-and-watch') {
100 + await compileAll('/app/js/*/**.js')
101 + startWatcher(watchFolders);
102 + } else if(process.argv[2] == 'compile-only') {
103 + await compileAll('/app/js/*/**.js')
104 + } else {
105 + startWatcher(watchFolders);
106 + }
107 + }
108 +
109 + go()

mikemorris bu gisti düzenledi 3 months ago. Düzenlemeye git

1 file changed, 2 insertions, 5 deletions

tailwindcss-compiler.js

@@ -36,11 +36,8 @@ async function build() {
36 36
37 37 try {
38 38 // Input CSS with Tailwind directives
39 - const inputCSS = `
40 - @import "tailwindcss" source(none);
41 - @source "/www/**/*.{html,js}";
42 - `;
43 -
39 + const inputCSS = fs.readFileSync('/app/css/tailwind/input.css', 'utf8');
40 +
44 41 // Process with PostCSS
45 42 const result = await postcss([
46 43 tailwindcss(tailwindoptions),

mikemorris bu gisti düzenledi 3 months ago. Düzenlemeye git

1 file changed, 1 insertion, 5 deletions

tailwindcss-compiler.js

@@ -27,14 +27,10 @@ async function build() {
27 27 log('-----------------------');
28 28
29 29 const tailwindoptions = {
30 - prefix: 'tw-',
31 30 content: [],
32 31 theme: {
33 32 extend: {},
34 - },
35 - corePlugins: {
36 - preflight: false
37 - },
33 + },
38 34 plugins: [],
39 35 };
40 36

mikemorris bu gisti düzenledi 3 months ago. Düzenlemeye git

1 file changed, 7 insertions, 7 deletions

tailwindcss-compiler.js

@@ -29,13 +29,13 @@ async function build() {
29 29 const tailwindoptions = {
30 30 prefix: 'tw-',
31 31 content: [],
32 - theme: {
33 - extend: {},
34 - },
35 - corePlugins: {
36 - preflight: false
37 - },
38 - plugins: [],
32 + theme: {
33 + extend: {},
34 + },
35 + corePlugins: {
36 + preflight: false
37 + },
38 + plugins: [],
39 39 };
40 40
41 41 try {
Daha yeni Daha eski