@tywalk/pcf-helper 1.5.0 → 1.5.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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Command line helper for building and publishing PCF controls to Dataverse.",
5
5
  "main": "dist/index.js",
6
6
  "types": "./types/",
@@ -15,7 +15,7 @@
15
15
  "test": "jest",
16
16
  "build": "tsc",
17
17
  "upgrade": "npm version patch --no-git-tag-version",
18
- "ready": "npm run upgrade"
18
+ "ready": "npm run upgrade && npm run build && npm publish --access public"
19
19
  },
20
20
  "keywords": [
21
21
  "pcf"
@@ -18,17 +18,21 @@ const color_logger_1 = __importDefault(require("@tywalk/color-logger"));
18
18
  const path_1 = __importDefault(require("path"));
19
19
  const fs_1 = __importDefault(require("fs"));
20
20
  const playwright_1 = require("playwright");
21
+ color_logger_1.default.setLevel('debug'); // Set to 'debug' for detailed logging
21
22
  function loadConfig(config) {
22
23
  // Load file config if exists
23
24
  let fileConfig = {};
24
- const configPath = path_1.default.join(__dirname, config || 'dev-config.json');
25
- console.log(`📁 Looking for config file at: ${configPath}`);
25
+ const configPath = path_1.default.join(process.cwd(), config || 'dev-config.json');
26
+ color_logger_1.default.log(`📁 Looking for config file at: ${configPath}`);
26
27
  if (fs_1.default.existsSync(configPath)) {
27
28
  fileConfig = JSON.parse(fs_1.default.readFileSync(configPath, 'utf8'));
28
- console.log(`✅ Loaded config file: ${JSON.stringify(fileConfig, null, 2)}`);
29
+ color_logger_1.default.log(`✅ Loaded config file: ${JSON.stringify(fileConfig, null, 2)}`);
30
+ }
31
+ else if (process.env.REMOTE_ENVIRONMENT_URL) {
32
+ color_logger_1.default.warn(`⚠️ Config file not found, using defaults or CLI/env options.`);
29
33
  }
30
34
  else {
31
- console.log(`⚠️ Config file not found, using defaults or CLI/env options.`);
35
+ return {}; // No config file and no env vars, return empty config to use defaults
32
36
  }
33
37
  // Get the base URL first
34
38
  const remoteEnvironmentUrl = process.env.REMOTE_ENVIRONMENT_URL ||
@@ -75,6 +79,10 @@ function loadConfig(config) {
75
79
  };
76
80
  }
77
81
  function runSession(remoteEnvironmentUrl, remoteScriptToIntercept, remoteStylesheetToIntercept, localBundlePath, localCssPath) {
82
+ if (!remoteEnvironmentUrl) {
83
+ color_logger_1.default.error('❌ Remote environment URL is required. Please provide it via CLI, config file, or environment variable.');
84
+ process.exit(1);
85
+ }
78
86
  const REMOTE_ENVIRONMENT_URL = remoteEnvironmentUrl;
79
87
  const REMOTE_SCRIPT_TO_INTERCEPT = remoteScriptToIntercept;
80
88
  const REMOTE_STYLESHEET_TO_INTERCEPT = remoteStylesheetToIntercept;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tywalk/pcf-helper",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Command line helper for building and publishing PCF controls to Dataverse.",
5
5
  "main": "dist/index.js",
6
6
  "types": "./types/",
@@ -15,7 +15,7 @@
15
15
  "test": "jest",
16
16
  "build": "tsc",
17
17
  "upgrade": "npm version patch --no-git-tag-version",
18
- "ready": "npm run upgrade"
18
+ "ready": "npm run upgrade && npm run build && npm publish --access public"
19
19
  },
20
20
  "keywords": [
21
21
  "pcf"
@@ -1,4 +1,10 @@
1
1
  declare function loadConfig(config?: string): {
2
+ remoteEnvironmentUrl?: undefined;
3
+ remoteScriptToIntercept?: undefined;
4
+ remoteStylesheetToIntercept?: undefined;
5
+ localCssPath?: undefined;
6
+ localBundlePath?: undefined;
7
+ } | {
2
8
  remoteEnvironmentUrl: any;
3
9
  remoteScriptToIntercept: any;
4
10
  remoteStylesheetToIntercept: any;