Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove hand-written index files #5440

Merged
merged 2 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
# is not able to access type information for dependencies
script:
- lerna bootstrap
- npm run build
- npm run lint

- node_js: "12"
Expand Down
6 changes: 0 additions & 6 deletions acceptance/extension-logging-fluentd/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions acceptance/extension-logging-fluentd/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions acceptance/extension-logging-fluentd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.3.3",
"description": "Acceptance test for extension-logging with fluentd",
"private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
Expand All @@ -29,8 +31,6 @@
},
"files": [
"README.md",
"index.js",
"index.d.ts",
"dist",
"src",
"!*/__tests__"
Expand Down
6 changes: 0 additions & 6 deletions acceptance/repository-cloudant/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions acceptance/repository-cloudant/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions acceptance/repository-cloudant/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions acceptance/repository-cloudant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "2.1.3",
"description": "",
"private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
Expand Down Expand Up @@ -36,8 +38,6 @@
},
"files": [
"README.md",
"index.js",
"index.d.ts",
"dist",
"src",
"!*/__tests__"
Expand Down
6 changes: 0 additions & 6 deletions acceptance/repository-mongodb/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions acceptance/repository-mongodb/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions acceptance/repository-mongodb/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions acceptance/repository-mongodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.7.3",
"description": "",
"private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
Expand All @@ -28,8 +30,6 @@
},
"files": [
"README.md",
"index.js",
"index.d.ts",
"dist",
"src",
"!*/__tests__"
Expand Down
6 changes: 0 additions & 6 deletions acceptance/repository-mysql/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions acceptance/repository-mysql/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions acceptance/repository-mysql/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions acceptance/repository-mysql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.7.3",
"description": "",
"private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
Expand All @@ -28,8 +30,6 @@
},
"files": [
"README.md",
"index.js",
"index.d.ts",
"dist",
"src",
"!*/__tests__"
Expand Down
6 changes: 0 additions & 6 deletions acceptance/repository-postgresql/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions acceptance/repository-postgresql/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions acceptance/repository-postgresql/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions acceptance/repository-postgresql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "2.1.3",
"description": "",
"private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
Expand All @@ -28,8 +30,6 @@
},
"files": [
"README.md",
"index.js",
"index.d.ts",
"dist",
"src",
"!*/__tests__"
Expand Down
18 changes: 0 additions & 18 deletions benchmark/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions benchmark/index.ts

This file was deleted.

7 changes: 3 additions & 4 deletions benchmark/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "@loopback/benchmark",
"version": "2.0.8",
"private": true,
"description": "Benchmarks measuring performance of our framework.",
"private": true,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"keywords": [
"loopback",
"performance",
"benchmark"
],
"main": "index.js",
"engines": {
"node": ">=10"
},
Expand All @@ -26,8 +27,6 @@
"license": "MIT",
"files": [
"README.md",
"index.js",
"index.d.ts",
"dist",
"src",
"!*/__tests__"
Expand Down
10 changes: 10 additions & 0 deletions benchmark/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ export async function main() {
bench.logger = (title, stats) => console.log('%s:', title, stats);
await bench.run();
}

if (require.main === module) {
main().then(
success => process.exit(0),
err => {
console.error('Cannot run the benchmark.', err);
process.exit(1);
},
);
}
6 changes: 3 additions & 3 deletions docs/site/deployment/Deploying-with-pm2-and-nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ section of documentation for detailed instructions.
apps: [
{
name: 'MyAPI',
script: 'index.js',
script: 'dist/index.js',
instances: 1,
autorestart: true,
watch: false,
Expand Down Expand Up @@ -105,8 +105,8 @@ section of documentation for detailed instructions.
$ npm start
```

This creates a dist folder which contains the transpiled code. Use `index.js`
at your app's root level for starting the server using `pm2`.
This creates a dist folder which contains the transpiled code. Use
`dist/index.js` at your app's root level for starting the server using `pm2`.

Now you can visit [http://127.0.0.1:3000/](http://127.0.0.1:3000/) to check
your newly deployed API.
Expand Down
24 changes: 8 additions & 16 deletions docs/site/express-with-lb4-rest-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ Create two properties, the Express application instance and LoopBack application
instance:

```ts
import {NoteApplication} from './application';
import {ApplicationConfig} from '@loopback/core';
import express from 'express';
import {ApplicationConfig, NoteApplication} from './application';

export {ApplicationConfig};

export class ExpressServer {
public readonly app: express.Application;
Expand Down Expand Up @@ -255,32 +256,23 @@ Now that our **src/server.ts** file is ready, then we can modify our
{% include code-caption.html content="src/index.ts" %}

```ts
import {ExpressServer} from './server';
import {ApplicationConfig} from '@loopback/core';
import {ApplicationConfig, ExpressServer} from './server';

export {ExpressServer, NoteApplication};
export {ApplicationConfig, ExpressServer, NoteApplication};

export async function main(options: ApplicationConfig = {}) {
const server = new ExpressServer(options);
await server.boot();
await server.start();
console.log('Server is running at http://127.0.0.1:3000');
}
```

{% include code-caption.html content="index.js" %}

```js
const application = require('./dist');

module.exports = application;

if (require.main === module) {
// Run the application
const config = {
rest: {
port: +process.env.PORT || 3000,
host: process.env.HOST || 'localhost',
port: +(process.env.PORT ?? 3000),
host: process.env.HOST ?? 'localhost',
openApiSpec: {
// useful when used with OpenAPI-to-GraphQL to locate your application
setServersFromRequest: true,
Expand All @@ -289,7 +281,7 @@ if (require.main === module) {
listenOnStart: false,
},
};
application.main(config).catch(err => {
main(config).catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
});
Expand Down
4 changes: 0 additions & 4 deletions docs/site/tutorials/todo/todo-tutorial-scaffolding.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ node_modules/
***
LICENSE
README.md
index.js
index.ts
package.json
tsconfig.json
.eslintrc.js
Expand All @@ -84,8 +82,6 @@ Note that there might be extra files not listed here.

| File | Purpose |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `index.ts` | Allows importing contents of the `src` folder (for use elsewhere) |
| `index.js` | Top-level file connecting components of the application. |
| `package.json` | Your application's package manifest. See [package.json](https://docs.npmjs.com/files/package.json) for details. |
| `tsconfig.json` | The TypeScript project configuration. See [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) for details. |
| `.eslintrc.js` | [ESLint configuration](https://eslint.org/docs/user-guide/configuring) |
Expand Down
6 changes: 0 additions & 6 deletions examples/access-control-migration/index.d.ts

This file was deleted.

Loading