1 | const path = require('path')
|
2 | const fs = require('fs')
|
3 |
|
4 | const appDirectory = fs.realpathSync(process.cwd())
|
5 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath)
|
6 |
|
7 | const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath)
|
8 |
|
9 | module.exports = {
|
10 | appPackageJson: resolveApp('package.json'),
|
11 | appIndexJs: resolveApp('src/index.ts'),
|
12 | appTsConfig: resolveApp('tsconfig.json'),
|
13 | appTsLint: resolveApp('tslint.json'),
|
14 | appDevBundlePath: resolveApp('build'),
|
15 | appSrc: resolveApp('src'),
|
16 | appBuild: resolveApp('dist'),
|
17 | testsSetup: resolveApp('setupTests.ts'),
|
18 | prodBundle: 'bundle.prod.js',
|
19 | }
|
20 |
|
21 | const useTemplate = appDirectory === fs.realpathSync(path.join(__dirname, '..'))
|
22 |
|
23 | if (useTemplate) {
|
24 | module.exports = {
|
25 | appPackageJson: resolveOwn('package.json'),
|
26 | appIndexJs: resolveOwn('template/src/index.ts'),
|
27 | appTsConfig: resolveOwn('template/tsconfig.json'),
|
28 | appTsLint: resolveOwn('template/tslint.json'),
|
29 | appDevBundlePath: resolveOwn('template/build'),
|
30 | appSrc: resolveOwn('template/src'),
|
31 | appBuild: resolveOwn('template/dist'),
|
32 | testsSetup: resolveOwn('template/setupTests.ts'),
|
33 | prodBundle: 'bundle.prod.js',
|
34 | }
|
35 | }
|