Skip to content

Commit 20a5fa6

Browse files
author
hirsch
committed
🎉 Initial commit
1 parent 51aafb4 commit 20a5fa6

11 files changed

+442
-16
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dist
33
lib
44
es
55
test/coverage
6+
.rpt2_cache
67

78
### node ###
89
logs
@@ -19,3 +20,7 @@ node_modules/
1920
!.vscode/tasks.json
2021
!.vscode/launch.json
2122
!.vscode/extensions.json
23+
24+
### templates ###
25+
tmp
26+
old

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 w3tecch
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

package.json

+13-8
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
"version": "0.0.0",
44
"description": "TypeORM seeding",
55
"bin": {
6-
"seed": "./lib/cli.js"
6+
"seed": "./dist/cli.js"
77
},
8-
"main": "dist/index.js",
9-
"module": "dist/index.es.js",
8+
"main": "dist/typeorm-seeding.js",
9+
"module": "dist/typeorm-seeding.es.js",
1010
"files": [
1111
"dist"
1212
],
13-
"types": "dist/index.d.ts",
13+
"types": "dist/typeorm-seeding.d.ts",
1414
"scripts": {
15-
"build": "rollup -c",
16-
"watch": "rollup -cw"
15+
"build": "npm run clean && rollup -c",
16+
"watch": "rollup -cw",
17+
"clean": "rimraf dist"
1718
},
1819
"license": "MIT",
1920
"author": "w3tec.ch <[email protected]>",
@@ -25,8 +26,12 @@
2526
}
2627
],
2728
"devDependencies": {
29+
"rimraf": "^2.6.2",
2830
"rollup": "^0.66.2",
2931
"rollup-plugin-typescript2": "^0.17.0",
32+
"rollup-plugin-cli": "^0.1.5",
33+
"tslint": "^5.11.0",
3034
"typescript": "^3.0.3"
31-
}
32-
}
35+
},
36+
"dependencies": {}
37+
}

rollup.config.js

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import typescript from 'rollup-plugin-typescript2'
2+
import cli from 'rollup-plugin-cli';
23
import pkg from './package.json'
3-
export default {
4-
input: 'src/index.ts',
4+
5+
export default [{
6+
input: 'src/typeorm-seeding.ts',
57
output: [
68
{
79
file: pkg.main,
@@ -21,4 +23,22 @@ export default {
2123
typescript: require('typescript'),
2224
}),
2325
],
24-
}
26+
},{
27+
input: 'src/cli.ts',
28+
output: [
29+
{
30+
file: pkg.bin.seed,
31+
format: 'umd',
32+
}
33+
],
34+
external: [
35+
...Object.keys(pkg.dependencies || {}),
36+
...Object.keys(pkg.peerDependencies || {}),
37+
],
38+
plugins: [
39+
typescript({
40+
typescript: require('typescript'),
41+
}),
42+
cli(),
43+
],
44+
}]

src/cli.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
console.log('Hello');

src/entity-factory.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export class EntityFactory<Entity, Settings> {
2+
3+
}

src/typeorm-seeding.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import 'reflect-metadata';
2+
3+
import { EntityFactory } from './entity-factory';
4+
5+
export const greet = () => console.log('Hello, world?!', EntityFactory);

src/types/json.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.json' {
2+
const value: any;
3+
export default value;
4+
}

tsconfig.json

+17-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22
"compilerOptions": {
33
"declaration": true,
44
"declarationDir": "./dist",
5-
"module": "es6",
6-
"noImplicitAny": true,
75
"outDir": "./dist",
8-
"target": "es5"
6+
"target": "es6",
7+
"module": "es6",
8+
"noImplicitAny": false,
9+
"importHelpers": true,
10+
"strict": true,
11+
"strictNullChecks": false,
12+
"noImplicitThis": true,
13+
"alwaysStrict": true,
14+
"noUnusedLocals": true,
15+
"noUnusedParameters": false,
16+
"noImplicitReturns": true,
17+
"noFallthroughCasesInSwitch": true,
18+
"moduleResolution": "node",
19+
"allowSyntheticDefaultImports": true,
20+
"experimentalDecorators": true,
21+
"emitDecoratorMetadata": true,
22+
"esModuleInterop": true
923
},
1024
"include": [
1125
"src/**/*"

tslint.json

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"extends": "tslint:recommended",
3+
"rules": {
4+
"max-line-length": [
5+
true,
6+
160
7+
],
8+
"no-unnecessary-initializer": false,
9+
"no-var-requires": true,
10+
"no-null-keyword": true,
11+
"no-consecutive-blank-lines": true,
12+
"quotemark": [
13+
true,
14+
"single",
15+
"avoid-escape"
16+
],
17+
"interface-name": false,
18+
"no-empty-interface": false,
19+
"no-namespace": false,
20+
"ordered-imports": false,
21+
"object-literal-sort-keys": false,
22+
"arrow-parens": false,
23+
"member-ordering": [
24+
true,
25+
{
26+
"order": [
27+
"public-static-field",
28+
"public-static-method",
29+
"protected-static-field",
30+
"protected-static-method",
31+
"private-static-field",
32+
"private-static-method",
33+
"public-instance-field",
34+
"protected-instance-field",
35+
"private-instance-field",
36+
"public-constructor",
37+
"protected-constructor",
38+
"private-constructor",
39+
"public-instance-method",
40+
"protected-instance-method",
41+
"private-instance-method"
42+
]
43+
}
44+
],
45+
"no-console": [
46+
true,
47+
"debug",
48+
"info",
49+
"time",
50+
"timeEnd",
51+
"trace"
52+
],
53+
"no-inferrable-types": [
54+
true,
55+
"ignore-params"
56+
],
57+
"no-switch-case-fall-through": true,
58+
"typedef": [
59+
true,
60+
"call-signature",
61+
"parameter"
62+
],
63+
"trailing-comma": [
64+
true,
65+
{
66+
"multiline": {
67+
"objects": "always",
68+
"arrays": "always",
69+
"functions": "never",
70+
"typeLiterals": "ignore"
71+
},
72+
"singleline": "never"
73+
}
74+
],
75+
"align": [
76+
true,
77+
"parameters"
78+
],
79+
"class-name": true,
80+
"curly": true,
81+
"eofline": true,
82+
"jsdoc-format": true,
83+
"member-access": true,
84+
"no-arg": true,
85+
"no-construct": true,
86+
"no-duplicate-variable": true,
87+
"no-empty": true,
88+
"no-eval": true,
89+
"no-internal-module": true,
90+
"no-string-literal": true,
91+
"no-trailing-whitespace": true,
92+
"no-unused-expression": true,
93+
"no-var-keyword": true,
94+
"one-line": [
95+
true,
96+
"check-open-brace",
97+
"check-catch",
98+
"check-else",
99+
"check-finally",
100+
"check-whitespace"
101+
],
102+
"semicolon": true,
103+
"switch-default": true,
104+
"triple-equals": [
105+
true,
106+
"allow-null-check"
107+
],
108+
"typedef-whitespace": [
109+
true,
110+
{
111+
"call-signature": "nospace",
112+
"index-signature": "nospace",
113+
"parameter": "nospace",
114+
"property-declaration": "nospace",
115+
"variable-declaration": "nospace"
116+
}
117+
],
118+
"variable-name": false,
119+
"whitespace": [
120+
true,
121+
"check-branch",
122+
"check-decl",
123+
"check-operator",
124+
"check-separator",
125+
"check-type"
126+
]
127+
}
128+
}

0 commit comments

Comments
 (0)