I want a tsssercmd to extract a selected identifier (function, const, class, type, etc...) to other new file.
{
command: "extractAndCreateFile",
file: "./main.js",
location: {
line: 2, col: 10
},
toFile: "./sum.js"
require('babel-polyfill'); | |
const { createStore, applyMiddleware, bindActionCreators, compose } = require('redux'); | |
const { enableBatching, batchActions, batchDispatchMiddleware, BATCH } = require('redux-batched-actions'); | |
const thunk = require('redux-thunk').default; | |
const { fork, createMiddleware } = require('redux-spork'); | |
function main() { | |
// reducer | |
const count = (prev = 0, action) => { |
I want a tsssercmd to extract a selected identifier (function, const, class, type, etc...) to other new file.
{
command: "extractAndCreateFile",
file: "./main.js",
location: {
line: 2, col: 10
},
toFile: "./sum.js"
interface Observable<T> { | |
subscribe(cb: (v: T) => void): void; | |
} | |
type StreamValue<S> = S extends Observable<infer T> ? T : never; | |
type Unwrap<S> = { [P in keyof S]: StreamValue<S[P]> }; | |
declare function combineLatest<U extends Observable<any>[]>(...streams: U): Observable<Unwrap<U>>; |
type RT<F> = F extends (...args: any[]) => infer R ? R : never; | |
interface Proxy<T, K extends keyof T> { | |
returnValue(value: RT<T[K]>): this; | |
} | |
declare function spyOn<T, K extends keyof T>(obj: T, methodName: K): { | |
and: Proxy<T, K>; | |
}; | |
const serviceToTest = { |
import { SchemaClassFactory } from '@ngtools/json-schema'; | |
// Input JSON schema json file | |
const factory = SchemaClassFactory<any>(require('@angular/cli/lib/config/schema.json')); | |
const schemaClass = new factory(null); | |
// Output .d.ts | |
console.log(schemaClass.$$serialize('text/x.dts')); |
{ | |
"owner": "Quramy", | |
"repository": "tsuquyomi", | |
"tag": "v0.8.0" | |
} |
I'm loving Angular, but running unit tests on Karma gets my nerves. It's too slow for me.
In this post, I explain mechanics under Angular's testing module and how to improve the performance.
To evaluate Angular unit testing performance I captured the CPU profiling with running Karma.
import * as ts from 'typescript/lib/tsserverlibrary'; | |
const { buildClientSchema } = require('graphql'); | |
const { getAutocompleteSuggestions } = require('graphql-language-service-interface'); | |
// TODO replace the result by introspection query | |
const introspectionJson = require('../schema.json'); | |
const schema = buildClientSchema(introspectionJson.data); | |
function findNode(sourceFile: ts.SourceFile, position: number): ts.Node | undefined { |
var path = require("path"); | |
var loadChildrenRegex = /loadChildren\s*:(.*)$/gm; | |
var ngfactoryRegex = /\.ngfactory(\.|$)/; | |
var stringRegex = /(['"])((?:[^\\]\\\1|.)*?)\1/g; | |
function replacePath(str, addSuffix) { | |
return str.replace(stringRegex, function(match, quote, pathAndFragment) { | |
var tmp = pathAndFragment.split("#"); | |
var fpath = addSuffix ? tmp[0] + ".ngfactory" : tmp[0]; | |
var moduleName; |
import { NgModule } from '@angular/core'; | |
import { FormsModule } from '@angular/forms'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { MyApp } from './my-app.component'; | |
import { routing , appRoutingProviders } from "./app.routing"; | |
import { TopComponent } from "./top.component"; | |
import { AboutComponent } from "./about.component"; | |
//import { SubModule } from "./sub/sub.module"; |