Skip to content

Commit 020d952

Browse files
committed
during build, make editor.embed.html, which is templated with relative paths and just basics, suitable for opening as a static page
1 parent 80acc1c commit 020d952

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

.env.embed

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
GOOGLE_CLIENT_ID=""
2+
GOOGLE_CLIENT_SECRET=""
3+
GOOGLE_API_KEY=""
4+
GOOGLE_SERVER_API_KEY=""
5+
GOOGLE_APP_ID=""
6+
BASE_URL="."
7+
CURRENT_PYRET_RELEASE=""
8+
PYRET="./js/cpo-main.jarr.js"
9+
POSTMESSAGE_ORIGIN="*"
10+
SHARED_FETCH_SERVER="https://code.pyret.org"
11+
URL_FILE_MODE="all-remote"
12+
IMAGE_PROXY_BYPASS="true"

Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ selenium-test-local:
3636
selenium-test-sauce:
3737
TEST_LOC="sauce" node test/test.js test/browser/pyret
3838

39+
build/web/editor.embed.html: src/web/editor.html .env.embed
40+
node make-template.js $< .env.embed > $@
41+
build/web/editor.html: src/web/editor.html
42+
cp $< $@
43+
3944
OUT_HTML := $(patsubst src/web/%.template.html,build/web/views/%.html,$(wildcard src/web/*.template.html))
4045

4146
build/web/views/%.html: src/web/%.template.html
@@ -336,9 +341,9 @@ $(WEBIMG):
336341
$(WEBARR):
337342
@$(call MKDIR,$(WEBARR))
338343

339-
web-local: $(WEB) $(WEBV) $(WEBJS) $(WEBJSGOOG) $(WEBCSS) $(WEBTHEMES) $(WEBFONTS) $(WEBIMG) $(WEBIMAGES) $(WEBARR) $(OUT_HTML) $(COPY_HTML) $(OUT_CSS) $(COPY_CSS) $(COPY_LIB_CSS) $(COPY_THEMES) $(COPY_FONTS) $(COPY_JS) $(COPY_LIB_JS) $(COPY_LIB_IMAGES) $(COPY_ARR) $(COPY_GIF) $(COPY_SVG) $(COPY_PNG) $(MISC_JS) $(MISC_CSS) $(MISC_IMG) $(COPY_NEW_CSS) $(COPY_NEW_JS) $(COPY_GOOGLE_JS) $(CPOMAIN) $(CPOGZ) build/web/js/editor-misc.min.js build/web/js/snap build/web/js/transpile.xml
344+
web-local: build/web/editor.html build/web/editor.embed.html $(WEB) $(WEBV) $(WEBJS) $(WEBJSGOOG) $(WEBCSS) $(WEBTHEMES) $(WEBFONTS) $(WEBIMG) $(WEBIMAGES) $(WEBARR) $(OUT_HTML) $(COPY_HTML) $(OUT_CSS) $(COPY_CSS) $(COPY_LIB_CSS) $(COPY_THEMES) $(COPY_FONTS) $(COPY_JS) $(COPY_LIB_JS) $(COPY_LIB_IMAGES) $(COPY_ARR) $(COPY_GIF) $(COPY_SVG) $(COPY_PNG) $(MISC_JS) $(MISC_CSS) $(MISC_IMG) $(COPY_NEW_CSS) $(COPY_NEW_JS) $(COPY_GOOGLE_JS) $(CPOMAIN) $(CPOGZ) build/web/js/editor-misc.min.js build/web/js/snap build/web/js/transpile.xml
340345

341-
web: $(WEB) $(WEBV) $(WEBJS) $(WEBJSGOOG) $(WEBCSS) $(WEBTHEMES) $(WEBFONTS) $(WEBIMG) $(WEBIMAGES) $(WEBARR) $(OUT_HTML) $(COPY_HTML) $(OUT_CSS) $(COPY_CSS) $(COPY_LIB_CSS) $(COPY_THEMES) $(COPY_FONTS) $(COPY_JS) $(COPY_LIB_JS) $(COPY_LIB_IMAGES) $(COPY_ARR) $(COPY_GIF) $(COPY_SVG) $(COPY_PNG) $(MISC_JS) $(MISC_CSS) $(MISC_IMG) $(COPY_NEW_CSS) $(COPY_NEW_JS) $(COPY_GOOGLE_JS) build/web/js/editor-misc.min.js build/web/js/snap build/web/js/transpile.xml
346+
web: build/web/editor.html build/web/editor.embed.html $(WEB) $(WEBV) $(WEBJS) $(WEBJSGOOG) $(WEBCSS) $(WEBTHEMES) $(WEBFONTS) $(WEBIMG) $(WEBIMAGES) $(WEBARR) $(OUT_HTML) $(COPY_HTML) $(OUT_CSS) $(COPY_CSS) $(COPY_LIB_CSS) $(COPY_THEMES) $(COPY_FONTS) $(COPY_JS) $(COPY_LIB_JS) $(COPY_LIB_IMAGES) $(COPY_ARR) $(COPY_GIF) $(COPY_SVG) $(COPY_PNG) $(MISC_JS) $(MISC_CSS) $(MISC_IMG) $(COPY_NEW_CSS) $(COPY_NEW_JS) $(COPY_GOOGLE_JS) build/web/js/editor-misc.min.js build/web/js/snap build/web/js/transpile.xml
342347

343348
link-pyret:
344349
ln -s node_modules/pyret-lang pyret

make-template.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ var mustache = require('mustache');
22
var file = require('fs');
33
// Silent suppresses "missing .env file" warning,
44
// which we want since deploys don't have that file
5-
require('dotenv').config({ silent: true });
5+
var dotenv = require('dotenv');
66

7-
var config = process.env;
7+
dotenv.config({ silent: true });
8+
9+
const replacementConfig = process.argv[3];
10+
let config;
11+
if(replacementConfig !== undefined) {
12+
const buf = Buffer.from(file.readFileSync(process.argv[3]));
13+
config = dotenv.parse(buf)
14+
}
15+
else {
16+
config = process.env;
17+
}
818

919
var fileIn = process.argv[2];
1020
var fileContents = String(file.readFileSync(fileIn));

0 commit comments

Comments
 (0)