5htp 0.0.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/package.json +94 -0
- package/src/commands/build.ts +32 -0
- package/src/commands/deploy/app.ts +29 -0
- package/src/commands/deploy/web.ts +62 -0
- package/src/commands/dev.ts +100 -0
- package/src/compiler/client/identite.ts +70 -0
- package/src/compiler/client/index.ts +335 -0
- package/src/compiler/common/babel/index.ts +261 -0
- package/src/compiler/common/babel/plugins/form.ts +191 -0
- package/src/compiler/common/babel/plugins/icones-svg.ts +350 -0
- package/src/compiler/common/babel/plugins/importations.ts +337 -0
- package/src/compiler/common/babel/plugins/injection-dependances/index.ts +223 -0
- package/src/compiler/common/babel/plugins/injection-dependances/remplacerFonction.ts +226 -0
- package/src/compiler/common/babel/plugins/models.ts +241 -0
- package/src/compiler/common/babel/plugins/pages.ts +185 -0
- package/src/compiler/common/babel/plugins/queries/index.ts +166 -0
- package/src/compiler/common/files/autres.ts +37 -0
- package/src/compiler/common/files/images.ts +19 -0
- package/src/compiler/common/files/style.ts +64 -0
- package/src/compiler/common/index.ts +148 -0
- package/src/compiler/common/plugins/indexage/_utils/Stringify.ts +72 -0
- package/src/compiler/common/plugins/indexage/_utils/annotations.ts +88 -0
- package/src/compiler/common/plugins/indexage/_utils/iterateur.ts +52 -0
- package/src/compiler/common/plugins/indexage/icones-svg/index.ts +198 -0
- package/src/compiler/common/plugins/indexage/index.ts +132 -0
- package/src/compiler/common/plugins/indexage/indexeur.ts +13 -0
- package/src/compiler/common/plugins/indexage/injection-dependances/index.ts +68 -0
- package/src/compiler/index.ts +86 -0
- package/src/compiler/server/index.ts +177 -0
- package/src/index.ts +192 -0
- package/src/paths.ts +158 -0
- package/src/print.ts +12 -0
- package/src/utils/index.ts +22 -0
- package/src/utils/keyboard.ts +78 -0
- package/tsconfig.json +38 -0
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "5htp",
|
|
3
|
+
"description": "5-HTP, scientifically called 5-Hydroxytryptophan, is the precursor of happiness neurotransmitter.",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
|
+
"repository": "git://github.com/gaetanlegac/5htp-cli.git",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"5htp": "cli/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=16.1.0",
|
|
13
|
+
"npm": ">=3.10.10"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"framework"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@babel/cli": "^7.15.4",
|
|
20
|
+
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
21
|
+
"@babel/plugin-proposal-decorators": "^7.15.4",
|
|
22
|
+
"@babel/plugin-proposal-private-methods": "^7.14.5",
|
|
23
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.15.4",
|
|
24
|
+
"@babel/plugin-transform-react-constant-elements": "^7.14.5",
|
|
25
|
+
"@babel/plugin-transform-react-jsx-self": "^7.14.9",
|
|
26
|
+
"@babel/plugin-transform-react-jsx-source": "^7.14.5",
|
|
27
|
+
"@babel/preset-env": "^7.15.6",
|
|
28
|
+
"@babel/preset-react": "^7.14.5",
|
|
29
|
+
"@babel/preset-typescript": "^7.15.0",
|
|
30
|
+
"@prefresh/webpack": "^3.3.2",
|
|
31
|
+
"@squoosh/lib": "^0.4.0",
|
|
32
|
+
"@types/babel__core": "^7.1.16",
|
|
33
|
+
"@types/cookie": "^0.4.1",
|
|
34
|
+
"@types/express": "^4.17.13",
|
|
35
|
+
"@types/favicons": "^6.2.2",
|
|
36
|
+
"@types/fs-extra": "^9.0.12",
|
|
37
|
+
"@types/node": "^16.9.1",
|
|
38
|
+
"@types/nodemailer": "^6.4.4",
|
|
39
|
+
"@types/pg": "^8.6.1",
|
|
40
|
+
"@types/pg-escape": "^0.2.1",
|
|
41
|
+
"@types/prompts": "^2.0.14",
|
|
42
|
+
"@types/universal-analytics": "^0.4.5",
|
|
43
|
+
"@types/webpack-env": "^1.16.2",
|
|
44
|
+
"@types/ws": "^7.4.7",
|
|
45
|
+
"5htp-core": "^0.0.2",
|
|
46
|
+
"babel-loader": "^8.2.2",
|
|
47
|
+
"babel-plugin-transform-imports": "^2.0.0",
|
|
48
|
+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
49
|
+
"brotli-webpack-plugin": "^1.1.0",
|
|
50
|
+
"browser-sync": "^2.27.5",
|
|
51
|
+
"compression-webpack-plugin": "^8.0.1",
|
|
52
|
+
"console-table-printer": "^2.10.0",
|
|
53
|
+
"css-loader": "^6.2.0",
|
|
54
|
+
"css-minimizer-webpack-plugin": "^4.1.0",
|
|
55
|
+
"dayjs": "^1.11.5",
|
|
56
|
+
"favicons": "^6.2.2",
|
|
57
|
+
"filesize": "^8.0.3",
|
|
58
|
+
"image-minimizer-webpack-plugin": "^2.2.0",
|
|
59
|
+
"imagemin": "^8.0.1",
|
|
60
|
+
"imagemin-svgo": "^10.0.0",
|
|
61
|
+
"imagemin-webp": "^6.0.0",
|
|
62
|
+
"json5": "^2.2.0",
|
|
63
|
+
"less-loader": "^10.0.1",
|
|
64
|
+
"less-vars-to-js": "^1.3.0",
|
|
65
|
+
"mini-css-extract-plugin": "^2.2.2",
|
|
66
|
+
"minimatch": "^3.0.4",
|
|
67
|
+
"module-alias": "^2.2.2",
|
|
68
|
+
"node-notifier": "^10.0.0",
|
|
69
|
+
"null-loader": "^4.0.1",
|
|
70
|
+
"prompts": "^2.4.2",
|
|
71
|
+
"react-dev-utils": "^11.0.4",
|
|
72
|
+
"speed-measure-webpack-plugin": "^1.5.0",
|
|
73
|
+
"terser-webpack-plugin": "^5.2.4",
|
|
74
|
+
"ts-alias": "^0.0.3-1",
|
|
75
|
+
"ts-node": "^10.9.1",
|
|
76
|
+
"tslog": "^3.3.4",
|
|
77
|
+
"webfont": "^11.2.26",
|
|
78
|
+
"webpack": "^5.56.0",
|
|
79
|
+
"webpack-assets-manifest": "^5.0.6",
|
|
80
|
+
"webpack-bundle-analyzer": "^4.4.2",
|
|
81
|
+
"webpack-dev-middleware": "^5.1.0",
|
|
82
|
+
"webpack-hot-middleware": "^2.25.0",
|
|
83
|
+
"webpack-node-externals": "^3.0.0",
|
|
84
|
+
"webpack-virtual-modules": "^0.4.3"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@types/favicons": "^6.2.2",
|
|
88
|
+
"@types/fs-extra": "^9.0.12",
|
|
89
|
+
"@types/node": "^16.9.1",
|
|
90
|
+
"@types/nodemailer": "^6.4.4",
|
|
91
|
+
"@types/prompts": "^2.0.14",
|
|
92
|
+
"@types/webpack-env": "^1.16.2"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*----------------------------------
|
|
2
|
+
- DEPENDANCES
|
|
3
|
+
----------------------------------*/
|
|
4
|
+
|
|
5
|
+
// Npm
|
|
6
|
+
import prompts from 'prompts';
|
|
7
|
+
|
|
8
|
+
// Configs
|
|
9
|
+
import createCompilers 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 multiCompiler = await createCompilers('prod');
|
|
21
|
+
|
|
22
|
+
multiCompiler.run((error, stats) => {
|
|
23
|
+
|
|
24
|
+
if (error) {
|
|
25
|
+
console.error("An error occurred during the compilation:", error);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
resolve();
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 = cli.paths.app.root + '/.deployment';
|
|
42
|
+
fs.emptyDirSync(temp);
|
|
43
|
+
|
|
44
|
+
// Merge package.json: framework + app
|
|
45
|
+
const appPkg = fs.readJSONSync(cli.paths.app.root + '/package.json');
|
|
46
|
+
const corePkg = fs.readJSONSync(cli.paths.core.root + '/package.json');
|
|
47
|
+
fs.outputJSONSync(temp + '/package.json', {
|
|
48
|
+
...appPkg,
|
|
49
|
+
dependencies: mergeDeps(corePkg, appPkg),
|
|
50
|
+
devDependencies: {}
|
|
51
|
+
}, { spaces: 4 });
|
|
52
|
+
|
|
53
|
+
// Copy config file
|
|
54
|
+
fs.copyFileSync( cli.paths.app.root + (simulate ? '/env.yaml' : '/env.server.yaml'), temp + '/env.yaml' );
|
|
55
|
+
|
|
56
|
+
// Compile & Run Docker
|
|
57
|
+
await cli.shell(`docker compose up --build`);
|
|
58
|
+
toast("info", "Server update", "A server update will start. You might experience some temporary slowdowns.")
|
|
59
|
+
|
|
60
|
+
fs.removeSync(temp);
|
|
61
|
+
|
|
62
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 Keyboard from '../utils/keyboard';
|
|
11
|
+
|
|
12
|
+
// Configs
|
|
13
|
+
import createCompilers, { compiling } from '../compiler';
|
|
14
|
+
import cli from '../';
|
|
15
|
+
|
|
16
|
+
/*----------------------------------
|
|
17
|
+
- COMMANDE
|
|
18
|
+
----------------------------------*/
|
|
19
|
+
export const run = () => new Promise<void>(async () => {
|
|
20
|
+
|
|
21
|
+
const multiCompiler = await createCompilers('dev', {
|
|
22
|
+
before: () => {
|
|
23
|
+
|
|
24
|
+
console.log('before');
|
|
25
|
+
stopApp();
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
after: () => {
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Allow the dev servet to fetch the frameworg node modules
|
|
35
|
+
fs.createSymlinkSync( cli.paths.core.root + '/node_modules', cli.paths.app.bin + '/node_modules', 'dir' );
|
|
36
|
+
|
|
37
|
+
multiCompiler.watch({
|
|
38
|
+
|
|
39
|
+
// https://webpack.js.org/configuration/watch/#watchoptions
|
|
40
|
+
// Watching may not work with NFS and machines in VirtualBox
|
|
41
|
+
// Uncomment next line if it is your case (use true or interval in milliseconds)
|
|
42
|
+
poll: 1000,
|
|
43
|
+
|
|
44
|
+
// Decrease CPU or memory usage in some file systems
|
|
45
|
+
ignored: /node_modules\/(?!5htp\-core\/src\/)/,
|
|
46
|
+
|
|
47
|
+
//aggregateTimeout: 1000,
|
|
48
|
+
}, async (error, stats) => {
|
|
49
|
+
|
|
50
|
+
if (error) {
|
|
51
|
+
console.error(`Error in milticompiler.watch`, error, stats?.toString());
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log("Watch callback. Reloading app ...");
|
|
56
|
+
startApp();
|
|
57
|
+
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
Keyboard.input('ctrl+r', async () => {
|
|
61
|
+
|
|
62
|
+
console.log(`Waiting for compilers to be ready ...`, Object.keys(compiling));
|
|
63
|
+
await Promise.all(Object.values(compiling));
|
|
64
|
+
|
|
65
|
+
console.log(`Reloading app ...`);
|
|
66
|
+
startApp();
|
|
67
|
+
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
Keyboard.input('ctrl+c', () => {
|
|
71
|
+
stopApp();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
/*----------------------------------
|
|
77
|
+
- APP RUN
|
|
78
|
+
----------------------------------*/
|
|
79
|
+
let cp: ChildProcess | undefined = undefined;
|
|
80
|
+
|
|
81
|
+
async function startApp() {
|
|
82
|
+
|
|
83
|
+
stopApp();
|
|
84
|
+
|
|
85
|
+
console.info(`Launching new server ...`);
|
|
86
|
+
cp = spawn('node', ['' + cli.paths.app.bin + '/server.js', '--preserve-symlinks'], {
|
|
87
|
+
|
|
88
|
+
// sdin, sdout, sderr
|
|
89
|
+
stdio: ['inherit', 'inherit', 'inherit']
|
|
90
|
+
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function stopApp() {
|
|
95
|
+
if (cp !== undefined) {
|
|
96
|
+
console.info(`Killing current server instance (ID: ${cp.pid}) ...`);
|
|
97
|
+
cp.kill();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Npm
|
|
2
|
+
import favicons from 'favicons';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
|
|
5
|
+
// Libs
|
|
6
|
+
import cli from '../..';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default async () => {
|
|
10
|
+
|
|
11
|
+
const dossierCache = cli.paths.app.root + '/public/app';
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(dossierCache)) {
|
|
14
|
+
|
|
15
|
+
console.info(`Generating identity assets ...`);
|
|
16
|
+
fs.emptyDirSync(dossierCache);
|
|
17
|
+
|
|
18
|
+
const identity = cli.identity;
|
|
19
|
+
|
|
20
|
+
const response = await favicons( cli.paths.app.root + '/src/client/assets/identity/logo.svg', {
|
|
21
|
+
|
|
22
|
+
path: '/assets/img/identite/favicons/',
|
|
23
|
+
appName: identity.name,
|
|
24
|
+
appShortName: identity.name,
|
|
25
|
+
appDescription: identity.description,
|
|
26
|
+
developerName: identity.author.name,
|
|
27
|
+
developerURL: identity.author.url,
|
|
28
|
+
dir: "auto",
|
|
29
|
+
lang: identity.language,
|
|
30
|
+
background: "#fff",
|
|
31
|
+
theme_color: identity.maincolor,
|
|
32
|
+
appleStatusBarStyle: "default",
|
|
33
|
+
display: "standalone",
|
|
34
|
+
orientation: "any",
|
|
35
|
+
//scope: "/",
|
|
36
|
+
start_url: "/",
|
|
37
|
+
version: identity.web.version,
|
|
38
|
+
logging: false,
|
|
39
|
+
pixel_art: false,
|
|
40
|
+
icons: {
|
|
41
|
+
android: true,
|
|
42
|
+
appleIcon: true,
|
|
43
|
+
appleStartup: false,
|
|
44
|
+
coast: false,
|
|
45
|
+
favicons: true,
|
|
46
|
+
firefox: true,
|
|
47
|
+
windows: true,
|
|
48
|
+
yandex: false
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
await Promise.all([
|
|
54
|
+
|
|
55
|
+
// Enregistrement images
|
|
56
|
+
...response.images.map((image) => {
|
|
57
|
+
let destimg = dossierCache + '/' + image.name;
|
|
58
|
+
return fs.writeFile(destimg, image.contents);
|
|
59
|
+
}),
|
|
60
|
+
|
|
61
|
+
// Enregistrement fichiers
|
|
62
|
+
...response.files.map((fichier) => {
|
|
63
|
+
let destfichier = dossierCache + '/' + fichier.name;
|
|
64
|
+
return fs.writeFile(destfichier, fichier.contents);
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|