Create empty-ish repo with create-ts-lib

This commit is contained in:
2019-05-31 19:15:35 +05:30
commit 93ce3a3c8e
10 changed files with 8720 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
node_modules
+47
View File
@@ -0,0 +1,47 @@
var webpackConf = require('./webpack.config.js');
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [{ pattern: './tests/unit/spec-bundle.js', watched: false }],
preprocessors: { './tests/unit/spec-bundle.js': ['webpack', 'sourcemap'] },
webpack: {
module: webpackConf.module,
resolve: webpackConf.resolve
},
webpackMiddleware: {
noInfo: true,
stats: 'errors-only'
},
reporters: ['spec', 'coverage-istanbul'],
specReporter: {
maxLogLines: 5, // limit number of lines logged per test
suppressErrorSummary: true, // do not print error summary
suppressFailed: false, // do not print information about failed tests
suppressPassed: false, // do not print information about passed tests
suppressSkipped: true, // do not print information about skipped tests
showSpecTiming: true // print the time elapsed for each spec
},
coverageIstanbulReporter: {
reports: ['html', 'lcov', 'text-summary'],
dir: './tests/coverage', // coverage results needs to be saved under coverage/
fixWebpackSourcePaths: true,
query: {
esModules: true
}
},
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: true,
concurrency: Infinity
});
};
+8434
View File
File diff suppressed because it is too large Load Diff
+82
View File
@@ -0,0 +1,82 @@
{
"_from": "@nobrainr/typescript_universal-webpack-karma_jasmine@^1.0.0",
"_id": "@nobrainr/typescript_universal-webpack-karma_jasmine@1.0.0",
"_inBundle": false,
"_integrity": "sha512-yt9IFFFsnYn0KwZxqKehMPyN/RpyF8tP8U7uJqj0yFrqox5Pxedv9h+aTWNzIGVGNbaihC6STzQokEzQQeNIfQ==",
"_location": "/@nobrainr/typescript_universal-webpack-karma_jasmine",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@nobrainr/typescript_universal-webpack-karma_jasmine@^1.0.0",
"name": "@nobrainr/typescript_universal-webpack-karma_jasmine",
"escapedName": "@nobrainr%2ftypescript_universal-webpack-karma_jasmine",
"scope": "@nobrainr",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"#DEV:/",
"#USER"
],
"_resolved": "https://registry.npmjs.org/@nobrainr/typescript_universal-webpack-karma_jasmine/-/typescript_universal-webpack-karma_jasmine-1.0.0.tgz",
"_shasum": "1c7e50d285c3427fd7ddb716147fc558b3d55754",
"_spec": "@nobrainr/typescript_universal-webpack-karma_jasmine@^1.0.0",
"_where": "/Users/abhas.b/.npm/_npx/89213/lib/node_modules/create-ts-lib",
"author": "",
"bundleDependencies": false,
"deprecated": false,
"description": "",
"devDependencies": {
"@types/jasmine": "^2.5.53",
"awesome-typescript-loader": "^5.2.0",
"cross-env": "^5.0.1",
"css-loader": "^1.0.0",
"ejs-loader": "^0.3.0",
"eslint": "^5.4.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"istanbul-instrumenter-loader": "^3.0.0",
"jasmine": "^3.2.0",
"jasmine-core": "^3.2.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.1",
"karma-jasmine": "^1.1.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.32",
"karma-webpack": "^3.0.0",
"rimraf": "^2.6.1",
"source-map-loader": "^0.2.1",
"style-loader": "^0.22.1",
"tslint": "^5.5.0",
"tslint-loader": "^3.5.3",
"typescript": "^3.0.1",
"webpack": "^4.17.0",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5"
},
"directories": {
"test": "tests"
},
"license": "ISC",
"main": "src/index.ts",
"name": "test-octokit-ts",
"scripts": {
"build": "npm run build:prod",
"build:dev": "webpack --mode development --config ./webpack.config.js --progress --color --display-error-details",
"build:prod": "cross-env NODE_ENV=production webpack --mode production --config ./webpack.config.js --progress --color --display-error-details --bail",
"clean": "npm cache clear && rimraf -- dist",
"server": "npm run server:dev",
"server:dev": "webpack-dev-server --mode development --config ./webpack.config.js --hot --inline --progress --watch --open",
"server:prod": "cross-env NODE_ENV=production webpack-dev-server --mode production --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --inline --progress --watch --open --content-base dist/",
"start": "npm run server:dev",
"test": "karma start"
},
"version": "0.0.1",
"dependencies": {
"@octokit/plugin-throttling": "^2.6.0",
"@octokit/rest": "^16.27.3"
}
}
+9
View File
@@ -0,0 +1,9 @@
import { MyLibrary } from './MyLibrary';
// describe('TypeScript WebPack Starter Tests', () => {
// it('A good way to start building an awesome library is by doing Unit Tests 👌🏽', () => {
// const myLibrary = new MyLibrary();
// const result = myLibrary.getRepos();
// expect(result >= 0 && result <= 10).toBeTruthy();
// });
// });
+22
View File
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<meta name="description" content="<%= htmlWebpackPlugin.options.title %>">
</head>
<body>
<div> You have successfully started your Typescript application using Webpack. Open your console to see your printed message from the index.ts file </div>
<p>By <a href="https://twitter.com/renaudin_yann">@renaudin_yann</a> </p>
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
Error.stackTraceLimit = Infinity;
var testContext = require.context('./../../src', true, /\.spec\.ts/);
function requireAll(requireContext) {
return requireContext.keys().map(requireContext);
}
var modules = requireAll(testContext);
+15
View File
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"outDir": "dist",
"lib": ["es2017", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"removeComments": true
},
"exclude": ["node_modules", "dist"]
}
+30
View File
@@ -0,0 +1,30 @@
{
"rules": {
"class-name": true,
"comment-format": [true, "check-space"],
"indent": [true, "spaces"],
"no-duplicate-variable": true,
"no-eval": true,
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-var-keyword": true,
"one-line": [true, "check-open-brace", "check-whitespace"],
"semicolon": false,
"triple-equals": [true, "allow-null-check"],
"typedef-whitespace": [true, {
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}],
"variable-name": [true, "ban-keywords"],
"whitespace": [true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}
+71
View File
@@ -0,0 +1,71 @@
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const nodeEnv = process.env.NODE_ENV || 'development';
const isProd = nodeEnv === 'production';
const plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(nodeEnv)
}
}),
new HtmlWebpackPlugin({
title: 'Typescript Webpack Starter',
template: '!!ejs-loader!src/index.html'
}),
new webpack.LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: true,
failOnHint: true
}
}
})
];
var config = {
devtool: isProd ? 'hidden-source-map' : 'source-map',
context: path.resolve('./src'),
entry: {
app: './index.ts'
},
output: {
path: path.resolve('./dist'),
filename: '[name].bundle.js'
},
module: {
rules: [
{
enforce: 'pre',
test: /\.tsx?$/,
exclude: [/\/node_modules\//],
use: ['awesome-typescript-loader', 'source-map-loader']
},
!isProd
? {
test: /\.(js|ts)$/,
loader: 'istanbul-instrumenter-loader',
exclude: [/\/node_modules\//],
query: {
esModules: true
}
}
: null,
{ test: /\.html$/, loader: 'html-loader' },
{ test: /\.css$/, loaders: ['style-loader', 'css-loader'] }
].filter(Boolean)
},
resolve: {
extensions: ['.ts', '.js']
},
plugins: plugins,
devServer: {
contentBase: path.join(__dirname, 'dist/'),
compress: true,
port: 3000,
hot: true
}
};
module.exports = config;