Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
wait until when d.ts of browserslist-useragent is merged
DefinitelyTyped/DefinitelyTyped#32328
  • Loading branch information
nju33 committed Jan 21, 2019
1 parent 1df716a commit 6564d2d
Show file tree
Hide file tree
Showing 17 changed files with 10,939 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
.docz
dist

### https://raw.github.com/github/gitignore/fad779220742a6d54ccfc0c1a0e5b3d820253de6/Node.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env



### https://raw.github.com/github/gitignore/fad779220742a6d54ccfc0c1a0e5b3d820253de6/Global/macOS.gitignore

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"noub"
]
}
Empty file added README.md
Empty file.
4 changes: 4 additions & 0 deletions doczrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
title: 'Noub',
typescript: true
};
23 changes: 23 additions & 0 deletions file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var Name = (function (redom) {
'use strict';

/* @jsx mount */
var Noub = /** @class */ (function () {
function Noub() {
this.el = redom.mount("div", null, "hoge");
}
Noub.create = function (elementId, opts) {
var targetElement = document.getElementById(elementId);
if (targetElement === null) {
throw TypeError('対象の要素が存在しません');
}
var noub = new Noub();
redom.mount(targetElement, noub);
return noub;
};
return Noub;
}());

return Noub;

}(redom));
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|.test).tsx?$',
};
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "noub",
"version": "1.0.0",
"main": "index.js",
"repository": "git@github.com:nju33/noub.git",
"author": "nju33 <nju33.ki@gmail.com>",
"license": "MIT",
"scripts": {
"prepare": "yarn build",
"test": "jest",
"typedoc": "typedoc --theme minimal --out docs src/index.ts --ignoreCompilerErrors",
"docz.dev": "docz dev",
"docz.build": "docz build",
"build.main": "tsc -P tsconfig.main.json",
"build.module": "tsc -P tsconfig.module.json",
"build.iife": "rollup dist/module/index.js --format iife --name Name --file file.js",
"build.types": "tsc -P tsconfig.types.json --emitDeclarationOnly",
"build": "yarn build.main; yarn build.module; yarn build.iife; yarn build.types"
},
"devDependencies": {
"@nju33/tsconfig-main": "^0.0.6",
"@nju33/tsconfig-module": "^0.0.6",
"@nju33/tsconfig-react-main": "^0.0.6",
"@nju33/tsconfig-react-module": "^0.0.6",
"@nju33/tsconfig-react-types": "^0.0.6",
"@nju33/tsconfig-types": "^0.0.6",
"@types/jest": "^23.3.13",
"@types/redom": "^3.12.0",
"docz": "^0.13.7",
"docz-theme-default": "^0.13.7",
"jest": "^23.6.0",
"rollup": "^1.1.1",
"ts-jest": "^23.10.5",
"tslint": "^5.12.1",
"typedoc": "^0.14.2",
"typescript": "^3.2.4"
},
"dependencies": {
"redom": "^3.17.1"
}
}
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {Noub} from './noub';

export default Noub;
19 changes: 19 additions & 0 deletions src/noub.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Noub
---

# Noub

import {Playground} from 'docz';
import {Noub} from './noub';

<div id="demo" />

<Playground>
{() => {
setTimeout(() => {
Noub.create('demo', '');
}, 1000);
return null;
}}
</Playground>
35 changes: 35 additions & 0 deletions src/noub.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* @jsx el */
import {el, mount, RedomComponent} from 'redom';

declare namespace JSX {
interface IntrinsicElements {
[index: string]: HTMLElement;
}
}

export interface NoubOptions {
browsers: string[];
}

export class Noub implements RedomComponent {
static create(elementId: string, opts: NoubOptions) {
const targetElement = document.getElementById(elementId);
if (targetElement === null) {
throw TypeError('対象の要素が存在しません');
}

const noub = new Noub();

mount(targetElement, noub);

return noub;
}

el: HTMLElement;

constructor() {
// el is not defined
el;
this.el = <div>hoge</div>;
}
}
5 changes: 5 additions & 0 deletions src/types/jsx/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare namespace JSX {
interface IntrinsicElements {
[index: string]: Partial<HTMLElement>;
}
}
8 changes: 8 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@nju33/tsconfig-react-main",
"include": ["src/**/*"],
"exclude": ["src/__tests__/**/*", "src/**/*test*", "src/dev.ts"],
"compilerOptions": {
"jsx": "react"
}
}
8 changes: 8 additions & 0 deletions tsconfig.main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@nju33/tsconfig-react-main",
"include": ["src/**/*"],
"exclude": ["src/__tests__/**/*", "src/**/*test*", "src/dev.ts"],
"compilerOptions": {
"outDir": "dist/main"
}
}
8 changes: 8 additions & 0 deletions tsconfig.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@nju33/tsconfig-react-module",
"include": ["src/**/*"],
"exclude": ["src/__tests__/**/*", "src/**/*test*", "src/dev.ts"],
"compilerOptions": {
"outDir": "dist/module"
}
}
8 changes: 8 additions & 0 deletions tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@nju33/tsconfig-react-types",
"include": ["src/**/*"],
"exclude": ["src/__tests__/**/*", "src/**/*test*", "src/dev.ts"],
"compilerOptions": {
"outDir": "dist/types"
}
}
49 changes: 49 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"extends": ["tslint-xo", "tslint-config-prettier"],
"rules": {
"no-require-imports": true,
"max-line-length": [
true,
{
"limit": 80,
"ignore-pattern": "^import|^export"
}
],
"max-file-line-count": [true, 500],
"no-namespace": true,
"no-duplicate-imports": true,
"object-literal-sort-keys": false,
"quotemark": [true, "single", "jsx-double"],
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore",
"allow-pascal-case"
],
"prefer-const": true,
"prefer-readonly": true,
"prefer-for-of": true,
"comment-format": [
true,
"check-lowercase",
{
"ignore-words": ["TODO"]
}
],
"no-for-in": true,
"no-for-in-array": true,
"no-unused-expression": true,
"no-unused-variable": [
true,
{
"ignore-pattern": "^_"
}
],
"interface-name": [true, "never-prefix"],
"arrow-return-shorthand": true,
"object-literal-key-quotes": [true, "as-needed"],
"no-void-expression": true,
"prefer-object-spread": true
}
}
Loading

0 comments on commit 6564d2d

Please sign in to comment.