@tixyel/cli 2.1.0 → 2.3.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/dist/api.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { defineWorkspaceConfig } from './workspace.js';
2
+ export type { WorkspaceConfig } from './workspace.js';
package/dist/api.js ADDED
@@ -0,0 +1 @@
1
+ export { defineWorkspaceConfig } from './workspace.js';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export * from './workspace.js';
3
- export * from './widget.js';
2
+ export {};
package/dist/index.js CHANGED
@@ -234,5 +234,3 @@ program
234
234
  }
235
235
  });
236
236
  program.parse();
237
- export * from './workspace.js';
238
- export * from './widget.js';
@@ -1,5 +1,5 @@
1
1
  export const workspace_config = `
2
- import { defineWorkspaceConfig } from '@tixyel/cli';
2
+ import { defineWorkspaceConfig } from '@tixyel/cli/api';
3
3
 
4
4
  export default defineWorkspaceConfig({
5
5
  search: {
package/dist/widget.js CHANGED
@@ -14,6 +14,7 @@ import inquirer from 'inquirer';
14
14
  import postcss from 'postcss';
15
15
  import cssnano from 'cssnano';
16
16
  import JSZip from 'jszip';
17
+ import { transformSync } from 'esbuild';
17
18
  export async function createWidget(path, metadata, config, root) {
18
19
  try {
19
20
  console.log(`📁 Creating ${metadata?.name} at: ${path}`);
@@ -257,6 +258,7 @@ export async function processBuild(widget, workspaceConfig, verbose = false) {
257
258
  const findPatterns = workspaceConfig.build?.find || {
258
259
  html: ['index.html'],
259
260
  script: ['script.js'],
261
+ typescript: ['script.ts'],
260
262
  css: ['styles.css'],
261
263
  fields: ['fields.json'],
262
264
  };
@@ -411,6 +413,30 @@ export async function processBuild(widget, workspaceConfig, verbose = false) {
411
413
  }
412
414
  result += mergedJS.trim();
413
415
  }
416
+ else if (['typescript', 'ts'].some((k) => key === k)) {
417
+ result += watermark.script + '\n';
418
+ if (verbose)
419
+ console.log(` - Processing TypeScript...`);
420
+ const files = findAndRead(entryDir, list);
421
+ let mergedTS = '';
422
+ for await (const content of files) {
423
+ try {
424
+ const transpiled = transformSync(content, {
425
+ loader: 'ts',
426
+ target: 'es2021',
427
+ format: 'iife',
428
+ });
429
+ mergedTS += transpiled.code + '\n';
430
+ }
431
+ catch (error) {
432
+ console.warn(` ⚠️ Failed to compile TypeScript: ${error}`);
433
+ throw error;
434
+ }
435
+ }
436
+ // Obfuscate the compiled JavaScript
437
+ const obfuscated = JavaScriptObfuscator.obfuscate(mergedTS.trim(), workspaceConfig.build?.obfuscation?.javascript);
438
+ result += obfuscated.getObfuscatedCode();
439
+ }
414
440
  else if (['fields', 'FIELDS', 'fielddata', 'fieldData'].some((k) => key === k)) {
415
441
  if (verbose)
416
442
  console.log(` - Processing Json...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tixyel/cli",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "CLI tool for streamelements widgets",
5
5
  "keywords": [
6
6
  "cli",
@@ -36,6 +36,11 @@
36
36
  "types": "./dist/index.d.ts",
37
37
  "import": "./dist/index.js",
38
38
  "default": "./dist/index.js"
39
+ },
40
+ "./api": {
41
+ "types": "./dist/api.d.ts",
42
+ "import": "./dist/api.js",
43
+ "default": "./dist/api.js"
39
44
  }
40
45
  },
41
46
  "files": [
@@ -52,6 +57,7 @@
52
57
  "commander": "^14.0.2",
53
58
  "cross-env": "^10.1.0",
54
59
  "cssnano": "^7.1.2",
60
+ "chokidar": "^3.6.0",
55
61
  "esbuild": "^0.25.12",
56
62
  "fast-glob": "^3.3.3",
57
63
  "html-minifier-terser": "^7.2.0",
@@ -62,14 +68,16 @@
62
68
  "postcss": "^8.5.6",
63
69
  "postcss-nested": "^7.0.2",
64
70
  "react": "^19.2.1",
65
- "react-dom": "^19.2.1"
71
+ "react-dom": "^19.2.1",
72
+ "ws": "^8.18.0"
66
73
  },
67
74
  "devDependencies": {
68
75
  "@types/html-minifier": "^4.0.6",
69
76
  "@types/html-minifier-terser": "^7.0.2",
70
77
  "@types/inquirer": "^9.0.9",
71
78
  "@types/react": "^19.2.7",
72
- "@types/react-dom": "^19.2.3"
79
+ "@types/react-dom": "^19.2.3",
80
+ "@types/ws": "^8.5.12"
73
81
  },
74
82
  "publishConfig": {
75
83
  "access": "public",