commit 052584b09a0ee86853fc4d3594f6b1d3d88968f1 Author: Matei Adriel Date: Thu Dec 19 12:37:48 2019 +0200 typescript(option): chore: initial setup Signed-off-by: prescientmoon diff --git a/typescript/option/.gitignore b/typescript/option/.gitignore new file mode 100644 index 0000000..25d4951 --- /dev/null +++ b/typescript/option/.gitignore @@ -0,0 +1,3 @@ +node_modules +dist +sandbox \ No newline at end of file diff --git a/typescript/option/.prettierrc b/typescript/option/.prettierrc new file mode 100644 index 0000000..da62ca6 --- /dev/null +++ b/typescript/option/.prettierrc @@ -0,0 +1,5 @@ +{ + "semi": false, + "tabWidth": 4, + "singleQuote": true +} diff --git a/typescript/option/LICENSE b/typescript/option/LICENSE new file mode 100644 index 0000000..5cd6321 --- /dev/null +++ b/typescript/option/LICENSE @@ -0,0 +1,39 @@ +The Prosperity Public License 2.0.0 + +Contributor: Matei Adriel + +Source Code: https://github.com/Mateiadrielrafael/ecs + +This license lets you use and share this software for free, +with a trial-length time limit on commercial use. Specifically: + +If you follow the rules below, you may do everything with this +software that would otherwise infringe either the contributor's +copyright in it, any patent claim the contributor can license +that covers this software as of the contributor's latest +contribution, or both. + +1. You must limit use of this software in any manner primarily + intended for or directed toward commercial advantage or + private monetary compensation to a trial period of 32 + consecutive calendar days. This limit does not apply to use in + developing feedback, modifications, or extensions that you + contribute back to those giving this license. + +2. Ensure everyone who gets a copy of this software from you, in + source code or any other form, gets the text of this license + and the contributor and source code lines above. + +3. Do not make any legal claim against anyone for infringing any + patent claim they would infringe by using this software alone, + accusing this software, with or without changes, alone or as + part of a larger application. + +You are excused for unknowingly breaking rule 1 if you stop +doing anything requiring this license within 30 days of +learning you broke the rule. + +**This software comes as is, without any warranty at all. As far +as the law allows, the contributor will not be liable for any +damages related to this software or this license, for any kind of +legal claim.** \ No newline at end of file diff --git a/typescript/option/package.json b/typescript/option/package.json new file mode 100644 index 0000000..a10fbc3 --- /dev/null +++ b/typescript/option/package.json @@ -0,0 +1,36 @@ +{ + "name": "@adrielus/option", + "version": "0.0.0-development", + "description": "Typescript version of fsharps Option module", + "main": "dist/bundle.cjs.js", + "module": "dist/bundle.esm.js", + "typings": "dist/index.d.ts", + "scripts": { + "prebuild": "rimraf dist", + "build": "rollup -c rollup.config.ts" + }, + "files": [ + "dist" + ], + "keywords": [ + "typescript", + "fsharp", + "option", + "maybe", + "nullable" + ], + "dependencies": {}, + "sideEffects": false, + "devDependencies": { + "rimraf": "^3.0.0", + "rollup": "^1.27.5", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-dts": "^1.1.12", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^5.1.2", + "rollup-plugin-typescript2": "^0.25.2", + "typescript": "^3.7.2" + }, + "author": "Matei Adriel", + "license": "SEE LICENSE IN LICENSE" +} diff --git a/typescript/option/rollup.config.ts b/typescript/option/rollup.config.ts new file mode 100644 index 0000000..19dadb4 --- /dev/null +++ b/typescript/option/rollup.config.ts @@ -0,0 +1,54 @@ +import commonjs from 'rollup-plugin-commonjs' +import nodeResolve from 'rollup-plugin-node-resolve' +import dts from 'rollup-plugin-dts' +import typescript from 'rollup-plugin-typescript2' +import { terser } from 'rollup-plugin-terser' +import { resolve } from 'path' + +const outputDirectory = resolve(__dirname, 'dist') +const inputFile = resolve(__dirname, 'src/index.ts') + +const npmConfig = require(resolve(__dirname, `package.json`)) + +const external = Object.keys(npmConfig.dependencies || {}) +const dev = Boolean(process.env.ROLLUP_WATCH) + +export default [ + { + input: inputFile, + external, + output: [ + { + file: `${outputDirectory}/bundle.cjs.js`, + format: 'cjs', + sourcemap: true + }, + { + file: `${outputDirectory}/bundle.esm.js`, + format: 'esm', + sourcemap: true + }, + { + file: `${outputDirectory}/bundle.amd.js`, + sourcemap: true, + format: 'amd', + name: 'Loopover' + } + ], + plugins: [ + nodeResolve({ + extensions: ['.ts'] + }), + commonjs(), + typescript({ + tsconfig: resolve(__dirname, 'tsconfig.json') + }), + !dev && terser() + ] + }, + { + input: inputFile, + output: [{ file: `${outputDirectory}/index.d.ts`, format: 'es' }], + plugins: [dts()] + } +] diff --git a/typescript/option/src/index.ts b/typescript/option/src/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/typescript/option/tsconfig.json b/typescript/option/tsconfig.json new file mode 100644 index 0000000..ee2ac52 --- /dev/null +++ b/typescript/option/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "lib": ["esnext", "dom", "es2015.iterable"], + "moduleResolution": "node", + "strictNullChecks": true, + "sourceMap": true, + "downlevelIteration": true, + "target": "es6" + }, + "include": ["src", "sandbox"] +}