fib-typify
Advanced tools
Comparing version 0.4.0 to 0.4.1
v0.4.0 / 2018-11-03 | ||
v0.4.1 / 2018-11-25 | ||
================== | ||
* add appveyor ci badget. | ||
* add appveyor ci config. | ||
* abstract utils overwriteFile | ||
* fix overwriting failure when executing '_getCopyWhiteListViaGlobrule'. | ||
* [README.md] add marked sample before `introduction`. | ||
v0.4.0 / 2018-11-03 | ||
=================== | ||
* Release v0.4.0 | ||
* update README.md | ||
@@ -6,0 +16,0 @@ * support read compilerOptions from 'tsconfig.json', and depreacte two useless util functions. |
@@ -20,2 +20,16 @@ const vm = require('vm') | ||
exports.overwriteFile = (srcpath, distpath) => { | ||
if (fs.exists(distpath)) { | ||
const stat = fs.stat(distpath) | ||
if (stat.isDirectory()) { | ||
rmdirr(distpath) | ||
} else { | ||
fs.unlink(distpath) | ||
} | ||
} | ||
fs.copy(srcpath, distpath) | ||
} | ||
exports.getLogPrefix = function getLogPrefix (domain = 'default', action = 'action') { | ||
@@ -25,2 +39,3 @@ return `${CORE.logPrefix}[${domain}:${action}] - [${time()}] ` | ||
exports.extendCompilerConfigFromTSConfig = function (origConfig = {}) { | ||
@@ -27,0 +42,0 @@ let tsConfigFilepath = path.resolve(process.cwd(), 'tsconfig.json') |
const fs = require('fs') | ||
const path = require('path') | ||
const mm = require('micromatch') | ||
const rmdirr = require('@fibjs/rmdirr') | ||
@@ -52,3 +53,3 @@ const compileFile = require('./fs-file') | ||
if (_filename) { | ||
fs.copy(srcpath, distpath) | ||
UTILs.overwriteFile(srcpath, distpath) | ||
} | ||
@@ -55,0 +56,0 @@ } |
{ | ||
"name": "fib-typify", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "just write fibjs with typescript : )", | ||
@@ -30,2 +30,3 @@ "main": "index.js", | ||
"@fibjs/mkdirp": "^1.0.1", | ||
"@fibjs/rmdirr": "^2.0.0", | ||
"micromatch": "^3.1.10", | ||
@@ -35,3 +36,3 @@ "typescript": "^3.1.6" | ||
"ci": { | ||
"type": "travis", | ||
"type": "travis, appveyor", | ||
"version": [ | ||
@@ -38,0 +39,0 @@ "0.21.0", |
# fib-typify | ||
[![NPM version](https://img.shields.io/npm/v/fib-typify.svg)](https://www.npmjs.org/package/fib-typify) | ||
[![Build Status](https://travis-ci.com/richardo2016/fib-typify.svg?branch=master)](https://travis-ci.org/richardo2016/fib-typify) | ||
[![NPM version](https://img.shields.io/npm/v/fib-typify.svg)](https://www.npmjs.org/package/fib-typify) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/lmp5jopw8m149v9h?svg=true)](https://ci.appveyor.com/project/richardo2016/fib-typify) | ||
just write fibjs with typescript : ) | ||
```javascript | ||
// entry.js | ||
const vm = require('vm') | ||
const typify = require('fib-typify') | ||
typify.generateLoaderbox().require('./index.ts', __dirname) | ||
// index.ts | ||
export function foo (str: string): string { | ||
return `hello, ${str}` | ||
} | ||
``` | ||
## Introduction | ||
@@ -12,3 +26,3 @@ `fib-typify` allows you write fibjs with [typescript] in compilation or in runtime. It depends on original [typescript] stable version. As typescript is written with **nodejs**, it's not restricted in nodejs runtime: you can also compile typescript in browser or _ANY_ other pure Javascript runtime. That is, you can use it in fibjs also. | ||
## renderer | ||
`fib-typify`'s core is [jstransformer-typescript] (which is one [jstransformer] aimed to typescript) like, but this core is only valid in fibjs rather than pure javascript | ||
`fib-typify`'s core is [jstransformer-typescript]-like ([jstransformer-typescript] is one [jstransformer] aimed to typescript), but this core is only valid in fibjs rather than pure javascript | ||
@@ -15,0 +29,0 @@ ## Usage |
102345
54
2101
224
5
+ Added@fibjs/rmdirr@^2.0.0
+ Added@fibjs/rmdirr@2.0.0(transitive)