-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.js
32 lines (24 loc) · 993 Bytes
/
init.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { fs, Log, MANIFEST_PATH, CONFIG_PATH } = require('./utilities');
Log('Initialising minimage');
Log('Generating Manifest');
const configStub = `${__dirname}/stubs/minimage.config.js`;
const configOutout = CONFIG_PATH;
// Publishing config
if (fs.existsSync(configOutout)) {
Exception(`A config already exists - please remove first e.g`);
Exception(`$ rm ${configOutout}`);
} else {
fs.copyFileSync(configStub, configOutout);
Log(`Config generated @ ${configOutout}`);
}
const manifestStub = `${__dirname}/stubs/minimage.json`;
const manifestOutout = MANIFEST_PATH
// Publishing Manifest
if (fs.existsSync(manifestOutout)) {
Exception(`A manifest already exists - please remove first e.g`);
Exception(`$ rm ${manifestOutout}`);
} else {
fs.copyFileSync(manifestStub, manifestOutout);
Log(`Manifest generated @ ${manifestOutout}`);
Log('Please edit the minimage.config.js to update your paths and API keys - You can get an API key from https://tinypng.com/developers');
}