underpost 2.7.7 → 2.7.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.
Files changed (39) hide show
  1. package/.github/workflows/ghpkg.yml +75 -0
  2. package/.github/workflows/publish.yml +21 -3
  3. package/.github/workflows/pwa-microservices-template.test.yml +30 -0
  4. package/bin/deploy.js +13 -2
  5. package/bin/index.js +1 -1
  6. package/docker-compose.yml +1 -1
  7. package/package.json +1 -1
  8. package/src/client/components/core/Css.js +0 -222
  9. package/src/client/components/core/Docs.js +1 -1
  10. package/src/client/components/core/Translate.js +6 -2
  11. package/src/client/components/core/Worker.js +14 -4
  12. package/src/client/services/default/default.management.js +118 -120
  13. package/src/client/ssr/Render.js +224 -3
  14. package/src/client/ssr/common/Alert.js +75 -0
  15. package/src/client/ssr/common/SsrCore.js +91 -0
  16. package/src/client/ssr/common/Translate.js +26 -0
  17. package/src/client/ssr/common/Worker.js +28 -0
  18. package/src/client/ssr/{body-components → components/body}/CacheControl.js +1 -1
  19. package/src/client/ssr/{body-components → components/body}/DefaultSplashScreen.js +15 -4
  20. package/src/client/ssr/offline/default.index.js +31 -0
  21. package/src/client/ssr/pages/404.js +12 -0
  22. package/src/client/ssr/pages/500.js +12 -0
  23. package/src/client/sw/default.sw.js +11 -9
  24. package/src/mailer/EmailRender.js +1 -1
  25. package/src/server/client-build-live.js +6 -0
  26. package/src/server/client-build.js +95 -25
  27. package/src/server/client-formatted.js +11 -1
  28. package/src/server/client-icons.js +1 -1
  29. package/src/server/conf.js +9 -7
  30. package/src/server/runtime.js +24 -7
  31. package/.github/workflows/test.yml +0 -80
  32. package/src/client/ssr/head-components/Microdata.js +0 -11
  33. package/src/client/ssr/head-components/Production.js +0 -1
  34. package/src/client/ssr/head-components/Seo.js +0 -14
  35. /package/src/client/ssr/{email-components → components/email}/DefaultRecoverEmail.js +0 -0
  36. /package/src/client/ssr/{email-components → components/email}/DefaultVerifyEmail.js +0 -0
  37. /package/src/client/ssr/{head-components → components/head}/Css.js +0 -0
  38. /package/src/client/ssr/{head-components → components/head}/DefaultScripts.js +0 -0
  39. /package/src/client/ssr/{head-components → components/head}/PwaDefault.js +0 -0
@@ -0,0 +1,75 @@
1
+ name: Update github repo package
2
+ on:
3
+ push:
4
+ branches: ['master']
5
+ pull_request:
6
+ branches: ['master']
7
+ permissions:
8
+ contents: write
9
+ packages: write
10
+ id-token: write
11
+ jobs:
12
+ test:
13
+ if: github.repository == 'underpostnet/pwa-microservices-template'
14
+ name: Update github repo package Jobs
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write
18
+ packages: write
19
+ id-token: write
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '22.x'
25
+
26
+ # - name: Get npm root
27
+ # run: sudo npm root -g
28
+
29
+ # - run: npm ci
30
+
31
+ # - name: Install underpost cli
32
+ # run: sudo npm install -g underpost
33
+
34
+ # usage: git remote set-url [--push] <name> <newurl> [<oldurl>]
35
+ # or: git remote set-url --add <name> <newurl>
36
+ # or: git remote set-url --delete <name> <url>
37
+ # --[no-]push manipulate push URLs
38
+ # --[no-]add add URL
39
+ # --[no-]delete delete URLs
40
+
41
+ - name: Install dependencies and set repo configuration
42
+ run: |
43
+ npm install
44
+ node ./bin/deploy rename-package @underpostnet/underpost
45
+ node ./bin/deploy set-repo underpostnet/pwa-microservices-template-ghpkg
46
+
47
+ - name: Clone github package repository
48
+ run: |
49
+ git clone https://github.com/underpostnet/pwa-microservices-template-ghpkg.git
50
+ rm -rf ./.git
51
+ cp -a ./pwa-microservices-template-ghpkg/.git ./.git
52
+ rm -rf ./pwa-microservices-template-ghpkg
53
+
54
+ - name: Set git credentials
55
+ run: |
56
+ git config --global credential.helper ""
57
+ git config credential.helper ""
58
+ git config --global user.name 'underpostnet'
59
+ git config --global user.email 'fcoverdugoa@underpost.net'
60
+ git config --global credential.interactive always
61
+ git config user.name 'underpostnet'
62
+ git config user.email 'fcoverdugoa@underpost.net'
63
+ git config credential.interactive always
64
+
65
+ - name: Push to github package repository
66
+ run: |
67
+ pwd
68
+ git status
69
+ git remote set-url origin git@github.com:underpostnet/pwa-microservices-template-ghpkg.git
70
+ git add .
71
+ git commit -m "Update github repo package"
72
+ git push https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template-ghpkg.git
73
+
74
+ # git push -u origin https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template-ghpkg.git
75
+ # git push -u origin master
@@ -34,7 +34,27 @@ jobs:
34
34
  name: Publish to npm
