Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

export-helper

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

export-helper - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "export-helper",
"version": "0.1.0",
"version": "0.1.1",
"description": "Nodejs utility to help compile TS modules into sweet es5 & es6 exports",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -34,3 +34,3 @@ # export-helper

mode: "es6", // needed. Available options: "es5", "es6"
path: "testFile.ts", // needed. Path to file (./ is optionnal)
path: "testFile.ts", // needed. Path to file (./ is optional)
silent: false, // default to false; set to true to remove the log

@@ -46,4 +46,4 @@ linesToTrim: 1 /* default to 1.

### ... more examples ?
This is my configuration on the [module](https://github.com/TheRealBarenziah/imgbb-uploader/blob/master) I made this for.
I have an utility file updateExport.js:
This is the configuration on the [module](https://github.com/TheRealBarenziah/imgbb-uploader/blob/master) I made this for.
I have an utility file updateExport.js :
```javascript

@@ -63,8 +63,13 @@ const exportHelper = require("export-helper");

```
This is my `npm run build` script:
`node rebuild.js && node updateExport.js es5 && tsc -p tsconfig-cjs.json && node updateExport.js es6 && tsc -p tsconfig.json`
And this script in my package.json :
```json
{
...
"npm run build": "node rebuild.js && node updateExport.js es5 && tsc -p tsconfig-cjs.json && node updateExport.js es6 && tsc -p tsconfig.json"
}
```
- rebuild.js is a [simple utility](https://github.com/TheRealBarenziah/imgbb-uploader/blob/dev/rebuild.js) that wipes the /lib folder before compilation.
- `node updateExport.js es5`: wrapping my module into a function using `process.argv`, I can easily pass arguments to it. Basically it will read the last line of my index file, search for `default` and replace it by `=`. It is that dumb.
- `node updateExport.js es5` : I wrapped my module into a function using `process.argv` to easily pass arguments to it.
- `tsc -p tsconfig-cjs.json`: I'm calling tsc with [this config file](https://github.com/TheRealBarenziah/imgbb-uploader/blob/dev/tsconfig-cjs.json)
- Now that I've compiled a proper cjs version with `module.exports`, I call `node updateExport.js es6` to change back the source code.
- Now that I've compiled proper cjs with `module.exports`, I call `node updateExport.js es6` to change the source code once more.
- Finally I call tsc to build the es6 module.
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