@playpilot/tpi 3.7.2 → 3.8.1
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 +32 -38
- package/dist/link-injections.js +9 -9
- package/index.html +1 -1
- package/package.json +1 -1
- package/src/lib/fakeData.ts +0 -71
- package/src/lib/linkInjection.ts +34 -28
- package/src/lib/session.ts +7 -7
- package/src/lib/types/config.d.ts +25 -0
- package/src/lib/types/global.d.ts +6 -9
- package/src/lib/types/script.d.ts +10 -0
- package/src/lib/types/title.d.ts +0 -2
- package/src/{main.js → main.ts} +3 -5
- package/src/routes/+layout.svelte +99 -47
- package/src/routes/+page.svelte +11 -7
- package/src/routes/components/Editorial/Editor.svelte +1 -4
- package/src/routes/components/Editorial/ManualInjection.svelte +3 -3
- package/src/routes/components/Modal.svelte +0 -3
- package/src/routes/components/Popover.svelte +0 -3
- package/src/routes/components/Title.svelte +0 -5
- package/src/tests/lib/linkInjection.test.js +70 -3
- package/src/tests/routes/+page.test.js +2 -12
- package/static/favicon.png +0 -0
- package/src/lib/types/participant.d.ts +0 -13
- package/src/routes/components/Participants.svelte +0 -51
- package/src/tests/routes/components/Participants.test.js +0 -33
package/README.md
CHANGED
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
npm run build
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
You can preview the production build with `npm run preview`.
|
|
37
|
-
|
|
38
|
-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
1
|
+
# 💉 PlayPilot Link Injections
|
|
2
|
+
|
|
3
|
+
Link Injections (also called TPI (Text Playlink Injection) and ALI (Article Link Injection)) adds links to any page content. These links open a popover or modal with relevant information for any given movie or show. Alternatively, they link directly to the related PlayPilot page.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
Start development server using:
|
|
8
|
+
```
|
|
9
|
+
npm run dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The dev environment will be available at:
|
|
13
|
+
```
|
|
14
|
+
localhost:3000
|
|
15
|
+
```
|
|
16
|
+
Only the root page has content. This page contains multiple examples different injection scenarios, some real, some made up. Some of these are intentionally tricky to parse, but have come up as real examples in the past.
|
|
17
|
+
|
|
18
|
+
## Build
|
|
19
|
+
|
|
20
|
+
To build the final script simply run `npm run build`.
|
|
21
|
+
|
|
22
|
+
The final build differs largely from the development environment. The development environment uses SvelteKit, but the final build only uses Svelte which is build to a single file that includes all images, css, and of course the javascript itself. This file is output to `/dist/link-injections.js`. This file is included in the repo.
|
|
23
|
+
|
|
24
|
+
## Publishing
|
|
25
|
+
|
|
26
|
+
The project is published on NPM as a package, but only the final dist file is relevant. This file is included in the repo so that it can be picked up by jsdelivr.net, which we use as a CDN for the script. The url that is presented to clients is a redirect from https://scripts.playpilot.com/link-injection.js to https://cdn.jsdelivr.net/npm/@playpilot/tpi@[version]/dist/link-injections.js. We use a direct version rather than `@latest` to have better control over caching, as `@latest` is cached both on jsdelivr and the end user's browser.
|
|
27
|
+
|
|
28
|
+
To publish the script follow these steps:
|
|
29
|
+
1. Build the script and commit the new file as a separate commit
|
|
30
|
+
2. Bump the package.json version and commit this change
|
|
31
|
+
3. Publish the script using `npm publish --access public` (or `npm publish --access public --tag next for beta versions)
|
|
32
|
+
4. Update redirect rules on Cloudflare to match the new version, which can be found under the "TPI: Latest script version (jsdelivr)" rule (or "TPI: Beta script version (jsdelivr)" for beta versions).
|