Skip to content
This repository was archived by the owner on Jun 19, 2019. It is now read-only.

Commit d21c687

Browse files
committed
ci(package): replace resolve-app-path w/ get-root-path, fix tsnode calls
1 parent 8017298 commit d21c687

File tree

8 files changed

+92
-59
lines changed

8 files changed

+92
-59
lines changed

package-lock.json

Lines changed: 78 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"main": "./index.js",
66
"private": true,
77
"scripts": {
8-
"benchmark": "ts-node ./support/benchmark",
8+
"benchmark": "ts-node --files ./support/benchmark",
99
"prebuild": "npm run clean",
10-
"build": "tsc -p ./tsconfig.main.json && ts-node --project ./tsconfig.package.json ./support/package.ts",
10+
"build": "tsc -p ./tsconfig.main.json && ts-node --project ./tsconfig.package.json --files ./support/package.ts",
1111
"check": "npm run build && npm test",
1212
"clean": "rimraf ./dist",
1313
"commit": "commit",
@@ -64,12 +64,12 @@
6464
"deepcopy": "2.0.0",
6565
"faker": "4.1.0",
6666
"filesize": "4.1.2",
67+
"get-root-path": "2.0.2",
6768
"husky": "^1.1.3",
6869
"jest": "24.3.1",
6970
"lodash": "4.17.11",
7071
"numeral": "2.0.6",
7172
"pad": "2.2.2",
72-
"resolve-app-path": "1.0.2",
7373
"rimraf": "2.6.3",
7474
"snapshot": "0.0.0",
7575
"standard-version": "^5.0.0",

support/benchmark/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ import chalk from 'chalk';
33
import pad = require('pad');
44
import * as numeral from 'numeral';
55
import * as benv from 'benv';
6-
import resolveAppPath = require('resolve-app-path');
6+
import { rootPath } from 'get-root-path';
77
import { getJsonSize, getRandomPerson } from './dataHelper';
88
import * as path from 'path';
99

10-
const appPath = resolveAppPath();
11-
1210
declare const angular: { copy: <T>(value: T) => T };
1311

1412
benv.setup(function () {
1513
benv.expose({
16-
angular: benv.require(path.join(appPath, './node_modules/angular/angular.js'), 'angular')
14+
angular: benv.require(path.join(rootPath, './node_modules/angular/angular.js'), 'angular')
1715
});
1816

1917
// Various cloning libraries
@@ -27,7 +25,7 @@ benv.setup(function () {
2725
return eval(expr);
2826
};
2927
})(require('snapshot')),
30-
'fast-clone': require(path.join(appPath, './dist/index.js')),
28+
'fast-clone': require(path.join(rootPath, './dist/index.js')),
3129
'angular.copy': angular.copy
3230
};
3331

support/package.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
3-
import resolveAppPath = require('resolve-app-path');
4-
5-
const appPath = resolveAppPath();
3+
import { rootPath } from 'get-root-path';
64

75
if (!fs.existsSync('./dist')) {
86
fs.mkdirSync('./dist');
@@ -18,12 +16,12 @@ const filesToCopy = [
1816
];
1917

2018
filesToCopy.forEach((fileName) => {
21-
const sourceFileName = path.join(appPath, `./${fileName}`);
22-
const destinationFileName = path.join(appPath, `./dist/${path.basename(fileName)}`);
19+
const sourceFileName = path.join(rootPath, `./${fileName}`);
20+
const destinationFileName = path.join(rootPath, `./dist/${path.basename(fileName)}`);
2321
fs.copyFileSync(sourceFileName, destinationFileName);
2422
});
2523

26-
const packageJson = fs.readFileSync(path.join(appPath, './dist/package.json'), 'utf8');
24+
const packageJson = fs.readFileSync(path.join(rootPath, './dist/package.json'), 'utf8');
2725
const packageObject = JSON.parse(packageJson);
2826

2927
delete packageObject.private;
@@ -32,7 +30,7 @@ delete packageObject.devDependencies;
3230
delete packageObject.husky;
3331

3432
fs.writeFileSync(
35-
path.join(appPath, './dist/package.json'),
33+
path.join(rootPath, './dist/package.json'),
3634
JSON.stringify(packageObject, null, ' '),
3735
'utf8'
3836
);

support/updatePackageVersion.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
3-
import resolveAppPath = require('resolve-app-path');
3+
import { rootPath } from 'get-root-path';
44

5-
const appPath = resolveAppPath();
6-
7-
const sourcePackageFileName = path.join(appPath, './package.json');
8-
const destinationPackageFileName = path.join(appPath, './dist/package.json');
5+
const sourcePackageFileName = path.join(rootPath, './package.json');
6+
const destinationPackageFileName = path.join(rootPath, './dist/package.json');
97

108
const sourcePackage = JSON.parse(fs.readFileSync(sourcePackageFileName, 'utf-8'));
119
const destinationPackage = JSON.parse(fs.readFileSync(destinationPackageFileName, 'utf-8'));

tsconfig.main.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55
"extends": "./tsconfig.json",
66
"files": [
77
"./src/index.ts"
8-
],
9-
"include": [
10-
"./typings/resolve-app-path.d.ts"
118
]
129
}

tsconfig.package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
"compilerOptions": {},
44
"files": [
55
"./support/package.ts"
6-
],
7-
"include": [
8-
"./typings/resolve-app-path.d.ts"
96
]
107
}

typings/resolve-app-path.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)