From a93c66c92b0c37b84bef3c284fea9331ba6ed5be Mon Sep 17 00:00:00 2001 From: Ben Papillon Date: Thu, 9 Nov 2023 14:19:48 -0500 Subject: [PATCH] Separate browser build --- .github/workflows/main.yml | 2 +- .npmignore | 1 + package.json | 7 +++---- src/browser.ts | 3 +++ src/main.ts | 4 +--- 5 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 .npmignore create mode 100644 src/browser.ts diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d9ccd07..278fbd40 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,7 +43,7 @@ jobs: run: | echo "::set-output name=version::$(node -p "require('./package.json').version")" - - name: Deploy + - name: Publish browser build run: | aws s3 cp --acl=public-read dist/main.js s3://$S3_BUCKET/js/schematic.js aws s3 cp --acl=public-read dist/main.js s3://$S3_BUCKET/js/schematic.${{ steps.package.outputs.version }}.js diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..849ddff3 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +dist/ diff --git a/package.json b/package.json index 4cd1eff8..80e03a80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "dependencies": { - "@types/pako": "^2.0.0", "@types/uuid": "^9.0.2", "uuid": "^9.0.0" }, @@ -13,11 +12,11 @@ "modules": false, "name": "schematic-js", "scripts": { - "build": "parcel build src/main.ts --public-url ./ --detailed-report", + "build": "parcel build src/browser.ts --public-url ./ --detailed-report", "clean": "rm -rf dist && rm -rf .parcel-cache", - "watch": "parcel watch src/main.ts --public-url ./" + "watch": "parcel watch src/browser.ts --public-url ./" }, - "source": "src/main.ts", + "source": "src/browser.ts", "targets": { "default": { "isLibrary": false, diff --git a/src/browser.ts b/src/browser.ts new file mode 100644 index 00000000..58c7eac6 --- /dev/null +++ b/src/browser.ts @@ -0,0 +1,3 @@ +import { Schematic } from "./main"; + +(window as any).Schematic = Schematic; diff --git a/src/main.ts b/src/main.ts index bf26628c..c4177e5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -41,7 +41,7 @@ type FlagCheckContext = { }; /* @preserve */ -class Schematic { +export class Schematic { private apiKey: string; private eventQueue: Event[]; @@ -172,5 +172,3 @@ class Schematic { } } } - -(window as any).Schematic = Schematic;