Skip to content

Commit

Permalink
近代化
Browse files Browse the repository at this point in the history
  • Loading branch information
Narazaka committed Jan 14, 2018
1 parent b900dfb commit 5c8ed49
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 100 deletions.
15 changes: 0 additions & 15 deletions .babelrc

This file was deleted.

14 changes: 0 additions & 14 deletions .codeclimate.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
parser: babel-eslint
extends: narazaka
env:
es6: true
node: true
mocha: true
rules:
func-names: 0
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

12 changes: 4 additions & 8 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"include": [
"src/**/*.ts"
"lib/**/*.ts"
],
"exclude": [
"node_modules",
Expand All @@ -10,14 +10,10 @@
".js",
".ts"
],
"require": [
"ts-node/register",
"babel-register"
],
"reporter": [
"lcov",
"html",
"text"
],
"all": true
"text",
"text-summary"
]
}
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
language: node_js
dist: trusty # for chrome
sudo: required # for chrome
node_js:
- 6
- 8
os:
- linux
- osx
before_script:
- export DISPLAY=:99.0
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export CHROME_BIN=chromium-browser ; fi
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export CHROME_BIN=google-chrome ; fi
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then sh -e /etc/init.d/xvfb start ; fi
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then brew cask install google-chrome; fi
- sleep 3 # give xvfb some time to start
after_success:
- bash <(curl -s https://codecov.io/bash)
Expand All @@ -17,3 +17,4 @@ cache:
- node_modules
addons:
firefox: latest-esr
chrome: stable
3 changes: 1 addition & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ branches:
install:
- ps: Install-Product node $env:nodejs_version
- node --version
- npm install -g npm
- npm --version
- npm install
test_script:
Expand All @@ -14,6 +13,6 @@ build: off
deploy: off
environment:
matrix:
- nodejs_version: 6
- nodejs_version: 8
cache:
- node_modules
30 changes: 29 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
module.exports = require("karma-config-narazaka-ts-js");
/* eslint no-process-env: 0, no-magic-numbers: 0, max-statements: 0 */
const webpack = require("./webpack.config");

module.exports = function(config) {
config.set({
mime: {"text/x-typescript": ["ts", "tsx"]}, // fix typescript serving video/mp2t mime type
frameworks: ["mocha"].concat(process.env.NO_DETECT ? [] : ["detectBrowsers"]),
files: ["test/**/*.ts"],
preprocessors: {"test/**/*.ts": ["webpack", "sourcemap", "espower"]},
reporters: ["mocha"],
webpack,
detectBrowsers: {
usePhantomJS: false,
postDetection(availableBrowsers) {
const result = availableBrowsers;
if (process.env.NO_IE) {
const ieIndex = result.indexOf("IE");
if (ieIndex !== -1) result.splice(ieIndex, 1);
}
const chromeIndex = availableBrowsers.indexOf("Chrome");
if (chromeIndex >= 0) {
result.splice(chromeIndex, 1);
result.push("ChromeHeadless");
}
return result;
},
},
});
};
File renamed without changes.
46 changes: 16 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,56 @@
"web"
],
"scripts": {
"prepare": "npm run dist",
"prepublishOnly": "npm run lint && npm run test",
"dist": "npm run node && npm run web",
"node": "rm -rf dist && cross-env NODE_ENV=production webpack",
"web": "rm -rf web && cross-env NODE_ENV=production webpack --config ./webpack.config.web.js",
"node": "rm -rf dist && cross-env NODE_ENV=production tsc",
"web": "rm -rf web && cross-env NODE_ENV=production webpack",
"lint": "npm run eslint && npm run tslint",
"eslint": "eslint *.js src test",
"prepublish": "npm run dist",
"tslint": "tslint tslint *.ts src/**/*.ts test/**/*.ts",
"eslint": "eslint *.js lib test",
"tslint": "tslint -p .",
"test": "npm run test-node && npm run test-web",
"test-cli": "npm run test-node && npm run test-web-headless",
"test-node": "cross-env NODE_ENV=test nyc mocha",
"test-web": "cross-env NODE_ENV=test karma start --single-run",
"test-web-headless": "cross-env NODE_ENV=test NO_DETECT=1 karma start --single-run --browsers ChromeHeadless",
"docdist": "cd doc && git clean -fd && git rm -rf * && cd .. && npm run doc && cd doc && touch .nojekyll && git add . && git commit -m doc && git push",
"doc": "typedoc --mode modules --out doc --readme Readme.md --name \"API Document\" --disableOutputCheck --includeDeclarations --excludeNotExported src && cd doc && git status && cd .."
"doc": "typedoc --mode file --out doc --readme Readme.md --disableOutputCheck --excludeNotExported lib && cd doc && git status && cd .."
},
"dependencies": {
"babel-runtime": "^6.18.0",
"shiori_transaction": "^2.0.3",
"shiorijk": "^1.0.0"
},
"devDependencies": {
"@types/mocha": "^2.2.33",
"@types/node": "^8.5.7",
"@types/node": "^9.3.0",
"@types/power-assert": "^1.4.29",
"babel-core": "^6.18.2",
"babel-eslint": "^8.1.2",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-latest": "^6.16.0",
"babel-preset-power-assert": "^1.0.0",
"babel-register": "^6.18.0",
"browserfs": "^1.1.0",
"cross-env": "^5.1.3",
"eslint": "^4.14.0",
"eslint-config-narazaka": "^1.0.1",
"eslint-loader": "^1.6.1",
"espower-ts-node": "^1.0.3",
"istanbul-instrumenter-loader": "^3.0.0",
"json-loader": "^0.5.4",
"espower-typescript": "^8.1.2",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.0.0",
"karma-config-narazaka-ts-js": "^1.0.2",
"karma-coverage": "^1.1.1",
"karma-detect-browsers": "^2.2.3",
"karma-edge-launcher": "^0.4.2",
"karma-espower-preprocessor": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-ie-launcher": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-own-reporter": "^1.1.2",
"karma-mocha-reporter": "^2.2.5",
"karma-opera-launcher": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-safari-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.9",
"mocha": "^4.1.0",
"nyc": "^11.4.1",
"phantomjs-prebuilt": "^2.1.13",
"power-assert": "^1.4.2",
"shioriloader": "^2.0.0",
"ts-loader": "^3.2.0",
"ts-node": "^4.1.0",
"tslint": "^5.8.0",
"tslint-loader": "^3.2.0",
"typedoc": "^0.9.0",
"typescript": "^2.1.1",
"webpack": "^3.10.0",
"webpack-config-narazaka-ts-js": "1.0.0"
"typescript": "^2.6.2",
"webpack": "^3.10.0"
},
"url": "https://github.com/Ikagaka/shiorif",
"author": "Narazaka",
Expand Down
2 changes: 1 addition & 1 deletion test/basic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="mocha" />
import * as assert from "power-assert";
import {Shiori} from "shioriloader";
import {Shiorif} from "../src/lib/shiorif";
import {Shiorif} from "../lib/shiorif";

