Skip to content

Commit 49a3f45

Browse files
committed
Minor generated metadata improvements
1 parent f5e88e2 commit 49a3f45

9 files changed

Lines changed: 38 additions & 5 deletions

File tree

solves/base-template/package.json.ejs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"name": "<%- name %>",
2+
"name": <%- JSON.stringify(String(name)) %>,
3+
"author": <%- JSON.stringify(String(author)) %>,
4+
"version": "0.0.0-dev",
35
"private": true,
46
"license": "MIT",
7+
"description": <%- JSON.stringify(String(description)) %>,
58
"scripts": {
69
"test": "jest",
710
"build": "webpack",

solves/base-template/src/components/App.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
width: 100%;
99
}
1010

11+
#app-title {
12+
width: 100%;
13+
}
14+
#app-title > * {
15+
margin: 0;
16+
}
17+
1118
.input-wrapper {
1219
flex: 1 0 0;
1320

solves/base-template/src/components/App.tsx.ejs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ export class App extends React.Component<{}, State> {
113113
-%>
114114

115115
return <div id="app">
116+
<div id="app-title">
117+
<h1><%- appTitle -%></h1>
118+
</div>
116119
<%-
117120
Object.entries(allTextInputs).map(([k, v]) => {
118121
const x = {};

solves/base-template/webpack.config.js renamed to solves/base-template/webpack.config.js.ejs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ function htmlWebpackPluginCommon(configArgs, mergeIn) {
1515

1616
minify: (configArgs.mode === "production"),
1717

18-
title: "Solves Prototype",
19-
author: "simshadows",
20-
description: "Solves Prototype",
18+
title: "<%- appTitle -%>",
19+
author: "<%- author -%>",
20+
description: "<%- description -%>",
2121
keywords: "",
2222
//favicon: path.resolve(__dirname, "src", "favicon.png"),
2323
}, mergeIn);

solves/src/spec-parse.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ interface OutputPartialSpec {
8585

8686
export interface SpecValues {
8787
name: string;
88+
appTitle: string;
89+
author: string;
90+
description: string;
91+
8892
encoding: string;
8993
constraintsCode: string;
9094

@@ -140,6 +144,10 @@ export function getSpecValues(specPath: string): SpecValues {
140144

141145
return {
142146
name: ensureStr(fileData?.name, "name"),
147+
appTitle: ensureStr(fileData?.appTitle, "appTitle"),
148+
author: ensureStr(fileData?.author, "author"),
149+
description: ensureStr(fileData?.description, "description"),
150+
143151
encoding: ensureStr(fileData?.encoding, "encoding"),
144152
constraintsCode: ensureStr(fileData?.constraints, "constraints"),
145153

solves/test/cnf-sat-alt.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: cnf-sat
2+
appTitle: CNF-SAT Solver (with dummy output for debugging)
3+
author: simshadows
4+
description: your description here
25

36
input-base:
47
variable:

solves/test/cnf-sat.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: cnf-sat
2+
appTitle: CNF-SAT Solver
3+
author: simshadows
4+
description: your description here
25

36
input-base:
47
variable:

solves/test/sample-spec.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: graph-colouring
2+
appTitle: Vertex Colouring Solver
3+
author: simshadows
4+
description: your description here
25

36
input-base:
47
colour:
@@ -32,7 +35,7 @@ input-constrained:
3235

3336
output:
3437
color:
35-
title: Colourings
38+
title: Valid Vertex Colouring
3639
fieldLabels:
3740
- Vertex
3841
- Colour

solves/test/vertex-cover.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: vertex-cover
2+
appTitle: Vertex Cover Solver
3+
author: simshadows
4+
description: your description here
25

36
input-base:
47
vertex:

0 commit comments

Comments
 (0)