@aj-shadow/z-abs-complayer-codeeditor-server 0.0.0-aj-beta.221
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/.gitattributes +26 -0
- package/LICENSE.txt +96 -0
- package/README.md +5 -0
- package/npm-shrinkwrap.json +13 -0
- package/package.json +10 -0
- package/project/server/_build/Server-CompLayer-Codeeditor-server.bld +12 -0
- package/project/server/_build/z-abs-complayer-codeeditor-server.prj +12 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFileDelete.js +40 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFileGet.js +21 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFileNew.js +112 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFileRename.js +29 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFileUpdate.js +20 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFolderDelete.js +21 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFolderGet.js +21 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFolderNew.js +21 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorFolderUpdate.js +21 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorProjectToggle.js +18 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorProjectUpdate.js +24 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorWorkspaceGet.js +184 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorWorkspaceNew.js +468 -0
- package/project/server/plugin-data/code-editor/plugin_data_CodeEditorWorkspaceSearch.js +204 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-bat.js +20 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-gitattributes.js +44 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-gitignore.js +28 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-help-text.js +55 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-html.js +46 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-main-jsx.js +74 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-main.js +29 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-package-json.js +90 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-postinstall.js +108 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-readme.js +19 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-settings.js +71 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-site-jsx.js +44 -0
- package/project/server/plugin-data/code-editor/templates-workspace/template-tree.js +43 -0
- package/project/z-abs-complayer-codeeditor-server.tree +35 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const ActorPathGenerated = require('z-abs-corelayer-server/server/path/actor-path-generated');
|
|
5
|
+
const ActorPathProject = require('z-abs-corelayer-server/server/path/actor-path-project');
|
|
6
|
+
const ActorPath = require('z-abs-corelayer-server/server/path/actor-path');
|
|
7
|
+
const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
|
|
8
|
+
const Fs = require('fs');
|
|
9
|
+
const Os = require('os');
|
|
10
|
+
const Path = require('path');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CodeEditorWorkspaceSearch extends PluginBaseMulti {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(PluginBaseMulti.GET);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onRequest(search, rules) {
|
|
19
|
+
this.expectAsynchResponseTemp();
|
|
20
|
+
this.asynchReadFile(ActorPathGenerated.getWorkspaceRecentFiles(), (err, data) => {
|
|
21
|
+
if(err) {
|
|
22
|
+
this.expectAsynchResponseError(`Could not get recent project files '${ActorPathGenerated.getWorkspaceRecentFiles()}'.`);
|
|
23
|
+
this.unExpectAsynchResponseTemp();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const lastWorkspace = data.recentWorkspaces[0];
|
|
27
|
+
this.asynchReadFile(ActorPathProject.getWorkspaceFile(lastWorkspace.appName, lastWorkspace.workspaceName), (err, workspace) => {
|
|
28
|
+
if(!err) {
|
|
29
|
+
let pendings = 0;
|
|
30
|
+
const fileDatas = [];
|
|
31
|
+
const searchedData = {
|
|
32
|
+
hits: 0,
|
|
33
|
+
files: 0,
|
|
34
|
+
searched: 0
|
|
35
|
+
};
|
|
36
|
+
workspace.projects.push({
|
|
37
|
+
project: '',
|
|
38
|
+
type: ''
|
|
39
|
+
});
|
|
40
|
+
for(let i = 0; i < workspace.projects.length; ++i) {
|
|
41
|
+
const project = workspace.projects[i];
|
|
42
|
+
++pendings;
|
|
43
|
+
this._searchFiles(fileDatas, searchedData, ActorPathProject.getCodeProjectFolder(project.name, project.type), project.name ? `${project.name}${Path.sep}${project.type}` : 'project', (err) => {
|
|
44
|
+
if(0 === --pendings) {
|
|
45
|
+
let inPendings = fileDatas.length;
|
|
46
|
+
const foundFiles = [];
|
|
47
|
+
fileDatas.forEach((fileData) => {
|
|
48
|
+
this._searchInFiles(foundFiles, searchedData, fileData, search, () => {
|
|
49
|
+
if(0 === --inPendings) {
|
|
50
|
+
this.expectAsynchResponseSuccess({
|
|
51
|
+
foundFiles: foundFiles,
|
|
52
|
+
hits: searchedData.hits,
|
|
53
|
+
files: searchedData.files,
|
|
54
|
+
searched: searchedData.searched
|
|
55
|
+
});
|
|
56
|
+
foundFiles.sort((a, b) => {
|
|
57
|
+
if(a.file < b.file) {
|
|
58
|
+
return -1;
|
|
59
|
+
}
|
|
60
|
+
else if(a.file > b.file) {
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
this.unExpectAsynchResponseTemp();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_searchFiles(fileNames, searchedData, searchPath, projectPath, done) {
|
|
81
|
+
Fs.readdir(searchPath, (err, files) => {
|
|
82
|
+
if(err) {
|
|
83
|
+
return done(err);
|
|
84
|
+
}
|
|
85
|
+
if(undefined === files || 0 === files.length) {
|
|
86
|
+
return done();
|
|
87
|
+
}
|
|
88
|
+
const fileData = {
|
|
89
|
+
path: searchPath,
|
|
90
|
+
projectPath: projectPath,
|
|
91
|
+
files: []
|
|
92
|
+
};
|
|
93
|
+
let pendings = files.length;
|
|
94
|
+
const filesLength = files.length;
|
|
95
|
+
for(let i = 0; i < filesLength; ++i) {
|
|
96
|
+
const path = searchPath + Path.sep + files[i];
|
|
97
|
+
const pPath = projectPath + '/' + files[i];
|
|
98
|
+
Fs.lstat(path, (err, stat) => {
|
|
99
|
+
if(err) {
|
|
100
|
+
ddb.error('Could not get stat from file, Error:', err);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if(stat.isDirectory()) {
|
|
104
|
+
this._searchFiles(fileNames, searchedData, path, pPath, (err) => {
|
|
105
|
+
if(0 === --pendings) {
|
|
106
|
+
if(0 !== fileData.files.length) {
|
|
107
|
+
fileNames.push(fileData);
|
|
108
|
+
}
|
|
109
|
+
done();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else if(stat.isFile()) {
|
|
114
|
+
++searchedData.searched;
|
|
115
|
+
fileData.files.push(files[i]);
|
|
116
|
+
if(0 === --pendings) {
|
|
117
|
+
if(0 !== fileData.files.length) {
|
|
118
|
+
fileNames.push(fileData);
|
|
119
|
+
}
|
|
120
|
+
done();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_searchInFiles(foundFiles, searchedData, fileData, search, done) {
|
|
129
|
+
const filesLength = fileData.files.length;
|
|
130
|
+
const files = fileData.files;
|
|
131
|
+
const path = fileData.path;
|
|
132
|
+
let pendings = filesLength;
|
|
133
|
+
for(let i = 0; i < filesLength; ++i) {
|
|
134
|
+
const file = path + Path.sep + files[i];
|
|
135
|
+
const searchLength = search.length;
|
|
136
|
+
Fs.readFile(file, (err, data) => {
|
|
137
|
+
let index = 0;
|
|
138
|
+
const found = {
|
|
139
|
+
file: fileData.projectPath + '/' + files[i],
|
|
140
|
+
indexes: []
|
|
141
|
+
};
|
|
142
|
+
while(-1 !== index) {
|
|
143
|
+
index = data.indexOf(search, index);
|
|
144
|
+
if(-1 !== index) {
|
|
145
|
+
++searchedData.hits;
|
|
146
|
+
const currentIndex = index;
|
|
147
|
+
index += searchLength;
|
|
148
|
+
let startLineIndex = data.lastIndexOf(Os.EOL, currentIndex);
|
|
149
|
+
if(-1 === startLineIndex) {
|
|
150
|
+
startLineIndex = 0;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
startLineIndex += Os.EOL.length;
|
|
154
|
+
}
|
|
155
|
+
let stopLineIndex = data.indexOf(Os.EOL, index);
|
|
156
|
+
if(-1 === stopLineIndex) {
|
|
157
|
+
stopLineIndex = data.length - 1;
|
|
158
|
+
}
|
|
159
|
+
found.indexes.push({
|
|
160
|
+
index: index,
|
|
161
|
+
lineIndex: currentIndex - startLineIndex,
|
|
162
|
+
lineNbr: -1,
|
|
163
|
+
lineBefore: data.slice(startLineIndex, currentIndex).toString(),
|
|
164
|
+
lineAfter: data.slice(index, stopLineIndex).toString()
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if(0 !== found.indexes.length) {
|
|
169
|
+
++searchedData.files;
|
|
170
|
+
foundFiles.push(found);
|
|
171
|
+
let index = 0;
|
|
172
|
+
const lineIndexes = [];
|
|
173
|
+
while(-1 !== index) {
|
|
174
|
+
index = data.indexOf(Os.EOL, index);
|
|
175
|
+
if(-1 !== index) {
|
|
176
|
+
lineIndexes.push(index);
|
|
177
|
+
index += Os.EOL.length;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const indexes = found.indexes;
|
|
181
|
+
const indexesLength = found.indexes.length;
|
|
182
|
+
let currentLineIndex = 0;
|
|
183
|
+
for(let i = 0; i < indexesLength; ++i) {
|
|
184
|
+
for(;;) {
|
|
185
|
+
if(lineIndexes[currentLineIndex] < indexes[i].index) {
|
|
186
|
+
++currentLineIndex;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
indexes[i].lineNbr = currentLineIndex + 1;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if(0 === --pendings) {
|
|
197
|
+
done();
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
module.exports = CodeEditorWorkspaceSearch;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplateBat {
|
|
8
|
+
static create() {
|
|
9
|
+
const text = `
|
|
10
|
+
|
|
11
|
+
@echo off
|
|
12
|
+
title actorjs
|
|
13
|
+
node --use_strict .\\main.js %* --silent
|
|
14
|
+
`.replaceAll('\n', Os.EOL);
|
|
15
|
+
return text;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module.exports = TemplateBat;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplateGitattributes {
|
|
8
|
+
static create() {
|
|
9
|
+
const text = `
|
|
10
|
+
|
|
11
|
+
# Set the default behavior, in case people don't have core.autocrlf set.
|
|
12
|
+
* text=auto
|
|
13
|
+
|
|
14
|
+
# Explicitly declare text files you want to always be normalized and converted
|
|
15
|
+
# to native line endings on checkout.
|
|
16
|
+
*.json text
|
|
17
|
+
*.js text
|
|
18
|
+
*.jsx text
|
|
19
|
+
*.txt text
|
|
20
|
+
*.md text
|
|
21
|
+
*.wrk text
|
|
22
|
+
*.bld text
|
|
23
|
+
*.tsk text
|
|
24
|
+
*.css text
|
|
25
|
+
*.html text
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Declare files that will always have CRLF line endings on checkout.
|
|
29
|
+
#*.sln text eol=crlf
|
|
30
|
+
|
|
31
|
+
# Declare files that will always have LF line endings on checkout.
|
|
32
|
+
#*.txt text eol=lf
|
|
33
|
+
|
|
34
|
+
# Denote all files that are truly binary and should not be modified.
|
|
35
|
+
*.png binary
|
|
36
|
+
*.jpg binary
|
|
37
|
+
|
|
38
|
+
`.replaceAll('\n', Os.EOL);
|
|
39
|
+
return text;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
module.exports = TemplateGitattributes;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplateGitignore {
|
|
8
|
+
static create() {
|
|
9
|
+
const text = `
|
|
10
|
+
build
|
|
11
|
+
dist
|
|
12
|
+
temp
|
|
13
|
+
node_modules
|
|
14
|
+
actorjs.sh
|
|
15
|
+
actorjs.bat
|
|
16
|
+
actorjs-cmd.bat
|
|
17
|
+
aj.bat
|
|
18
|
+
postinstall.log
|
|
19
|
+
.DS_Store
|
|
20
|
+
actorjs.arg
|
|
21
|
+
|
|
22
|
+
`.replaceAll('\n', Os.EOL);
|
|
23
|
+
return text;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
module.exports = TemplateGitignore;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplateHelpText {
|
|
8
|
+
static create(lowercaseAppName, noDashAppName) {
|
|
9
|
+
const text = `
|
|
10
|
+
${this.lowercaseAppName} usage: ${this.lowercaseAppName}|aj cmd [--[parameter name] [parameter value | parameter]] ...
|
|
11
|
+
|
|
12
|
+
cmd:
|
|
13
|
+
|
|
14
|
+
debug Build and start ${noDashAppName} in debug mode.
|
|
15
|
+
release Build and start ${noDashAppName} in release mode.
|
|
16
|
+
start Start ${noDashAppName} in the mode it is built.
|
|
17
|
+
--httphost: the ${noDashAppName} HTTP host address. Default: 'localhost'.
|
|
18
|
+
--httpport: the ${noDashAppName} HTTP port. Default: 9005.
|
|
19
|
+
--wsp: the ${noDashAppName} websocket host address. Default: 'localhost'.
|
|
20
|
+
--wsh: the ${noDashAppName} websocket port. Default: 9006.
|
|
21
|
+
--bottleneck: limit the number of parallel processes building ${noDashAppName}. Default: [unlimited].
|
|
22
|
+
--build: just build, do not start ${noDashAppName}.
|
|
23
|
+
--buildall: build ${noDashAppName} and all other nodes.
|
|
24
|
+
--install: make an 'npm install' before other commands.
|
|
25
|
+
--test: start clients and servers with test config values if they exist.
|
|
26
|
+
|
|
27
|
+
clean:all Removes the build, dist, temp, generated & node_modules folders.
|
|
28
|
+
clean:build Removes the build folder. A new build has to be done with either '${lowercaseAppName} debug' or '${lowercaseAppName} release'.
|
|
29
|
+
clean:compiled Removes the build and dist folders.
|
|
30
|
+
clean:dist Removes the dist folder. A new build has to be done with either '${lowercaseAppName} debug' or '${lowercaseAppName} release'.
|
|
31
|
+
clean:generated Removes the ../Generated folder.
|
|
32
|
+
clean:node Removes the node_modules folder.
|
|
33
|
+
clean:temp Removes the temp folder.
|
|
34
|
+
|
|
35
|
+
status Show the changed files in the repos.
|
|
36
|
+
diff Show the files diff in the repos.
|
|
37
|
+
clone Clone repo
|
|
38
|
+
--repo: the name of the repo to clone.
|
|
39
|
+
--all: clone all repos that are not already cloned.
|
|
40
|
+
pull Pull repo
|
|
41
|
+
--repo: the name of the repo to pull.
|
|
42
|
+
--all: pull all repos that are not already cloned.
|
|
43
|
+
tag Tag repo.
|
|
44
|
+
--repo: the name of the repo to tag.
|
|
45
|
+
--all: tag all repos.
|
|
46
|
+
--name: the name of the tag.
|
|
47
|
+
--msg|message: the message of the tag.
|
|
48
|
+
|
|
49
|
+
`.replaceAll('\n', Os.EOL);
|
|
50
|
+
return text;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
module.exports = TemplateHelpText;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplateHtml {
|
|
8
|
+
static create(lowercaseAppName, description) {
|
|
9
|
+
const text = `
|
|
10
|
+
<!DOCTYPE html>
|
|
11
|
+
<html lang="en">
|
|
12
|
+
<head>
|
|
13
|
+
<meta charset="UTF-8">
|
|
14
|
+
<meta name="viewport" content="width=device-width">
|
|
15
|
+
<meta name="${description}">
|
|
16
|
+
<script src="/abs-scripts/3ppLayer-D3-client.js" type="text/javascript" defer></script>
|
|
17
|
+
<script src="/abs-scripts/3ppLayer-jQuery-client.js" type="text/javascript" defer></script>
|
|
18
|
+
<script src="/abs-scripts/3ppLayer-Nodejs-client.js" type="text/javascript" defer></script>
|
|
19
|
+
<script src="/abs-scripts/3ppLayer-React-client.js" type="text/javascript" defer></script>
|
|
20
|
+
<script src="/abs-scripts/3ppLayer-Reactdom-client.js" type="text/javascript" defer></script>
|
|
21
|
+
<script src="/abs-scripts/CoreLayer-cs.js" type="text/javascript" defer></script>
|
|
22
|
+
<script src="/abs-scripts/CoreLayer-client.js" type="text/javascript" defer></script>
|
|
23
|
+
<script src="/abs-scripts/CompLayer-Router-client.js" type="text/javascript" defer></script>
|
|
24
|
+
<script src="/abs-scripts/CompLayer-Bootstrap-client.js" type="text/javascript" defer></script>
|
|
25
|
+
<script src="/abs-scripts/AppLayer-cs.js" type="text/javascript" defer></script>
|
|
26
|
+
<script src="/abs-scripts/AppLayer-client.js" type="text/javascript" defer></script>
|
|
27
|
+
<link rel="preload" href="/abs-css/bundle-${lowercaseAppName}.css" as="style" onload="this.onload=null;this.rel='stylesheet'" type="text/css" media="screen">
|
|
28
|
+
<noscript><link rel="stylesheet" href="/abs-css/bundle-${lowercaseAppName}.css"></noscript>
|
|
29
|
+
<link rel="preload" href="/abs-css/bundle-CompLayer-Bootstrap.css" as="style" onload="this.onload=null;this.rel='stylesheet'" type="text/css" media="screen">
|
|
30
|
+
<noscript><link rel="stylesheet" href="/abs-css/bundle-CompLayer-Bootstrap.css"></noscript>
|
|
31
|
+
<link rel="preload" href="/abs-css/bundle-CoreLayer.css" as="style" onload="this.onload=null;this.rel='stylesheet'" type="text/css" media="screen">
|
|
32
|
+
<noscript><link rel="stylesheet" href="/abs-css/bundle-CoreLayer.css"></noscript>
|
|
33
|
+
</head>
|
|
34
|
+
<body>
|
|
35
|
+
<div id="app"></div>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
`.replaceAll('\n', Os.EOL);
|
|
41
|
+
return text;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
module.exports = TemplateHtml;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplateMainJsx {
|
|
8
|
+
static create(appName, lowercaseAppName) {
|
|
9
|
+
const text = `
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import Site from './components/site';
|
|
15
|
+
import Router from 'z-abs-complayer-router-client/client/react-component/router';
|
|
16
|
+
import ReactComponentBase from 'z-abs-corelayer-client/client/react-component/react-component-base';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { createRoot } from 'react-dom/client';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Actor extends ReactComponentBase {
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
Actor.routerRef = React.createRef();
|
|
25
|
+
window.actorJsReleaseData = {
|
|
26
|
+
appName: '${lowercaseAppName}',
|
|
27
|
+
appTitle: '${appName}'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
shouldUpdate(nextProps, nextState) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
render() {
|
|
36
|
+
return (
|
|
37
|
+
<div className="main">
|
|
38
|
+
<Router ref={Actor.routerRef}>
|
|
39
|
+
<Site />
|
|
40
|
+
</Router>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function actorJsRerender(uri) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
if(null !== Actor.routerRef.current) {
|
|
49
|
+
Actor.routerRef.current.rerender(uri, () => {
|
|
50
|
+
resolve();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
resolve();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
window.actorJsRerender = actorJsRerender;
|
|
60
|
+
Actor.routerRef = null;
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const container = document.getElementById('app');
|
|
64
|
+
const root = createRoot(container);
|
|
65
|
+
root.render(<Actor />);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
`.replaceAll('\n', Os.EOL);
|
|
69
|
+
return text;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
module.exports = TemplateMainJsx;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplateMain {
|
|
8
|
+
static create(lowercaseAppName) {
|
|
9
|
+
const text = `
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const Path = require('path');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
require(Path.resolve('../z-build-require/project/server/module')).init(true, '');
|
|
17
|
+
const AbsProcess = require('z-build-project/project/server/process');
|
|
18
|
+
AbsProcess.run('${lowercaseAppName}', 'source', '');
|
|
19
|
+
}
|
|
20
|
+
catch(err) {
|
|
21
|
+
console.log('Could not start ${lowercaseAppName}.', err);
|
|
22
|
+
}
|
|
23
|
+
`.replaceAll('\n', Os.EOL);
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
module.exports = TemplateMain;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const Os = require('os');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TemplatePackageJson {
|
|
8
|
+
static create(isApp, appName, lowercaseAppName) {
|
|
9
|
+
const shortName = appName.replace(/[^A-Z]+/g, "").toLowerCase();
|
|
10
|
+
if(isApp) {
|
|
11
|
+
const appJson = {
|
|
12
|
+
name: `${lowercaseAppName}`,
|
|
13
|
+
version: "0.0.0-aj-alpha.0+production-0",
|
|
14
|
+
shortname: `${shortName}`,
|
|
15
|
+
longname: `${lowercaseAppName}`,
|
|
16
|
+
folder: `${lowercaseAppName}`,
|
|
17
|
+
description: `${lowercaseAppName} - .`,
|
|
18
|
+
scripts: {
|
|
19
|
+
postinstall: "node -e \"try{require('./npm-post-install.js')}catch(e){console.log(e);}\""
|
|
20
|
+
},
|
|
21
|
+
author: "ActorJs AB",
|
|
22
|
+
license: "SEE LICENSE IN LICENSE.txt",
|
|
23
|
+
browser: {
|
|
24
|
+
jquery: "./node_modules/jquery/dist/jquery.js",
|
|
25
|
+
},
|
|
26
|
+
dependencies: {},
|
|
27
|
+
repository: `https://gitlab.com/actorjs-development-apps/${lowercaseAppName}.git`
|
|
28
|
+
};
|
|
29
|
+
appJson["release-step"] = "development";
|
|
30
|
+
appJson.dependencies["@babel/plugin-transform-runtime"] = "7.24.7";
|
|
31
|
+
appJson.dependencies["@babel/preset-env"] = "7.25.3";
|
|
32
|
+
appJson.dependencies["@babel/preset-react"] = "7.24.7";
|
|
33
|
+
appJson.dependencies["@babel/runtime"] = "7.25.0";
|
|
34
|
+
appJson.dependencies.bufferutil = "4.0.8";
|
|
35
|
+
appJson.dependencies["cli-color"] = "2.0.4";
|
|
36
|
+
appJson.dependencies["@codemirror/view"] = "6.30.0";
|
|
37
|
+
appJson.dependencies["@codemirror/state"] = "6.4.1";
|
|
38
|
+
appJson.dependencies["@codemirror/commands"] = "6.6.0";
|
|
39
|
+
appJson.dependencies["@codemirror/autocomplete"] = "6.18.0";
|
|
40
|
+
appJson.dependencies["@codemirror/search"] = "6.5.6";
|
|
41
|
+
appJson.dependencies["@codemirror/language"] = "6.10.2";
|
|
42
|
+
appJson.dependencies["@codemirror/lang-javascript"] = "6.2.2";
|
|
43
|
+
appJson.dependencies["@codemirror/lang-css"] = "6.2.1";
|
|
44
|
+
appJson.dependencies["@codemirror/lang-html"] = "6.4.9";
|
|
45
|
+
appJson.dependencies["@codemirror/lang-json"] = "6.0.1";
|
|
46
|
+
appJson.dependencies["@codemirror/lang-markdown"] = "6.2.5";
|
|
47
|
+
appJson.dependencies["@uiw/codemirror-theme-vscode"] = "4.23.0";
|
|
48
|
+
appJson.dependencies.jquery = "3.7.1";
|
|
49
|
+
appJson.dependencies["mime-types"] = "2.1.35";
|
|
50
|
+
appJson.dependencies.react = "18.3.1";
|
|
51
|
+
appJson.dependencies["react-dom"] = "18.3.1";
|
|
52
|
+
appJson.dependencies["simple-git"] = "3.25.0";
|
|
53
|
+
appJson.dependencies["sudo-js"] = "1.0.2";
|
|
54
|
+
appJson.dependencies["sudo-prompt"] = "9.2.1";
|
|
55
|
+
appJson.dependencies.ws ="8.18.0";
|
|
56
|
+
return appJson;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const nodeJson = {
|
|
60
|
+
name: `${lowercaseAppName}`,
|
|
61
|
+
version: "0.0.0-aj-alpha.0+production-0",
|
|
62
|
+
shortname: `${shortName}`,
|
|
63
|
+
longname: `${lowercaseAppName}`,
|
|
64
|
+
folder: `${lowercaseAppName}`,
|
|
65
|
+
description: `${lowercaseAppName} - .`,
|
|
66
|
+
scripts: {
|
|
67
|
+
postinstall: "node -e \"try{require('./npm-post-install.js')}catch(e){console.log(e);}\""
|
|
68
|
+
},
|
|
69
|
+
author: "ActorJs AB",
|
|
70
|
+
license: "SEE LICENSE IN LICENSE.txt",
|
|
71
|
+
dependencies: {},
|
|
72
|
+
repository: `https://gitlab.com/actorjs-development-nodes/${lowercaseAppName}.git`
|
|
73
|
+
};
|
|
74
|
+
nodeJson["release-step"] = "development";
|
|
75
|
+
nodeJson.dependencies["@babel/preset-env"] = "7.25.3";
|
|
76
|
+
nodeJson.dependencies["@babel/runtime"] = "7.25.0";
|
|
77
|
+
nodeJson.dependencies.bufferutil = "4.0.8";
|
|
78
|
+
nodeJson.dependencies["cli-color"] = "2.0.4";
|
|
79
|
+
nodeJson.dependencies["mime-types"] = "2.1.35";
|
|
80
|
+
nodeJson.dependencies["simple-git"] = "3.25.0";
|
|
81
|
+
nodeJson.dependencies["sudo-js"] = "1.0.2";
|
|
82
|
+
nodeJson.dependencies["sudo-prompt"] = "9.2.1";
|
|
83
|
+
nodeJson.dependencies.ws = "8.18.0";
|
|
84
|
+
return nodeJson;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
module.exports = TemplatePackageJson;
|