mirror of
https://github.com/bendtherules/react-vis-gridarea.git
synced 2026-08-18 13:51:59 +00:00
Initial structure
Generated with node-typescript-webpack
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"env",
|
||||||
|
{
|
||||||
|
"modules": false,
|
||||||
|
"targets": {
|
||||||
|
"browsers": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not ie <= 8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stage-2"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
coverage/
|
||||||
|
node_modules/
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.nyc_output
|
||||||
|
lib
|
||||||
|
lib_test
|
||||||
|
dist
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# gitignore
|
||||||
|
|
||||||
|
coverage/
|
||||||
|
node_modules/
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.nyc_output
|
||||||
|
lib
|
||||||
|
lib_test
|
||||||
|
|
||||||
|
# npmignore
|
||||||
|
|
||||||
|
src/
|
||||||
|
__tests__/
|
||||||
|
.vscode/
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- 'node' # use latest stable nodejs version
|
||||||
|
script:
|
||||||
|
- npm run coverage # jest test with coverage flag does coverage too
|
||||||
|
after_script:
|
||||||
|
- 'cat coverage/lcov.info | ./node_modules/.bin/coveralls' # sends the coverage report to coveralls
|
||||||
Vendored
+34
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible Node.js debug attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug file",
|
||||||
|
"program": "${workspaceRoot}/lib/${fileBasenameNoExtension}.js",
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"sourceMaps": true,
|
||||||
|
"smartStep": true,
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceRoot}/lib/*.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug test",
|
||||||
|
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
|
||||||
|
"args": [
|
||||||
|
"--findRelatedTests",
|
||||||
|
"${relativeFile}",
|
||||||
|
"--env",
|
||||||
|
"jest-environment-node-debug"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceRoot}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"typescript.tsdk": "node_modules/typescript/lib/"
|
||||||
|
}
|
||||||
Vendored
+59
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"taskName": "Run current file",
|
||||||
|
"command": "ts-node ${relativeFile}",
|
||||||
|
"type": "shell",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"label": "clean",
|
||||||
|
"script": "clean",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"label": "build",
|
||||||
|
"script": "build",
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"problemMatcher":[]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"label": "format",
|
||||||
|
"script": "format",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"label": "coverage",
|
||||||
|
"script": "coverage",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"label": "test",
|
||||||
|
"script": "test",
|
||||||
|
"group": {
|
||||||
|
"kind": "test",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"label": "lint",
|
||||||
|
"script": "lint",
|
||||||
|
"problemMatcher": [
|
||||||
|
"$eslint-stylish"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2018
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
[](https://travis-ci.org/{{github-user-name}}/{{github-app-name}}.svg?branch=master)
|
||||||
|
[](https://coveralls.io/github/{{github-user-name}}/{{github-app-name}}?branch=master)
|
||||||
|
[](http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
# Using this module in other modules
|
||||||
|
|
||||||
|
Here is a quick example of how this module can be used in other modules. The [TypeScript Module Resolution Logic](https://www.typescriptlang.org/docs/handbook/module-resolution.html) makes it quite easy. The file `src/index.ts` is a [barrel](https://basarat.gitbooks.io/typescript/content/docs/tips/barrel.html) that re-exports selected exports from other files. The _package.json_ file contains `main` attribute that points to the generated `lib/index.js` file and `typings` attribute that points to the generated `lib/index.d.ts` file.
|
||||||
|
|
||||||
|
> If you are planning to have code in multiple files (which is quite natural for a NodeJS module) that users can import, make sure you update `src/index.ts` file appropriately.
|
||||||
|
|
||||||
|
Now assuming you have published this amazing module to _npm_ with the name `my-amazing-lib`, and installed it in the module in which you need it -
|
||||||
|
|
||||||
|
- To use the `Greeter` class in a TypeScript file -
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { Greeter } from "my-amazing-lib";
|
||||||
|
|
||||||
|
const greeter = new Greeter("World!");
|
||||||
|
greeter.greet();
|
||||||
|
```
|
||||||
|
|
||||||
|
- To use the `Greeter` class in a JavaScript file -
|
||||||
|
|
||||||
|
```js
|
||||||
|
const Greeter = require('my-amazing-lib').Greeter;
|
||||||
|
|
||||||
|
const greeter = new Greeter('World!');
|
||||||
|
greeter.greet();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setting travis and coveralls badges
|
||||||
|
1. Sign in to [travis](https://travis-ci.org/) and activate the build for your project.
|
||||||
|
2. Sign in to [coveralls](https://coveralls.io/) and activate the build for your project.
|
||||||
|
3. Replace {{github-user-name}}/{{github-app-name}} with your repo details like: "ospatil/generator-node-typescript".
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { Greeter } from '../src/greeter';
|
||||||
|
|
||||||
|
test('Should greet with message', () => {
|
||||||
|
const greeter = new Greeter('friend');
|
||||||
|
expect(greeter.greet()).toBe('Bonjour, friend!');
|
||||||
|
});
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const mockWind = jest.fn<Window>();
|
||||||
|
const anyGlobal = global as any;
|
||||||
|
anyGlobal.window = new mockWind();
|
||||||
|
|
||||||
|
import * as index from '../src/index';
|
||||||
|
|
||||||
|
test('Should have Greeter available', () => {
|
||||||
|
expect(index.Greeter).toBeTruthy();
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta content='width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0' name='viewport' />
|
||||||
|
<script src="index.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1> open dev tool and console logs</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"name": "react-vis-gridarea",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "react-vis-gridarea",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "",
|
||||||
|
"author": {
|
||||||
|
"name": "",
|
||||||
|
"email": "",
|
||||||
|
"url": ""
|
||||||
|
},
|
||||||
|
"keywords": [""],
|
||||||
|
"files": ["lib"],
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"typings": "lib/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf lib && rimraf coverage",
|
||||||
|
"format":
|
||||||
|
"prettier --write \"{src,__tests__}/**/*.ts\" --single-quote --trailing-comma es5",
|
||||||
|
"lint": "tslint --force --format verbose \"src/**/*.ts\"",
|
||||||
|
"prepare": "npm run build",
|
||||||
|
"prebuild":
|
||||||
|
"npm run clean && npm run format && npm run lint && echo Using TypeScript && tsc --version",
|
||||||
|
"build": "tsc --pretty && webpack",
|
||||||
|
"dev": "webpack-dev-server --progress --open-page dist/",
|
||||||
|
"demo": "npm run build && http-server dist -o",
|
||||||
|
"test": "jest",
|
||||||
|
"coverage": "jest --coverage",
|
||||||
|
"watch": "npm run build -- --watch",
|
||||||
|
"watch:test": "jest --watch"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^22.0.1",
|
||||||
|
"@types/node": "^8.0.0",
|
||||||
|
"babel-loader": "^7.1.2",
|
||||||
|
"babel-preset-env": "^1.6.1",
|
||||||
|
"babel-preset-stage-2": "^6.24.1",
|
||||||
|
"copy-webpack-plugin": "^4.4.1",
|
||||||
|
"coveralls": "^2.0.0",
|
||||||
|
"http-server": "^0.11.1",
|
||||||
|
"jest": "^22.0.4",
|
||||||
|
"jest-environment-node-debug": "^2.0.0",
|
||||||
|
"prettier": "^1.5.2",
|
||||||
|
"rimraf": "^2.0.0",
|
||||||
|
"ts-jest": "^22.0.1",
|
||||||
|
"ts-loader": "^3.4.0",
|
||||||
|
"ts-node": "^3.2.0",
|
||||||
|
"tslint": "^5.0.0",
|
||||||
|
"tslint-config-prettier": "^1.1.0",
|
||||||
|
"typescript": "^2.3.0",
|
||||||
|
"webpack": "^3.10.0",
|
||||||
|
"webpack-dev-server": "^2.11.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"transform": {
|
||||||
|
".(ts)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
|
||||||
|
},
|
||||||
|
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|js)$",
|
||||||
|
"moduleFileExtensions": ["ts", "js"],
|
||||||
|
"testEnvironment": "node",
|
||||||
|
"mapCoverage": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export class Greeter {
|
||||||
|
private greeting: string;
|
||||||
|
|
||||||
|
constructor(message: string) {
|
||||||
|
this.greeting = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public greet(): string {
|
||||||
|
return `Bonjour, ${this.greeting}!`;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { Greeter } from './greeter';
|
||||||
|
export * from './greeter';
|
||||||
|
|
||||||
|
// tslint:disable-next-line:only-arrow-functions
|
||||||
|
(function(currentWindow: Window) {
|
||||||
|
// execute when load index.js
|
||||||
|
|
||||||
|
// tslint:disable-next-line:no-console
|
||||||
|
console.log('hello world');
|
||||||
|
|
||||||
|
// assign Greeter to global
|
||||||
|
const myWindow = currentWindow as any;
|
||||||
|
myWindow.Greeter = Greeter;
|
||||||
|
// we can use Greeter , execute following in console
|
||||||
|
// var greet = new Greeter('myName');
|
||||||
|
// greet.greet();
|
||||||
|
})(window);
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"lib": [
|
||||||
|
"esnext",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
|
"target": "es5",
|
||||||
|
"strict": true,
|
||||||
|
"outDir": "./lib",
|
||||||
|
"preserveConstEnums": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"inlineSourceMap": true,
|
||||||
|
"typeRoots": [
|
||||||
|
"./node_modules/@types"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/*-spec.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"tslint:latest",
|
||||||
|
"tslint-config-prettier"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
const webpack = require("webpack");
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
devtool: 'inline-source-map',
|
||||||
|
entry: {
|
||||||
|
"index": './src/index.ts',
|
||||||
|
"index.min": './src/index.ts',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: 'dist/[name].js'
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
// Add `.ts` and `.tsx` as a resolvable extension.
|
||||||
|
extensions: ['.ts', '.tsx', '.js']
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{ test: /\.js$/, loader: 'babel-loader' },
|
||||||
|
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
|
||||||
|
{ test: /\.tsx?$/, loader: 'babel-loader!ts-loader' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
|
include: /\.min\.js$/,
|
||||||
|
minimize: true
|
||||||
|
}) ,
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
{ from: 'demo/index.html', to: 'dist/' }
|
||||||
|
])
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user