@intuned/browser-dev 2.2.3-test-build.2 → 2.2.3-test-build.23

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.
@@ -16,17 +16,18 @@ The `common/browser_scripts.js` file at the root of the monorepo needs to be inc
16
16
 
17
17
  The generation happens automatically:
18
18
 
19
- ### During Installation
19
+ ### During Development (prepare hook)
20
20
 
21
- When you run `yarn install`, the `postinstall` hook automatically generates `script.ts`:
21
+ When you run `yarn install` or `npm publish` in the development repo, the `prepare` hook generates `script.ts`:
22
22
 
23
23
  ```bash
24
- yarn install # automatically runs generate-browser-script
24
+ yarn install # automatically runs prepare → generate-browser-script
25
+ npm publish # prepare hook runs before publishing
25
26
  ```
26
27
 
27
28
  ### During Build
28
29
 
29
- The build script also regenerates `script.ts` before compiling:
30
+ The build script regenerates `script.ts` before compiling:
30
31
 
31
32
  ```bash
32
33
  yarn build # runs generate-browser-script → tsc → babel
@@ -40,6 +41,10 @@ You can manually regenerate the file:
40
41
  yarn generate-browser-script
41
42
  ```
42
43
 
44
+ ### For Package Consumers
45
+
46
+ When users install your package via npm/yarn, they get the pre-generated `script.ts` that's committed to the repo. The `prepare` hook does NOT run when installing as a dependency (only during development/publishing).
47
+
43
48
  ## Usage in Code
44
49
 
45
50
  In `ensureBrowserScripts.ts`:
@@ -65,9 +70,10 @@ async function ensureBrowserScripts(page: Page): Promise<void> {
65
70
  ## Important Notes
66
71
 
67
72
  - **DO NOT** edit `script.ts` manually - it's auto-generated
68
- - **DO NOT** commit `script.ts` to git - it's in `.gitignore`
69
- - The file is regenerated on every build and install
70
- - If you update `common/browser_scripts.js`, run `yarn generate-browser-script` to update
73
+ - **DO** commit `script.ts` to git - it needs to be in the published package
74
+ - The file is regenerated on every build and during `prepare` (development only)
75
+ - If you update `common/browser_scripts.js`, run `yarn generate-browser-script` to update and commit the changes
76
+ - Package consumers get the pre-generated file, so they don't need the `scripts/` folder
71
77
 
72
78
  ## Benefits
73
79
 
@@ -2599,5 +2599,4 @@ const BROWSER_SCRIPT = exports.BROWSER_SCRIPT = `(function () {
2599
2599
  convertHtmlStringToSemanticMarkdown: nodeExports.convertHtmlToMarkdown,
2600
2600
  getElementXPath: getElementXPath,
2601
2601
  };
2602
- })();
2603
- `;
2602
+ })();`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/browser-dev",
3
- "version": "2.2.3-test-build.2",
3
+ "version": "2.2.3-test-build.23",
4
4
  "description": "runner package for intuned functions",
5
5
  "types": "./dist/index.d.ts",
6
6
  "typesVersions": {
@@ -35,8 +35,7 @@
35
35
  "author": "Intuned Team",
36
36
  "license": "Elastic-2.0",
37
37
  "scripts": {
38
- "generate-browser-script": "node scripts/generate-browser-script.js",
39
- "postinstall": "yarn generate-browser-script",
38
+ "generate-browser-script": "bash scripts/generate-browser-script.sh",
40
39
  "build": "rm -rf dist && yarn generate-browser-script && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && node scripts/ensure-index-types.js",
41
40
  "ensure-types": "node scripts/ensure-index-types.js",
42
41
  "test": "vitest run",