Skip to content

Commit

Permalink
chore: reorg project layout for better typescript refs
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Sep 28, 2018
1 parent d16e94b commit 729be0a
Show file tree
Hide file tree
Showing 289 changed files with 203 additions and 573 deletions.
6 changes: 0 additions & 6 deletions benchmark/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"performance",
"benchmark"
],
"main": "index.js",
"types": "./dist10/index.d.ts",
"engines": {
"node": ">=8.9"
},
Expand All @@ -19,7 +19,7 @@
"build:dist10": "lb-tsc es2018",
"clean": "lb-clean dist*",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"DIST/test\"",
"test": "lb-mocha \"DIST/__tests__\"",
"prestart": "npm run build",
"start": "node ."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {expect} from '@loopback/testlab';
import * as request from 'request-promise-native';
import {Benchmark} from '..';
import {Autocannon, EndpointStats} from '../src/autocannon';
import {Autocannon, EndpointStats} from '../autocannon';

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

Expand Down
File renamed without changes.
7 changes: 1 addition & 6 deletions benchmark/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "../packages/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": ".",
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
},
"include": [
"index.ts",
"src",
"test"
],
"references": [
{
"path": "../packages/testlab/tsconfig.build.json"
Expand Down
4 changes: 2 additions & 2 deletions docs/site/Controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ with a test to verify that the error is thrown properly.

```ts
// test/integration/controllers/hello.controller.integration.ts
import {HelloController} from '../../../src/controllers';
import {HelloRepository} from '../../../src/repositories';
import {HelloController} from '../../..//controllers';
import {HelloRepository} from '../../..//repositories';
import {testdb} from '../../fixtures/datasources/testdb.datasource';
import {expect} from '@loopback/testlab';
import {HttpErrors} from '@loopback/rest';
Expand Down
23 changes: 10 additions & 13 deletions docs/site/Testing-your-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ helper method; for example:
{% include code-caption.html content="test/helpers/database.helpers.ts" %}

```ts
import {ProductRepository, CategoryRepository} from '../../src/repositories';
import {ProductRepository, CategoryRepository} from '../../repositories';
import {testdb} from '../fixtures/datasources/testdb.datasource';

export async function givenEmptyDatabase() {
Expand Down Expand Up @@ -413,8 +413,8 @@ detailed explanation.

```ts
import {expect, sinon} from '@loopback/testlab';
import {ProductRepository} from '../../../src/repositories';
import {ProductController} from '../../../src/controllers';
import {ProductRepository} from '../../..//repositories';
import {ProductController} from '../../..//controllers';

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

```ts
import {Person} from '../../../src/models';
import {Person} from '../../..//models';
import {givenPersonData} from '../../helpers/database.helpers';
import {expect} from '@loopback/testlab';

Expand Down Expand Up @@ -547,7 +547,7 @@ import {
givenEmptyDatabase,
givenCategory,
} from '../../helpers/database.helpers';
import {CategoryRepository} from '../../../src/repositories';
import {CategoryRepository} from '../../..//repositories';
import {expect} from '@loopback/testlab';
import {testdb} from '../../fixtures/datasources/testdb.datasource';

Expand Down Expand Up @@ -580,8 +580,8 @@ ingredient.
```ts
import {expect} from '@loopback/testlab';
import {givenEmptyDatabase, givenProduct} from '../../helpers/database.helpers';
import {ProductController} from '../../../src/controllers';
import {ProductRepository} from '../../../src/repositories';
import {ProductController} from '../../..//controllers';
import {ProductRepository} from '../../..//repositories';
import {testdb} from '../../fixtures/datasources/testdb.datasource';

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

```ts
import {
GeoService,
GeoServiceProvider,
} from '../../src/services/geo.service.ts';
import {GeoDataSource} from '../../src/datasources/geo.datasource.ts';
import {GeoService, GeoServiceProvider} from '../../services/geo.service.ts';
import {GeoDataSource} from '../../datasources/geo.datasource.ts';

describe('GeoService', () => {
let service: GeoService;
Expand All @@ -653,7 +650,7 @@ instance:
```ts
import {merge} from 'lodash';

const GEO_CODER_CONFIG = require('../src/datasources/geo.datasource.json');
const GEO_CODER_CONFIG = require('../datasources/geo.datasource.json');

function givenGeoService() {
const config = merge({}, GEO_CODER_CONFIG, {
Expand Down
6 changes: 0 additions & 6 deletions examples/hello-world/index.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions examples/hello-world/index.ts

This file was deleted.

7 changes: 4 additions & 3 deletions examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"scripts": {
"acceptance": "lb-mocha \"DIST/test/acceptance/**/*.js\"",
"acceptance": "lb-mocha \"DIST/__tests__/acceptance/**/*.js\"",
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
Expand All @@ -24,9 +25,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"DIST/test\"",
"test": "lb-mocha --allow-console-logs \"DIST/__tests__\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs DIST/__tests__/**/*.js && npm run posttest",
"prestart": "npm run build",
"start": "node ."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
expect,
givenHttpServerConfig,
} from '@loopback/testlab';
import {HelloWorldApplication} from '../../src/application';
import {HelloWorldApplication} from '../../application';

describe('Application', () => {
let app: HelloWorldApplication;
Expand Down
7 changes: 1 addition & 6 deletions examples/hello-world/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "./node_modules/@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": ".",
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
},
"include": [
"index.ts",
"src",
"test"
],
"references": [
{
"path": "../../packages/testlab/tsconfig.build.json"
Expand Down
6 changes: 0 additions & 6 deletions examples/log-extension/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions examples/log-extension/index.ts

This file was deleted.

5 changes: 3 additions & 2 deletions examples/log-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
Expand All @@ -22,9 +23,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"DIST/test/unit/**/*.js\" \"DIST/test/acceptance/**/*.js\"",
"test": "lb-mocha \"DIST/__tests__/unit/**/*.js\" \"DIST/__tests__/acceptance/**/*.js\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs DIST/__tests__/**/*.js && npm run posttest",
"verify": "npm pack && tar xf *example-log-extension*.tgz && tree package && npm run clean"
},
"repository": {
Expand Down
File renamed without changes.
7 changes: 1 addition & 6 deletions examples/log-extension/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "./node_modules/@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": ".",
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
},
"include": [
"index.ts",
"src",
"test"
],
"references": [
{
"path": "../../packages/testlab/tsconfig.build.json"
Expand Down
6 changes: 0 additions & 6 deletions examples/rpc-server/index.d.ts

This file was deleted.

11 changes: 0 additions & 11 deletions examples/rpc-server/index.ts

This file was deleted.

5 changes: 3 additions & 2 deletions examples/rpc-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
Expand All @@ -25,9 +26,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha DIST/test",
"test": "lb-mocha DIST/__tests__",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs DIST/__tests__/**/*.js && npm run posttest",
"prestart": "npm run build",
"start": "node ."
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {GreetController} from '../../../src/controllers';
import {GreetController} from '../../..//controllers';
import {expect} from '@loopback/testlab';

describe('greet.controller', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// License text available at https://opensource.org/licenses/MIT

import * as express from 'express';
import {RPCServer} from '../../src/rpc.server';
import {routeHandler} from '../../src/rpc.router';
import {RPCServer} from '../../rpc.server';
import {routeHandler} from '../../rpc.router';
import {expect, sinon} from '@loopback/testlab';

describe('rpcRouter', () => {
Expand Down
5 changes: 0 additions & 5 deletions examples/soap-calculator/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion examples/soap-calculator/index.ts

This file was deleted.

7 changes: 4 additions & 3 deletions examples/soap-calculator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
],
"main": "index.js",
"engines": {
"node": ">=8"
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
Expand All @@ -29,9 +30,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"DIST/test\"",
"test": "lb-mocha \"DIST/__tests__\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs DIST/__tests__/**/*.js && npm run posttest",
"prestart": "npm run build",
"start": "node ."
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Client, createRestAppClient, expect} from '@loopback/testlab';
import {SoapCalculatorApplication} from '../../src/application';
import {SoapCalculatorApplication} from '../../application';

describe('Application', function() {
let app: SoapCalculatorApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CalculatorDataSource} from '../src/datasources/calculator.datasource';
import {CalculatorDataSource} from '../datasources/calculator.datasource';

export async function givenAConnectedDataSource(): Promise<
CalculatorDataSource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
CalculatorService,
CalculatorParameters,
} from '../../../src/services/calculator.service';
import {CalculatorServiceProvider} from '../../../src/services/calculator.service';
} from '../../..//services/calculator.service';
import {CalculatorServiceProvider} from '../../..//services/calculator.service';
import {givenAConnectedDataSource} from '../../helpers';

import {expect} from '@loopback/testlab';
Expand Down
7 changes: 1 addition & 6 deletions examples/soap-calculator/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "./node_modules/@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": ".",
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
},
"include": [
"index.ts",
"src",
"test"
],
"references": [
{
"path": "../../packages/testlab/tsconfig.build.json"
Expand Down
6 changes: 0 additions & 6 deletions examples/todo-list/index.d.ts

This file was deleted.

Loading

0 comments on commit 729be0a

Please sign in to comment.