class TestShiori implements Shiori {
load(_: string) {
Expand Down
5 changes: 1 addition & 4 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
--compilers ts:ts-node/register
--compilers js:babel-register
--require espower-ts-node
--require espower-typescript/guess
--recursive
test/*.js
test/*.ts
11 changes: 8 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "commonjs",
"target": "es2015",
"declaration": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noImplicitReturns": true,
Expand All @@ -12,11 +13,15 @@
"noUnusedParameters": true,
"preserveConstEnums": true,
"sourceMap": true,
"strictNullChecks": true
"sourceRoot": ".",
"strictNullChecks": true,
"outDir": "dist",
"lib": [
"es2015"
]
},
"exclude": [
"node_modules",
"dist",
"test"
"dist"
]
}
34 changes: 30 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
const config = require("webpack-config-narazaka-ts-js").node;
const path = require("path");
const tsconfig = require("./tsconfig.json");

config.entry.shiorif = "./src/lib/shiorif.ts";
config.output.library = "shiorif";
tsconfig.compilerOptions.outDir = "web"; // for d.ts
tsconfig.compilerOptions.target = "es5";

module.exports = config;
module.exports = {
entry: {shiorif: "./lib/shiorif.ts"},
output: {
library: "shiorif",
libraryTarget: "umd",
path: path.resolve("."),
filename: "web/lib/[name].js",
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
exclude: /node_modules/,
options: {compilerOptions: tsconfig.compilerOptions},
},
],
},
resolve: {
extensions: [
".ts",
".js",
],
},
devtool: "source-map",
};
6 changes: 0 additions & 6 deletions webpack.config.web.js

This file was deleted.

0 comments on commit 5c8ed49

Please sign in to comment.