Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Commit

Permalink
modify how modules are exported.
Browse files Browse the repository at this point in the history
  • Loading branch information
joesonw committed Nov 29, 2016
1 parent 0b377cf commit 442024f
Show file tree
Hide file tree
Showing 47 changed files with 330 additions and 420 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -14,6 +14,13 @@ $ npm install koa@next @types/koa @t2ee/vader --save
This is the core component of t2ee, the routing service.

More documentations will be added soon, for immediate access to all features, please refer to the declaration file.
## Example

```typescript

```

## Contributing

PRs and Issues are welcome

Expand Down
7 changes: 0 additions & 7 deletions dist/core/index.d.ts

This file was deleted.

14 changes: 0 additions & 14 deletions dist/core/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/core/index.js.map

This file was deleted.

18 changes: 0 additions & 18 deletions dist/decorators/index.d.ts

This file was deleted.

36 changes: 0 additions & 36 deletions dist/decorators/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/decorators/index.js.map

This file was deleted.

7 changes: 0 additions & 7 deletions dist/enums/index.d.ts

This file was deleted.

14 changes: 0 additions & 14 deletions dist/enums/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/enums/index.js.map

This file was deleted.

41 changes: 35 additions & 6 deletions dist/index.d.ts
@@ -1,6 +1,35 @@
import 'app-module-path/register';
import * as core from './core';
import * as decorators from './decorators';
import * as enums from './enums';
import * as utils from './utils';
export { core, decorators, enums, utils };
export { default as AbstractMiddleware } from './core/AbstractMiddleware';
export { default as ControllerProperty } from './core/ControllerProperty';
export { default as IMiddleware } from './core/IMiddleware';
export { default as IParameter } from './core/IParameter';
export { default as Response } from './core/Response';
export { default as RouteProperty } from './core/RouteProperty';
export { default as Router } from './core/Router';
export { default as VaderContext } from './core/VaderContext';
export { default as BodyParam } from './decorators/BodyParam';
export { default as Consume } from './decorators/Consume';
export { default as Context } from './decorators/Context';
export { default as DELETE } from './decorators/DELETE';
export { default as GET } from './decorators/GET';
export { default as HEAD } from './decorators/HEAD';
export { default as HeaderParam } from './decorators/HeaderParam';
export { default as Method } from './decorators/Method';
export { default as OPTIONS } from './decorators/OPTIONS';
export { default as POST } from './decorators/POST';
export { default as PUT } from './decorators/PUT';
export { default as Param } from './decorators/Param';
export { default as Path } from './decorators/Path';
export { default as PathParam } from './decorators/PathParam';
export { default as Produce } from './decorators/Produce';
export { default as QueryParam } from './decorators/QueryParam';
export { default as Use } from './decorators/Use';
export { default as Charset } from './enums/Charset';
export { default as HttpMethod } from './enums/HttpMethod';
export { default as MediaType } from './enums/MediaType';
export { default as ParamType } from './enums/ParamType';
export { default as Property } from './enums/Property';
export { default as Status } from './enums/Status';
export { default as createArray } from './utils/createArray';
export { default as debug } from './utils/debug';
export { default as decorate } from './utils/decorate';
export { default as parseMulti } from './utils/parseMulti';
75 changes: 66 additions & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions dist/utils/index.d.ts

This file was deleted.

10 changes: 0 additions & 10 deletions dist/utils/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/utils/index.js.map

This file was deleted.

34 changes: 34 additions & 0 deletions generateIndex.js
@@ -0,0 +1,34 @@
'use strict';
const fs = require('fs');
const path = require('path');

function walk(dir) {
const files = fs.readdirSync(dir);
const result = [];
for (const file of files) {
const p = path.resolve(dir, file)
const stat = fs.statSync(p);
if (stat.isDirectory()) {
result.push(...walk(p));
} else {
result.push(p);
}
}
return result;
}

try {
fs.unlinkSync('./src/index.ts');
} catch (e) {

}
const files = walk('./src').map(f => path.relative('./src', f));
let output = '';
for (const file of files) {
const extname = path.extname(file);
const module = path.basename(file, extname);
output += `export { default as ${module}} from './${file.slice(0, -extname.length)}';\n`
}


fs.writeFileSync('./src/index.ts', output);
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@t2ee/vader",
"version": "0.1.1",
"version": "0.1.2",
"description": "t2ee core component, router framework used on top of koa",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
15 changes: 0 additions & 15 deletions src/core/index.ts

This file was deleted.

36 changes: 0 additions & 36 deletions src/decorators/index.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/enums/index.ts

This file was deleted.

0 comments on commit 442024f

Please sign in to comment.