Skip to content

Commit 5b076bd

Browse files
authored
Merge pull request #1 from DrewImm/v0.0.2
V0.0.2
2 parents c8a6829 + 7935890 commit 5b076bd

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Config
2+
config/
3+
14
# Logs
25
logs
36
*.log

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog - html-to-app
2+
3+
## [0.0.2] - 2018-03-24
4+
5+
### Fixes
6+
7+
- Remove config directory from source-control
8+
- Create a blank config file if non-existant
9+
- Changed the default image import path from `./assets/images/` to `./images`

lib/index.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
process.env.SUPPRESS_NO_CONFIG_WARNING = 'y';
2+
const env = process.env.NODE_ENV || 'default';
23

34
// Import dependencies
45
const getCliArguments = require("command-line-args");
56
const config = require("config");
7+
const shell = require("child_process");
8+
const fs = require("fs");
69

710
// Build chain functions
811
const configureChainLink = require("./config-link");
@@ -33,7 +36,7 @@ let cli = {
3336
config: {
3437
"importer": {
3538
"dirHTML": "./",
36-
"dirImages": "./assets/images",
39+
"dirImages": "./images",
3740
"dirCSS": "./",
3841
"dirJS": "./",
3942

@@ -88,6 +91,31 @@ converter = configureChainLink(converter, cli.config.converter);
8891
builder = configureChainLink(builder, cli.config.builder);
8992
exporter = configureChainLink(exporter, cli.config.exporter);
9093

94+
// Check for config dir
95+
if (!fs.existsSync("config")) {
96+
// Create dir
97+
shell.execSync("mkdir config");
98+
}
99+
100+
// Check for environment config file
101+
if (!fs.existsSync("config/" + env + ".json")) {
102+
103+
// Create file
104+
fs.writeFileSync("config/" + env + ".json",
105+
JSON.stringify(
106+
{
107+
"importer": {},
108+
"converter": {},
109+
"builder": {},
110+
"exporter": {}
111+
},
112+
null,
113+
'\t'
114+
)
115+
);
116+
117+
}
118+
91119
// Pull config file
92120
cli.config.importer = config.get("importer");
93121
cli.config.converter = config.get("converter");

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-to-app",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "Convert HTML flat file sites to Apps",
55
"main": "lib/index.js",
66
"bin": {

0 commit comments

Comments
 (0)