Skip to content

Commit

Permalink
[other] clarify run instructions / editing in startDev.js (#1108)
Browse files Browse the repository at this point in the history
# Pull Request Template

## Description

Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.


Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit test
- [ ] Integration test

## JS Budget Check

Please mention the size in kb before abd after this PR

| Files            | Before      | After       | 
| -----------      | ----------- | ----------- |
| dist/build.js.   |             |             |
| dist/build.min.js|             |             |

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
- [ ] I have checked my code and corrected any misspellings

## Mentions: 
List the person or team responsible for reviewing proposed changes.

cc @BranchMetrics/saas-sdk-devs for visibility.
  • Loading branch information
bredmond5 authored Dec 19, 2024
1 parent c041e9d commit 80c9fae
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions startDev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const defaultDev = {
"port": "3000"
};

const TEMPLATE_FILE = 'examples/example.template.html';
const DEV_HTML = 'dev.html';

async function fileExists(filePath) {
try {
await fs.access(filePath);
Expand Down Expand Up @@ -61,8 +64,8 @@ async function processTemplate(templateFile, outputFile, replacements) {

async function writeExampleHtml(config) {
// Define your file paths and replacements
const templateFile = path.join(__dirname, 'examples/example.template.html');
const outputFile = path.join(__dirname, 'dev.html');
const templateFile = path.join(__dirname, TEMPLATE_FILE);
const outputFile = path.join(__dirname, DEV_HTML);
const replacements = {
'key_place_holder': config.sdkKey,
'api_place_holder': config.APIEndpoint,
Expand All @@ -79,13 +82,12 @@ function executeBuild(config) {
console.error(`Error executing makefile: ${error.message}`);
return;
}
console.log('Dev build successful.');
console.log('Starting server...');
console.log(`Dev websdk build successful, ${DEV_HTML} built from ${TEMPLATE_FILE}`);
const app = new Koa();
app.use(serve('.'));
app.listen(config.port, () => {
console.log('Server started successfully.');
console.log(`Example page running at http://localhost:${config.port}/dev.html`);
console.log(`Example page running at http://localhost:${config.port}/${DEV_HTML}. To edit, update ${TEMPLATE_FILE}`);
});
});
}
Expand Down

0 comments on commit 80c9fae

Please sign in to comment.