Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update react packages #41

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions demos/react/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { execSync } = require("child_process");
const fs = require("fs");

// Step 1: Run the build command
console.log("Running build...");
execSync("npm run build", { stdio: "inherit" });

// Step 2: Move the index.html file
console.log("Moving index.html...");
execSync("mv dist/index.html .", { stdio: "inherit" });

// Step 3: Update the paths in index.html
const htmlFile = "index.html";
const content = fs
.readFileSync(htmlFile, "utf8")
.replace('src="bundle.js"', 'src="dist/bundle.js"')
.replace('href="bundle.css"', 'href="dist/bundle.css"');

fs.writeFileSync(htmlFile, content);
console.log("Updated paths in index.html");

// Step 4: Add files to Git
console.log("Adding files to git...");
execSync("git add dist index.html", { stdio: "inherit" });

// Step 5: Commit the changes
console.log("Committing changes...");
execSync('git commit -m "Update the React demo"', { stdio: "inherit" });

// Step 6: Push the changes
console.log("Pushing to repository...");
execSync("git push", { stdio: "inherit" });

console.log("Build and commit process complete.");
8 changes: 7 additions & 1 deletion demos/react/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

For using Qualified Embed in an actual project, these steps won't be necessary. This procedure is for Qualified staff who need to update our GitHub pages deploy.

```
npm run deploy
```

which does:

```
npm run build
mv dist/index.html .
# Manually edit the bundle links in index.html to point to dist/bundle.{js,css}
sed -i 's|src="bundle.js"|src="dist/bundle.js"|; s|href="bundle.css"|href="dist/bundle.css"|' index.html
git add dist index.html
git commit -m "Update the React demo"
git push
Expand Down
2 changes: 1 addition & 1 deletion demos/react/dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading