This repository was archived by the owner on May 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·74 lines (69 loc) · 2.19 KB
/
Copy pathapp.js
File metadata and controls
executable file
·74 lines (69 loc) · 2.19 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
70
71
72
73
74
#!/usr/bin/env node
// Import modules
const program = require('commander');
const fs = require('fs-extra');
const { execSync } = require('child_process');
const log = require('../scripts/helper/logger');
const path = require('../scripts/helper/path');
const run = require('../scripts/helper/run');
const { version } = require('../package.json');
// Check if App Framework was cloned and no .enableDevelopmentMode file exists
if (path.project() === path.framework() && !fs.pathExistsSync(path.project('.enableDevelopmentMode'))) {
log.error(`
App Framework should be installed as a Node package - not beeing cloned.
To contribute to App Frameworkwork itself, please activate the development mode.
Please read the documentation for details.
`);
}
// Define default programs
program
.version(version, '-v --version');
program
.command('test [name]')
.description('run tests according configuration')
.action((name) => {
if (name === undefined) {
run.script('test');
} else if (name === 'eslint') {
run.script('test-eslint');
} else if (name === 'jest') {
run.script('test-jest');
} else {
log.error('Allowed names are "eslint" and "jest" only.');
}
});
program
.command('dev')
.description('open app on development server with hot-reload')
.action(() => {
run.script('dev');
});
program
.command('build')
.description('build application according configuration')
.action(() => {
run.script('build');
});
program
.command('deploy <target>')
.description('deploy application to the target (ftp or firebase)')
.action((target) => {
if (target === 'ftp') {
execSync('node ./deploy-ftp.js', { cwd: path.scripts(), stdio: 'inherit' });
} else if (target === 'firebase') {
execSync('node ./deploy-firebase.js', { cwd: path.scripts(), stdio: 'inherit' });
} else {
log.error('Allowed targets are "ftp" and "firebase" only.');
}
});
// Define development programs
if (path.framework() === path.project()) {
program
.command('update-f7')
.description('update Framework7 demo files')
.action(() => {
run.script('update-framework7-demo-files');
});
}
// Parse program
program.parse(process.argv);