5htp 0.0.8-2 → 0.0.8-3

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.8-2",
4
+ "version": "0.0.8-3",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-cli.git",
7
7
  "license": "MIT",
@@ -4,6 +4,7 @@
4
4
 
5
5
  // Npm
6
6
  import webpack from 'webpack';
7
+ import fs from 'fs-extra';
7
8
 
8
9
  // Minimizers
9
10
  const TerserPlugin = require("terser-webpack-plugin");
@@ -16,6 +17,23 @@ import createCommonConfig, { TCompileMode, regex } from '../common';
16
17
  // Type
17
18
  import type App from '../../app';
18
19
 
20
+ const getCorePluginsList = (app: App,) => {
21
+
22
+ const corePlugins: string[] = [];
23
+
24
+ if (fs.existsSync( app.paths.root + '/node_modules' ))
25
+ for (const moduleName of fs.readdirSync( app.paths.root + '/node_modules' ))
26
+ if (moduleName.startsWith('5htp-'))
27
+ corePlugins.push(app.paths.root + '/node_modules/' + moduleName + '/src');
28
+
29
+ if (fs.existsSync( cli.paths.core.root + '/node_modules' ))
30
+ for (const moduleName of fs.readdirSync( cli.paths.core.root+ '/node_modules' ))
31
+ if (moduleName.startsWith('5htp-'))
32
+ corePlugins.push(cli.paths.core.root + '/node_modules/' + moduleName + '/src');
33
+
34
+ return corePlugins;
35
+ }
36
+
19
37
  /*----------------------------------
20
38
  - CONFIG
21
39
  ----------------------------------*/
@@ -70,11 +88,14 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
70
88
  function ({ request }, callback) {
71
89
 
72
90
  const shouldCompile = request !== undefined && (
73
- request[0] === '.'
74
- ||
75
- request[0] === '/'
91
+ // Local files
92
+ request[0] === '.' || request[0] === '/'
76
93
  ||
94
+ // Aliased modules
77
95
  app.aliases.server.containsAlias(request)
96
+ ||
97
+ // Compile 5HTP modules
98
+ request.startsWith('5htp-')
78
99
  )
79
100
 
80
101
  //console.log('isNodeModule', request, isNodeModule);
@@ -119,7 +140,10 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
119
140
 
120
141
  // Dossiers server uniquement pour le bundle server
121
142
  app.paths.root + '/src/server',
122
- cli.paths.core.root + '/src/server'
143
+ cli.paths.core.root + '/src/server',
144
+
145
+ // Complle 5HTP modules so they can refer to the framework instance and aliases
146
+ ...getCorePluginsList(app)
123
147
  ],
124
148
  rules: require('../common/babel')(app, 'server', dev)
125
149
  },
