proteum 1.0.0-1 → 1.0.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/changelog.md +5 -0
- package/client/components/Dialog/index.less +1 -3
- package/package.json +3 -69
- package/server/app/container/console/index.ts +1 -1
- package/templates/composant.tsx +40 -0
- package/templates/form.ts +30 -0
- package/templates/modal.tsx +47 -0
- package/templates/modele.ts +56 -0
- package/templates/page.tsx +74 -0
- package/templates/route.ts +43 -0
- package/templates/service.ts +75 -0
- package/tsconfig.common.json +1 -2
- package/vscode/copyimportationpath/.eslintrc.json +24 -0
- package/vscode/copyimportationpath/.vscodeignore +12 -0
- package/vscode/copyimportationpath/CHANGELOG.md +9 -0
- package/vscode/copyimportationpath/README.md +3 -0
- package/vscode/copyimportationpath/copyimportationpath-0.0.1.vsix +0 -0
- package/vscode/copyimportationpath/out/extension.js +206 -0
- package/vscode/copyimportationpath/out/extension.js.map +1 -0
- package/vscode/copyimportationpath/package-lock.json +4536 -0
- package/vscode/copyimportationpath/package.json +86 -0
- package/vscode/copyimportationpath/src/extension.ts +300 -0
- package/vscode/copyimportationpath/tsconfig.json +22 -0
- package/vscode/copyimportationpath/vsc-extension-quickstart.md +42 -0
- package/cli/app/config.ts +0 -54
- package/cli/app/index.ts +0 -195
- package/cli/bin.js +0 -11
- package/cli/commands/build.ts +0 -34
- package/cli/commands/deploy/app.ts +0 -29
- package/cli/commands/deploy/web.ts +0 -60
- package/cli/commands/dev.ts +0 -109
- package/cli/commands/init.ts +0 -85
- package/cli/compiler/client/identite.ts +0 -72
- package/cli/compiler/client/index.ts +0 -334
- package/cli/compiler/common/babel/index.ts +0 -170
- package/cli/compiler/common/babel/plugins/index.ts +0 -0
- package/cli/compiler/common/babel/plugins/services.ts +0 -579
- package/cli/compiler/common/babel/routes/imports.ts +0 -127
- package/cli/compiler/common/babel/routes/routes.ts +0 -1130
- package/cli/compiler/common/files/autres.ts +0 -39
- package/cli/compiler/common/files/images.ts +0 -35
- package/cli/compiler/common/files/style.ts +0 -78
- package/cli/compiler/common/index.ts +0 -154
- package/cli/compiler/index.ts +0 -532
- package/cli/compiler/server/index.ts +0 -211
- package/cli/index.ts +0 -189
- package/cli/paths.ts +0 -165
- package/cli/print.ts +0 -12
- package/cli/tsconfig.json +0 -38
- package/cli/utils/index.ts +0 -22
- package/cli/utils/keyboard.ts +0 -78
package/cli/bin.js
DELETED
package/cli/commands/build.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*----------------------------------
|
|
2
|
-
- DEPENDANCES
|
|
3
|
-
----------------------------------*/
|
|
4
|
-
|
|
5
|
-
// Npm
|
|
6
|
-
import prompts from 'prompts';
|
|
7
|
-
|
|
8
|
-
// Configs
|
|
9
|
-
import Compiler from '../compiler';
|
|
10
|
-
|
|
11
|
-
/*----------------------------------
|
|
12
|
-
- TYPES
|
|
13
|
-
----------------------------------*/
|
|
14
|
-
|
|
15
|
-
/*----------------------------------
|
|
16
|
-
- COMMAND
|
|
17
|
-
----------------------------------*/
|
|
18
|
-
export const run = (): Promise<void> => new Promise(async (resolve) => {
|
|
19
|
-
|
|
20
|
-
const compiler = new Compiler('prod');
|
|
21
|
-
|
|
22
|
-
const multiCompiler = await compiler.create();
|
|
23
|
-
|
|
24
|
-
multiCompiler.run((error, stats) => {
|
|
25
|
-
|
|
26
|
-
if (error) {
|
|
27
|
-
console.error("An error occurred during the compilation:", error);
|
|
28
|
-
throw error;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//resolve();
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*----------------------------------
|
|
2
|
-
- DEPENDANCES
|
|
3
|
-
----------------------------------*/
|
|
4
|
-
|
|
5
|
-
// Npm
|
|
6
|
-
import fs from 'fs-extra';
|
|
7
|
-
|
|
8
|
-
// Core
|
|
9
|
-
import cli from '../..';
|
|
10
|
-
import { api } from '../../utils';
|
|
11
|
-
|
|
12
|
-
/*----------------------------------
|
|
13
|
-
- COMMAND
|
|
14
|
-
----------------------------------*/
|
|
15
|
-
export async function run() {
|
|
16
|
-
|
|
17
|
-
const { project, local } = cli.args;
|
|
18
|
-
|
|
19
|
-
const versionfile = fs.readFileSync( project + '/version.txt', 'utf-8' );
|
|
20
|
-
|
|
21
|
-
const [platform, version, build] = versionfile.split('\n');
|
|
22
|
-
|
|
23
|
-
console.log({ project, platform, version, build });
|
|
24
|
-
|
|
25
|
-
await cli.shell(
|
|
26
|
-
api('POST', '/app/release', { platform, version, build }, local)
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*----------------------------------
|
|
2
|
-
- DEPENDANCES
|
|
3
|
-
----------------------------------*/
|
|
4
|
-
|
|
5
|
-
// Npm
|
|
6
|
-
import fs from 'fs-extra';
|
|
7
|
-
import prompts from 'prompts';
|
|
8
|
-
|
|
9
|
-
// Core
|
|
10
|
-
import cli from '../..';
|
|
11
|
-
import { api } from '../../utils';
|
|
12
|
-
|
|
13
|
-
0/*----------------------------------
|
|
14
|
-
- HELPERS
|
|
15
|
-
----------------------------------*/
|
|
16
|
-
|
|
17
|
-
const mergeDeps = ({ dependencies: coreDeps }, { dependencies: appDeps }) => {
|
|
18
|
-
for (const dep in appDeps)
|
|
19
|
-
if (dep in coreDeps) {
|
|
20
|
-
|
|
21
|
-
if (coreDeps[dep] !== appDeps[dep])
|
|
22
|
-
throw new Error(`Duplicate dependency "${dep}" with different version in core (${coreDeps[dep]}) and app (${appDeps[dep]})`);
|
|
23
|
-
else
|
|
24
|
-
console.warn(`Duplicate dependency "${dep}" in core and app`);
|
|
25
|
-
|
|
26
|
-
} else
|
|
27
|
-
coreDeps[dep] = appDeps[dep];
|
|
28
|
-
return coreDeps;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const toast = (type: string, title: string, content: string) =>
|
|
32
|
-
api('POST', '/admin/api/notification', { type, title, content }, true)
|
|
33
|
-
|
|
34
|
-
/*----------------------------------
|
|
35
|
-
- COMMAND
|
|
36
|
-
----------------------------------*/
|
|
37
|
-
export async function run() {
|
|
38
|
-
|
|
39
|
-
const { simulate } = cli.args;
|
|
40
|
-
|
|
41
|
-
const temp = app.paths.root + '/.deployment';
|
|
42
|
-
fs.emptyDirSync(temp);
|
|
43
|
-
|
|
44
|
-
// Merge package.json: framework + app
|
|
45
|
-
fs.outputJSONSync(temp + '/package.json', {
|
|
46
|
-
...appPkg,
|
|
47
|
-
dependencies: mergeDeps(cli.packageJson, appPkg),
|
|
48
|
-
devDependencies: {}
|
|
49
|
-
}, { spaces: 4 });
|
|
50
|
-
|
|
51
|
-
// Copy config file
|
|
52
|
-
fs.copyFileSync( app.paths.root + (simulate ? '/env.yaml' : '/env.server.yaml'), temp + '/env.yaml' );
|
|
53
|
-
|
|
54
|
-
// Compile & Run Docker
|
|
55
|
-
await cli.shell(`docker compose up --build`);
|
|
56
|
-
toast("info", "Server update", "A server update will start. You might experience some temporary slowdowns.")
|
|
57
|
-
|
|
58
|
-
fs.removeSync(temp);
|
|
59
|
-
|
|
60
|
-
}
|
package/cli/commands/dev.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/*----------------------------------
|
|
2
|
-
- DEPENDANCES
|
|
3
|
-
----------------------------------*/
|
|
4
|
-
|
|
5
|
-
// Npm
|
|
6
|
-
import fs from 'fs-extra';
|
|
7
|
-
import { spawn, ChildProcess } from 'child_process';
|
|
8
|
-
|
|
9
|
-
// Cor elibs
|
|
10
|
-
import cli from '..';
|
|
11
|
-
import Keyboard from '../utils/keyboard';
|
|
12
|
-
|
|
13
|
-
// Configs
|
|
14
|
-
import Compiler from '../compiler';
|
|
15
|
-
|
|
16
|
-
// Core
|
|
17
|
-
import { app, App } from '../app';
|
|
18
|
-
|
|
19
|
-
/*----------------------------------
|
|
20
|
-
- COMMANDE
|
|
21
|
-
----------------------------------*/
|
|
22
|
-
export const run = () => new Promise<void>(async () => {
|
|
23
|
-
|
|
24
|
-
const compiler = new Compiler('dev', {
|
|
25
|
-
before: (compiler) => {
|
|
26
|
-
|
|
27
|
-
const changedFilesList = compiler.modifiedFiles ? [...compiler.modifiedFiles] : [];
|
|
28
|
-
|
|
29
|
-
if (changedFilesList.length === 0)
|
|
30
|
-
stopApp("Starting a new compilation");
|
|
31
|
-
else
|
|
32
|
-
stopApp("Need to recompile because files changed:\n" + changedFilesList.join('\n'));
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
after: () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const multiCompiler = await compiler.create();
|
|
42
|
-
|
|
43
|
-
multiCompiler.watch({
|
|
44
|
-
|
|
45
|
-
// https://webpack.js.org/configuration/watch/#watchoptions
|
|
46
|
-
// Watching may not work with NFS and machines in VirtualBox
|
|
47
|
-
// Uncomment next line if it is your case (use true or interval in milliseconds)
|
|
48
|
-
poll: 1000,
|
|
49
|
-
|
|
50
|
-
// Decrease CPU or memory usage in some file systems
|
|
51
|
-
// Ignore updated from:
|
|
52
|
-
// - Node modules except 5HTP core (framework dev mode)
|
|
53
|
-
// - Generated files during runtime (cause infinite loop. Ex: models.d.ts)
|
|
54
|
-
ignored: /(node_modules\/(?!proteum\/))|(\.generated\/)/
|
|
55
|
-
|
|
56
|
-
//aggregateTimeout: 1000,
|
|
57
|
-
}, async (error, stats) => {
|
|
58
|
-
|
|
59
|
-
if (error) {
|
|
60
|
-
console.error(`Error in milticompiler.watch`, error, stats?.toString());
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
console.log("Watch callback. Reloading app ...");
|
|
65
|
-
startApp(app);
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
Keyboard.input('ctrl+r', async () => {
|
|
70
|
-
|
|
71
|
-
console.log(`Waiting for compilers to be ready ...`, Object.keys(compiler.compiling));
|
|
72
|
-
await Promise.all(Object.values(compiler.compiling));
|
|
73
|
-
|
|
74
|
-
console.log(`Reloading app ...`);
|
|
75
|
-
startApp(app);
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
Keyboard.input('ctrl+c', () => {
|
|
80
|
-
stopApp("CTRL+C Pressed");
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/*----------------------------------
|
|
86
|
-
- APP RUN
|
|
87
|
-
----------------------------------*/
|
|
88
|
-
let cp: ChildProcess | undefined = undefined;
|
|
89
|
-
|
|
90
|
-
async function startApp( app: App ) {
|
|
91
|
-
|
|
92
|
-
stopApp('Restart asked');
|
|
93
|
-
|
|
94
|
-
console.info(`Launching new server ...`);
|
|
95
|
-
cp = spawn('node', ['' + app.paths.bin + '/server.js', '--preserve-symlinks'], {
|
|
96
|
-
|
|
97
|
-
// sdin, sdout, sderr
|
|
98
|
-
stdio: ['inherit', 'inherit', 'inherit']
|
|
99
|
-
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function stopApp( reason: string ) {
|
|
104
|
-
if (cp !== undefined) {
|
|
105
|
-
console.info(`Killing current server instance (ID: ${cp.pid}) for the following reason:`, reason);
|
|
106
|
-
cp.kill();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
}
|
package/cli/commands/init.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/*----------------------------------
|
|
2
|
-
- DEPENDANCES
|
|
3
|
-
----------------------------------*/
|
|
4
|
-
|
|
5
|
-
// Npm
|
|
6
|
-
import fs from 'fs-extra';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import prompts from 'prompts';
|
|
9
|
-
import cmd from 'node-cmd';
|
|
10
|
-
import replaceOnce from 'replace-once';
|
|
11
|
-
|
|
12
|
-
// Cor elibs
|
|
13
|
-
import cli from '..';
|
|
14
|
-
|
|
15
|
-
// Configs
|
|
16
|
-
const filesToConfig = [
|
|
17
|
-
'package.json',
|
|
18
|
-
'identity.yaml'
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
/*----------------------------------
|
|
22
|
-
- COMMANDE
|
|
23
|
-
----------------------------------*/
|
|
24
|
-
export const run = () => new Promise<void>(async () => {
|
|
25
|
-
|
|
26
|
-
const config = await prompts([{
|
|
27
|
-
type: 'text', name: 'name',
|
|
28
|
-
message: 'Project name ?',
|
|
29
|
-
initial: "MyProject",
|
|
30
|
-
validate: value => /[a-z0-9\-\.]/i.test(value) || "Must only include alphanumeric characters, and - . "
|
|
31
|
-
},{
|
|
32
|
-
type: 'text', name: 'dirname',
|
|
33
|
-
message: 'Folder name ?',
|
|
34
|
-
initial: value => value.toLowerCase(),
|
|
35
|
-
validate: value => /[a-z0-9\-\.]/.test(value) || "Must only include lowercase alphanumeric characters, and - . "
|
|
36
|
-
},{
|
|
37
|
-
type: 'text', name: 'description',
|
|
38
|
-
message: 'Briefly describe your project to your mom:',
|
|
39
|
-
initial: "It will revolutionnize the world",
|
|
40
|
-
validate: value => /[a-z0-9\-\. ]/i.test(value) || "Must only include alphanumeric characters, and - . "
|
|
41
|
-
},{
|
|
42
|
-
type: 'toggle', name: 'microservice',
|
|
43
|
-
message: 'Separate API from the UI servers ?'
|
|
44
|
-
}]);
|
|
45
|
-
|
|
46
|
-
const placeholders = {
|
|
47
|
-
PROJECT_NAME: config.name,
|
|
48
|
-
PACKAGE_NAME: config.name.toLowerCase(),
|
|
49
|
-
PROJECT_DESCRIPTION: config.description
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const paths = {
|
|
53
|
-
skeleton: path.join( cli.paths.core.cli, 'skeleton'),
|
|
54
|
-
project: path.join( process.cwd(), config.dirname)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Copy skeleton to cwd/<project-name>
|
|
58
|
-
console.info("Creating project skeleton ...");
|
|
59
|
-
fs.copySync( paths.skeleton, paths.project );
|
|
60
|
-
|
|
61
|
-
// Replace placeholders
|
|
62
|
-
console.info("Configuring project ...");
|
|
63
|
-
for (const file of filesToConfig) {
|
|
64
|
-
console.log('- ' + file);
|
|
65
|
-
|
|
66
|
-
const filepath = path.join( paths.project, file )
|
|
67
|
-
const content = fs.readFileSync(filepath, 'utf-8');
|
|
68
|
-
|
|
69
|
-
const placeholders_keys = Object.keys(placeholders).map(k => '{{ ' + k + ' }}')
|
|
70
|
-
const values = Object.values(placeholders);
|
|
71
|
-
|
|
72
|
-
fs.writeFileSync(filepath,
|
|
73
|
-
replaceOnce(content, placeholders_keys, values)
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Npm install
|
|
78
|
-
console.info("Installing packages ...");
|
|
79
|
-
cmd.runSync(`cd "${paths.project}" && npm i`);
|
|
80
|
-
|
|
81
|
-
// Run demo app
|
|
82
|
-
/*console.info("Run demo ...");
|
|
83
|
-
await cli.shell('5htp dev');*/
|
|
84
|
-
|
|
85
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// Npm
|
|
2
|
-
import favicons from 'favicons';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
|
|
5
|
-
// Libs
|
|
6
|
-
import cli from '../..';
|
|
7
|
-
|
|
8
|
-
// Type
|
|
9
|
-
import type App from '../../app';
|
|
10
|
-
|
|
11
|
-
export default async ( app: App ) => {
|
|
12
|
-
|
|
13
|
-
const dossierCache = app.paths.root + '/public/app';
|
|
14
|
-
|
|
15
|
-
if (!fs.existsSync(dossierCache)) {
|
|
16
|
-
|
|
17
|
-
console.info(`Generating identity assets ...`);
|
|
18
|
-
fs.emptyDirSync(dossierCache);
|
|
19
|
-
|
|
20
|
-
const identity = app.identity;
|
|
21
|
-
|
|
22
|
-
const response = await favicons( app.paths.root + '/client/assets/identity/logo.svg', {
|
|
23
|
-
|
|
24
|
-
path: '/assets/img/identite/favicons/',
|
|
25
|
-
appName: identity.name,
|
|
26
|
-
appShortName: identity.name,
|
|
27
|
-
appDescription: identity.description,
|
|
28
|
-
developerName: identity.author.name,
|
|
29
|
-
developerURL: identity.author.url,
|
|
30
|
-
dir: "auto",
|
|
31
|
-
lang: identity.language,
|
|
32
|
-
background: "#fff",
|
|
33
|
-
theme_color: identity.maincolor,
|
|
34
|
-
appleStatusBarStyle: "default",
|
|
35
|
-
display: "standalone",
|
|
36
|
-
orientation: "any",
|
|
37
|
-
//scope: "/",
|
|
38
|
-
start_url: "/",
|
|
39
|
-
version: identity.web.version,
|
|
40
|
-
logging: false,
|
|
41
|
-
pixel_art: false,
|
|
42
|
-
icons: {
|
|
43
|
-
android: true,
|
|
44
|
-
appleIcon: true,
|
|
45
|
-
appleStartup: false,
|
|
46
|
-
coast: false,
|
|
47
|
-
favicons: true,
|
|
48
|
-
firefox: true,
|
|
49
|
-
windows: true,
|
|
50
|
-
yandex: false
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
await Promise.all([
|
|
56
|
-
|
|
57
|
-
// Enregistrement images
|
|
58
|
-
...response.images.map((image) => {
|
|
59
|
-
let destimg = dossierCache + '/' + image.name;
|
|
60
|
-
return fs.writeFile(destimg, image.contents);
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
// Enregistrement fichiers
|
|
64
|
-
...response.files.map((fichier) => {
|
|
65
|
-
let destfichier = dossierCache + '/' + fichier.name;
|
|
66
|
-
return fs.writeFile(destfichier, fichier.contents);
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
]);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|