-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-component.js
More file actions
69 lines (57 loc) · 1.6 KB
/
Copy pathbuild-component.js
File metadata and controls
69 lines (57 loc) · 1.6 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const fs = require('fs');
const fsExtra = require('fs-extra');
const concat = require('concat');
build = async () => {
const runtimePath = './dist/apps-launchpad/runtime.js';
const polyfillsPath = './dist/apps-launchpad/polyfills.js';
const scriptPath = './dist/apps-launchpad/scripts.js';
const mainPath = './dist/apps-launchpad/main.js';
const files = [];
if (fs.existsSync(runtimePath)) {
files.push(runtimePath);
}
if (fs.existsSync(polyfillsPath)) {
files.push(polyfillsPath);
}
if (fs.existsSync(scriptPath)) {
files.push(scriptPath);
}
if (fs.existsSync(mainPath)) {
files.push(mainPath);
}
await fsExtra.ensureDir('public');
await concat(files, 'public/apps-launchpad.js');
}
updateReadme = async () => {
const readmePath = './README.md';
if (fs.existsSync(readmePath)) {
await fsExtra.copy(readmePath, 'public/README.md');
}
}
updateVersion = async () => {
const pjson = require('./package.json');
const publicPackageJson = 'public/package.json';
const content = getPackageJson();
content.version = pjson.version;
await fsExtra.writeJson(publicPackageJson, content, { spaces: 2, replacer: ' ' });
};
getPackageJson = () => {
return {
"name": "apps-launchpad",
"version": "0",
"description": "A simple apps launchpad",
"main": "apps-launchpad.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/7eXx/apps-launchpad.git"
},
"author": "Texx",
"license": "MIT"
};
}
build();
updateVersion();
updateReadme();