5htp 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp.git",
7
7
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "@types/webpack-env": "^1.16.2",
41
41
  "@types/ws": "^7.4.7",
42
42
  "babel-loader": "^8.2.2",
43
- "babel-plugin-glob-import": "^0.0.7",
43
+ "babel-plugin-glob-import": "^0.0.8-1",
44
44
  "babel-plugin-transform-imports": "^2.0.0",
45
45
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
46
46
  "brotli-webpack-plugin": "^1.1.0",
@@ -140,7 +140,7 @@ module.exports = (app: App, side: TAppSide, dev: boolean): webpack.RuleSetRule[]
140
140
 
141
141
  overrides: [
142
142
 
143
- require('./plugins/icones-svg'),
143
+ require('./plugins/icones-svg')(app),
144
144
 
145
145
  // Universal forms
146
146
  //require('./plugins/form'),
@@ -4,30 +4,29 @@
4
4
 
5
5
  // Npm
6
6
  import * as types from '@babel/types'
7
-
8
7
  import { PluginObj } from '@babel/core';
9
8
 
9
+ import type { App } from '../../../../app';
10
+
10
11
  export type TIndexIcones = { [chemin: string]: { id: string, nom: string, fichier: string } };
11
12
 
12
13
  /*----------------------------------
13
14
  - WEBPACK RULE
14
15
  ----------------------------------*/
15
- module.exports = {
16
+ module.exports = (app: App) => ({
16
17
  test: /\.(tsx|jsx|ts)$/, // <i src="icon" /> et /* @icon */"icon"
17
18
  plugins: [
18
- [Plugin]
19
+ [Plugin, { app }]
19
20
  ]
20
- }
21
+ })
21
22
 
22
23
  const debug = false;
23
24
 
24
- const defaultIconsPack = 'regular';
25
-
26
25
  /*----------------------------------
27
26
  - PLUGIN
28
27
  ----------------------------------*/
29
28
  const ids: string[] = []
30
- function Plugin (babel) {
29
+ function Plugin (babel, { app }: { app: App }) {
31
30
 
32
31
  const t = babel.types as typeof types;
33
32
 
@@ -57,7 +56,7 @@ function Plugin (babel) {
57
56
  let [dossierIcone, nomIcone] = nomBrut.split('/');
58
57
  if (nomIcone === undefined) {
59
58
  nomIcone = dossierIcone;
60
- dossierIcone = defaultIconsPack;
59
+ dossierIcone = app.identity.iconsPack || 'regular';
61
60
  }
62
61
 
63
62
  // Extraction des infos
@@ -16,5 +16,8 @@ module.exports = (app: App, dev: boolean, client: boolean): webpack.RuleSetRule[
16
16
  }
17
17
  }
18
18
 
19
- }]
19
+ }, {
20
+ test: /\.(webm|mp4|avi|mpk|mov|mkv)$/,
21
+ type: 'asset/resource',
22
+ },]
20
23
  }
@@ -91,7 +91,7 @@ export default function createCommonConfig( app: App, side: TAppSide, mode: TCom
91
91
  //'injection-dependances': new InjectDeps,
92
92
  }),
93
93
 
94
- ...(cli.args.analyze === side ? [
94
+ ...(side === 'client' && cli.args.analyze ? [
95
95
 
96
96
  new BundleAnalyzerPlugin({
97
97
  defaultSizes: 'stat',
@@ -100,8 +100,6 @@ export default function createCommonConfig( app: App, side: TAppSide, mode: TCom
100
100
 
101
101
  ] : []),
102
102
 
103
-
104
-
105
103
  ...(dev ? [
106
104
 
107
105
  // HMR
@@ -13,7 +13,7 @@ import cli from '@cli';
13
13
 
14
14
  // Types
15
15
  import type { TIndexIcones } from '../../../babel/plugins/icones-svg';
16
- import type App from '@cli/app';
16
+ import type { App } from '../../../../../app';
17
17
 
18
18
  /*----------------------------------
19
19
  - UTILS
package/src/index.ts CHANGED
@@ -75,9 +75,7 @@ export class CLI {
75
75
  if (this.commands[commandName] === undefined)
76
76
  throw new Error(`Command ${commandName} does not exists.`);
77
77
 
78
- const options = {
79
- workdir: process.cwd()
80
- }
78
+ this.args.workdir = process.cwd();
81
79
 
82
80
  let opt: string | null = null;
83
81
  for (const a of argv) {
@@ -85,37 +83,35 @@ export class CLI {
85
83
  if (a[0] === '-') {
86
84
 
87
85
  opt = a.substring(1);
88
- if (!(opt in options))
86
+ if (!(opt in this.args))
89
87
  throw new Error(`Unknown option: ${opt}`);
90
88
 
91
89
  // Init with default value
92
- if (typeof options[opt] === "boolean")
93
- options[opt] = true;
90
+ if (typeof this.args[opt] === "boolean")
91
+ this.args[opt] = true;
94
92
 
95
93
  } else if (opt !== null) {
96
94
 
97
- const curVal = options[opt];
95
+ const curVal = this.args[opt];
98
96
 
99
97
  if (Array.isArray( curVal ))
100
98
  curVal.push(a);
101
99
  else
102
- options[opt] = a;
100
+ this.args[opt] = a;
103
101
 
104
102
  opt = null;
105
103
 
106
104
  } else {
107
105
 
108
- //args.push(a);
106
+ this.args[ a ] = true;
109
107
 
110
108
  }
111
109
  }
112
110
 
113
- this.runCommand(commandName, options);
111
+ this.runCommand(commandName);
114
112
  }
115
113
 
116
- public async runCommand(command: string, args: TArgsObject) {
117
-
118
- this.args = args;
114
+ public async runCommand(command: string) {
119
115
 
120
116
  this.debug && console.info(`Running command ${command}`, this.args);
121
117