Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
devAyushDubey committed Oct 22, 2024
2 parents 9e24c15 + 22ab4c2 commit acc466a
Show file tree
Hide file tree
Showing 80 changed files with 3,530 additions and 1,882 deletions.
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx ts-node --esm mustache.ts
npm run build
npx tsx mustache.ts
git add .
npx lint-staged
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ npm install @contentstack/live-preview-utils
Alternatively, if you want to include the package directly in your website HTML code, use the following command:

```html
<script type='module'>
import ContentstackLivePreview from 'https://esm.sh/@contentstack/[email protected].3';
<script type='module' integrity='sha384-lCmcVfWM6NvgMmsDlPZYYJ9MwFk9oDU3WhsJ3KmUJPWa7iKvIuYl+XzTl+cOCuim' crossorigin="anonymous">
import ContentstackLivePreview from 'https://esm.sh/@contentstack/[email protected].4';
ContentstackLivePreview.init({
stackDetails: {
Expand Down
2 changes: 1 addition & 1 deletion main.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @contentstack/live-preview-utils
Alternatively, if you want to include the package directly in your website HTML code, use the following command:

```html
<script type='module'>
<script type='module' integrity='{{integrity}}' crossorigin="anonymous">
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@{{packageVersion}}';
ContentstackLivePreview.init({
Expand Down
7 changes: 6 additions & 1 deletion mustache.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
// index.js
// import { render } from 'mustache';
import * as mustache from 'mustache';
import { readFile, writeFileSync } from 'fs';
import { readFile, readFileSync, writeFileSync } from 'fs';
import packageJson from "./package.json" assert { type: "json" };
import ssri from 'ssri';
const MUSTACHE_MAIN_DIR = './main.mustache';
const fileContent = readFileSync('./dist/modern/index.js');
const integrity = ssri.fromData(fileContent, { algorithms: ['sha384'] });
/**
* DATA is the object that contains all
* the data to be provided to Mustache
* Notice the "name" and "date" property.
*/
const DATA = {
packageVersion: packageJson.version,
integrity: integrity.toString(),
};
function generateReadMe() {

readFile(MUSTACHE_MAIN_DIR, (err, data) => {
if (err) throw err;
const output = mustache.default.render(data.toString(), DATA);
Expand Down
Loading

0 comments on commit acc466a

Please sign in to comment.