Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
Set the Puter SDK URL in the config
Browse files Browse the repository at this point in the history
This makes it easier to develop against a local Puter server with any
local changes to the SDK.
  • Loading branch information
AtkinsSJ committed Apr 12, 2024
1 parent 84c2450 commit 42d587a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" href="xterm.css">
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="style.css">
<script src="https://puter.com/puter.js/v2"></script>
<script src="__SDK_URL__"></script>
<script src="config.js"></script>
<script src="bundle.js"></script>
<script>
Expand Down
3 changes: 2 additions & 1 deletion config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
*/
globalThis.__CONFIG__ = {
"origin": "https://puter.local:8080",
"shell.href": "https://puter.local:8081"
"shell.href": "https://puter.local:8081",
"sdk_url": "http://puter.localhost:4100/sdk/puter.js",
};
3 changes: 2 additions & 1 deletion config/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
*/
globalThis.__CONFIG__ = {
origin: location.origin,
'shell.href': location.origin + '/puter-shell/'
'shell.href': location.origin + '/puter-shell/',
sdk_url: 'https://puter.com/puter.js/v2',
};
9 changes: 8 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';

const configFile = process.env.CONFIG_FILE ?? 'config/dev.js';
await import(`./${configFile}`);

export default {
input: "src/main_puter.js",
Expand All @@ -33,7 +34,13 @@ export default {
commonjs(),
copy({
targets: [
{ src: 'assets/index.html', dest: 'dist' },
{
src: 'assets/index.html',
dest: 'dist',
transform: (contents, name) => {
return contents.toString().replace('__SDK_URL__', globalThis.__CONFIG__.sdk_url);
}
},
{ src: 'assets/shell.html', dest: 'dist' },
{ src: 'assets/normalize.css', dest: 'dist' },
{ src: 'assets/style.css', dest: 'dist' },
Expand Down

0 comments on commit 42d587a

Please sign in to comment.