Skip to content

Commit

Permalink
fixes to get building and actually working
Browse files Browse the repository at this point in the history
  • Loading branch information
willishq committed Dec 17, 2018
1 parent b82effa commit 423a1c3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
package-lock.json
package-lock.json
dist
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@willishq/ts-container",
"version": "0.0.2",
"version": "0.0.3",
"description": "A simple TypeScript container",
"scripts": {
"build": "tsc",
"lint": "eslint --fix src/**/*.ts",
"test": "mocha -r ts-node/register src/**/*.spec.ts"
},
Expand Down Expand Up @@ -47,5 +48,6 @@
"url": "https://github.com/willishq/ts-container/issues"
},
"homepage": "https://github.com/willishq/ts-container#readme",
"main": "src/App.ts"
"main": "dist/index.js",
"types": "dist/index.d.js"
}
10 changes: 5 additions & 5 deletions src/App.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const AppExceptions = {
setAlreadyExists: (name) => `Can not set service ${name} - it already exists.`,
makeDoesNotExist: (name) => `Can not make service ${name} - it does not exist.`,
overwriteNotExist: (name) => `Can not overwrite service ${name} - it does not exist.`
setAlreadyExists: (name: string) => `Can not set service ${name} - it already exists.`,
makeDoesNotExist: (name: string) => `Can not make service ${name} - it does not exist.`,
overwriteNotExist: (name: string) => `Can not overwrite service ${name} - it does not exist.`
};

export default class App {
private services: {} = {};
private instances: {} = {};
private services: {[key: string]: any} = {};
private instances: {[key: string]: any} = {};

public set<T> (name: string, service: (app: App) => T) {
if (this.services.hasOwnProperty(name)) {
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./App";
19 changes: 19 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["es2017", "es7", "es6", "dom"],
"declaration": true,
"outDir": "./dist",
"strict": true,
"esModuleInterop": true
},
"include": [
"src/**/*.ts"
],
"exclude": [
"src/**/*.spec.*",
"node_modules",
"dist"
]
}

0 comments on commit 423a1c3

Please sign in to comment.