neo.mjs 3.0.5 → 3.1.2
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 +0 -2
- package/apps/website/data/blog.json +26 -0
- package/buildScripts/buildAll.mjs +136 -0
- package/buildScripts/buildThemes.mjs +434 -0
- package/buildScripts/{copyFolder.js → copyFolder.mjs} +3 -5
- package/buildScripts/createApp.mjs +288 -0
- package/buildScripts/docs/{jsdocx.js → jsdocx.mjs} +31 -32
- package/buildScripts/webpack/buildMyApps.mjs +125 -0
- package/buildScripts/webpack/buildThreads.mjs +115 -0
- package/buildScripts/webpack/development/{webpack.config.appworker.js → webpack.config.appworker.mjs} +20 -22
- package/buildScripts/webpack/development/webpack.config.main.mjs +24 -0
- package/buildScripts/webpack/development/{webpack.config.myapps.js → webpack.config.myapps.mjs} +15 -15
- package/buildScripts/webpack/development/{webpack.config.worker.js → webpack.config.worker.mjs} +12 -9
- package/buildScripts/webpack/production/{webpack.config.appworker.js → webpack.config.appworker.mjs} +20 -22
- package/buildScripts/webpack/production/webpack.config.main.mjs +23 -0
- package/buildScripts/webpack/production/{webpack.config.myapps.js → webpack.config.myapps.mjs} +15 -15
- package/buildScripts/webpack/production/{webpack.config.worker.js → webpack.config.worker.mjs} +12 -9
- package/buildScripts/webpack/{webpack.server.config.js → webpack.server.config.mjs} +2 -2
- package/docs/app/view/classdetails/MembersList.mjs +7 -13
- package/package.json +14 -13
- package/src/DefaultConfig.mjs +1 -1
- package/src/Neo.mjs +13 -13
- package/src/list/plugin/Animate.mjs +59 -11
- package/src/main/addon/AmCharts.mjs +2 -2
- package/src/manager/DomEvent.mjs +1 -1
- package/src/worker/Base.mjs +6 -5
- package/buildScripts/buildAll.js +0 -148
- package/buildScripts/buildThemes.js +0 -442
- package/buildScripts/createApp.js +0 -283
- package/buildScripts/webpack/buildMyApps.js +0 -125
- package/buildScripts/webpack/buildThreads.js +0 -112
- package/buildScripts/webpack/development/webpack.config.main.js +0 -21
- package/buildScripts/webpack/index.ejs +0 -25
- package/buildScripts/webpack/production/webpack.config.main.js +0 -20
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
const chalk = require('chalk'),
|
|
2
|
-
{program} = require('commander'),
|
|
3
|
-
cp = require('child_process'),
|
|
4
|
-
cwd = process.cwd(),
|
|
5
|
-
envinfo = require('envinfo'),
|
|
6
|
-
fs = require('fs'),
|
|
7
|
-
inquirer = require('inquirer'),
|
|
8
|
-
path = require('path'),
|
|
9
|
-
packageJson = require(path.resolve(process.cwd(), 'package.json')),
|
|
10
|
-
insideNeo = packageJson.name === 'neo.mjs',
|
|
11
|
-
neoPath = insideNeo ? './' : './node_modules/neo.mjs/',
|
|
12
|
-
addonChoices = fs.readdirSync(path.join(neoPath, '/src/main/addon')).map(item => item.slice(0, -4)),
|
|
13
|
-
os = require('os'),
|
|
14
|
-
programName = `${packageJson.name} create-app`,
|
|
15
|
-
questions = [],
|
|
16
|
-
scssFolders = fs.readdirSync(path.join(neoPath, '/resources/scss')),
|
|
17
|
-
themeFolders = [];
|
|
18
|
-
|
|
19
|
-
scssFolders.forEach(folder => {
|
|
20
|
-
if (folder.includes('theme')) {
|
|
21
|
-
themeFolders.push(`neo-${folder}`);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
program
|
|
26
|
-
.name(programName)
|
|
27
|
-
.version(packageJson.version)
|
|
28
|
-
.option('-i, --info', 'print environment debug info')
|
|
29
|
-
.option('-a, --appName <value>')
|
|
30
|
-
.option('-m, --mainThreadAddons <value>', `Comma separated list of:\n${addonChoices.join(', ')}\nDefaults to DragDrop, Stylesheet`)
|
|
31
|
-
.option('-t, --themes <value>', ['all', ...themeFolders, 'none'].join(", "))
|
|
32
|
-
.option('-u, --useSharedWorkers <value>', '"yes", "no"')
|
|
33
|
-
.allowUnknownOption()
|
|
34
|
-
.on('--help', () => {
|
|
35
|
-
console.log('\nIn case you have any issues, please create a ticket here:');
|
|
36
|
-
console.log(chalk.cyan(packageJson.bugs.url));
|
|
37
|
-
})
|
|
38
|
-
.parse(process.argv);
|
|
39
|
-
|
|
40
|
-
const programOpts = program.opts();
|
|
41
|
-
|
|
42
|
-
if (programOpts.info) {
|
|
43
|
-
console.log(chalk.bold('\nEnvironment Info:'));
|
|
44
|
-
console.log(`\n current version of ${packageJson.name}: ${packageJson.version}`);
|
|
45
|
-
console.log(` running from ${__dirname}`);
|
|
46
|
-
return envinfo
|
|
47
|
-
.run({
|
|
48
|
-
System : ['OS', 'CPU'],
|
|
49
|
-
Binaries : ['Node', 'npm', 'Yarn'],
|
|
50
|
-
Browsers : ['Chrome', 'Edge', 'Firefox', 'Safari'],
|
|
51
|
-
npmPackages: ['neo.mjs']
|
|
52
|
-
}, {
|
|
53
|
-
duplicates : true,
|
|
54
|
-
showNotFound: true
|
|
55
|
-
})
|
|
56
|
-
.then(console.log);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
console.log(chalk.green(programName));
|
|
60
|
-
|
|
61
|
-
if (programOpts.mainThreadAddons) {
|
|
62
|
-
programOpts.mainThreadAddons = programOpts.mainThreadAddons.split(',');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!programOpts.appName) {
|
|
66
|
-
questions.push({
|
|
67
|
-
type : 'input',
|
|
68
|
-
name : 'appName',
|
|
69
|
-
message: 'Please choose a name for your neo app:',
|
|
70
|
-
default: 'MyApp'
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!programOpts.themes) {
|
|
75
|
-
questions.push({
|
|
76
|
-
type : 'list',
|
|
77
|
-
name : 'themes',
|
|
78
|
-
message: 'Please choose a theme for your neo app:',
|
|
79
|
-
choices: ['all', ...themeFolders, 'none'],
|
|
80
|
-
default: 'all'
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!programOpts.mainThreadAddons) {
|
|
85
|
-
questions.push({
|
|
86
|
-
type : 'checkbox',
|
|
87
|
-
name : 'mainThreadAddons',
|
|
88
|
-
message: 'Please choose your main thread addons:',
|
|
89
|
-
choices: addonChoices,
|
|
90
|
-
default: ['DragDrop', 'Stylesheet']
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (!programOpts.useSharedWorkers) {
|
|
95
|
-
questions.push({
|
|
96
|
-
type : 'list',
|
|
97
|
-
name : 'useSharedWorkers',
|
|
98
|
-
message: 'Do you want to use SharedWorkers? Pick yes for multiple main threads (Browser Windows):',
|
|
99
|
-
choices: ['yes', 'no'],
|
|
100
|
-
default: 'no'
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
inquirer.prompt(questions).then(answers => {
|
|
105
|
-
let appName = programOpts.appName || answers.appName,
|
|
106
|
-
mainThreadAddons = programOpts.mainThreadAddons || answers.mainThreadAddons,
|
|
107
|
-
themes = programOpts.themes || answers.themes,
|
|
108
|
-
useSharedWorkers = programOpts.useSharedWorkers || answers.useSharedWorkers,
|
|
109
|
-
lAppName = appName.toLowerCase(),
|
|
110
|
-
appPath = 'apps/' + lAppName + '/',
|
|
111
|
-
dir = 'apps/' + lAppName,
|
|
112
|
-
folder = path.resolve(cwd, dir),
|
|
113
|
-
startDate = new Date();
|
|
114
|
-
|
|
115
|
-
if (!Array.isArray(themes)) {
|
|
116
|
-
themes = [themes];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (themes.length > 0 && !themes.includes('none') && !mainThreadAddons.includes('Stylesheet')) {
|
|
120
|
-
console.error('ERROR! The Stylesheet mainThreadAddon is mandatory in case you are using themes');
|
|
121
|
-
console.log('Exiting with error.');
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
fs.mkdir(path.join(folder, '/view'), { recursive: true }, (err) => {
|
|
126
|
-
if (err) {
|
|
127
|
-
throw err;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const appContent = [
|
|
131
|
-
"import MainContainer from './view/MainContainer.mjs';",
|
|
132
|
-
"",
|
|
133
|
-
"const onStart = () => Neo.app({",
|
|
134
|
-
" mainView: MainContainer,",
|
|
135
|
-
" name : '" + appName + "'",
|
|
136
|
-
"});",
|
|
137
|
-
"",
|
|
138
|
-
"export {onStart as onStart};"
|
|
139
|
-
].join(os.EOL);
|
|
140
|
-
|
|
141
|
-
fs.writeFileSync(folder + '/app.mjs', appContent);
|
|
142
|
-
|
|
143
|
-
const indexContent = [
|
|
144
|
-
"<!DOCTYPE HTML>",
|
|
145
|
-
"<html>",
|
|
146
|
-
"<head>",
|
|
147
|
-
' <meta name="viewport" content="width=device-width, initial-scale=1">',
|
|
148
|
-
' <meta charset="UTF-8">',
|
|
149
|
-
" <title>" + appName + "</title>",
|
|
150
|
-
"</head>",
|
|
151
|
-
"<body>",
|
|
152
|
-
' <script src="../../src/MicroLoader.mjs" type="module"></script>',
|
|
153
|
-
"</body>",
|
|
154
|
-
"</html>",
|
|
155
|
-
];
|
|
156
|
-
|
|
157
|
-
fs.writeFileSync(path.join(folder, 'index.html'), indexContent.join(os.EOL));
|
|
158
|
-
|
|
159
|
-
let neoConfig = {
|
|
160
|
-
appPath : `${insideNeo ? '' : '../../'}${appPath}app.mjs`,
|
|
161
|
-
basePath : '../../',
|
|
162
|
-
environment: 'development',
|
|
163
|
-
mainPath : './Main.mjs'
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
if (!(mainThreadAddons.includes('DragDrop') && mainThreadAddons.includes('Stylesheet') && mainThreadAddons.length === 2)) {
|
|
167
|
-
neoConfig.mainThreadAddons = mainThreadAddons;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (!themes.includes('all')) { // default value
|
|
171
|
-
if (themes.includes('none')) {
|
|
172
|
-
neoConfig.themes = [];
|
|
173
|
-
} else {
|
|
174
|
-
neoConfig.themes = themes;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (useSharedWorkers !== 'no') {
|
|
179
|
-
neoConfig.useSharedWorkers = true;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (!insideNeo) {
|
|
183
|
-
neoConfig.workerBasePath = '../../node_modules/neo.mjs/src/worker/';
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
let configs = Object.entries(neoConfig).sort((a, b) => a[0].localeCompare(b[0]));
|
|
187
|
-
neoConfig = {};
|
|
188
|
-
|
|
189
|
-
configs.forEach(([key, value]) => {
|
|
190
|
-
neoConfig[key] = value;
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
fs.writeFileSync(path.join(folder, 'neo-config.json'), JSON.stringify(neoConfig, null, 4));
|
|
194
|
-
|
|
195
|
-
const mainContainerContent = [
|
|
196
|
-
"import Component from '../../../" + (insideNeo ? '' : 'node_modules/neo.mjs/') + "src/component/Base.mjs';",
|
|
197
|
-
"import TabContainer from '../../../" + (insideNeo ? '' : 'node_modules/neo.mjs/') + "src/tab/Container.mjs';",
|
|
198
|
-
"import Viewport from '../../../" + (insideNeo ? '' : 'node_modules/neo.mjs/') + "src/container/Viewport.mjs';",
|
|
199
|
-
"",
|
|
200
|
-
"/**",
|
|
201
|
-
" * @class " + appName + ".view.MainContainer",
|
|
202
|
-
" * @extends Neo.container.Viewport",
|
|
203
|
-
" */",
|
|
204
|
-
"class MainContainer extends Viewport {",
|
|
205
|
-
" static getConfig() {return {",
|
|
206
|
-
" className: '" + appName + ".view.MainContainer',",
|
|
207
|
-
" autoMount: true,",
|
|
208
|
-
" layout : {ntype: 'fit'},",
|
|
209
|
-
"",
|
|
210
|
-
" items: [{",
|
|
211
|
-
" module: TabContainer,",
|
|
212
|
-
" height: 300,",
|
|
213
|
-
" width : 500,",
|
|
214
|
-
" style : {flex: 'none', margin: '20px'},",
|
|
215
|
-
"",
|
|
216
|
-
" itemDefaults: {",
|
|
217
|
-
" module: Component,",
|
|
218
|
-
" cls : ['neo-examples-tab-component'],",
|
|
219
|
-
" style : {padding: '20px'},",
|
|
220
|
-
" },",
|
|
221
|
-
"",
|
|
222
|
-
" items: [{",
|
|
223
|
-
" tabButtonConfig: {",
|
|
224
|
-
" iconCls: 'fa fa-home',",
|
|
225
|
-
" text : 'Tab 1'",
|
|
226
|
-
" },",
|
|
227
|
-
" vdom: {innerHTML: 'Welcome to your new Neo App.'}",
|
|
228
|
-
" }, {",
|
|
229
|
-
" tabButtonConfig: {",
|
|
230
|
-
" iconCls: 'fa fa-play-circle',",
|
|
231
|
-
" text : 'Tab 2'",
|
|
232
|
-
" },",
|
|
233
|
-
" vdom: {innerHTML: 'Have fun creating something awesome!'}",
|
|
234
|
-
" }]",
|
|
235
|
-
" }]",
|
|
236
|
-
" }}",
|
|
237
|
-
"}",
|
|
238
|
-
"",
|
|
239
|
-
"Neo.applyClassConfig(MainContainer);",
|
|
240
|
-
"",
|
|
241
|
-
"export {MainContainer as default};"
|
|
242
|
-
].join(os.EOL);
|
|
243
|
-
|
|
244
|
-
fs.writeFileSync(path.join(folder + '/view/MainContainer.mjs'), mainContainerContent);
|
|
245
|
-
|
|
246
|
-
let appJsonPath = path.resolve(cwd, 'buildScripts/myApps.json'),
|
|
247
|
-
appJson;
|
|
248
|
-
|
|
249
|
-
if (fs.existsSync(appJsonPath)) {
|
|
250
|
-
appJson = require(appJsonPath);
|
|
251
|
-
} else {
|
|
252
|
-
appJsonPath = path.resolve(__dirname, '../buildScripts/webpack/json/myApps.json');
|
|
253
|
-
|
|
254
|
-
if (fs.existsSync(appJsonPath)) {
|
|
255
|
-
appJson = require(appJsonPath);
|
|
256
|
-
} else {
|
|
257
|
-
appJson = require(path.resolve(__dirname, '../buildScripts/webpack/json/myApps.template.json'));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (!appJson.apps.includes(appName)) {
|
|
262
|
-
appJson.apps.push(appName);
|
|
263
|
-
appJson.apps.sort();
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 4));
|
|
267
|
-
|
|
268
|
-
if (mainThreadAddons.includes('HighlightJS')) {
|
|
269
|
-
cp.spawnSync('node', [
|
|
270
|
-
'./buildScripts/copyFolder.js',
|
|
271
|
-
'-s',
|
|
272
|
-
path.resolve(neoPath, 'docs/resources'),
|
|
273
|
-
'-t',
|
|
274
|
-
path.resolve(folder, 'resources'),
|
|
275
|
-
], { env: process.env, cwd: process.cwd(), stdio: 'inherit' });
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
|
|
279
|
-
console.log(`\nTotal time for ${programName}: ${processTime}s`);
|
|
280
|
-
|
|
281
|
-
process.exit();
|
|
282
|
-
});
|
|
283
|
-
});
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const chalk = require('chalk'),
|
|
4
|
-
{ program } = require('commander'),
|
|
5
|
-
cp = require('child_process'),
|
|
6
|
-
cwd = process.cwd(),
|
|
7
|
-
cpOpts = {env: process.env, cwd: cwd, stdio: 'inherit', shell: true},
|
|
8
|
-
envinfo = require('envinfo'),
|
|
9
|
-
fs = require('fs'),
|
|
10
|
-
inquirer = require('inquirer'),
|
|
11
|
-
os = require('os'),
|
|
12
|
-
path = require('path'),
|
|
13
|
-
processRoot = process.cwd(),
|
|
14
|
-
packageJson = require(path.resolve(cwd, 'package.json')),
|
|
15
|
-
configPath = path.resolve(processRoot, 'buildScripts/myApps.json'),
|
|
16
|
-
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
|
17
|
-
webpackPath = path.resolve(neoPath, 'buildScripts/webpack'),
|
|
18
|
-
programName = `${packageJson.name} buildMyApps`,
|
|
19
|
-
questions = [];
|
|
20
|
-
|
|
21
|
-
let webpack = './node_modules/.bin/webpack',
|
|
22
|
-
config;
|
|
23
|
-
|
|
24
|
-
if (fs.existsSync(configPath)) {
|
|
25
|
-
config = require(configPath);
|
|
26
|
-
} else {
|
|
27
|
-
const myAppsPath = path.resolve(neoPath, 'buildScripts/webpack/json/myApps.json');
|
|
28
|
-
|
|
29
|
-
if (fs.existsSync(myAppsPath)) {
|
|
30
|
-
config = require(myAppsPath);
|
|
31
|
-
} else {
|
|
32
|
-
config = require(path.resolve(neoPath, 'buildScripts/webpack/json/myApps.template.json'));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let index = config.apps.indexOf('Docs');
|
|
37
|
-
|
|
38
|
-
if (index > -1) {
|
|
39
|
-
config.apps.splice(index, 1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
program
|
|
43
|
-
.name(programName)
|
|
44
|
-
.version(packageJson.version)
|
|
45
|
-
.option('-i, --info', 'print environment debug info')
|
|
46
|
-
.option('-a, --apps <value>', ['all'].concat(config.apps).map(e => `"${e}"`).join(', '))
|
|
47
|
-
.option('-e, --env <value>', '"all", "dev", "prod"')
|
|
48
|
-
.option('-f, --framework')
|
|
49
|
-
.option('-n, --noquestions')
|
|
50
|
-
.allowUnknownOption()
|
|
51
|
-
.on('--help', () => {
|
|
52
|
-
console.log('\nIn case you have any issues, please create a ticket here:');
|
|
53
|
-
console.log(chalk.cyan(packageJson.bugs.url));
|
|
54
|
-
})
|
|
55
|
-
.parse(process.argv);
|
|
56
|
-
|
|
57
|
-
const programOpts = program.opts();
|
|
58
|
-
|
|
59
|
-
if (programOpts.info) {
|
|
60
|
-
console.log(chalk.bold('\nEnvironment Info:'));
|
|
61
|
-
console.log(`\n current version of ${packageJson.name}: ${packageJson.version}`);
|
|
62
|
-
console.log(` running from ${__dirname}`);
|
|
63
|
-
return envinfo
|
|
64
|
-
.run({
|
|
65
|
-
System : ['OS', 'CPU'],
|
|
66
|
-
Binaries : ['Node', 'npm', 'Yarn'],
|
|
67
|
-
Browsers : ['Chrome', 'Edge', 'Firefox', 'Safari'],
|
|
68
|
-
npmPackages: ['neo.mjs']
|
|
69
|
-
}, {
|
|
70
|
-
duplicates : true,
|
|
71
|
-
showNotFound: true
|
|
72
|
-
})
|
|
73
|
-
.then(console.log);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
console.log(chalk.green(programName));
|
|
77
|
-
|
|
78
|
-
if (!programOpts.noquestions) {
|
|
79
|
-
if (!programOpts.env) {
|
|
80
|
-
questions.push({
|
|
81
|
-
type : 'list',
|
|
82
|
-
name : 'env',
|
|
83
|
-
message: 'Please choose the environment:',
|
|
84
|
-
choices: ['all', 'dev', 'prod'],
|
|
85
|
-
default: 'all'
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (!programOpts.apps && config.apps.length > 1) {
|
|
90
|
-
questions.push({
|
|
91
|
-
type : 'checkbox',
|
|
92
|
-
name : 'apps',
|
|
93
|
-
message: 'Please choose which apps you want to build:',
|
|
94
|
-
choices: config.apps
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
inquirer.prompt(questions).then(answers => {
|
|
100
|
-
const apps = (answers.apps.length > 0 ? answers.apps : null) || programOpts.apps || ['all'],
|
|
101
|
-
env = answers.env || programOpts.env || ['all'],
|
|
102
|
-
insideNeo = !!programOpts.framework || false,
|
|
103
|
-
startDate = new Date();
|
|
104
|
-
|
|
105
|
-
if (os.platform().startsWith('win')) {
|
|
106
|
-
webpack = path.resolve(webpack).replace(/\\/g,'/');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// dist/development
|
|
110
|
-
if (env === 'all' || env === 'dev') {
|
|
111
|
-
console.log(chalk.blue(`${programName} starting dist/development`));
|
|
112
|
-
cp.spawnSync(webpack, ['--config', `${webpackPath}/development/webpack.config.myapps.js`, `--env apps=${apps}`, `--env insideNeo=${insideNeo}`], cpOpts);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// dist/production
|
|
116
|
-
if (env === 'all' || env === 'prod') {
|
|
117
|
-
console.log(chalk.blue(`${programName} starting dist/production`));
|
|
118
|
-
cp.spawnSync(webpack, ['--config', `${webpackPath}/production/webpack.config.myapps.js`, `--env apps=${apps}`, `--env insideNeo=${insideNeo}`], cpOpts);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
|
|
122
|
-
console.log(`\nTotal time for ${programName}: ${processTime}s`);
|
|
123
|
-
|
|
124
|
-
process.exit();
|
|
125
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const chalk = require('chalk'),
|
|
4
|
-
{ program } = require('commander'),
|
|
5
|
-
cp = require('child_process'),
|
|
6
|
-
cwd = process.cwd(),
|
|
7
|
-
cpOpts = {env: process.env, cwd: cwd, stdio: 'inherit', shell: true},
|
|
8
|
-
envinfo = require('envinfo'),
|
|
9
|
-
inquirer = require('inquirer'),
|
|
10
|
-
os = require('os'),
|
|
11
|
-
path = require('path'),
|
|
12
|
-
packageJson = require(path.resolve(cwd, 'package.json')),
|
|
13
|
-
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
|
14
|
-
webpackPath = path.resolve(neoPath, 'buildScripts/webpack'),
|
|
15
|
-
programName = `${packageJson.name} buildThreads`,
|
|
16
|
-
questions = [];
|
|
17
|
-
|
|
18
|
-
let webpack = './node_modules/.bin/webpack';
|
|
19
|
-
|
|
20
|
-
program
|
|
21
|
-
.name(programName)
|
|
22
|
-
.version(packageJson.version)
|
|
23
|
-
.option('-i, --info', 'print environment debug info')
|
|
24
|
-
.option('-e, --env <value>', '"all", "dev", "prod"')
|
|
25
|
-
.option('-f, --framework')
|
|
26
|
-
.option('-n, --noquestions')
|
|
27
|
-
.option('-t, --threads <value>', '"all", "app", "data", "main", "vdom"')
|
|
28
|
-
.allowUnknownOption()
|
|
29
|
-
.on('--help', () => {
|
|
30
|
-
console.log('\nIn case you have any issues, please create a ticket here:');
|
|
31
|
-
console.log(chalk.cyan(packageJson.bugs.url));
|
|
32
|
-
})
|
|
33
|
-
.parse(process.argv);
|
|
34
|
-
|
|
35
|
-
const programOpts = program.opts();
|
|
36
|
-
|
|
37
|
-
if (programOpts.info) {
|
|
38
|
-
console.log(chalk.bold('\nEnvironment Info:'));
|
|
39
|
-
console.log(`\n current version of ${packageJson.name}: ${packageJson.version}`);
|
|
40
|
-
console.log(` running from ${__dirname}`);
|
|
41
|
-
return envinfo
|
|
42
|
-
.run({
|
|
43
|
-
System : ['OS', 'CPU'],
|
|
44
|
-
Binaries : ['Node', 'npm', 'Yarn'],
|
|
45
|
-
Browsers : ['Chrome', 'Edge', 'Firefox', 'Safari'],
|
|
46
|
-
npmPackages: ['neo.mjs']
|
|
47
|
-
}, {
|
|
48
|
-
duplicates : true,
|
|
49
|
-
showNotFound: true
|
|
50
|
-
})
|
|
51
|
-
.then(console.log);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log(chalk.green(programName));
|
|
55
|
-
|
|
56
|
-
if (!programOpts.noquestions) {
|
|
57
|
-
if (!programOpts.threads) {
|
|
58
|
-
questions.push({
|
|
59
|
-
type : 'list',
|
|
60
|
-
name : 'threads',
|
|
61
|
-
message: 'Please choose the threads to build:',
|
|
62
|
-
choices: ['all', 'app', 'canvas', 'data', 'main', 'vdom'],
|
|
63
|
-
default: 'all'
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!programOpts.env) {
|
|
68
|
-
questions.push({
|
|
69
|
-
type : 'list',
|
|
70
|
-
name : 'env',
|
|
71
|
-
message: 'Please choose the environment:',
|
|
72
|
-
choices: ['all', 'dev', 'prod'],
|
|
73
|
-
default: 'all'
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
inquirer.prompt(questions).then(answers => {
|
|
79
|
-
const env = answers.env || programOpts.env || 'all',
|
|
80
|
-
threads = answers.threads || programOpts.threads || 'all',
|
|
81
|
-
insideNeo = programOpts.framework || false,
|
|
82
|
-
startDate = new Date();
|
|
83
|
-
|
|
84
|
-
if (path.sep === '\\') {
|
|
85
|
-
webpack = path.resolve(webpack).replace(/\\/g,'/');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function parseThreads(tPath) {
|
|
89
|
-
if (threads === 'all' || threads === 'main') {cp.spawnSync(webpack, ['--config', `${tPath}.main.js`], cpOpts);}
|
|
90
|
-
if (threads === 'all' || threads === 'app') {cp.spawnSync(webpack, ['--config', `${tPath}.appworker.js`, `--env insideNeo=${insideNeo}`], cpOpts);}
|
|
91
|
-
if (threads === 'all' || threads === 'canvas') {cp.spawnSync(webpack, ['--config', `${tPath}.worker.js`, `--env insideNeo=${insideNeo} worker=canvas`], cpOpts);}
|
|
92
|
-
if (threads === 'all' || threads === 'data') {cp.spawnSync(webpack, ['--config', `${tPath}.worker.js`, `--env insideNeo=${insideNeo} worker=data`], cpOpts);}
|
|
93
|
-
if (threads === 'all' || threads === 'vdom') {cp.spawnSync(webpack, ['--config', `${tPath}.worker.js`, `--env insideNeo=${insideNeo} worker=vdom`], cpOpts);}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// dist/development
|
|
97
|
-
if (env === 'all' || env === 'dev') {
|
|
98
|
-
console.log(chalk.blue(`${programName} starting dist/development`));
|
|
99
|
-
parseThreads(`${webpackPath}/development/webpack.config`);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// dist/production
|
|
103
|
-
if (env === 'all' || env === 'prod') {
|
|
104
|
-
console.log(chalk.blue(`${programName} starting dist/production`));
|
|
105
|
-
parseThreads(`${webpackPath}/production/webpack.config`);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
|
|
109
|
-
console.log(`\nTotal time for ${programName}: ${processTime}s`);
|
|
110
|
-
|
|
111
|
-
process.exit();
|
|
112
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const path = require('path'),
|
|
2
|
-
buildTarget = require('./buildTarget.json'),
|
|
3
|
-
processRoot = process.cwd(),
|
|
4
|
-
packageJson = require(path.resolve(processRoot, 'package.json')),
|
|
5
|
-
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
|
6
|
-
filenameConfig = require(path.resolve(neoPath, 'buildScripts/webpack/json/build.json')),
|
|
7
|
-
entry = {main: path.resolve(neoPath, filenameConfig.mainInput)};
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
mode : 'development',
|
|
11
|
-
devtool: 'inline-source-map',
|
|
12
|
-
entry,
|
|
13
|
-
target : 'web',
|
|
14
|
-
|
|
15
|
-
output: {
|
|
16
|
-
chunkFilename: 'chunks/main/[id].js',
|
|
17
|
-
filename : filenameConfig.mainOutput,
|
|
18
|
-
path : path.resolve(processRoot, buildTarget.folder),
|
|
19
|
-
publicPath : ''
|
|
20
|
-
}
|
|
21
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE HTML>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<title><%= title %></title>
|
|
7
|
-
</head>
|
|
8
|
-
<%= bodyTag %>
|
|
9
|
-
<script>
|
|
10
|
-
Neo = self.Neo || {}; Neo.config = Neo.config || {};
|
|
11
|
-
|
|
12
|
-
Object.assign(Neo.config, {
|
|
13
|
-
appPath : '<%= appPath %>',
|
|
14
|
-
basePath : '<%= basePath %>',
|
|
15
|
-
environment : '<%= environment %>',
|
|
16
|
-
mainThreadAddons : [<%= mainThreadAddons %>],
|
|
17
|
-
renderCountDeltas: <%= renderCountDeltas %>,
|
|
18
|
-
themes : [<%= themes %>],
|
|
19
|
-
useSharedWorkers : <%= useSharedWorkers %>,
|
|
20
|
-
workerBasePath : '<%= workerBasePath %>'
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
23
|
-
<script src="<%= mainPath %>"></script>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const path = require('path'),
|
|
2
|
-
buildTarget = require('./buildTarget.json'),
|
|
3
|
-
processRoot = process.cwd(),
|
|
4
|
-
packageJson = require(path.resolve(processRoot, 'package.json')),
|
|
5
|
-
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
|
6
|
-
filenameConfig = require(path.resolve(neoPath, 'buildScripts/webpack/json/build.json')),
|
|
7
|
-
entry = {main: path.resolve(neoPath, filenameConfig.mainInput)};
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
mode : 'production',
|
|
11
|
-
entry,
|
|
12
|
-
target: 'web',
|
|
13
|
-
|
|
14
|
-
output: {
|
|
15
|
-
chunkFilename: 'chunks/main/[id].js',
|
|
16
|
-
filename : filenameConfig.mainOutput,
|
|
17
|
-
path : path.resolve(processRoot, buildTarget.folder),
|
|
18
|
-
publicPath : ''
|
|
19
|
-
}
|
|
20
|
-
};
|