New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fib-typify

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fib-typify - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

18

bin/fib-typify.js

@@ -44,10 +44,18 @@ #!/usr/bin/env fibjs

finalParams.configFilepath = getParamFromArgs(args, ['-c', '--config-file'])
let configFilepath = finalParams.configFilepath ? path.resolve(baseDir, finalParams.configFilepath) : null
let configFilepath = finalParams.configFilepath ? path.resolve(cwd, finalParams.configFilepath) : null
isDebug && console.log('configFilepath', configFilepath)
if (configFilepath && fs.exists(configFilepath)) {
let config = {}
try {
config = JSON.parse(fs.readTextFile(configFilepath))
} catch (e) {
console.warn(`error occured when trying to parse config file: ${configFilepath}`)
if (['.json', '.js', '.jsc'].some(ext => configFilepath.endsWith(ext))) {
config = require(configFilepath)
isDebug && console.log('internal extension', config)
} else {
try {
config = JSON.parse(fs.readTextFile(configFilepath))
} catch (e) {
console.warn(`error occured when trying to parse config file: ${configFilepath}`)
}
}
tsCompilerOptions = util.extend({}, tsCompilerOptions, config)

@@ -54,0 +62,0 @@ }

{
"name": "fib-typify",
"version": "0.1.3",
"version": "0.2.0",
"description": "just write fibjs with typescript : )",

@@ -44,4 +44,4 @@ "main": "index.js",

"@fibjs/ci": "^2.0.0",
"@types/fibjs": "github:fibjs/fib-types#v1.0.6"
"@types/fibjs": "github:fibjs/fib-types#v1.0.7"
}
}

@@ -16,2 +16,9 @@ # fib-typify

```bash
# locally
fibjs --install fib-typify
# or globally
npm i -g fib-typify
```
### APIs

@@ -82,2 +89,21 @@

## CLI
Started from `0.2.0`, you can run `fib-typify` in CLI.
```bash
fib-typify src -o lib -c .typify.json
```
Command above means compiling directory `src` to directory `lib` with configuration file `.typify.json`. The default tsCompilerOptions is
```javascript
{
target: 'es6',
module: 'commonjs'
}
```
if you want to extend it, just write .json/.js/.jsc file, and put its path relateive to `cwd()` after `-c`/`--config-file` CLI option.
I only provided one simple and crude error exception mechanism, so in some cases it may be not friendly as you like, it's welcome to take PR to help optimizting this part of `fib-typify` :)
## TODO

@@ -93,3 +119,3 @@

- [ ] pack compiled '.jsc' to binary and extract one zipped file.
- [ ] `--help` CLI option for cli
## Contributions

@@ -96,0 +122,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc