Skip to content

Commit

Permalink
feat: use jsdelivr cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
koladilip committed Jun 12, 2024
1 parent f783028 commit 1c18170
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 32 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:

name: release-please

permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -59,16 +54,4 @@ jobs:
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Assume IAM Role and Set AWS Credentials
id: assume-role
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_IAM_ROLE_ARN }}
role-duration-seconds: 900 # Adjust as needed

- name: Publish build artifacts to S3 for CDN distribution
run: |
cd dist
aws s3 sync . s3://transformers-workflow-engine/libs

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
},
"scripts": {
"test": "jest --coverage --verbose",
"build": "tsc && vite build",
"build": "vite build && tsc",
"dev": "vite",
"clean": "rm -rf build",
"build:clean": "npm run clean && npm run build",
Expand Down
9 changes: 3 additions & 6 deletions public/cdn-sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ <h2>Output:</h2>
</div>
</div>
<script
src="https://transformers-workflow-engine.rudderstack.com/libs/rudder-json-template-engine.0.11.5.js"
type="module"
src="https://cdn.jsdelivr.net/npm/@rudderstack/json-template-engine/build/json-template.min.js"
></script>
<script>
const template = document.getElementById('template');
const data = document.getElementById('data');
const output = document.getElementById('output');
const result = JsonTemplateEngine.evaluateAsSync(
template.value,
{},
JSON.parse(data.value),
);
const result = JsonTemplateEngine.evaluateAsSync(template.value, {}, JSON.parse(data.value));
output.innerText = JSON.stringify(result, null, 2);
</script>
</body>
Expand Down
6 changes: 1 addition & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ engine.evaluate({ name: 'World' }); // => 'Hello World'
```

### Use CDN directly in the browser
[//]: <> (x-release-please-start-version)

URL: https://transformers-workflow-engine.rudderstack.com/libs/rudder-json-template-engine.0.11.5.js

[//]: <> (x-release-please-end)
URL: https://cdn.jsdelivr.net/npm/@rudderstack/json-template-engine/build/json-template.min.js

Refer this [example](public/cdn-sample.html) for more details.

Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { defineConfig } from 'vite';
import { resolve } from 'path';
import { version } from './package.json';

// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
formats: ['es'],
fileName: () => `rudder-json-template-engine.${version}.js`,
fileName: 'json-template.min.js',
},
outDir: 'build',
},
resolve: { alias: { src: resolve('src/') } },
});

0 comments on commit 1c18170

Please sign in to comment.