lucy-cli 0.6.0 → 0.7.0

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/src/init.ts CHANGED
@@ -7,6 +7,7 @@ import fs from 'fs/promises';
7
7
  import { spawnSync } from 'child_process';
8
8
  import path from 'path';
9
9
  import { ModuleSettings, ProjectSettings, blue, green, orange, red } from './index.js';
10
+ import { gitInit, installPackages } from './helpers.js';
10
11
 
11
12
  /**
12
13
  * Init Lucy project
@@ -23,10 +24,10 @@ export async function init(moduleSettings: ModuleSettings, projectSettings: Proj
23
24
 
24
25
  await copyFolder(join(moduleSettings.packageRoot, 'files'), moduleSettings.targetFolder);
25
26
 
26
- await editJson(moduleSettings.packageJsonPath, ['type', 'scripts', 'wixLucy'], ['module', moduleSettings.settings.scripts, moduleSettings.settings.lucySettings ]);
27
+ await editJson(moduleSettings.packageJsonPath, ['type', 'scripts'], ['module', moduleSettings.settings.scripts ]);
27
28
  await stringReplace(join(moduleSettings.targetFolder, 'currents.config.js'), ['__ProjectName__'], [path.basename(moduleSettings.targetFolder)]);
28
29
 
29
- await installPackages( moduleSettings.settings.wixPackages, moduleSettings.settings.devPackages, moduleSettings.targetFolder);
30
+ await installPackages( moduleSettings.settings.wixPackages, moduleSettings.settings.devPackages, moduleSettings.targetFolder, moduleSettings.lockVersion);
30
31
 
31
32
  await editJson(join(moduleSettings.targetFolder, 'jsconfig.json'), ['compilerOptions', 'exclude'], [moduleSettings.settings.wixSettings.compilerOptions, moduleSettings.settings.wixSettings.exclude]);
32
33
  await editJson(join(moduleSettings.targetFolder, 'typedoc.json'), ['name'], [path.basename(moduleSettings.targetFolder)]);
@@ -126,55 +127,4 @@ async function stringReplace(filePath: string, keys: string[], values: string[])
126
127
  } finally {
127
128
  console.log(blue.underline(`🐕 => Updated file ${orange(filePath)}`));
128
129
  }
129
- }
130
-
131
- async function installPackages(wixPackages: Record<string, string>, devPackages: Record<string, string>, cwd: string) {
132
-
133
- const wixPackageNames = Object.keys(wixPackages);
134
-
135
- const devPackageNames = Object.keys(devPackages);
136
- const devPackageVersions = Object.values(devPackages);
137
- const devPackageNamesAndVersions = devPackageNames.map((name, index) => `${name}@${devPackageVersions[index]}`);
138
-
139
- let success = true;
140
- wixPackageNames.forEach((name, index) => {
141
- console.log(`🐕 => Installing ${orange(name)}`);
142
- const wixInstall = `wix install ${name}`;
143
- const wixres = spawnSync(wixInstall, { shell: true, stdio: 'inherit' });
144
- if (wixres.error) {
145
- console.log((`💩 ${red.underline.bold("=> Failed to install package =>")} ${orange(wixres.error.message)}`));
146
- success = false;
147
- } else {
148
- console.log("🐕" + blue.underline(` => Package installed!`));
149
- }
150
- });
151
-
152
- const yarnAdd = `yarn add -D ${devPackageNamesAndVersions.join(' ')}`;
153
- const yarnRes = spawnSync(yarnAdd, { shell: true, stdio: 'inherit' });
154
- if (yarnRes.error) {
155
- success = false;
156
- console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(yarnRes.error.message)}`));
157
- }
158
-
159
- if(success) {
160
- await fs.writeFile(join(cwd, 'wixpkgs.json'), JSON.stringify(wixPackages, null, 2), 'utf8');
161
- console.log("🐕" + blue.underline(` => All Packages installed!`));
162
- } else {
163
- console.log("🐕" + red.underline(` => Some packages failed to install!`));
164
- }
165
- }
166
-
167
- async function gitInit(cwd: string, modules: Record<string, string>) {
168
- const git = simpleGit({ baseDir: cwd });
169
- for (const [name, url] of Object.entries(modules)) {
170
- console.log(chalk.green.underline.bold(`Cloning ${name}`));
171
- try {
172
- await git.submoduleAdd(url, name)
173
- } catch (err) {
174
- console.log((`💩 ${red.underline.bold("=> Command failed =>")} ${orange(err)}`));
175
- } finally {
176
- console.log("🐕" + blue.underline(` => Cloned ${orange(name)}`));
177
- }
178
- }
179
- console.log("🐶" + green.underline(' => All Modules cloned!'));
180
130
  }
package/src/prepare.ts ADDED
@@ -0,0 +1,23 @@
1
+ import chalk from 'chalk';
2
+ import { ModuleSettings, ProjectSettings, blue, green, orange, red } from './index.js';
3
+ import { gitInit, installPackages } from './helpers.js';
4
+
5
+ /**
6
+ * Init Lucy project
7
+ * @param {string} cwd Current working directory
8
+ * @param {string} packageRoot Package root directory
9
+ * @returns {void}
10
+ */
11
+ export async function prepare(moduleSettings: ModuleSettings, projectSettings: ProjectSettings) {
12
+
13
+ if(projectSettings.lucySettings?.initialized) {
14
+ console.log((`💩 ${red.underline.bold("=> This project is already initialized =>")} ${orange(moduleSettings.targetFolder)}`));
15
+ return;
16
+ }
17
+
18
+ await installPackages(moduleSettings.settings.wixPackages, moduleSettings.settings.devPackages, moduleSettings.targetFolder, moduleSettings.lockVersion);
19
+
20
+ await gitInit(moduleSettings.targetFolder, projectSettings?.lucySettings?.modules ? projectSettings?.lucySettings?.modules : moduleSettings.settings.modules);
21
+
22
+ console.log(chalk.greenBright.underline('🐶 => Initialization done!'));
23
+ }
package/src/settings.json CHANGED
@@ -1,97 +1,29 @@
1
1
  {
2
- "modules": {
3
- "lib": "git@github.com:Integral-Systems/lucy-lib.git"
4
- },
2
+ "modules": {},
5
3
  "wixSettings": {
6
4
  "compilerOptions": {
7
5
  "composite": true,
8
6
  "noEmit": false,
9
- "lib": [
10
- "DOM"
11
- ],
12
- "jsx": "react"
7
+ "lib": [],
8
+ "jsx": "react-jsx"
13
9
  },
14
- "exclude": [
15
- "**/*.js"
16
- ]
17
- },
18
- "lucySettings": {
19
- "initialized": true
10
+ "exclude": ["**/*.js"]
20
11
  },
12
+ "initialized": false,
21
13
  "wixPackages": {
22
- "@js-joda/core": "5.5.3",
23
- "@js-joda/locale": "4.8.10",
24
- "@js-joda/locale_de": "4.8.10",
25
- "@js-joda/locale_en": "4.8.10",
26
- "@js-joda/locale_fr": "4.8.10",
27
- "@js-joda/locale_it": "4.8.10",
28
- "@js-joda/timezone": "2.18.0",
29
- "@react-pdf/renderer": "4.0.0",
30
- "@wix/image": "1.96.0",
31
- "@wix/velo-bind": "1.0.8",
32
- "add": "^2.0.6",
33
- "await-semaphore": "0.1.3",
34
- "axios": "1.4.0",
35
- "crypto-js": "4.1.1",
36
- "uuid": "11.0.3",
37
- "velo-sync": "^0.0.9",
38
- "@legendapp/state": "beta",
39
- "zod": "3.22.2",
40
- "react": "18.2.0",
41
- "react-dom": "18.1.0",
42
- "react-transition-group": "4.4.5",
43
- "mobx": "6.8.0",
44
- "mobx-utils": "6.0.3",
45
- "node-cache": "5.1.2",
46
- "nodemailer": "6.9.3",
47
- "payment": "2.3.0",
48
- "merge-stream": "^2.0.0",
49
- "i18next": "23.16.5",
50
- "eventemitter3": "5.0.1",
51
- "gsap": "3.11.4"
14
+ "@hey-api/openapi-ts": "0.55.1"
52
15
  },
53
16
  "devPackages": {
54
- "@danpercic86/helpful-decorators": "^2.4.0",
55
- "@styled/typescript-styled-plugin": "^1.0.1",
56
- "@total-typescript/ts-reset": "0.6.1",
57
- "@types/i18n": "^0.13.6",
58
- "@types/jest": "^29.5.3",
59
- "@types/node": "22.9.0",
60
- "@types/nodemailer": "^6.4.10",
61
- "@types/react": "^18.2.21",
62
- "@typescript-eslint/eslint-plugin": "8.14.0",
63
- "@typescript-eslint/parser": "8.14.0",
64
- "@typescript-eslint/utils": "8.14.0",
65
- "@wix/cli": "latest",
66
- "@wix/eslint-plugin-cli": "latest",
67
- "cypress": "13.15.2",
68
- "cypress-cloud": "^1.9.3",
69
- "esbuild": "0.24.0",
70
- "eslint": "9.14.0",
71
- "eslint-plugin-import": "^2.27.5",
72
- "eslint-plugin-jsdoc": "50.5.0",
73
- "eslint-plugin-named-import-spacing": "^1.0.3",
74
- "eslint-plugin-simple-import-sort": "12.1.1",
75
- "helpful-decorators": "^2.1.0",
76
- "jest": "^29.6.1",
77
- "prettier": "^3.0.3",
78
- "sass": "^1.65.1",
79
- "ts-jest": "^29.1.1",
80
- "ts-node": "^10.9.1",
81
- "tsx": "4.19.2",
82
- "typedoc": "0.26.11",
83
- "typedoc-theme-hierarchy": "5.0.3",
84
- "typescript": "^5.1.6",
85
- "typescript-eslint-language-service": "^5.0.5"
17
+ "@wix/cli": "1.1.50"
86
18
  },
87
19
  "scripts": {
88
20
  "postinstall": "wix sync-types",
89
21
  "wix:dev": "wix dev",
90
- "dev": "gulp dev",
22
+ "dev": "lucy-cli dev",
91
23
  "lint": "eslint .",
92
24
  "docs": "typedoc --tsconfig typescript/tsconfig.json --skipErrorChecking",
93
- "build": "gulp build-prod",
94
- "fix-wix": "gulp fix-wix",
25
+ "build": "lucy-cli build-prod",
26
+ "fix-wix": "lucy-cli fix",
95
27
  "tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
96
28
  "test": "jest --config jest.config.ts --passWithNoTests",
97
29
  "test:watch": "jest --config jest.config.ts --watch"
package/.drone/.drone.yml DELETED
@@ -1,156 +0,0 @@
1
- kind: pipeline
2
- type: docker
3
- name: Build-Pipeline
4
-
5
- steps:
6
- - name: Test-${DRONE_TAG}
7
- image: node:18
8
- commands:
9
- - yarn install --ignore-scripts
10
- - npx gulp fix-masterpage
11
- - npx gulp fix-types
12
- - yarn tsc
13
- - yarn test
14
- - yarn build
15
- settings:
16
- mtu: 1450
17
- when:
18
- ref:
19
- include:
20
- - refs/tags/*
21
- branch:
22
- exclude:
23
- - main
24
- - name: push commit
25
- image: appleboy/drone-git-push
26
- settings:
27
- remote_name: origin
28
- commit: true
29
- commit_message: Tests Passed - ${DRONE_COMMIT_MESSAGE}
30
- branch: ${DRONE_BRANCH}
31
- when:
32
- status:
33
- - success
34
- ref:
35
- include:
36
- - refs/tags/*
37
- branch:
38
- exclude:
39
- - main
40
- - name: Notify-via-Telegram
41
- image: appleboy/drone-telegram
42
- settings:
43
- mtu: 1450
44
- token:
45
- from_secret: telegram_token
46
- to:
47
- from_secret: telegram_default_groupe_id
48
- message_file: .drone/telegram_prod_build.tpl
49
- when:
50
- status:
51
- - failure
52
- - success
53
- ref:
54
- include:
55
- - refs/tags/*
56
- branch:
57
- exclude:
58
- - main
59
- - name: Notify-via-Mail
60
- image: drillster/drone-email
61
- settings:
62
- mtu: 1450
63
- host: smtp.gmail.com
64
- username:
65
- from_secret: gmail_user
66
- password:
67
- from_secret: gmail_pass
68
- from: admin@integralschweiz.org
69
- recipients: []
70
- recipients_only: true
71
- body: file:///drone/src/.drone/mail_prod_build.hbs
72
- when:
73
- status: [ changed, failure, success ]
74
- when:
75
- status:
76
- - failure
77
- - success
78
- ref:
79
- include:
80
- - refs/tags/*
81
- branch:
82
- exclude:
83
- - main
84
- trigger:
85
- event:
86
- - tag
87
- ############Production Deploy only##########
88
- ---
89
- kind: pipeline
90
- type: docker
91
- name: Deploy-Production
92
-
93
- steps:
94
- - name: Create-Pull-Request & Merge
95
- image: registry.integral-systems.ch/integral-systems/alpine:github-client-alpine
96
- environment:
97
- GH_TOKEN:
98
- from_secret: github_api_token
99
- commands:
100
- - gh pr create --base main --head dev --title "Automated Pull Request ${DRONE_TAG}" --body "This pull request is for version ${DRONE_TAG} with the commit message ${DRONE_COMMIT_MESSAGE}"
101
- - PR_NUMBER=$(gh pr list --base main --head dev --json number --jq '.[0].number')
102
- - gh pr merge "$PR_NUMBER" --auto --merge
103
- #############Notification###################
104
- - name: Notify-via-Telegram
105
- image: appleboy/drone-telegram
106
- settings:
107
- mtu: 1450
108
- token:
109
- from_secret: telegram_token
110
- to:
111
- from_secret: telegram_default_groupe_id
112
- message_file: .drone/telegram_prod_deploy.tpl
113
- when:
114
- status:
115
- - failure
116
- - success
117
- - name: Notify-via-Mail
118
- image: drillster/drone-email
119
- settings:
120
- mtu: 1450
121
- host: smtp.gmail.com
122
- username:
123
- from_secret: gmail_user
124
- password:
125
- from_secret: gmail_pass
126
- from: admin@integralschweiz.org
127
- recipients: []
128
- recipients_only: true
129
- body: file:///drone/src/.drone/mail_prod_deploy.hbs
130
- when:
131
- status: [ changed, failure, success ]
132
- when:
133
- status:
134
- - failure
135
- - success
136
- # - name: Update-Rollbar-Deploy
137
- # image: plugins/webhook
138
- # settings:
139
- # mtu: 1450
140
- # urls: https://api.rollbar.com/api/1/deploy
141
- # headers:
142
- # - "X-Rollbar-Access-Token=675b85f9093e4099b89376f4a973bca8"
143
- # template: |
144
- # {
145
- # "environment": "production",
146
- # "revision": "{{build.commit}}",
147
- # "rollbar_username": "{{build.author}}",
148
- # "local_username": "{{build.author}}",
149
- # "comment": "{{build.message}}",
150
- # "status": "succeeded"
151
- # }
152
- trigger:
153
- event:
154
- - promote
155
- target:
156
- - production
@@ -1,319 +0,0 @@
1
- <!DOCTYPE html
2
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml">
4
-
5
- <head>
6
- <meta name="viewport"
7
- content="width=device-width" />
8
- <meta http-equiv="Content-Type"
9
- content="text/html; charset=UTF-8" />
10
- <style>
11
- * {
12
- margin: 0;
13
- padding: 0;
14
- font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
15
- box-sizing: border-box;
16
- font-size: 14px;
17
- }
18
-
19
- body {
20
- -webkit-font-smoothing: antialiased;
21
- -webkit-text-size-adjust: none;
22
- width: 100% !important;
23
- height: 100%;
24
- line-height: 1.6;
25
- background-color: #f6f6f6;
26
- }
27
-
28
- table td {
29
- vertical-align: top;
30
- }
31
-
32
- .body-wrap {
33
- background-color: #f6f6f6;
34
- width: 100%;
35
- }
36
-
37
- .container {
38
- display: block !important;
39
- max-width: 600px !important;
40
- margin: 0 auto !important;
41
- /* makes it centered */
42
- clear: both !important;
43
- }
44
-
45
- .content {
46
- max-width: 600px;
47
- margin: 0 auto;
48
- display: block;
49
- padding: 20px;
50
- }
51
-
52
- .main {
53
- background: #fff;
54
- border: 1px solid #e9e9e9;
55
- border-radius: 3px;
56
- }
57
-
58
- .content-wrap {
59
- padding: 20px;
60
- }
61
-
62
- .content-block {
63
- padding: 0 0 20px;
64
- }
65
-
66
- .header {
67
- width: 100%;
68
- margin-bottom: 20px;
69
- }
70
-
71
- h1,
72
- h2,
73
- h3 {
74
- font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
75
- color: #000;
76
- margin: 40px 0 0;
77
- line-height: 1.2;
78
- font-weight: 400;
79
- }
80
-
81
- h1 {
82
- font-size: 32px;
83
- font-weight: 500;
84
- }
85
-
86
- h2 {
87
- font-size: 24px;
88
- }
89
-
90
- h3 {
91
- font-size: 18px;
92
- }
93
-
94
- hr {
95
- border: 1px solid #e9e9e9;
96
- margin: 20px 0;
97
- height: 1px;
98
- padding: 0;
99
- }
100
-
101
- p,
102
- ul,
103
- ol {
104
- margin-bottom: 10px;
105
- font-weight: normal;
106
- }
107
-
108
- p li,
109
- ul li,
110
- ol li {
111
- margin-left: 5px;
112
- list-style-position: inside;
113
- }
114
-
115
- a {
116
- color: #348eda;
117
- text-decoration: underline;
118
- }
119
-
120
- .last {
121
- margin-bottom: 0;
122
- }
123
-
124
- .first {
125
- margin-top: 0;
126
- }
127
-
128
- .padding {
129
- padding: 10px 0;
130
- }
131
-
132
- .aligncenter {
133
- text-align: center;
134
- }
135
-
136
- .alignright {
137
- text-align: right;
138
- }
139
-
140
- .alignleft {
141
- text-align: left;
142
- }
143
-
144
- .clear {
145
- clear: both;
146
- }
147
-
148
- .alert {
149
- font-size: 16px;
150
- color: #fff;
151
- font-weight: 500;
152
- padding: 20px;
153
- text-align: center;
154
- border-radius: 3px 3px 0 0;
155
- }
156
-
157
- .alert a {
158
- color: #fff;
159
- text-decoration: none;
160
- font-weight: 500;
161
- font-size: 16px;
162
- }
163
-
164
- .alert.alert-warning {
165
- background: #ff9f00;
166
- }
167
-
168
- .alert.alert-bad {
169
- background: #d0021b;
170
- }
171
-
172
- .alert.alert-good {
173
- background: #68b90f;
174
- }
175
-
176
- @media only screen and (max-width: 640px) {
177
-
178
- h1,
179
- h2,
180
- h3 {
181
- font-weight: 600 !important;
182
- margin: 20px 0 5px !important;
183
- }
184
-
185
- h1 {
186
- font-size: 22px !important;
187
- }
188
-
189
- h2 {
190
- font-size: 18px !important;
191
- }
192
-
193
- h3 {
194
- font-size: 16px !important;
195
- }
196
-
197
- .container {
198
- width: 100% !important;
199
- }
200
-
201
- .content,
202
- .content-wrapper {
203
- padding: 10px !important;
204
- }
205
- }
206
- </style>
207
- </head>
208
-
209
- <body>
210
- <table class="body-wrap">
211
- <tr>
212
- <td></td>
213
- <td class="container"
214
- width="600">
215
- <div class="content">
216
- <table class="main"
217
- width="100%"
218
- cellpadding="0"
219
- cellspacing="0">
220
- <tr>
221
- {{#success build.status}}
222
- <td class="alert alert-good">
223
- <a href="{{ build.link }}">
224
- Successful Production-Build #{{ build.number }}
225
- </a>
226
- </td>
227
- {{else}}
228
- <td class="alert alert-bad">
229
- <a href="{{ build.link }}">
230
- Failed Production-Build #{{ build.number }}
231
- </a>
232
- </td>
233
- {{/success}}
234
- </tr>
235
- <tr>
236
- <td class="content-wrap">
237
- <table width="100%"
238
- cellpadding="0"
239
- cellspacing="0">
240
- <tr>
241
- <td>
242
- Repo:
243
- </td>
244
- <td>
245
- {{ repo.owner }}/{{ repo.name }}
246
- </td>
247
- </tr>
248
- <tr>
249
- <td>
250
- Author:
251
- </td>
252
- <td>
253
- {{ commit.author.name }} ({{ commit.author.email }})
254
- </td>
255
- </tr>
256
- <tr>
257
- <td>
258
- Branch:
259
- </td>
260
- <td>
261
- {{ commit.branch }}
262
- </td>
263
- </tr>
264
- <tr>
265
- <td>
266
- Tag:
267
- </td>
268
- <td>
269
- {{ tag }}
270
- </td>
271
- </tr>
272
- <tr>
273
- <td>
274
- Commit:
275
- </td>
276
- <td>
277
- {{ truncate commit.sha 8 }}
278
- </td>
279
- </tr>
280
- <tr>
281
- <td>
282
- Started at:
283
- </td>
284
- <td>
285
- {{ datetime build.created "Mon Jan 2 15:04:05 MST 2006" "Local" }}
286
- </td>
287
- </tr>
288
- {{#success build.status}}
289
- <tr>
290
- <td>
291
- Deploy Build:
292
- </td>
293
- <td>
294
- drone build promote {{ repo.owner }}/{{ repo.name }} {{build.number}} production
295
- </td>
296
- </tr>
297
- {{/success}}
298
- </table>
299
- <hr>
300
- <table width="100%"
301
- cellpadding="0"
302
- cellspacing="0">
303
- <tr>
304
- <td>
305
- {{ commit.message }}
306
- </td>
307
- </tr>
308
- </table>
309
- </td>
310
- </tr>
311
- </table>
312
- </div>
313
- </td>
314
- <td></td>
315
- </tr>
316
- </table>
317
- </body>
318
-
319
- </html>