Skip to content

Commit

Permalink
V1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tareksaleem committed Jul 10, 2023
1 parent 9542b36 commit 4e236fd
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 3 deletions.
6 changes: 6 additions & 0 deletions examples/hello-world-app/src/db.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export declare class DB {
users: {
username: string;
}[];
}
export declare const db: DB;
14 changes: 14 additions & 0 deletions examples/hello-world-app/src/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.db = exports.DB = void 0;
class DB {
constructor() {
this.users = [
{
username: "tarek",
}
];
}
}
exports.DB = DB;
exports.db = new DB();
1 change: 1 addition & 0 deletions examples/hello-world-app/src/diInit.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const DiInit: () => void;
10 changes: 10 additions & 0 deletions examples/hello-world-app/src/diInit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiInit = void 0;
const injectx_1 = require("injectx");
const db_1 = require("./db");
const getUser_repository_1 = require("./getUser.repository");
const DiInit = () => {
(0, injectx_1.GetContainer)('default').Bind(db_1.db, { name: 'db' }).Bind(getUser_repository_1.GetUserRepository);
};
exports.DiInit = DiInit;
7 changes: 7 additions & 0 deletions examples/hello-world-app/src/getUser.repository.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { DB } from './db';
export declare const GetUserRepository: ({ db }: {
db: DB;
}) => (username: string) => {
username: string;
};
export declare const getUserReposistory: any;
9 changes: 9 additions & 0 deletions examples/hello-world-app/src/getUser.repository.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserReposistory = exports.GetUserRepository = void 0;
const injectx_1 = require("injectx");
const GetUserRepository = ({ db }) => (username) => {
return db.users.find(user => user.username === username);
};
exports.GetUserRepository = GetUserRepository;
exports.getUserReposistory = (0, injectx_1.InjectIn)(exports.GetUserRepository);
1 change: 1 addition & 0 deletions examples/hello-world-app/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
6 changes: 6 additions & 0 deletions examples/hello-world-app/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const diInit_1 = require("./diInit");
(0, diInit_1.DiInit)();
const getUser_repository_1 = require("./getUser.repository");
console.log((0, getUser_repository_1.getUserReposistory)("tarek"));
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "injectx",
"version": "1.0.2",
"version": "1.0.3",
"main": "lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon",
"build": "tsc -p .",
"publish": "npm run build & npm publish"
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@
"resolveJsonModule": true, /* Include modules imported with '.json' extension */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
},
"exclude": ["examples/**", "lib"]
}

0 comments on commit 4e236fd

Please sign in to comment.