Skip to content

Commit 464fe4b

Browse files
committed
2.x-devel: Fixed build and push ts
1 parent 2e6241e commit 464fe4b

File tree

7 files changed

+11856
-6442
lines changed

7 files changed

+11856
-6442
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ lib
66
tmp
77
node_modules
88
oclif.manifest.json
9+
tsconfig.tsbuildinfo
10+
.idea/

README.md

Lines changed: 108 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ce-dev 2.x
22
======
33
Local Stack wrapper tool
44

5-
[![Build status](https://github.com/codeenigma/ce-dev/actions/workflows/ce-dev-build.yml/badge.svg)](https://github.com/codeenigma/ce-dev/actions/workflows/ce-dev-build.yml)
5+
[![2.x: Linux - Build ce_dev binaries, images and templates (test)](https://github.com/codeenigma/ce-dev/actions/workflows/ce-dev-devel-linux.yml/badge.svg?branch=2.x-devel)](https://github.com/codeenigma/ce-dev/actions/workflows/ce-dev-devel-linux.yml)
66
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=codeenigma_ce-dev&metric=security_rating)](https://sonarcloud.io/dashboard?id=codeenigma_ce-dev)
77
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=codeenigma_ce-dev&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=codeenigma_ce-dev)
88
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=codeenigma_ce-dev&metric=bugs)](https://sonarcloud.io/dashboard?id=codeenigma_ce-dev)
@@ -13,16 +13,12 @@ Local Stack wrapper tool
1313
* Use of latest Typescript version (5.3.x)
1414
* Binaries built with Emacs instead of Commonjs: Emacs can consume Commonjs modules,
1515
but Commonjs can't consume Emacs modules. It means we can use more contrib modules
16-
* ce-dev-controller is compatible with ce-provision 1.x and 2.x, by default ce-dev uses ce-provision 2
16+
* ce-dev-controller uses ce-provision 2. The roles in provision.yml have been updated.
1717
* src folder has been organised a bit better.
1818
* Removed drupal 8 and drupal 9 templates.
1919
* The way to assign IPs have changed.
2020
* All the packages used are up to date.
2121

22-
## ToDo: Review docs folder
23-
24-
A local stack based on Docker Compose and Ansible. It aims to be easy to use but also stay flexible and powerful by not hiding complexity behind yet another abstraction layer.
25-
2622
## Key features
2723
- Allows several projects (or the host) to re-use the same ports
2824
- Allows mixing any Docker images with ce-dev specific ones
@@ -36,12 +32,111 @@ A local stack based on Docker Compose and Ansible. It aims to be easy to use but
3632

3733
## Do you want to contribute?
3834

39-
* Clone this repository in your computer.
40-
* Once you make your changes, run 'yarn' in the root folder
41-
This will clean and create the {root}/lib folder, with the compiled TS files to JS.
42-
* Use oclif pack to generate new releases for the different Systems
35+
### Preparation
36+
37+
* Install Node.js in your local machine https://nodejs.org/en/download/package-manager
38+
* Clone this repo in your local machine.
39+
* Change the branch (2.x, 2.x-devel, etc...) to work on it.
40+
* Run ```npm install```
41+
42+
With these steps you will have all the packages installed.
43+
44+
### How to compile
45+
46+
CE-Dev is made with typescript, you need to compile the code to js to make the different distributions.
47+
Once you make your changes in the source dode ({root}/src folder), you need to compile it. To compile you can
48+
execute the following commands:
49+
50+
```
51+
yarn clean
52+
yarn build
53+
```
54+
55+
This will clean and compile the new js files. A new folder {root}/lib is generated
56+
with all the js file. If you only need to test your changes with your current projects you have, you can execute
57+
the commands directly using the run.js file. In this way you don't need to break your current ce-dev installation
58+
(located in /opt/ce-dev)
59+
Example:
60+
61+
```angular2html
62+
{absolute_path}/bin/run.js --help
63+
```
64+
65+
#### Generating new docker images
66+
In case you need to test new docker images (example, when a new major version will be released) you need to build these
67+
images locally. To see the ce-dev version for this branch: you can check the value in this file
68+
```angular2html
69+
src/app-settings.ts
70+
```
71+
72+
Currently having ```ceDevVersion : 2```
73+
74+
it means you would need to have the local docker images with tag 2.x
75+
76+
```angular2html
77+
dioni@dionice:~/projects/wrap$ docker image ls
78+
[sudo] contraseña para dioni:
79+
REPOSITORY TAG IMAGE ID CREATED SIZE
80+
codeenigma/drupal10-db 2.x 5cae51ec65c0 3 days ago 409MB
81+
codeenigma/drupal10-web 2.x 83cc832fb73d 3 days ago 1.47GB
82+
codeenigma/blank-blank 2.x 5157934972ad 3 days ago 1.26GB
83+
codeenigma/ce-dev 2.x 8753195771fc 3 days ago 691MB
84+
codeenigma/ce-dev-controller 2.x 5aed115a5e74 3 days ago 1.83GB
85+
```
86+
87+
if you are testing the devel version, the tag will be 2.x-devel.
88+
89+
If you don't have the local images, you can follow these steps:
90+
91+
1. Delete your current ce_dev_controller...yes stop and delete it, no worries!
92+
It can be re-created starting a project with your installed ce-dev version
93+
2. Execute the following commands to create the docker images (you may need to add +x to the run.js file).
94+
95+
```angular2html
96+
/bin/sh docker-images/export.sh --version 2.x --image-name ce-dev --dockerfile-path base
97+
/bin/sh docker-images/export.sh --version 2.x --image-name ce-dev-controller --dockerfile-path controller
98+
/bin/sh templates/prebuild.sh --template ce-dev.compose.yml
99+
```
100+
101+
The last step will generate the drupal10-web, drupal10-db and blank docker images. Also, it will create docker containers
102+
with the same name. You can remove these containers because we only need the images.
103+
104+
Now we can start to test our ce-dev changes as it is described in the previous point 'How to compile'
105+
106+
107+
### Testing a new ce-dev release locally.
108+
109+
If you need to test the creation of releases locally, we can do it using oclif.
110+
111+
oclif is an open source framework for building a command line interface (CLI) in Node.js and Typescript https://oclif.io/
112+
113+
As part of the command we used ```yarn build```, a folder /lib was generated. This folder contains the javascript code
114+
used by oclif.
115+
116+
According to your system, your local ce-dev version will be different. Here the list of available targets:
117+
* linux-x64
118+
* linux-arm
119+
* linux-arm64
120+
* win32-x64
121+
* win32-x86
122+
* win32-arm64
123+
* darwin-x64
124+
* darwin-arm64
125+
126+
Probably you will use linux-...64 or darwin-...64 version.
127+
128+
Use oclif pack to generate a new release for your system:
43129

44-
i.e: <code>yarn oclif pack tarballs --targets=linux-x64 --no-xz</code>
130+
i.e: <code>yarn oclif pack tarballs --targets=linux-x64 --no-xz</code>
131+
132+
This will generate a tar.gz file inside a new directory named /dir/ce-dev-xxxxxx
133+
You can un-compress and put it where you want. i.e: you can put it in /opt too (where you have the current ce-dev)
134+
as ce-dev-local or something like that.
135+
136+
Then you can create the symlink here /usr/bin/local aiming to /opt/ce-dev-local/bin/ce-dev.
137+
138+
From now, you can use
139+
```angular2html
140+
ce-dev-local --help
141+
```
45142

46-
This will create a {root}/dist folder with the different releases of ce-dev.
47-
You can use the release according to your OS to test the results in your computer

0 commit comments

Comments
 (0)