Added some missing config files.
Added rollup to build distribution js files.
This commit is contained in:
parent
99ad0710a6
commit
db9dcf643a
9
package-lock.json
generated
9
package-lock.json
generated
@ -3344,6 +3344,15 @@
|
||||
"glob": "^7.1.3"
|
||||
}
|
||||
},
|
||||
"rollup": {
|
||||
"version": "2.33.1",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.33.1.tgz",
|
||||
"integrity": "sha512-uY4O/IoL9oNW8MMcbA5hcOaz6tZTMIh7qJHx/tzIJm+n1wLoY38BLn6fuy7DhR57oNFLMbDQtDeJoFURt5933w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fsevents": "~2.1.2"
|
||||
}
|
||||
},
|
||||
"run-parallel": {
|
||||
"version": "1.1.10",
|
||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz",
|
||||
|
@ -7,7 +7,8 @@
|
||||
"test:js": "mocha test/**/*.js",
|
||||
"test:ts": "mocha -r ts-node/register test/**/*.ts",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"coverage": "nyc npm run test:js"
|
||||
"coverage": "nyc npm run test:js",
|
||||
"build:js": "rollup -c rollup.config.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Martin Donnelly",
|
||||
@ -23,6 +24,7 @@
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^8.2.1",
|
||||
"nyc": "^15.1.0",
|
||||
"rollup": "^2.33.1",
|
||||
"ts-node": "^9.0.0",
|
||||
"typings": "^2.1.1"
|
||||
},
|
||||
|
17
rollup.config.js
Normal file
17
rollup.config.js
Normal file
@ -0,0 +1,17 @@
|
||||
export default {
|
||||
input: 'lib/carpark.js',
|
||||
output: [
|
||||
{
|
||||
file: 'dist/carpark.js',
|
||||
format: 'umd',
|
||||
name: 'carpark',
|
||||
sourcemap: true
|
||||
},
|
||||
{
|
||||
file: 'dist/carpark.mjs',
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
}
|
||||
],
|
||||
plugins: []
|
||||
};
|
36
ts-lib/carparc-calc.d.ts
vendored
Normal file
36
ts-lib/carparc-calc.d.ts
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
declare class Carpark {
|
||||
private _startDT;
|
||||
private _endDT;
|
||||
private _dayLength;
|
||||
private _hourLength;
|
||||
private _validDays;
|
||||
private _validStart;
|
||||
private _validEnd;
|
||||
private _longPrice;
|
||||
private _shortPrice;
|
||||
private _secondPrice;
|
||||
/**
|
||||
* Check if a specific timestamp is a valid date
|
||||
* @param workTime
|
||||
*/
|
||||
private _isValidTime;
|
||||
/**
|
||||
* Calculate short term parking costs
|
||||
*/
|
||||
private _calcShortTerm;
|
||||
/**
|
||||
* Calculate long term parking costs
|
||||
* @returns {number}
|
||||
* @private
|
||||
*/
|
||||
private _calcLongTerm;
|
||||
/**
|
||||
* The public calculate method
|
||||
* @param start
|
||||
* @param end
|
||||
* @param mode
|
||||
* @returns {number}
|
||||
*/
|
||||
calculate(start: string, end: string, mode?: string): number;
|
||||
}
|
||||
export default Carpark;
|
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"outFile": "./dist/carpark-tsc.js",
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["ts-lib/**/*"],
|
||||
"exclude": ["node_modules", "test/**/*.ts"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user