lucy-cli 0.9.0 → 0.9.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/README.md CHANGED
@@ -70,6 +70,12 @@ Lucy-CLI comes with a range of commands and options to help manage your Wix Velo
70
70
  - **`sync`**: Synchronizes the database and any dependencies or configurations necessary for the project.
71
71
  - **`install`**: Installs all Wix npm packages listed in the `wixpkgs.json` file in the project directory.
72
72
  - **`fix`**: Runs a fix command to resolve common issues in development or production settings.
73
+ - **🦮 `docs`**: Generates documentation for the project.
74
+ - **🦮 `cypress`**: Starts the Cypress test runner.
75
+ - **🦮 `e2e`**: Starts the Cypress test runner in CI mode.
76
+ **Usage:** `e2e <someKey> <someID>`
77
+ - **`someKey`**: The key for the test.
78
+ - **`someID`**: The build ID for the test.
73
79
 
74
80
  ### Options
75
81
 
@@ -114,6 +120,9 @@ Commands:
114
120
  🦮 sync : Synchronizes the database and any dependencies or configurations necessary for the project.
115
121
  🦮 install : Installs all Wix npm packages listed in the 'wixpkgs.json' file in the project directory.
116
122
  🦮 fix : Runs a fix command to resolve common issues in development or production settings.
123
+ 🦮 docs : Generates documentation for the project.
124
+ 🦮 cypress : Starts the cypress test runner.
125
+ 🦮 e2e : Starts the cypress test runner in CI mode. first argument is the key second is the build id <e2e <somekey <someID>
117
126
 
118
127
  Options:
119
128
  🦮 -h, help : Displays this help message.
