From 365d90fba266cf69eaeb67bc929edfff5338cef8 Mon Sep 17 00:00:00 2001 From: Luke Phillips Date: Wed, 14 Feb 2018 14:45:39 +0000 Subject: [PATCH] simplified build process, updated to latest node --- .babelrc | 6 - README.md | 211 +--------------------------- config/ci/after.sh | 8 -- config/ci/before.sh | 3 - config/ci/install.sh | 10 -- config/ci/test.sh | 15 -- config/karma.config.js | 49 ------- config/rollup/rollup.dev.config.js | 42 ------ config/rollup/rollup.prod.config.js | 34 ----- config/webpack/browser.config.js | 41 ------ config/webpack/common.config.js | 62 -------- config/webpack/dev.config.js | 27 ---- config/webpack/dev2.config.js | 114 --------------- config/webpack/karma.config.js | 39 ----- config/webpack/prod.config.js | 50 ------- package.json | 98 ++----------- {typings => types}/recorder.d.ts | 0 17 files changed, 17 insertions(+), 792 deletions(-) delete mode 100644 .babelrc delete mode 100755 config/ci/after.sh delete mode 100755 config/ci/before.sh delete mode 100755 config/ci/install.sh delete mode 100755 config/ci/test.sh delete mode 100644 config/karma.config.js delete mode 100644 config/rollup/rollup.dev.config.js delete mode 100644 config/rollup/rollup.prod.config.js delete mode 100644 config/webpack/browser.config.js delete mode 100644 config/webpack/common.config.js delete mode 100644 config/webpack/dev.config.js delete mode 100644 config/webpack/dev2.config.js delete mode 100644 config/webpack/karma.config.js delete mode 100644 config/webpack/prod.config.js rename {typings => types}/recorder.d.ts (100%) diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 4db4f80..0000000 --- a/.babelrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "presets": [ "es2015", "stage-0"], - "env": { - "development": { "plugins": [] } - } -} \ No newline at end of file diff --git a/README.md b/README.md index 3049f26..96ffe61 100644 --- a/README.md +++ b/README.md @@ -1,209 +1,10 @@ -## A ultimate TypeScript 2.0 Pre boilerplate for node and the browser +# Omni -[![Build Status](https://travis-ci.org/Kflash/sikky.svg?branch=master)](https://travis-ci.org/Kflash/sikky) -[![CircleCI](https://circleci.com/gh/Kflash/sikky.svg?style=svg)](https://circleci.com/gh/Kflash/sikky) -[![Build status](https://ci.appveyor.com/api/projects/status/vibxi4wro4qwbdtw?svg=true)](https://ci.appveyor.com/project/Kflash/sikky) -[![Coverage Status](https://coveralls.io/repos/github/Kflash/sikky/badge.svg?branch=master)](https://coveralls.io/github/Kflash/sikky?branch=master) -[![npm version](https://badge.fury.io/js/sikky.svg)](https://badge.fury.io/js/sikky) -[![npm downloads](https://img.shields.io/npm/dm/sikky.svg)](https://www.npmjs.org/package/sikky) -[![npm](https://img.shields.io/npm/l/express.svg?style=flat-square)](https://github.com/kflash/sikky/blob/master/LICENSE.md) +Still work in progres -A TypeScript 2.0 starter kit using all the latest technology, included the latest available -TypeScript version - version 2.0 Pre (*nightly build*). -If this boilerplate are too complex,a and you need a super fast, and lightweight TypeScript boilerplate that export a single file, [click here](https://github.com/Kflash/rachelle). +### Workflow +- npm install +- npm start +- http://localhost:3000/ -## Features - -- [x] Statically typed build system for working with [Typescript](https://www.typescriptlang.org/) 2.0 Pre -- [x] VSCode integration. Debug and run tests in the editor. -- [x] Chrome dev tools integration with VSCode -- [x] Consistent code style with [TSLint](https://palantir.github.io/tslint/). -- [x] Intelligent code editing with [VSCode](https://code.visualstudio.com/) -- [x] Experimental support for [ES7](https://tc39.github.io/ecma262/) decorators. -- [x] Async/await and generators support for ES5/ES3 -- [x] Parallel Test Driven Development (TDD) -- [x] All up-to-date TypeScript 2.0 features -- [x] Code Coverage with [Istanbul](https://github.com/gotwarlost/istanbul) and [Karma](https://karma-runner.github.io/0.13/index.html) -- [x] Hot Module Replacement with Webpack -- [x] Async/await and generators support for ES5/ES3 -- [x] ES Modules (*specs will change again*). -- [x] Allow dead code elimination for ES6 modules -- [x] TSX / JSX -- [x] Complete sourcemap support -- [x] Environment variabels -- [x] Browser tests in browser (*port 8080*) -- [x] [Babel](https://babeljs.io/) as the ES2015 compiler for the testing stack -- [x] [Bublé](https://gitlab.com/Rich-Harris/buble) as the ES2015 compiler -- [x] [Rollup](http://rollupjs.org/) for bundling -- [x] [Sinon](http://sinonjs.org/) for test doubles -- [x] iOS and Android support -- [x] React support -- [x] Angular2 support -- [x] [Mocha](https://mochajs.org/) & [Chai](http://chaijs.com/) de facto standard -- [x] Easy debugging (*parallell*) - -## Quick start - -The only development dependency of this project is [Node.js](https://nodejs.org/en/). So just make sure you have it installed. -Then type few commands known to every Node developer... - -```bash -git clone --depth 1 https://github.com/kflash/sikky.git -cd sikky -# install the project's dependencies -npm install - -# dev build -npm run build:dev -# prod build -npm run build:prod -``` -... and boom! You have it all setup for you! - -## Workflow - -* `npm start` - runs a web server on localhost:3000 and updates on changes using HMR -* `npm run build` - transpile down to ES5 and builds a bundle both for development and production -* `npm run build:dev` - transpile down to ES5 and builds a bundle for development -* `npm run build:prod` - transpile down to ES5 and builds a bundle for production -* `npm run build:finale` - transpile down to ES5 and builds a bundle for production with Rollup and `Bublé` -* `npm run build:finale:prod` - transpile down to ES5 and builds a bundle for production with Rollup and `Bublé` -* `npm run build:finale:prod` - transpile down to ES5 and builds a bundle for production with Rollup and `Bublé` -* `npm run debug` - debug task used with the `VSCode editor`. -* `npm run cleanup` - remove the dist, coverage and build folders -* `npm run remove:build` - remove the build folder -* `npm run remove:dist` - removed the dist folder -* `npm run lint` - validates everything -* `npm run lint:src` - validates all source files -* `npm run lint:tests` - validates all test files -* `npm run test` - run tests both for browser and the `node.js environment` -* `npm run test:browser` - run all unit tests in the browser -* `npm run test:node` - run all unit tests in the `node.js environment` -* `npm run watch:browser` - run all unit tests and watch files for changes in the browser. -* `npm run watch:build` - watch your TypeScript files and trigger recompilation on changes. -* `npm run watch:node` - run all unit tests and watch files for changes in the `node.js` environment. -* `npm run tdd` - run all watch tasks in parallel and watch files for changes. -* `update:dependencies` - update npm packages - - -## Build workflow - -Everything is done with `Webpack`. When you are satisfied and ready to ship the code to production, you can make a nice, clean output with `Rollup`. - -`npm run build:finale` bundle the `finale build` files with Rollup, and make them ready for shipping. This files are put inside it's own folder `dist-finale`. - -A `finale` build shaves off around 4 - 5 KB from the bundled source, compared to `Webpack`. Less bytes - more happy customers!! - -## Visual Studio Code - -This workflow is tightly integrated with `VSCode`. In fact you can do everything from the editor. - -Start the VSCode editor, and press **Ctrl+Shift+B** to compile the project. A build folder appers with the transpiled files in it. - -To stop the compilation, press **Ctrl+P → > Tasks: Terminate Running Task**. - -If you want to debug the source code, set a **breakpoint** on line 6 in /test/browser-tests/sikky.browser.js. -Then press **Cmd + D** to view debugging options. - -Select `Debug Current TypeScript Test` from the dropdown and press **F5** to launch the debugger. - -You should hit the breakpoint. Now you can press **F11** to step into function, or press **Shift+F5** to stop the debugger. - -**Note!** Debugging may randomly return warning on build. [See](https://github.com/Microsoft/vscode/issues/4070). - -Unit tests can be run by pressin **Cmd + T**. You should see results displayed in the **Output window**. - -Both browser and server tests are set up to run at the same time in parallel. - -## Custom Type Definitions - -When including 3rd party modules you also need to include the type definition for the module if they don't provide one within the module. -From TypeScript 2.0 both `TDD` and `Typings` are *deprecated*. All definitions are now installed through `NPM packages`. - - ```js - npm install @types/`. - ``` - -You can read more about it [here](https://github.com/Microsoft/TypeScript/issues/9184) - -## Test-driven development (TDD) - -There exist one task for this - `npm run tdd`. This task runs all watch task in parallel. - -## Watch tasks - -It's integrated a **watch task** for server and unit testing, and a task to keep an eye on your build process. This is tightly integrated with the -debugger task included in the `VSCode editor`. - -`npm run watch:build` starts the `TypeScript 2.0` compiler in watch mode, and watch input files and trigger recompilation on changes. Dead code elimination for ES6 modules are activated by default, so later on you can use either -`Webpack 2.0` (*early beta stage*) or `Rollup` to perform tree shaking. - -The watch task inform you if something is wrong with your code, and can come up with suggestions on how to solve current issue. - -```bash -7:28:24 PM - File change detected. Starting incremental compilation... -src/universal/foo.ts(7,10): error TS2348: Value of type 'typeof TeaSpoon' is not callable. -Did you mean to include 'new'? -``` -## Continuous integration (CI) - -Travis, Circle and Appveyor are the only supported CI. Travis is setup to work with Linux and OSX. Appveyor only runs in a Windows environment, but are configured to run on both the x86 and x64 platform. - -You will need to change permissons on the .sh files used by Travis. - -## Code coverage - -The library is set up to integrate with [`Coveralls.io`](https://coveralls.io/), and are using [`Istanbul`](https://github.com/gotwarlost/istanbul) and Karma + Webpack to generate coverage report. - -Coverage report for server tests will be included soon as I find it stable enough. - -## Server testing - -Browser testing are done with `mocha+chai+sinon`. Debugging are enabled by default on `port 5858`. - -All server related tests are located inside the `test/node-tests folder`, and named with a node extension. E.g. `foo.node.ts`. - -`JsDOM` are used to fake DOM on the server. - -**Note!** There is no need to manually import testing framework related packages such as `Chai`, `Sinon` etc. This have been done automatically. - -## Browser testing - -Browser testing are done with `Webpack` together with Karma as the test runner. - -All server related tests are located inside the test/browser-tests folder, and named with a node extension. E.g. `foo.browser.ts`. - -## Direct browser testing - -The browser spec runner - `./config/runner.html` - can be opened in a browser to run your tests. For it to work, you must -first run `npm run browser`, and open `port 8080` in your browser. - -This will set up a watch task that will automatically refresh the tests when your scripts, or the tests, change. - -## Android and iOS - -This boilerplate is tested against `Travis CI` configured to run `Android` with `SDK version android-19 - 23`. -It's not tested with `iOS`. But the conlusion is that this works just fine. - -## Linting - -This boilerplate uses `TSLint` to lint your source. To change the rules, edit the .tslint.json` file in the root directory, respectively. - -## FAQ - -### When should I consider using this boilerplate? - -This library is ideal for libraries that export a single file. - -### Will this boilerplate always support the latest technology and specs on the market? - -Yes. It will always be up-to-date. - -### What's the browser compatibility? - -As a rule of thumb, `TypeScript`, `Bublé` and `Babel` works best in `IE9` and above. - -### What's the cost of transpiling? - -A thorough analysis of this question can be found [here](https://github.com/samccone/The-cost-of-transpiling-es2015-in-2016). diff --git a/config/ci/after.sh b/config/ci/after.sh deleted file mode 100755 index c358ef0..0000000 --- a/config/ci/after.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -ex -o pipefail - -# Upload to coveralls, but don't _fail_ if coveralls is down. -cat coverage/lcov.info | node_modules/.bin/coveralls || echo "Coveralls upload failed" -node node_modules/lcov-filter/index.js lcov.info config | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage - diff --git a/config/ci/before.sh b/config/ci/before.sh deleted file mode 100755 index 2b6cb01..0000000 --- a/config/ci/before.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -set -ex -o pipefail diff --git a/config/ci/install.sh b/config/ci/install.sh deleted file mode 100755 index 4db9336..0000000 --- a/config/ci/install.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -ex -o pipefail - -# Install version of npm that we are locked against -npm install -g npm@3 -npm -g install karma-cli tslint -# Disable the spinner, it looks bad on Travis -npm config set spin false -npm install diff --git a/config/ci/test.sh b/config/ci/test.sh deleted file mode 100755 index 0464459..0000000 --- a/config/ci/test.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -ex -o pipefail - -if [ $TRAVIS_OS_NAME == "linux" ]; then - # used by xvfb that is used by Chrome - export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0; - # Used by karma and karma-chrome-launcher - export CHROME_BIN=/usr/bin/google-chrome - sh -e /etc/init.d/xvfb start; - sleep 3; -fi - -# This need to be here else Chrome will not run on Linux -npm test diff --git a/config/karma.config.js b/config/karma.config.js deleted file mode 100644 index 3d48cb2..0000000 --- a/config/karma.config.js +++ /dev/null @@ -1,49 +0,0 @@ -const webpackConfig = require('./webpack/karma.config'); -const isCI = process.env.CONTINUOUS_INTEGRATION === 'true'; - -module.exports = function (config) { - - const configuration = { - - basePath: '../', - files: [ { pattern: 'test/main.js', watched: false } ], - preprocessors: { 'test/main.js': ['coverage', 'webpack', 'sourcemap'] }, - frameworks: ['mocha', 'chai', 'sinon', 'source-map-support'], - client: { - args: ['--grep', config.grep || ''], - useIframe: false - }, - excluded: [], - webpack: webpackConfig, - coverageReporter: { - dir: 'coverage/', - reporters: [ - { type: 'text' }, - { type: 'lcov' }, - { type: 'text-summary' }, - { type: 'json', subdir: '.', file: 'coverage-final.json' }, - { type: 'html' } - ] - }, - webpackServer: { noInfo: true }, - reporters: ['mocha', 'coverage'], - mochaReporter: { output: 'autowatch' }, - port: 9876, - captureTimeout: 60000, - browserDisconnectTimeout : 60000, - browserDisconnectTolerance : 3, - browserNoActivityTimeout : 60000, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: false, - browsers: ['Chrome'], - singleRun: true, - concurrency: Infinity - } - - if (isCI) { - configuration.reporters.push('coveralls'); - } - - config.set(configuration); -} \ No newline at end of file diff --git a/config/rollup/rollup.dev.config.js b/config/rollup/rollup.dev.config.js deleted file mode 100644 index ed7b244..0000000 --- a/config/rollup/rollup.dev.config.js +++ /dev/null @@ -1,42 +0,0 @@ -import * as path from 'path'; -import buble from 'rollup-plugin-buble'; -import replace from 'rollup-plugin-replace'; -import commonjs from 'rollup-plugin-commonjs'; -const pkg = require('../../package.json'); - -export default { - entry: path.resolve('build/src/app.js'), - useStrict: false, - banner: - '/**\n' + - ' * ' + pkg.name + '\n' + - ' * @version ' + pkg.version + '\n' + - ' * @copyright (c) 2016 ' + pkg.author + '\n' + - ' * @license MIT <'+ pkg.homepage + '/blob/master/LICENSE>\n' + - ' */', - plugins: [ - commonjs({ include: 'node_modules/**' }), - replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }), - buble() - ], - targets: [ - { - dest: path.resolve('dist-finale/' + pkg.name + '.js'), - format: 'umd', - moduleName: pkg.name, - sourceMap: false - }, - // ES Modules - { - dest: path.resolve('dist-finale/' + pkg.name + '.es'), - format: 'es', - sourceMap: false - }, - // ES Modules - { - dest: path.resolve('dist-finale/' + pkg.name + '.mjs'), - format: 'es', - sourceMap: false - } - ] -}; \ No newline at end of file diff --git a/config/rollup/rollup.prod.config.js b/config/rollup/rollup.prod.config.js deleted file mode 100644 index bcee023..0000000 --- a/config/rollup/rollup.prod.config.js +++ /dev/null @@ -1,34 +0,0 @@ -import * as path from 'path'; -import buble from 'rollup-plugin-buble'; -import uglify from 'rollup-plugin-uglify'; -import commonjs from 'rollup-plugin-commonjs'; -import replace from 'rollup-plugin-replace'; -import strip from 'rollup-plugin-strip'; -const pkg = require('../../package.json'); - -export default { - entry: path.resolve('build/src/app.js'), - plugins: [ - uglify({ - warnings: false, - compress: { - screw_ie8: true, - dead_code: true, - unused: true, - drop_debugger: true - } - }), - commonjs({ include: 'node_modules/**' }), - strip({ debugger: true }), - replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }), - buble() - ], - targets: [ - { - dest: path.resolve('dist-finale/'+ pkg.name +'.min.js'), - format: 'umd', - moduleName: pkg.name, - sourceMap: false - } - ] -}; \ No newline at end of file diff --git a/config/webpack/browser.config.js b/config/webpack/browser.config.js deleted file mode 100644 index 4ee7ed9..0000000 --- a/config/webpack/browser.config.js +++ /dev/null @@ -1,41 +0,0 @@ -const path = require('path') -const glob = require('glob'); -const webpack = require('webpack'); - -module.exports = { - watch: true, - entry: glob.sync('./test/browser-tests/**/*browser.ts').concat(glob.sync('./test/node-tests/**/*node.ts')), - output: { filename: '__spec-build.js' }, - module: { - preLoaders: [ - { test: /\.tsx?$/, loader: 'tslint-loader', exclude: [ path.resolve('node_modules')] }, - { test: /\.js$/, loader: 'source-map-loader', exclude: [] } - ], - loaders: [ - { test: /\.tsx?$/, loader: 'babel-loader!awesome-typescript-loader', exclude: [/\.(spec|e2e|async)\.ts$/] } - ] - }, - devServer: { - contentBase: './', - port: 8080, - noInfo: false, - hot: true, - inline: true, - proxy: { - '/': { - bypass: function(req, res, proxyOptions) { - return '/test/runner.html'; - }, - "target": { - "protocol": 'http:' - } - } - } - }, - plugins: [ - // By default, webpack does `n=>n` compilation with entry files. This concatenates - // them into a single chunk. - new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }), - new webpack.HotModuleReplacementPlugin() - ] -} \ No newline at end of file diff --git a/config/webpack/common.config.js b/config/webpack/common.config.js deleted file mode 100644 index 2054656..0000000 --- a/config/webpack/common.config.js +++ /dev/null @@ -1,62 +0,0 @@ -const webpack = require('webpack'); -const path = require('path'); -const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin; - -module.exports = { - entry: { 'index': './src/index.ts' }, - resolve: { - extensions: ['', '.ts', '.tsx', '.js'], - root: path.resolve('src/'), - modulesDirectories: ['node_modules'] - }, - module: { - preLoaders: [ { test: /\.js$/, loader: 'source-map-loader', exclude: [] } ], - loaders: [ - { - test: /\.tsx?$/, - loader: 'awesome-typescript-loader', - exclude: [/\.(browser|node|e2e)\.ts$/] - }, - { - test: /\.scss$/, - loaders: ["style", "css", "sass"] - }, - { - test: /\.css$/, - loader: 'style!css' - }, - { - test: /\.woff$/, - loader: 'file', - query: { - name: 'public/fonts/[name].[ext]' - }, - }, - { - test: /\.svg$/, - loader: 'svg-url-loader' - }, - { - test: /\.worker.js$/, - loader: "worker-loader" - }, - ], - }, - plugins: [ - // add all common plugins here - new ForkCheckerPlugin(), - // Promise and fetch polyfills - new webpack.ProvidePlugin({ - Promise: 'imports?this=>global!exports?global.Promise!es6-promise', - fetch: 'imports?this=>global!exports?global.fetch!whatwg-fetch', - }) - ], - node: { - global: 'window', - crypto: 'empty', - module: false, - clearImmediate: false, - setImmediate: false, - fs: "empty", - } -}; \ No newline at end of file diff --git a/config/webpack/dev.config.js b/config/webpack/dev.config.js deleted file mode 100644 index 1dfdc00..0000000 --- a/config/webpack/dev.config.js +++ /dev/null @@ -1,27 +0,0 @@ -const webpack = require('webpack'); -const webpackMerge = require('webpack-merge'); -const path = require('path') -const commonConfig = require('./common.config.js'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); - -const environment = process.env.NODE_ENV = 'development'; - -module.exports = webpackMerge(commonConfig, { - devtool: 'inline-source-map', - output: { - path: path.resolve('dist'), - filename: '[name].js', - chunkFilename: '[id].chunk.js', - sourceMapFilename: '[name].map' - }, - plugins: [ - new HtmlWebpackPlugin({ - hash: true, - template: 'index.html', - }), - // set environment global variable used in the js code - new webpack.DefinePlugin({ - NODE_ENV: JSON.stringify(environment), - }) - ] -}); \ No newline at end of file diff --git a/config/webpack/dev2.config.js b/config/webpack/dev2.config.js deleted file mode 100644 index a81b1fa..0000000 --- a/config/webpack/dev2.config.js +++ /dev/null @@ -1,114 +0,0 @@ -const Webpack = require('webpack'); -const Path = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); - -const isProduction = process.argv.indexOf('-p') >= 0; -const outPath = Path.join(__dirname, './dist'); -const sourcePath = Path.join(__dirname, './src'); - -module.exports = { - context: sourcePath, - entry: { - main: './index.tsx', - vendor: [ - 'react', - 'react-dom', - 'react-redux', - 'react-router', - 'redux' - ] - }, - output: { - path: outPath, - publicPath: '/', - filename: 'bundle.js', - }, - target: 'web', - resolve: { - extensions: ['.js', '.ts', '.tsx'], - // Fix webpack's default behavior to not load packages with jsnext:main module - // https://github.com/Microsoft/TypeScript/issues/11677 - mainFields: ['browser', 'main'] - }, - module: { - loaders: [ - // .ts, .tsx - { - test: /\.tsx?$/, - use: isProduction - ? 'awesome-typescript-loader?module=es6' - : [ - 'react-hot-loader/webpack', - 'awesome-typescript-loader' - ] - }, - // css - { - test: /\.css$/, - use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [ - { - loader: 'css-loader', - query: { - modules: true, - sourceMap: !isProduction, - importLoaders: 1, - localIdentName: '[local]__[hash:base64:5]' - } - }, - { - loader: 'postcss-loader', - options: { - ident: 'postcss', - plugins: [ - require('postcss-import')({ addDependencyTo: Webpack }), - require('postcss-url')(), - require('postcss-cssnext')(), - require('postcss-reporter')(), - require('postcss-browser-reporter')({ disabled: isProduction }), - ] - } - } - ] - }) - }, - // static assets - { test: /\.html$/, use: 'html-loader' }, - { test: /\.png$/, use: 'url-loader?limit=10000' }, - { test: /\.jpg$/, use: 'file-loader' }, - ], - }, - plugins: [ - new Webpack.DefinePlugin({ - 'process.env.NODE_ENV': isProduction === true ? JSON.stringify('production') : JSON.stringify('development') - }), - new Webpack.optimize.CommonsChunkPlugin({ - name: 'vendor', - filename: 'vendor.bundle.js', - minChunks: Infinity - }), - new Webpack.optimize.AggressiveMergingPlugin(), - new ExtractTextPlugin({ - filename: 'styles.css', - disable: !isProduction - }), - new HtmlWebpackPlugin({ - template: 'index.html' - }) - ], - devServer: { - contentBase: sourcePath, - hot: true, - stats: { - warnings: false - }, - }, - node: { - // workaround for webpack-dev-server issue - // https://github.com/webpack/webpack-dev-server/issues/60#issuecomment-103411179 - fs: 'empty', - net: 'empty' - } -}; \ No newline at end of file diff --git a/config/webpack/karma.config.js b/config/webpack/karma.config.js deleted file mode 100644 index a160d6a..0000000 --- a/config/webpack/karma.config.js +++ /dev/null @@ -1,39 +0,0 @@ -const resolve = require('path').resolve; - -module.exports = { - devtool: 'inline-source-map', - entry: './test/main.js', - verbose: true, - resolve: { - extensions: ['', '.ts', '.tsx', 'js'], - root: resolve('src') - }, - module: { - preLoaders: [ - { test: /\.tsx?$/, loader: 'tslint-loader', exclude: [resolve('node_modules')] }, - { test: /\.js$/, loader: 'source-map-loader', exclude: [] } - ], - loaders: [ { test: /\.tsx?$/, loader: 'babel-loader!awesome-typescript-loader' } - ], - postLoaders: [ - { - test: /\.(js|ts|tsx)$/, loader: 'istanbul-instrumenter-loader', - include: resolve('src/'), - exclude: [/node_modules/, /test/, /\.(e2e|browser|node)\.ts(x?)$/] - } - ] - }, - plugins: [], - tslint: { - emitErrors: false, - failOnHint: false, - resourcePath: 'src' - }, - node: { - global: 'window', - crypto: 'empty', - module: false, - clearImmediate: false, - setImmediate: false - } -}; \ No newline at end of file diff --git a/config/webpack/prod.config.js b/config/webpack/prod.config.js deleted file mode 100644 index 7e15e50..0000000 --- a/config/webpack/prod.config.js +++ /dev/null @@ -1,50 +0,0 @@ -const webpack = require('webpack'); -const webpackMerge = require('webpack-merge'); -const path = require('path') -const commonConfig = require('./common.config.js'); -const environment = process.env.NODE_ENV = 'production'; -const HtmlWebpackPlugin = require('html-webpack-plugin'); - -module.exports = webpackMerge(commonConfig, { - debug: false, - devtool: 'source-map', - output: { - path: path.resolve('dist/'), - filename: '[name].[hash].js', - chunkFilename: '[id].[hash].chunk.js', - sourceMapFilename: '[name].map' - - }, - plugins: [ - new HtmlWebpackPlugin({ - hash: true, - template: 'index.html', - }), - // pass options to uglify - new webpack.LoaderOptionsPlugin({ - minimize: true, - debug: false, - }), - // set environment global variable used in the js code - new webpack.DefinePlugin({ - NODE_ENV: JSON.stringify(environment), - }), - // minifies your code - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: false, - }, - output: { - comments: false, - }, - sourceMap: true - }), - // removes duplicate modules - new webpack.optimize.DedupePlugin(), - ], - tslint: { - emitErrors: true, - failOnHint: true, - resourcePath: 'src' - } -}); \ No newline at end of file diff --git a/package.json b/package.json index e6659bc..8f78ad3 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,6 @@ "main": "dist/app.js", "author": "Luke Phillips", "homepage": "http://femurdesign.com/", - "engineStrict": true, - "engines": { - "node": ">= 5.4.1 < 6" - }, "repository": { "type": "git", "url": "https://github.com/lukephills/omni" @@ -16,47 +12,10 @@ "bugs": { "url": "https://github.com/lukephills/omni/issues" }, - "keywords": [ - "es", - "es2015", - "jsx", - "tsx" - ], - "files": [ - "src", - "dist" - ], "scripts": { - "browser": "webpack-dev-server --inline --config ./config/webpack/browser.config.js", - - "build:dev": "cross-env NODE_ENV=development webpack --config config/webpack/dev.config.js --progress --profile --display-error-details --display-cached", - "build:prod": "cross-env NODE_ENV=production webpack --config config/webpack/prod.config.js --progress --profile --display-error-details --display-cached", - "build:finale": "npm run lint:src && npm run transpile && npm run build:finale:dev && npm run build:finale:prod", - "build:finale:dev": "cross-env NODE_ENV=development rollup -c ./config/rollup/rollup.dev.config.js", - "build:finale:prod": "cross-env NODE_ENV=development npm run lint:src && rollup -c ./config/rollup/rollup.prod.config.js", - "debug": "cross-env NODE_ENV=debug npm-run-all cleanup transpile:sourcemap", - "lint": "tslint -c ./tslint.json \"!(node_modules)/**/*.ts?(x)\"", - "lint:src": "tslint -c ./tslint.json src/**/*.ts src/**/*.tsx", - "lint:tests": "tslint -c ./tslint.json test/**/*.ts test/**/*.tsx", - "preinstall": "npm cache clean", - "prebuild": "rimraf ./build && tsc -p . --sourceMap", - "cleanup": "rimraf ./dist ./dist-finale ./build ./coverage", - "remove:dist": "rimraf ./dist", - "remove:build": "rimraf ./build", - "start": "webpack-dev-server --config ./config/webpack/dev.config.js --hot --inline --watch --port 3000", - - "test:browser": "cross-env NODE_ENV=test karma start config/karma.config.js --no-auto-watch", - "test:node": "cross-env NODE_ENV=test npm run lint:tests && mocha -R spec --bail", - "transpile": "rimraf build && tsc -p .", - "transpile:sourcemap": "rimraf build && tsc --outDir build -t es5 --m umd --sourceMap", - "update:dependencies": "ncu -u", - "watch:build": "cross-env NODE_ENV=tdd tsc -p . -w", - "watch:browser": "cross-env NODE_ENV=tdd karma start config/karma.config.js -auto-watch --no-single-run", - "watch:node": "cross-env NODE_ENV=tdd npm run lint:tests && mocha -R spec --bail --watch", - "tdd": "npm-run-all --parallel watch:build watch:node watch:browser", - "test": "echo \"Error: no test specified\" && exit 1", - "start2": "webpack-dev-server --debug --devtool cheap-module-source-map --output-pathinfo --history-api-fallback --hot --inline --progress --colors --port 3000 --open", - "build": "webpack -p --progress --colors" + "build": "webpack -p --progress --colors", + "start": "webpack-dev-server --debug --devtool cheap-module-source-map --output-pathinfo --history-api-fallback --hot --inline --progress --colors --port 3000", + "test": "echo \"Error: no test specified\" && exit 1" }, "devDependencies": { "@types/classnames": "2.2.3", @@ -69,36 +28,15 @@ "@types/redux-actions": "2.2.2", "@types/webpack": "3.8.1", "@types/webpack-env": "1.13.2", - - "@types/chai": "^3.4.22-alpha", - "@types/mocha": "^2.2.21-alpha", - "@types/sinon": "^1.16.20-alpha", - "@types/sinon-chai": "^2.7.20-alpha", "awesome-typescript-loader": "^3.4.0", - - - "babel-cli": "^6.10.1", - "babel-core": "^6.10.4", - "babel-loader": "^6.2.4", - "babel-polyfill": "^6.9.1", - "babel-preset-es2015": "^6.9.0", - "babel-preset-stage-0": "^6.5.0-1", - "buble": "^0.12.3", - "chai": "^3.5.0", - "core-js": "^2.4.0", - "cross-env": "^1.0.8", - "css-loader": "^0.28.7", - "extract-text-webpack-plugin": "^3.0.2", - "es6-promise": "^3.2.1", + "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^1.1.5", - "glob": "^7.0.5", "html-loader": "^0.5.1", - "html-webpack-plugin": "^2.30.1", - + "node-sass": "^4.7.2", "postcss": "^6.0.14", "postcss-browser-reporter": "^0.5.0", "postcss-cssnext": "^3.0.2", @@ -108,34 +46,21 @@ "postcss-url": "^7.2.1", "react-hot-loader": "^3.1.3", "redux-devtools-extension": "^2.13.2", - "style-loader": "^0.19.0", - "typescript": "^2.6.1", - "url-loader": "^0.6.2", - "webpack": "^3.8.1", - "webpack-dev-server": "^2.9.4", - - - "npm": "^3.10.8", - "npm-check-updates": "2.6.7", - "npm-run-all": "^2.2.2", - "rimraf": "^2.5.2", - - - + "sass-loader": "6.0.6", "source-map-loader": "^0.1.5", "source-map-support": "^0.4.0", - + "style-loader": "^0.19.0", "svg-url-loader": "^1.1.0", "ts-node": "^0.9.3", "tslint": "3.12.1", "tslint-loader": "^2.1.5", - - - + "typescript": "^2.6.1", + "url-loader": "^0.6.2", + "webpack": "^3.8.1", + "webpack-dev-server": "^2.9.4", "worker-loader": "^0.7.0" }, "dependencies": { - "audio-buffer-utils": "^2.0.1", "document-visibility": "^1.0.1", "es6-map": "^0.1.4", @@ -144,7 +69,6 @@ "normalize.css": "^3.0.3", "svg-injector": "^1.1.3", "worker-timer": "^1.0.0", - "classnames": "^2.2.5", "react": "^16.1.1", "react-dom": "^16.1.1", diff --git a/typings/recorder.d.ts b/types/recorder.d.ts similarity index 100% rename from typings/recorder.d.ts rename to types/recorder.d.ts