@@ -1,93 +0,0 @@
1
- name: Node.js CI
2
-
3
- on:
4
- push:
5
- branches: [main]
6
-
7
- env:
8
- AWS_REGION: eu-west-3
9
- ECR_REPOSITORY: megacharger
10
- ECS_SERVICE: megacharger
11
- ECS_CLUSTER: main-cluster
12
- ECS_TASK_DEFINITION: .github/workflows/ecs-task.json
13
- CONTAINER_NAME: megacharger
14
-
15
- jobs:
16
- build:
17
- name: Build
18
- runs-on: ubuntu-latest
19
- steps:
20
- # git pull
21
- - uses: actions/checkout@v3
22
- # Use Node.JS
23
- - name: Use Node.js
24
- uses: actions/setup-node@v3
25
- with:
26
- node-version: '18.x'
27
- # Install node deps
28
- - run: npm ci
29
- # Install 5htp CLI
30
- - run: npm i --prefix=$HOME/.local -g 5htp;
31
- # Buold app
32
- - run: 5htp build
33
-
34
- - uses: actions/upload-artifact@v2
35
- with:
36
- name: built-app
37
- path: |
38
- ./bin
39
- ./public
40
- ./package.json
41
- ./package-lock.json
42
- ./identity.yaml
43
- ./Dockerfile
44
- ./.github/workflows/ecs-task.json
45
-
46
- deploy:
47
- name: Deploy
48
- runs-on: ubuntu-latest
49
- environment: production
50
- needs: build
51
- steps:
52
- - uses: actions/download-artifact@v2
53
- with:
54
- name: built-app
55
-
56
- - name: Configure AWS credentials
57
- uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3
58
- with:
59
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
60
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
61
- aws-region: ${{ env.AWS_REGION }}
62
-
63
- - run: ls -al
64
-
65
- - name: Login to Amazon ECR
66
- id: login-ecr
67
- uses: aws-actions/amazon-ecr-login@aaf69d68aa3fb14c1d5a6be9ac61fe15b48453a2
68
-
69
- - name: Build, tag, and push image to Amazon ECR
70
- id: build-image
71
- env:
72
- ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
73
- IMAGE_TAG: ${{ github.sha }}
74
- run: |
75
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
76
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
77
- echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
78
-
79
- - name: Fill in the new image ID in the Amazon ECS task definition
80
- id: task-def
81
- uses: aws-actions/amazon-ecs-render-task-definition@97587c9d45a4930bf0e3da8dd2feb2a463cf4a3a
82
- with:
83
- task-definition: ${{ env.ECS_TASK_DEFINITION }}
84
- container-name: ${{ env.CONTAINER_NAME }}
85
- image: ${{ steps.build-image.outputs.image }}
86
-
87
- - name: Deploy Amazon ECS task definition
88
- uses: aws-actions/amazon-ecs-deploy-task-definition@v1
89
- with:
90
- task-definition: ${{ steps.task-def.outputs.task-definition }}
91
- service: ${{ env.ECS_SERVICE }}
92
- cluster: ${{ env.ECS_CLUSTER }}
93
- wait-for-service-stability: true
@@ -1,77 +0,0 @@
1
- {
2
- "taskDefinitionArn": "arn:aws:ecs:eu-west-3:909466428160:task-definition/run-app:8",
3
- "containerDefinitions": [
4
- {
5
- "name": "megacharger",
6
- "image": "909466428160.dkr.ecr.eu-west-3.amazonaws.com/megacharger",
7
- "cpu": 0,
8
- "portMappings": [
9
- {
10
- "containerPort": 3010,
11
- "hostPort": 3010,
12
- "protocol": "tcp"
13
- }
14
- ],
15
- "essential": true,
16
- "environment": [],
17
- "mountPoints": [],
18
- "volumesFrom": [],
19
- "logConfiguration": {
20
- "logDriver": "awslogs",
21
- "options": {
22
- "awslogs-group": "/ecs/run-app",
23
- "awslogs-region": "eu-west-3",
24
- "awslogs-stream-prefix": "ecs"
25
- }
26
- }
27
- }
28
- ],
29
- "family": "run-app",
30
- "taskRoleArn": "arn:aws:iam::909466428160:role/ecsTaskExecutionRole",
31
- "executionRoleArn": "arn:aws:iam::909466428160:role/ecsTaskExecutionRole",
32
- "networkMode": "awsvpc",
33
- "revision": 8,
34
- "volumes": [],
35
- "status": "ACTIVE",
36
- "requiresAttributes": [
37
- {
38
- "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
39
- },
40
- {
41
- "name": "ecs.capability.execution-role-awslogs"
42
- },
43
- {
44
- "name": "com.amazonaws.ecs.capability.ecr-auth"
45
- },
46
- {
47
- "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
48
- },
49
- {
50
- "name": "com.amazonaws.ecs.capability.task-iam-role"
51
- },
52
- {
53
- "name": "ecs.capability.execution-role-ecr-pull"
54
- },
55
- {
56
- "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
57
- },
58
- {
59
- "name": "ecs.capability.task-eni"
60
- }
61
- ],
62
- "placementConstraints": [],
63
- "compatibilities": [
64
- "EC2",
65
- "FARGATE"
66
- ],
67
- "runtimePlatform": {
68
- "operatingSystemFamily": "LINUX"
69
- },
70
- "requiresCompatibilities": [
71
- "FARGATE"
72
- ],
73
- "cpu": "256",
74
- "memory": "512",
75
- "registeredAt": "2022-10-17T11:13:18.185000+02:00",
76
- "registeredBy": "arn:aws:iam::909466428160:user/github-ci"
77
- }