5htp 0.0.7-1 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp",
3
3
  "description": "5-HTP, scientifically called 5-Hydroxytryptophan, is the precursor of happiness neurotransmitter.",
4
- "version": "0.0.7-1",
4
+ "version": "0.0.8",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-cli.git",
7
7
  "license": "MIT",
@@ -72,7 +72,7 @@
72
72
  "replace-once": "^1.0.0",
73
73
  "speed-measure-webpack-plugin": "^1.5.0",
74
74
  "terser-webpack-plugin": "^5.2.4",
75
- "ts-alias": "^0.0.4",
75
+ "ts-alias": "^0.0.5",
76
76
  "ts-node": "^10.9.1",
77
77
  "tslog": "^3.3.4",
78
78
  "webfont": "^11.2.26",
package/readme.md ADDED
@@ -0,0 +1,30 @@
1
+ # 5-HTP Framework
2
+
3
+ Opinionated, Lightweight & Full Stack Typescript framework, designed for productivity, modularity and performance.
4
+
5
+ **/!\ This is a side-project. I cannot guarantee the maintenance.**
6
+
7
+ ## Get Started
8
+
9
+ 1. Install:
10
+
11
+ `npm i -g 5htp`
12
+
13
+ 2. Create a project:
14
+
15
+ `5htp init`
16
+
17
+ 3. Launch dev server:
18
+
19
+ `5htp dev`
20
+
21
+ 4. Build for production:
22
+
23
+ `5htp build`
24
+
25
+ ## To be done:
26
+
27
+ - Fix Typescript errors
28
+ - Improve stability
29
+ - Improve modularity
30
+ - Make it less opinionated
package/src/app/index.ts CHANGED
@@ -32,7 +32,7 @@ export default class App {
32
32
  src: cli.paths.appRoot + '/src',
33
33
  bin: cli.paths.appRoot + '/bin',
34
34
  data: cli.paths.appRoot + '/var/data',
35
- public: cli.paths.appRoot + '/bin/public',
35
+ public: cli.paths.appRoot + '/public',
36
36
  pages: cli.paths.appRoot + '/src/client/pages',
37
37
  cache: cli.paths.appRoot + '/src/.cache',
38
38
 
@@ -55,9 +55,21 @@ export default class App {
55
55
  ----------------------------------*/
56
56
 
57
57
  public aliases = {
58
- client: new TsAlias(this.paths.root + '/src/client'),
59
- server: new TsAlias(this.paths.root + '/src/server'),
58
+ client: new TsAlias({
59
+ rootDir: this.paths.root + '/src/client',
60
+ modulesDir: [
61
+ cli.paths.appRoot + '/node_modules',
62
+ cli.paths.coreRoot + '/node_modules'
63
+ ],
64
+ debug: false
65
+ }),
66
+ server: new TsAlias({
67
+ rootDir: this.paths.root + '/src/server',
68
+ modulesDir: [
69
+ cli.paths.appRoot + '/node_modules',
70
+ cli.paths.coreRoot + '/node_modules'
71
+ ],
72
+ debug: false
73
+ }),
60
74
  }
61
-
62
-
63
75
  }
@@ -36,9 +36,6 @@ export const run = () => new Promise<void>(async () => {
36
36
  }
37
37
  });
38
38
 
39
- // Allow the dev servet to fetch the frameworg node modules
40
- //fs.createSymlinkSync( cli.paths.core.cli + '/node_modules', app.paths.bin + '/node_modules', 'dir' );
41
-
42
39
  multiCompiler.watch({
43
40
 
44
41
  // https://webpack.js.org/configuration/watch/#watchoptions
@@ -54,7 +54,7 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
54
54
  const { aliases } = app.aliases.client.forWebpack(app.paths.root + '/node_modules');
55
55
  // Disable access to server-side libs from client side
56
56
  delete aliases["@server"];
57
- delete aliases["@/server"];
57
+ delete aliases["@/server"];
58
58
 
59
59
  const config: webpack.Configuration = {
60
60
 
@@ -3,6 +3,7 @@
3
3
  ----------------------------------*/
4
4
 
5
5
  // Npm
6
+ import path from 'path';
6
7
  import webpack from 'webpack';
7
8
  import fs from 'fs-extra';
8
9
 
@@ -37,6 +38,21 @@ export default async function createCompilers(
37
38
 
38
39
  // Cleanup
39
40
  fs.emptyDirSync( app.paths.bin );
41
+ fs.ensureDirSync( path.join(app.paths.bin, 'public') )
42
+ const publicFiles = fs.readdirSync(app.paths.public);
43
+ for (const publicFile of publicFiles)
44
+ fs.symlinkSync(
45
+ path.join(app.paths.public, publicFile),
46
+ path.join(app.paths.bin, 'public', publicFile)
47
+ );
48
+
49
+ // When the 5htp package is installed from npm link,
50
+ // Modules are installed locally and not glbally as with with the 5htp package from NPM.
51
+ // So we need to symbilnk the http-core node_modules in one of the parents of server.js.
52
+ fs.symlinkSync(
53
+ path.join(app.paths.root, '/node_modules/5htp-core/node_modules'),
54
+ path.join(app.paths.bin, '/node_modules')
55
+ );
40
56
 
41
57
  // Create compilers
42
58
  const multiCompiler = webpack([
package/src/paths.ts CHANGED
@@ -125,7 +125,9 @@ export default class Paths {
125
125
 
126
126
  public applyAliases() {
127
127
 
128
- const aliases = new TsAlias( this.core.cli );
128
+ const aliases = new TsAlias({
129
+ rootDir: this.core.cli
130
+ });
129
131
 
130
132
  console.log('Applying Aliases ...', aliases);
131
133