Skip to content

Commit 729be0a

Browse files
committed
chore: reorg project layout for better typescript refs
1 parent d16e94b commit 729be0a

File tree

289 files changed

+203
-573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+203
-573
lines changed

benchmark/index.ts

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

benchmark/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"performance",
99
"benchmark"
1010
],
11-
"main": "index.js",
11+
"types": "./dist10/index.d.ts",
1212
"engines": {
1313
"node": ">=8.9"
1414
},
@@ -19,7 +19,7 @@
1919
"build:dist10": "lb-tsc es2018",
2020
"clean": "lb-clean dist*",
2121
"pretest": "npm run clean && npm run build",
22-
"test": "lb-mocha \"DIST/test\"",
22+
"test": "lb-mocha \"DIST/__tests__\"",
2323
"prestart": "npm run build",
2424
"start": "node ."
2525
},

benchmark/test/benchmark.integration.ts renamed to benchmark/src/__tests__/benchmark.integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import {expect} from '@loopback/testlab';
77
import * as request from 'request-promise-native';
88
import {Benchmark} from '..';
9-
import {Autocannon, EndpointStats} from '../src/autocannon';
9+
import {Autocannon, EndpointStats} from '../autocannon';
1010

1111
const debug = require('debug')('test');
1212

benchmark/tsconfig.build.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
"$schema": "http://json.schemastore.org/tsconfig",
33
"extends": "../packages/build/config/tsconfig.common.json",
44
"compilerOptions": {
5-
"rootDir": ".",
5+
"rootDir": "src",
66
"composite": true,
77
"target": "es2018",
88
"outDir": "dist10"
99
},
10-
"include": [
11-
"index.ts",
12-
"src",
13-
"test"
14-
],
1510
"references": [
1611
{
1712
"path": "../packages/testlab/tsconfig.build.json"

docs/site/Controllers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ with a test to verify that the error is thrown properly.
241241

242242
```ts
243243
// test/integration/controllers/hello.controller.integration.ts
244-
import {HelloController} from '../../../src/controllers';
245-
import {HelloRepository} from '../../../src/repositories';
244+
import {HelloController} from '../../..//controllers';
245+
import {HelloRepository} from '../../..//repositories';
246246
import {testdb} from '../../fixtures/datasources/testdb.datasource';
247247
import {expect} from '@loopback/testlab';
248248
import {HttpErrors} from '@loopback/rest';

docs/site/Testing-your-application.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ helper method; for example:
129129
{% include code-caption.html content="test/helpers/database.helpers.ts" %}
130130

131131
```ts
132-
import {ProductRepository, CategoryRepository} from '../../src/repositories';
132+
import {ProductRepository, CategoryRepository} from '../../repositories';
133133
import {testdb} from '../fixtures/datasources/testdb.datasource';
134134

135135
export async function givenEmptyDatabase() {
@@ -413,8 +413,8 @@ detailed explanation.
413413

414414
```ts
415415
import {expect, sinon} from '@loopback/testlab';
416-
import {ProductRepository} from '../../../src/repositories';
417-
import {ProductController} from '../../../src/controllers';
416+
import {ProductRepository} from '../../..//repositories';
417+
import {ProductController} from '../../..//controllers';
418418

419419
describe('ProductController (unit)', () => {
420420
let repository: ProductRepository;
@@ -456,7 +456,7 @@ valid data to create a new model instance.
456456
{% include code-caption.html content="test/unit/models/person.model.unit.ts" %}
457457

458458
```ts
459-
import {Person} from '../../../src/models';
459+
import {Person} from '../../..//models';
460460
import {givenPersonData} from '../../helpers/database.helpers';
461461
import {expect} from '@loopback/testlab';
462462

@@ -547,7 +547,7 @@ import {
547547
givenEmptyDatabase,
548548
givenCategory,
549549
} from '../../helpers/database.helpers';
550-
import {CategoryRepository} from '../../../src/repositories';
550+
import {CategoryRepository} from '../../..//repositories';
551551
import {expect} from '@loopback/testlab';
552552
import {testdb} from '../../fixtures/datasources/testdb.datasource';
553553

@@ -580,8 +580,8 @@ ingredient.
580580
```ts
581581
import {expect} from '@loopback/testlab';
582582
import {givenEmptyDatabase, givenProduct} from '../../helpers/database.helpers';
583-
import {ProductController} from '../../../src/controllers';
584-
import {ProductRepository} from '../../../src/repositories';
583+
import {ProductController} from '../../..//controllers';
584+
import {ProductRepository} from '../../..//repositories';
585585
import {testdb} from '../../fixtures/datasources/testdb.datasource';
586586

587587
describe('ProductController (integration)', () => {
@@ -628,11 +628,8 @@ of the service proxy by invoking the provider. This helper should be typically
628628
invoked once before the integration test suite begins.
629629

630630
```ts
631-
import {
632-
GeoService,
633-
GeoServiceProvider,
634-
} from '../../src/services/geo.service.ts';
635-
import {GeoDataSource} from '../../src/datasources/geo.datasource.ts';
631+
import {GeoService, GeoServiceProvider} from '../../services/geo.service.ts';
632+
import {GeoDataSource} from '../../datasources/geo.datasource.ts';
636633

637634
describe('GeoService', () => {
638635
let service: GeoService;
@@ -653,7 +650,7 @@ instance:
653650
```ts
654651
import {merge} from 'lodash';
655652

656-
const GEO_CODER_CONFIG = require('../src/datasources/geo.datasource.json');
653+
const GEO_CODER_CONFIG = require('../datasources/geo.datasource.json');
657654

658655
function givenGeoService() {
659656
const config = merge({}, GEO_CODER_CONFIG, {

examples/hello-world/index.d.ts

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

examples/hello-world/index.ts

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

examples/hello-world/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"engines": {
77
"node": ">=8.9"
88
},
9+
"types": "./dist10/index.d.ts",
910
"scripts": {
10-
"acceptance": "lb-mocha \"DIST/test/acceptance/**/*.js\"",
11+
"acceptance": "lb-mocha \"DIST/__tests__/acceptance/**/*.js\"",
1112
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
1213
"build:apidocs": "lb-apidocs",
1314
"build": "lb-tsc",
@@ -24,9 +25,9 @@
2425
"tslint": "lb-tslint",
2526
"tslint:fix": "npm run tslint -- --fix",
2627
"pretest": "npm run clean && npm run build",
27-
"test": "lb-mocha --allow-console-logs \"DIST/test\"",
28+
"test": "lb-mocha --allow-console-logs \"DIST/__tests__\"",
2829
"posttest": "npm run lint",
29-
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
30+
"test:dev": "lb-mocha --allow-console-logs DIST/__tests__/**/*.js && npm run posttest",
3031
"prestart": "npm run build",
3132
"start": "node ."
3233
},

0 commit comments

Comments
 (0)