neo.mjs 6.7.8 → 6.8.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/apps/ServiceWorker.mjs +2 -2
- package/apps/form/view/pages/Page2.mjs +1 -1
- package/buildScripts/webpack/development/webpack.config.appworker.mjs +19 -23
- package/buildScripts/webpack/json/myApps.template.json +0 -5
- package/buildScripts/webpack/production/webpack.config.appworker.mjs +13 -21
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/dialog/DemoDialog.mjs +1 -0
- package/examples/dialog/MainContainer.mjs +1 -0
- package/package.json +1 -2
- package/resources/scss/src/dialog/Base.scss +12 -0
- package/resources/scss/src/form/field/Switch.scss +13 -12
- package/resources/scss/theme-dark/form/field/Switch.scss +4 -2
- package/resources/scss/theme-light/form/field/Switch.scss +4 -2
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +5 -2
- package/src/dialog/Base.mjs +58 -2
- package/src/dialog/header/Toolbar.mjs +23 -24
- package/src/form/field/Date.mjs +9 -9
- package/src/form/field/FileUpload.mjs +9 -5
- package/src/form/field/Picker.mjs +32 -64
- package/src/main/DomAccess.mjs +102 -2
- package/buildScripts/webpack/buildMyApps.mjs +0 -128
- package/buildScripts/webpack/development/webpack.config.myapps.mjs +0 -127
- package/buildScripts/webpack/production/webpack.config.myapps.mjs +0 -132
@@ -1,132 +0,0 @@
|
|
1
|
-
import fs from 'fs-extra';
|
2
|
-
import path from 'path';
|
3
|
-
import webpack from 'webpack';
|
4
|
-
|
5
|
-
const cwd = process.cwd(),
|
6
|
-
configPath = path.resolve(cwd, 'buildScripts/myApps.json'),
|
7
|
-
requireJson = path => JSON.parse(fs.readFileSync((path))),
|
8
|
-
packageJson = requireJson(path.resolve(cwd, 'package.json')),
|
9
|
-
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
10
|
-
buildTarget = requireJson(path.resolve(neoPath, 'buildScripts/webpack/production/buildTarget.json')),
|
11
|
-
filenameConfig = requireJson(path.resolve(neoPath, 'buildScripts/webpack/json/build.json')),
|
12
|
-
plugins = [],
|
13
|
-
regexIndexNodeModules = /node_modules/g,
|
14
|
-
regexLineBreak = /(\r\n|\n|\r)/gm,
|
15
|
-
regexTopLevel = /\.\.\//g,
|
16
|
-
regexTrimEnd = /\s+$/gm,
|
17
|
-
regexTrimStart = /^\s+/gm;
|
18
|
-
|
19
|
-
let config;
|
20
|
-
|
21
|
-
if (fs.existsSync(configPath)) {
|
22
|
-
config = requireJson(configPath);
|
23
|
-
} else {
|
24
|
-
const myAppsPath = path.resolve(neoPath, 'buildScripts/webpack/json/myApps.json');
|
25
|
-
|
26
|
-
if (fs.existsSync(myAppsPath)) {
|
27
|
-
config = requireJson(myAppsPath);
|
28
|
-
} else {
|
29
|
-
config = requireJson(path.resolve(neoPath, 'buildScripts/webpack/json/myApps.template.json'));
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
let index = config.apps.indexOf('Docs');
|
34
|
-
|
35
|
-
index > -1 && config.apps.splice(index, 1);
|
36
|
-
|
37
|
-
if (!buildTarget.folder) {
|
38
|
-
buildTarget.folder = 'dist/production';
|
39
|
-
}
|
40
|
-
|
41
|
-
export default env => {
|
42
|
-
let apps = env.apps.split(','),
|
43
|
-
insideNeo = env.insideNeo == 'true',
|
44
|
-
buildAll = apps.includes('all'),
|
45
|
-
choices = [],
|
46
|
-
basePath, content, i, inputPath, outputPath, lAppName, treeLevel, workerBasePath;
|
47
|
-
|
48
|
-
// MicroLoader.mjs
|
49
|
-
inputPath = path.resolve(cwd, 'src/MicroLoader.mjs');
|
50
|
-
outputPath = path.resolve(cwd, buildTarget.folder, 'src/MicroLoader.mjs');
|
51
|
-
|
52
|
-
content = fs.readFileSync(inputPath).toString().replace(/\s/gm, '');
|
53
|
-
fs.mkdirpSync(path.resolve(cwd, buildTarget.folder, 'src/'));
|
54
|
-
fs.writeFileSync(outputPath, content);
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
if (config.apps) {
|
59
|
-
config.apps.forEach(key => {
|
60
|
-
choices.push(key);
|
61
|
-
});
|
62
|
-
|
63
|
-
config.apps.forEach(key => {
|
64
|
-
if (buildAll || choices.length < 2 || apps.includes(key)) {
|
65
|
-
basePath = '';
|
66
|
-
workerBasePath = '';
|
67
|
-
treeLevel = key.replace('.', '/').split('/').length + 3;
|
68
|
-
|
69
|
-
for (i=0; i < treeLevel; i++) {
|
70
|
-
basePath += '../';
|
71
|
-
|
72
|
-
if (i > 1) {
|
73
|
-
workerBasePath += '../';
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
lAppName = key.toLowerCase();
|
78
|
-
|
79
|
-
// neo-config.json
|
80
|
-
inputPath = path.resolve(cwd, 'apps', lAppName, 'neo-config.json');
|
81
|
-
outputPath = path.resolve(cwd, buildTarget.folder, 'apps', lAppName, 'neo-config.json');
|
82
|
-
|
83
|
-
content = requireJson(inputPath);
|
84
|
-
delete content.environment;
|
85
|
-
|
86
|
-
content.appPath = content.appPath.replace(regexTopLevel, '');
|
87
|
-
|
88
|
-
Object.assign(content, {
|
89
|
-
basePath,
|
90
|
-
mainPath: '../main.js',
|
91
|
-
workerBasePath
|
92
|
-
});
|
93
|
-
|
94
|
-
fs.writeFileSync(outputPath, JSON.stringify(content));
|
95
|
-
|
96
|
-
// index.html
|
97
|
-
inputPath = path.resolve(cwd, 'apps', lAppName, 'index.html');
|
98
|
-
outputPath = path.resolve(cwd, buildTarget.folder, 'apps', lAppName, 'index.html');
|
99
|
-
|
100
|
-
content = fs.readFileSync(inputPath).toString()
|
101
|
-
.replace(regexIndexNodeModules, '../../node_modules')
|
102
|
-
.replace(regexTrimStart, '')
|
103
|
-
.replace(regexTrimEnd, '')
|
104
|
-
.replace(', ', ',')
|
105
|
-
.replace(regexLineBreak, '');
|
106
|
-
|
107
|
-
fs.writeFileSync(outputPath, content);
|
108
|
-
}
|
109
|
-
});
|
110
|
-
}
|
111
|
-
|
112
|
-
return {
|
113
|
-
mode : 'production',
|
114
|
-
entry : {app: path.resolve(neoPath, './src/worker/App.mjs')},
|
115
|
-
target: 'webworker',
|
116
|
-
|
117
|
-
plugins: [
|
118
|
-
new webpack.ContextReplacementPlugin(/.*/, context => {
|
119
|
-
if (!insideNeo && context.context.includes('/src/worker')) {
|
120
|
-
context.request = '../../' + context.request;
|
121
|
-
}
|
122
|
-
}),
|
123
|
-
...plugins
|
124
|
-
],
|
125
|
-
|
126
|
-
output: {
|
127
|
-
chunkFilename: 'chunks/app/[id].js',
|
128
|
-
filename : filenameConfig.workers.app.output,
|
129
|
-
path : path.resolve(cwd, buildTarget.folder)
|
130
|
-
}
|
131
|
-
}
|
132
|
-
};
|