35
35
  run: npm publish --provenance --access public
36
36
 
37
- # Publish to npm
37
+ - name: Clone github package repository
38
+ run: |
39
+ git clone https://github.com/underpostnet/pwa-microservices-template-ghpkg.git
40
+ rm -rf ./.git
41
+ cp -a ./pwa-microservices-template-ghpkg/.git ./.git
42
+ rm -rf ./pwa-microservices-template-ghpkg
43
+ node ./bin/deploy rename-package @underpostnet/underpost
44
+ node ./bin/deploy set-repo underpostnet/pwa-microservices-template-ghpkg
45
+
46
+ - name: Set git credentials
47
+ run: |
48
+ git config --global credential.helper ""
49
+ git config credential.helper ""
50
+ git config --global user.name 'underpostnet'
51
+ git config --global user.email 'fcoverdugoa@underpost.net'
52
+ git config --global credential.interactive always
53
+ git config user.name 'underpostnet'
54
+ git config user.email 'fcoverdugoa@underpost.net'
55
+ git config credential.interactive always
56
+
57
+ # Publish to npm git hub package
38
58
  - uses: actions/setup-node@v4
39
59
  with:
40
60
  node-version: '22.x'
@@ -45,7 +65,6 @@ jobs:
45
65
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46
66
  name: Publish to npm
47
67
  run: |
48
- node ./bin/deploy rename-package @underpostnet/underpost
49
68
  npm publish --provenance --access public
50
69
 
51
70
  # Publish to GitHub Packages
@@ -58,7 +77,6 @@ jobs:
58
77
  scope: '@underpostnet'
59
78
 
60
79
  - run: |
61
- node ./bin/deploy rename-package @underpostnet/underpost
62
80
  npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GIT_AUTH_TOKEN }}
63
81
  echo "//npm.pkg.github.com/:_authToken=${{ secrets.GIT_AUTH_TOKEN }}" > ~/.npmrc
64
82
  echo "@underposnet:registry=https://npm.pkg.github.com" >> ~/.npmrc
@@ -0,0 +1,30 @@
1
+ name: Test
2
+ on: [push]
3
+ jobs:
4
+ test:
5
+ if: (github.repository == 'underpostnet/pwa-microservices-template') || (github.repository == 'underpostnet/pwa-microservices-template-ghpkg')
6
+ name: Node ${{ matrix.node }} on ${{ matrix.os }}
7
+ runs-on: ${{ matrix.os }}
8
+ strategy:
9
+ matrix:
10
+ node-version: [21.x]
11
+ os: [ubuntu-latest]
12
+ # os: [ubuntu-latest, windows-latest]
13
+
14
+ steps:
15
+ - name: Clone repository
16
+ uses: actions/checkout@v3
17
+
18
+ - name: Set Node.js version
19
+ uses: actions/setup-node@v3
20
+ with:
21
+ node-version: ${{ matrix.node }}
22
+
23
+ - name: Get npm root
24
+ run: sudo npm root -g
25
+
26
+ - name: Install underpost cli
27
+ run: sudo npm install -g underpost
28
+
29
+ - name: Run test
30
+ run: sudo underpost test
package/bin/deploy.js CHANGED
@@ -502,6 +502,17 @@ try {
502
502
  break;
503
503
  }
504
504
 
505
+ case 'set-repo': {
506
+ const originPackage = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));
507
+ originPackage.repository = {
508
+ type: 'git',
509
+ url: `git+https://github.com/${process.argv[3]}.git`,
510
+ };
511
+ fs.writeFileSync(`./package.json`, JSON.stringify(originPackage, null, 4), 'utf8');
512
+
513
+ break;
514
+ }
515
+
505
516
  case 'update-version':
