Skip to content

Commit

Permalink
✨ Better URLs for bundles using /cdn path and enable short URLs for j…
Browse files Browse the repository at this point in the history
  • Loading branch information
srod committed Dec 12, 2024
1 parent 2604187 commit 19bd789
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ jobs:
with:
url: |
https://cdn.jsdelivr.net/npm/@frak-labs/nexus-sdk@latest/dist/bundle/bundle.js
https://cdn.jsdelivr.net/npm/@frak-labs/core-sdk@latest/dist/bundle/bundle.js
https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/dist/bundle/components.js
https://cdn.jsdelivr.net/npm/@frak-labs/core-sdk@latest/cdn/bundle.js
https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/components.js
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cdk.context.json
# production
build
dist
cdn

# misc
.DS_Store
Expand All @@ -54,4 +55,4 @@ packages/wallet/next-env.d.ts
.idea

# Turbo tmp stuff
.turbo
.turbo
1 change: 1 addition & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"_types",
"dist",
"build",
"cdn",
"node_modules/**",
".sst/**",
".open-next/**",
Expand Down
2 changes: 1 addition & 1 deletion example/vanilla-js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Example Vanilla JS</title>
<link rel="icon" href="/favicon.ico" sizes="32x32"/>
<!-- <script src="https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/dist/bundle/components.js" defer="defer"></script>-->
<!-- <script src="https://cdn.jsdelivr.net/npm/@frak-labs/components" defer="defer"></script>-->
<script src="@/components.js"></script>
<script type="module" src="/src/main.ts"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion example/vanilla-js/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { resolve } from "node:path";
import { defineConfig } from "vite";

const projectRootDir = resolve(__dirname);
const bundleDir = resolve(projectRootDir, "../../sdk/components/dist/bundle");
const bundleDir = resolve(projectRootDir, "../../sdk/components/cdn");

export default defineConfig({
server: {
Expand Down
2 changes: 1 addition & 1 deletion sdk/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To have more info about how does it works under the hood, you can check [this](h
Add the following script tag to your HTML file:

```html
<script src="https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/dist/bundle/components.js" defer="defer"></script>
<script src="https://cdn.jsdelivr.net/npm/@frak-labs/components" defer="defer"></script>
```

## Quick start
Expand Down
6 changes: 4 additions & 2 deletions sdk/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
"sideEffects": false,
"private": false,
"type": "module",
"main": "dist/bundle/components.js",
"files": [
"/dist"
"/dist",
"/cdn"
],
"main": "./cdn/components.js",
"browser": "./cdn/components.js",
"scripts": {
"lint": "biome lint .",
"format:check": "biome check .",
Expand Down
2 changes: 1 addition & 1 deletion sdk/components/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig([
target: "es2022",
// All of our entry-points
entry: ["src/components.ts"],
outDir: "dist/bundle",
outDir: "cdn",
outExtension() {
return {
js: ".js",
Expand Down
4 changes: 3 additions & 1 deletion sdk/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
"private": false,
"type": "module",
"files": [
"/dist"
"/dist",
"/cdn"
],
"browser": "./cdn/bundle.js",
"exports": {
".": {
"import": {
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/src/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./index";
export * from "./actions";
export * from "./interactions";
3 changes: 0 additions & 3 deletions sdk/core/src/bundle/bundle.ts

This file was deleted.

4 changes: 2 additions & 2 deletions sdk/core/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default defineConfig([
{
target: "es2022",
// All of our entry-points
entry: ["src/bundle/bundle.ts"],
outDir: "dist/bundle",
entry: ["src/bundle.ts"],
outDir: "cdn",
outExtension() {
return {
js: ".js",
Expand Down
3 changes: 2 additions & 1 deletion sdk/legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"files": [
"/dist"
],
"main": "dist/bundle/bundle.js",
"main": "./dist/bundle/bundle.js",
"browser": "./dist/bundle/bundle.js",
"scripts": {
"lint": "biome lint .",
"format:check": "biome check .",
Expand Down
4 changes: 2 additions & 2 deletions sdk/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"files": [
"/dist"
],
"main": "dist/index.cjs",
"types": "dist/index.d.cts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"exports": {
".": {
"import": {
Expand Down

0 comments on commit 19bd789

Please sign in to comment.