@@ -127,7 +127,7 @@ export function checkTs(options) {
127
127
  const tsProject = ts.createProject(`./${folder}/tsconfig.json`, { noEmit: true });
128
128
  const taskName = `test-${folder}`; // Create a unique name for each task
129
129
  const task = () => gulp.src([`${folder}/**/*.ts`, `!${folder}/types/**/*.ts`], { cwd: folder })
130
- .pipe(tsProject(ts.reporter.fullReporter()))
130
+ .pipe(tsProject(ts.reporter.fullReporter(true)))
131
131
  .on('error', function (e) {
132
132
  console.log("💩" + red.underline.bold(` => Typescriptcheck for ${orange(folder)} failed!`));
133
133
  console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
package/dist/index.js CHANGED
@@ -96,6 +96,8 @@ async function main() {
96
96
  console.log("🦮 " + magenta.bold('install') + " : Installs all Wix npm packages listed in the 'lucy.json' file in the project directory.");
97
97
  console.log("🦮 " + magenta.bold('fix') + " : Runs a fix command to resolve common issues in development or production settings.");
98
98
  console.log("🦮 " + magenta.bold('docs') + " : Generates documentation for the project.");
99
+ console.log("🦮 " + magenta.bold('cypress') + " : Starts the cypress test runner.");
100
+ console.log("🦮 " + magenta.bold('e2e') + " : Starts the cypress test runner in CI mode. first argument is the key second is the build id <e2e <somekey <someID>");
99
101
  console.log("\nOptions:");
100
102
  console.log("🦮 " + magenta.bold('-h, help') + " : Displays this help message.");
101
103
  console.log("🦮 " + magenta.bold('-v, version') + " : Displays the current version of Lucy CLI as defined in the project’s package.json.");
@@ -171,10 +173,35 @@ async function main() {
171
173
  if (moduleSettings.args.includes('docs')) {
172
174
  const res = spawnSync('yarn docs', { shell: true, stdio: 'inherit' });
173
175
  if (res.error) {
174
- return console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(res.error.message)}`));
176
+ return console.log((`💩 ${red.underline.bold("=> Failed to Docs generated => ")} ${orange(res.error.message)}`));
175
177
  }
176
178
  return console.log("🐕" + blue.underline(` => Docs generated!`));
177
179
  }
180
+ if (moduleSettings.args.includes('cypress')) {
181
+ const res = spawnSync('yarn cypress', { shell: true, stdio: 'inherit' });
182
+ if (res.error) {
183
+ return console.log((`💩 ${red.underline.bold("=> Failed to start cypress => ")} ${orange(res.error.message)}`));
184
+ }
185
+ return console.log("🐕" + blue.underline(` => Started Cypress`));
186
+ }
187
+ if (moduleSettings.args.includes('e2e')) {
188
+ // Extract arguments
189
+ const e2eIndex = moduleSettings.args.indexOf('e2e');
190
+ const key = moduleSettings.args[e2eIndex + 1];
191
+ const buildId = moduleSettings.args[e2eIndex + 2];
192
+ // Validate that both arguments are provided
193
+ if (!key && !buildId) {
194
+ console.log(`💩 ${red.underline.bold("=> Missing required arguments:")} ${orange("key")} and ${orange("build ID")}`);
195
+ process.exit(1);
196
+ }
197
+ // Run Cypress with the provided arguments
198
+ const res = spawnSync(`yarn e2e --key ${key} --ci-build-id ${buildId}`, { shell: true, stdio: 'inherit' });
199
+ if (res.error) {
200
+ console.log(`💩 ${red.underline.bold("=> Failed to start Cypress =>")} ${orange(res.error.message)}`);
201
+ process.exit(1);
202
+ }
203
+ return console.log("🐕 " + blue.underline(`=> Started Cypress successfully`));
204
+ }
178
205
  if (moduleSettings.args.includes('prepare')) {
179
206
  await prepare(moduleSettings, projectSettings);
180
207
  return;
@@ -57,6 +57,8 @@
57
57
  "fix-wix": "lucy-cli fix-wix",
58
58
  "tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
59
59
  "test": "jest --config jest.config.ts --passWithNoTests",
60
- "test:watch": "jest --config jest.config.ts --watch"
60
+ "test:watch": "jest --config jest.config.ts --watch",
61
+ "cypress": "cypress open",
62
+ "e2e": "cypress-cloud run --parallel --record"
61
63
  }
62
64
  }
@@ -0,0 +1,14 @@
1
+
2
+ describe('Basic E2E Test', () => {
3
+ const currentDate = new Date();
4
+ const formattedDate = currentDate.toISOString().split('T')[0];
5
+ const formattedTime = currentDate.toTimeString().split(' ')[0].replace(/:/g, '-');
6
+
7
+ it('passes', () => {
8
+ cy.visit('/');
9
+ cy.get('#comp-m3blk8zj_r_comp-m3ta27x7').should('be.visible');
10
+ cy.screenshot(`loaded_${formattedDate}_${formattedTime}`);
11
+ });
12
+ });
13
+
14
+
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io",
4
+ "body": "Fixtures are a great way to mock data for responses to routes"
5
+ }
@@ -0,0 +1,37 @@
1
+ /// <reference types="cypress" />
2
+ // ***********************************************
3
+ // This example commands.ts shows you how to
4
+ // create various custom commands and overwrite
5
+ // existing commands.
6
+ //
7
+ // For more comprehensive examples of custom
8
+ // commands please read more here:
9
+ // https://on.cypress.io/custom-commands
10
+ // ***********************************************
11
+ //
12
+ //
13
+ // -- This is a parent command --
14
+ // Cypress.Commands.add('login', (email, password) => { ... })
15
+ //
16
+ //
17
+ // -- This is a child command --
18
+ // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19
+ //
20
+ //
21
+ // -- This is a dual command --
22
+ // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23
+ //
24
+ //
25
+ // -- This will overwrite an existing command --
26
+ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27
+ //
28
+ // declare global {
29
+ // namespace Cypress {
30
+ // interface Chainable {
31
+ // login(email: string, password: string): Chainable<void>
32
+ // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33
+ // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34
+ // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35
+ // }
36
+ // }
37
+ // }
@@ -0,0 +1,24 @@
1
+ // ***********************************************************
2
+ // This example support/e2e.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands';
18
+
19
+ // before(() => {
20
+ // // Set the base URL for your application
21
+ // cy.visit('https://www.zikade.ch');
22
+ // });
23
+ // Alternatively you can use CommonJS syntax:
24
+ // require('./commands')
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": ["es5", "dom"],
5
+ "types": ["cypress", "node"],
6
+ "rootDir": "."
7
+ },
8
+ "include": ["**/*.ts"]
9
+ }
@@ -1,10 +1,22 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
3
+ /* eslint-disable @typescript-eslint/no-require-imports */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
1
5
  // cypress.config.js
2
- import { defineConfig } from "cypress";
3
- import { cloudPlugin } from "cypress-cloud/plugin";
6
+ const { defineConfig } = require('cypress');
7
+ const { cloudPlugin } = require('cypress-cloud/plugin');
4
8
 
5
9
  module.exports = defineConfig({
6
10
  videoCompression: 15,
11
+ chromeWebSecurity: true,
12
+ pageLoadTimeout: 120000,
13
+ defaultCommandTimeout: 10000,
14
+ retries: {
15
+ runMode: 0,
16
+ openMode: 0,
17
+ },
7
18
  e2e: {
19
+ baseUrl: 'https://www.somehost.com/',
8
20
  setupNodeEvents(on, config) {
9
21
  return cloudPlugin(on, config);
10
22
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "lucy-cli",
4
- "version": "0.9.0",
4
+ "version": "0.9.2",
5
5
  "description": "Lucy Framework for WIX Studio Editor",
6
6
  "main": ".dist/index.js",
7
7
  "scripts": {
@@ -68,7 +68,8 @@
68
68
  "ts-node": "^10.9.1",
69
69
  "typedoc": "0.26.11",
70
70
  "typedoc-theme-hierarchy": "5.0.3",
71
- "velo-sync": "^0.0.9"
71
+ "velo-sync": "^0.0.9",
72
+ "typescript": "^5.6.3"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@types/fs-extra": "^11.0.4",
@@ -92,7 +93,6 @@
92
93
  "eslint-plugin-jsdoc": "50.5.0",
93
94
  "eslint-plugin-named-import-spacing": "^1.0.3",
94
95
  "eslint-plugin-simple-import-sort": "12.1.1",
95
- "ts-node": "^10.9.1",
96
- "typescript": "^5.6.3"
96
+ "ts-node": "^10.9.1"
97
97
  }
98
98
  }
@@ -135,12 +135,13 @@ export function checkTs(options: TaskOptions) {
135
135
 
136
136
  const task = () =>
137
137
  gulp.src([`${folder}/**/*.ts`, `!${folder}/types/**/*.ts`], { cwd: folder })
138
- .pipe(tsProject(ts.reporter.fullReporter()))
138
+ .pipe(tsProject(ts.reporter.fullReporter(true)))
139
139
  .on('error', function (e: Error) {
140
140
  console.log("💩" + red.underline.bold(` => Typescriptcheck for ${orange(folder)} failed!`));
141
141
  console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
142
142
  this.emit('end');
143
143
  })
144
+
144
145
  .on('end', function () {
145
146
  console.log("🐶" + blue.underline(` => Typescriptcheck for ${orange(folder)} succeeded!`));
146
147
  });
package/src/index.ts CHANGED
@@ -155,6 +155,8 @@ async function main(): Promise<void> {
155
155
  console.log("🦮 " + magenta.bold('install') + " : Installs all Wix npm packages listed in the 'lucy.json' file in the project directory.");
156
156
  console.log("🦮 " + magenta.bold('fix') + " : Runs a fix command to resolve common issues in development or production settings.");
157
157
  console.log("🦮 " + magenta.bold('docs') + " : Generates documentation for the project.");
158
+ console.log("🦮 " + magenta.bold('cypress') + " : Starts the cypress test runner.");
159
+ console.log("🦮 " + magenta.bold('e2e') + " : Starts the cypress test runner in CI mode. first argument is the key second is the build id <e2e <somekey <someID>");
158
160
  console.log("\nOptions:");
159
161
  console.log("🦮 " + magenta.bold('-h, help') + " : Displays this help message.");
160
162
  console.log("🦮 " + magenta.bold('-v, version') + " : Displays the current version of Lucy CLI as defined in the project’s package.json.");
@@ -234,11 +236,40 @@ async function main(): Promise<void> {
234
236
  if(moduleSettings.args.includes('docs')){
235
237
  const res = spawnSync('yarn docs', { shell: true, stdio: 'inherit' });
236
238
  if (res.error) {
237
- return console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(res.error.message)}`));
239
+ return console.log((`💩 ${red.underline.bold("=> Failed to Docs generated => ")} ${orange(res.error.message)}`));
238
240
  }
239
241
  return console.log("🐕" + blue.underline(` => Docs generated!`));
240
242
  }
241
243
 
244
+ if(moduleSettings.args.includes('cypress')){
245
+ const res = spawnSync('yarn cypress', { shell: true, stdio: 'inherit' });
246
+ if (res.error) {
247
+ return console.log((`💩 ${red.underline.bold("=> Failed to start cypress => ")} ${orange(res.error.message)}`));
248
+ }
249
+ return console.log("🐕" + blue.underline(` => Started Cypress`));
250
+ }
251
+
252
+ if (moduleSettings.args.includes('e2e')) {
253
+ // Extract arguments
254
+ const e2eIndex = moduleSettings.args.indexOf('e2e');
255
+ const key = moduleSettings.args[e2eIndex + 1];
256
+ const buildId = moduleSettings.args[e2eIndex + 2];
257
+
258
+ // Validate that both arguments are provided
259
+ if (!key && !buildId) {
260
+ console.log(`💩 ${red.underline.bold("=> Missing required arguments:")} ${orange("key")} and ${orange("build ID")}`);
261
+ process.exit(1);
262
+ }
263
+
264
+ // Run Cypress with the provided arguments
265
+ const res = spawnSync(`yarn e2e --key ${key} --ci-build-id ${buildId}`, { shell: true, stdio: 'inherit' });
266
+ if (res.error) {
267
+ console.log(`💩 ${red.underline.bold("=> Failed to start Cypress =>")} ${orange(res.error.message)}`);
268
+ process.exit(1);
269
+ }
270
+ return console.log("🐕 " + blue.underline(`=> Started Cypress successfully`));
271
+ }
272
+
242
273
  if(moduleSettings.args.includes('prepare')){
243
274
  await prepare( moduleSettings, projectSettings);
244
275
 
package/src/settings.json CHANGED
@@ -57,6 +57,8 @@
57
57
  "fix-wix": "lucy-cli fix-wix",
58
58
  "tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
59
59
  "test": "jest --config jest.config.ts --passWithNoTests",
60
- "test:watch": "jest --config jest.config.ts --watch"
60
+ "test:watch": "jest --config jest.config.ts --watch",
61
+ "cypress": "cypress open",
62
+ "e2e": "cypress-cloud run --parallel --record"
61
63
  }
62
64
  }