506
517
  {
507
518
  const newVersion = process.argv[3];
@@ -553,9 +564,9 @@ try {
553
564
  );
554
565
 
555
566
  fs.writeFileSync(
556
- `./src/client/ssr/body-components/CacheControl.js`,
567
+ `./src/client/ssr/components/body/CacheControl.js`,
557
568
  fs
558
- .readFileSync(`./src/client/ssr/body-components/CacheControl.js`, 'utf8')
569
+ .readFileSync(`./src/client/ssr/components/body/CacheControl.js`, 'utf8')
559
570
  .replaceAll(`v${version}`, `v${newVersion}`),
560
571
  'utf8',
561
572
  );
package/bin/index.js CHANGED
@@ -19,7 +19,7 @@ const globalBinFolder = `${shellExec(`npm root -g`, {
19
19
 
20
20
  const program = new Command();
21
21
 
22
- const version = '2.7.7';
22
+ const version = '2.7.8';
23
23
 
24
24
  program.name('underpost').description(`underpost.net ci/cd cli ${version}`).version(version);
25
25
 
@@ -58,7 +58,7 @@ services:
58
58
  cpus: '0.25'
59
59
  memory: 20M
60
60
  labels: # labels in Compose file instead of Dockerfile
61
- engine.version: '2.7.7'
61
+ engine.version: '2.7.8'
62
62
  networks:
63
63
  - load-balancer
64
64
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.7.7",
5
+ "version": "2.7.8",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
@@ -31,228 +31,6 @@ const Css = {
31
31
  Init: async function (options) {
32
32
  if (!options) options = ThemesScope[0];
33
33
  const { theme } = options;
34
- append(
35
- 'body',
36
- html`
37
- <style>
38
- html {
39
- scroll-behavior: smooth;
40
- }
41
-
42
- body {
43
- /* overscroll-behavior: contain; */
44
- /* box-sizing: border-box; */
45
- padding: 0px;
46
- margin: 0px;
47
- }
48
-
49
- .fl {
50
- position: relative;
51
- display: flow-root;
52
- }
53
-
54
- .abs,
55
- .in {
56
- display: block;
57
- }
58
-
59
- .fll {
60
- float: left;
61
- }
62
-
63
- .flr {
64
- float: right;
65
- }
66
-
67
- .abs {
68
- position: absolute;
69
- }
70
-
71
- .in,
72
- .inl {
73
- position: relative;
74
- }
75
-
76
- .inl {
77
- display: inline-table;
78
- display: -webkit-inline-table;
79
- display: -moz-inline-table;
80
- display: -ms-inline-table;
81
- display: -o-inline-table;
82
- }
83
-
84
- .fix {
85
- position: fixed;
86
- display: block;
87
- }
88
-
89
- .stq {
90
- position: sticky;
91
- /* require defined at least top, bottom, left o right */
92
- }
93
-
94
- .wfa {
95
- width: available;
96
- width: -webkit-available;
97
- width: -moz-available;
98
- width: -ms-available;
99
- width: -o-available;
100
-
101
- width: fill-available;
102
- width: -webkit-fill-available;
103
- width: -moz-fill-available;
104
- width: -ms-fill-available;
105
- width: -o-fill-available;
106
- }
107
-
108
- .wft {
109
- width: fit-content;
110
- width: -webkit-fit-content;
111
- width: -moz-fit-content;
112
- width: -ms-fit-content;
113
- width: -o-fit-content;
114
- }
115
-
116
- .wfm {
117
- width: max-content;
118
- width: -webkit-max-content;
119
- width: -moz-max-content;
120
- width: -ms-max-content;
121
- width: -o-max-content;
122
- }
123
-
124
- .negative-color {
125
- filter: invert(1);
126
- -webkit-filter: invert(1);
127
- -moz-filter: invert(1);
128
- -ms-filter: invert(1);
129
- -o-filter: invert(1);
130
- }
131
-
132
- .no-drag {
133
- user-drag: none;
134
- -webkit-user-drag: none;
135
- -moz-user-drag: none;
136
- -ms-user-drag: none;
137
- -o-user-drag: none;
138
- user-select: none;
139
- -webkit-user-select: none;
140
- -moz-user-select: none;
141
- -ms-user-select: none;
142
- -o-user-select: none;
143
- }
144
-
145
- .center {
146
- transform: translate(-50%, -50%);
147
- top: 50%;
148
- left: 50%;
149
- width: 100%;
150
- text-align: center;
151
- }
152
-
153
- input {
154
- outline: none !important;
155
- border: none;
156
- padding-block: 0;
157
- padding-inline: 0;
158
- }
159
- input::file-selector-button {
160
- outline: none !important;
161
- border: none;
162
- }
163
-
164
- .hide {
165
- display: none !important;
166
- }
167
- /*
168
-
169
- placeholder
170
-
171
- */
172
-
173
- ::placeholder {
174
- color: black;
175
- opacity: 1;
176
- /* Firefox */
177
- background: none;
178
- }
179
-
180
- :-ms-input-placeholder {
181
- /* Internet Explorer 10-11 */
182
- color: black;
183
- background: none;
184
- }
185
-
186
- ::-ms-input-placeholder {
187
- /* Microsoft Edge */
188
- color: black;
189
- background: none;
190
- }
191
-
192
- /*
193
-
194
- selection
195
-
196
- */
197
-
198
- ::-moz-selection {
199
- /* Code for Firefox */
200
- color: black;
201
- background: rgb(208, 208, 208);
202
- }
203
-
204
- ::selection {
205
- color: black;
206
- background: rgb(208, 208, 208);
207
- }
208
-
209
- .lowercase {
210
- text-transform: lowercase;
211
- }
212
- .uppercase {
213
- text-transform: uppercase;
214
- }
215
- .capitalize {
216
- text-transform: capitalize;
217
- }
218
-
219
- .bold {
220
- font-weight: bold;
221
- }
222
-
223
- .m {
224
- font-family: monospace;
225
- }
226
-
227
- .gray {
228
- filter: grayscale(1);
229
- }
230
- </style>
231
- <div class="session">
232
- <style>
233
- .session-in-log-out {
234
- display: block;
235
- }
236
- .session-inl-log-out {
237
- display: inline-table;
238
- }
239
- .session-fl-log-out {
240
- display: flow-root;
241
- }
242
- .session-in-log-in {
243
- display: none;
244
- }
245
- .session-inl-log-in {
246
- display: none;
247
- }
248
- .session-fl-log-in {
249
- display: none;
250
- }
251
- </style>
252
- </div>
253
- <div class="theme"></div>
254
- `,
255
- );
256
34
  return await Themes[theme](options);
257
35
  },
258
36
  RenderSetting: async function () {
@@ -63,7 +63,7 @@ const Docs = {
63
63
  icon: html`<i class="fa-brands fa-osi"></i>`,
64
64
  text: 'Source Docs',
65
65
  url: function () {
66
- return `${getProxyPath()}docs/engine/2.7.7`;
66
+ return `${getProxyPath()}docs/engine/2.7.8`;
67
67
  },
68
68
  },
69
69
  {
@@ -1,7 +1,7 @@
1
1
  import { newInstance, getId, cap, capFirst } from './CommonJs.js';
2
2
  import { DropDown } from './DropDown.js';
3
3
  import { loggerFactory } from './Logger.js';
4
- import { s, htmls } from './VanillaJs.js';
4
+ import { s, htmls, getLang } from './VanillaJs.js';
5
5
 
6
6
  const logger = loggerFactory(import.meta);
7
7
 
@@ -66,7 +66,11 @@ const Translate = {
66
66
 
67
67
  const TranslateCore = {
68
68
  Init: async function () {
69
- if (localStorage.getItem('lang')) s('html').lang = localStorage.getItem('lang');
69
+ s('html').lang = localStorage.getItem('lang')
70
+ ? localStorage.getItem('lang')
71
+ : getLang() && getLang().match('es')
72
+ ? 'es'
73
+ : 'en';
70
74
  Translate.Data = {
71
75
  ...Translate.Data,
72
76
  isEmpty: {
@@ -90,14 +90,24 @@ const Worker = {
90
90
  if (isInstall) {
91
91
  const cacheNames = await caches.keys();
92
92
  for (const cacheName of cacheNames) {
93
- if (cacheName.match('components/') || cacheName.match('services/') || cacheName.match('.index.js')) {
93
+ if (
94
+ cacheName.match('components/') ||
95
+ cacheName.match('services/') ||
96
+ cacheName.match('.index.js') ||
97
+ cacheName.match('offline.')
98
+ ) {
94
99
  await caches.delete(cacheName);
95
100
  }
96
101
  }
97
- this.updateServiceWorker();
102
+ await this.updateServiceWorker();
103
+ try {
104
+ await fetch('/offline.html');
105
+ } catch (error) {
106
+ logger.error('error');
107
+ }
98
108
  }
99
109
  },
100
- updateServiceWorker: function () {},
110
+ updateServiceWorker: async function () {},
101
111
  status: function () {
102
112
  let status = false;
103
113
  return new Promise((resolve, reject) => {
@@ -110,7 +120,7 @@ const Worker = {
110
120
  else if (registration.waiting) logger.info('waiting', registration);
111
121
  else if (registration.active) {
112
122
  logger.info('active', registration);
113
- this.updateServiceWorker = () => registration.update();
123
+ this.updateServiceWorker = async () => await registration.update();
114
124
  }
115
125
  }
116
126
  if (registrations.length > 0) status = true;