diff --git a/.gitignore b/.gitignore index 54bfd2001e64d03a43570130180635049cd8f0b2..e1d335288fa6a8bf17651ca70452f89f20a3f4a9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # compiled output /dist +/build /tmp /out-tsc @@ -32,6 +33,7 @@ npm-debug.log testem.log /typings +Makefile # e2e /e2e/*.js diff --git a/karma.conf.js b/karma.conf.js index 0cd2a217a253f50dc94d4fcf5b58779c53651af8..acf16b031749452acef1db26b55090289d491894 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -5,17 +5,19 @@ module.exports = function (config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: '', + basePath: './', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['jasmine', 'karma-typescript'], + frameworks: ['jasmine', 'requirejs'], // list of files / patterns to load in the browser files: [ - { pattern: 'dist/out-tsc/**/*.spec.js', included: false } + { pattern: 'src/**/*.ts', included: false }, + { pattern: 'spec/**/*.ts', included: false }, + 'spec/test-main.js' ], @@ -27,21 +29,24 @@ module.exports = function (config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { - 'src/**/*.spec.ts': ['karma-typescript'] + '+(src|spec)**/*.ts': ['typescript'] }, + typescriptPreprocessor: { + options: { + // https://github.com/Microsoft/TypeScript/blob/b0584b58fa07ee8c06e6d6f0f1bce2d4c37c7640/lib/typescript.d.ts#L1573 + // enum ScriptTarget { ES3 = 0, ES5 = 1, ES6 = 2, ES2015 = 2, Latest = 2 } + target: 1, + // https://github.com/Microsoft/TypeScript/blob/b0584b58fa07ee8c06e6d6f0f1bce2d4c37c7640/lib/typescript.d.ts#L1544 + // enum ModuleKind { None = 0, CommonJS = 1, AMD = 2, UMD = 3, System = 4, ES6 = 5, ES2015 = 5 } + module: 2 + } + }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress', 'karma-typescript'], - - // https://github.com/monounity/karma-typescript/blob/master/cookbook.md#user-content-importing-es2015-aka-es6-modules - karmaTypescriptConfig: { - bundlerOptions: { - transforms: [require("karma-typescript-es6-transform")()] - } - }, + reporters: ['progress', 'kjhtml'], // web server port diff --git a/package.json b/package.json index c1f0a0b9481d803e268019291ff3364849159442..de06a326220b5d2c45eaa8b30722867b2cba842b 100644 --- a/package.json +++ b/package.json @@ -1,29 +1,26 @@ { - "name": "jalhyd", - "version": "0.0.1", - "license": "MIT", + "name": "JaLHyd", + "version": "1.0.0", + "author": "DD", + "license": "ISC" + "description": "Javascript Library for Hydraulics", + "dependencies": {}, + "devDependencies": { + "jasmine-core": "^2.5.2", + "karma": "^1.3.0", + "karma-jasmine": "^1.0.2", + "karma-jasmine-html-reporter": "^0.2.2", + "karma-chrome-launcher": "^2.0.0", + "karma-requirejs": "^1.1.0", + "karma-typescript-preprocessor": "^0.3.0", + "requirejs": "^2.3.2", + "typescript": "^2.0.3", + "tslint": "^3.15.1" + }, "scripts": { - "build": "tsc --p src/tsconfig.app.json", - "test": "./node_modules/karma/bin/karma start", + "build": "./node_modules/typescript/bin/tsc --p src/tsconfig.app.json", + "test": "./node_modules/typescript/bin/tsc --p spec/tsconfig.spec.json && ./node_modules/karma/bin/karma start", "lint": "./node_modules/tslint/bin/tslint", "viz": "tsviz -recursive src/ jalhyd_class_diagram.png" }, - "private": true, - "dependencies": {}, - "devDependencies": { - "@types/jasmine": "2.5.38", - "@types/node": "~6.0.60", - "jasmine-core": "~2.5.2", - "jasmine-spec-reporter": "~3.2.0", - "karma": "~1.4.1", - "karma-chrome-launcher": "~2.1.1", - "karma-coverage-istanbul-reporter": "^0.2.0", - "karma-jasmine": "~1.1.0", - "karma-jasmine-html-reporter": "^0.2.2", - "karma-typescript": "^3.0.1", - "karma-typescript-es6-transform": "^1.0.0", - "ts-node": "~2.0.0", - "tslint": "~4.5.0", - "typescript": "~2.2.0" - } } diff --git a/src/base.spec.ts b/src/base.spec.ts deleted file mode 100644 index 10316147254cceeb012ae5bd7b662c23eacbe3fb..0000000000000000000000000000000000000000 --- a/src/base.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Nub, Result } from "base"; - -class NubTest extends Nub { - Equation(): Result { - let res: Result = new Result(); - res.varCalc = this.v["A"] + this.v["B"]; - return res; - } -} -let nub = new NubTest({ "A": 1, "B": 2, "C": null }); -let res = new Result; - -describe('Class Nub: ', () => { - beforeEach(() => { - nub.sVarsEq = ["C"]; - res.varCalc = 3; - }); - describe('Calc(): ', () => { - it('should return a result', () => { - expect(nub.Calc("C")).toBe(res); - }); - }); -}); - diff --git a/src/lechaptcalmon.ts b/src/lechaptcalmon.ts index 8827a3dd02c70f7b8f3c67f0f800b7fd8d56fd02..79bdda2cb97318e4eb7dd01c01464a497710458f 100644 --- a/src/lechaptcalmon.ts +++ b/src/lechaptcalmon.ts @@ -1,4 +1,4 @@ -import { Nub, Result, IParametres } from "base"; +import { Nub, Result, IParametres } from "./base"; interface IParamLechaptCalmon extends IParametres { diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index 5e2507db58c96c20ac2015842994a5af0e39734b..b66f5dea9bddb60494f5d16e9ce6f7ce7de5eeb1 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -1,13 +1,10 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../out-tsc/app", - "module": "es2015", - "baseUrl": "", "types": [] }, - "exclude": [ - "test.ts", - "**/*.spec.ts" - ] + "include": [ + "../src/**/*.ts" + ], + "exclude": [] } diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json deleted file mode 100644 index 510e3f1fdae16c04db35a215260837dedf236a43..0000000000000000000000000000000000000000 --- a/src/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/spec", - "module": "commonjs", - "target": "es5", - "baseUrl": "", - "types": [ - "jasmine", - "node" - ] - }, - "files": [ - "test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/tsconfig.json b/tsconfig.json index a35a8ee3a40d4326972a6d31edf57a9bce437520..63b55c597831d942a073ff8b94cb162dddec313a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,12 @@ { - "compileOnSave": false, "compilerOptions": { - "outDir": "./dist/out-tsc", - "baseUrl": "src", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, "target": "es5", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2016", - "dom" - ] - } -} + "module": "commonjs", + "outDir": "./build", + "noImplicitAny": false, + "sourceMap": true + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/tslint.json b/tslint.json index 97adaa5e922346cee8e74d1d7b5effd0387b33d0..68ab2e5730fa3a9929fbf6a9152918e72ca8cc13 100644 --- a/tslint.json +++ b/tslint.json @@ -127,4 +127,4 @@ "templates-use-public": true, "invoke-injectable": true } -} +} \ No newline at end of file