Skip to content

Commit 8d202fa

Browse files
authored
Merge pull request #15 from StatelessSoftware/v0.1.1
V0.1.1
2 parents ba6eec8 + 2b5127a commit 8d202fa

3 files changed

Lines changed: 51 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog - html-to-app
22

3+
## [0.1.1] - 2018-03-26
4+
5+
### Fixes
6+
7+
- [Issue #14] - Checking builder.shouldBuild() is not idempotent
8+
- [Issue #13] - html-to-app fails if out-of-source build, with -f, and dist folder already existing
9+
- [Issue #12] - html-to-app -c should kill program after creating config file
10+
311
## [0.1.0] - 2018-03-26
412

513
### Additions

lib/chainlinks/builder.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ let Builder = function() {
4444
shell.execSync("rm -rf bin");
4545
}
4646

47+
// Create build directory if necessary
48+
if (!fs.existsSync(buildPath)) {
49+
this.binCmd("mkdir " + buildPath, false);
50+
}
51+
4752
// Install
48-
if (this.binCmd("mkdir " + buildPath, false) &&
53+
if (
4954
this.binCmd(this.installCmd) &&
5055
this.binCmd(this.cleanupCmd)) {
5156

lib/index.js

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,41 +72,50 @@ try {
7272
}
7373
catch (ex) {
7474

75-
// Create a config file if asked to do so
76-
if (cli.args.createConfig) {
75+
console.log("No configuration, using defaults.");
76+
77+
}
7778

78-
// Check for config dir
79-
if (!fs.existsSync("config")) {
80-
// Create dir
81-
executeCommand("mkdir config");
82-
}
83-
84-
// Check for environment config file
85-
if (!fs.existsSync("config/" + env + ".json")) {
86-
87-
// Create file
88-
fs.writeFileSync("config/" + env + ".json",
89-
JSON.stringify(
90-
{
91-
"importer": importer,
92-
"converter": converter,
93-
"builder": builder,
94-
"exporter": exporter
95-
},
96-
null,
97-
'\t'
98-
)
99-
);
100-
101-
}
79+
// Create a config file if asked to do so
80+
if (cli.args.createConfig) {
10281

82+
// Check for config dir
83+
if (!fs.existsSync("config")) {
84+
// Create dir
85+
executeCommand("mkdir config");
10386
}
10487

88+
// Check for environment config file
89+
if (!fs.existsSync("config/" + env + ".json")) {
90+
91+
// Create file
92+
fs.writeFileSync("config/" + env + ".json",
93+
JSON.stringify(
94+
{
95+
"importer": importer,
96+
"converter": converter,
97+
"builder": builder,
98+
"exporter": exporter
99+
},
100+
null,
101+
'\t'
102+
)
103+
);
104+
105+
}
106+
107+
// Kill the program
108+
console.log("Configuration file created successfully.");
109+
process.exit();
110+
105111
}
106112

107113
// Append properties to payload
108114
payload.build.force = cli.args.forceBuild;
109115

116+
// Check if we need to build
117+
let shouldBuild = builder.shouldBuild() || cli.args.forceBuild;
118+
110119
// Start the engine
111120
console.log("Importing...");
112121
executeCommand(importer.precmd);
@@ -119,7 +128,7 @@ importer.run(payload)
119128
})
120129
.then((payload) => {
121130
executeCommand(converter.postcmd);
122-
if (builder.shouldBuild() || cli.args.forceBuild) {
131+
if (shouldBuild) {
123132
executeCommand(builder.precmd);
124133
console.log("Building...");
125134
return builder.run(payload);
@@ -130,7 +139,7 @@ importer.run(payload)
130139
}
131140
})
132141
.then((payload) => {
133-
if (builder.shouldBuild() || cli.args.forceBuild) {
142+
if (shouldBuild) {
134143
executeCommand(builder.postcmd);
135144
}
136145
executeCommand(exporter.precmd);

0 commit comments

Comments
 (0)