export-helper
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72
7757
7
72