Skip to content

Commit

Permalink
rename project 😞
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Nov 1, 2018
1 parent 8e56c87 commit 027b1f6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## esm2cjs
## esm-to-cjs

> Transform ESM to Common JS for present NodeJS, without any junk wrappers or useless renaming.
Expand Down Expand Up @@ -89,7 +89,7 @@ exports.baz = lorem1.baz;
```


So, I created this tool using some simple string manipulations. A lot of sample input/output are [available here](https://github.com/sidvishnoi/esm2cjs/blob/master/test/fixtures/supported.md).
So, I created this tool using some simple string manipulations. A lot of sample input/output are [available here](https://github.com/sidvishnoi/esm-to-cjs/blob/master/test/fixtures/supported.md).



Expand All @@ -103,23 +103,23 @@ So, I created this tool using some simple string manipulations. A lot of sample

This tool is available in form of two packages:

- `esm2cjs`: the core module.
- `gulp-esm2cjs`: as a gulp plugin.
- `esm-to-cjs`: the core module.
- `gulp-esm-to-cjs`: as a gulp plugin.

### `esm2cjs`
### `esm-to-cjs`

This is the core module. It includes a tokenizer and a transformer. I didn't use some specific JS parser due to overheads and created my own using string manipulation.

**Install:**

```
npm i --save-dev esm2cjs
npm i --save-dev esm-to-cjs
```

**Usage:**

``` js
const { runTransform } = require("esm2cjs");
const { runTransform } = require("esm-to-cjs");

const input = `import { resolve as resolvePath } from "path";`
const options = { quote: "double" }; // see details below
Expand Down Expand Up @@ -159,26 +159,26 @@ indent:
```
### `gulp-esm2cjs`
### `gulp-esm-to-cjs`

Gulp plugin for esm2cjs.
Gulp plugin for esm-to-cjs.

**Install**:

```
npm i --save-dev gulp-esm2cjs
npm i --save-dev gulp-esm-to-cjs
```
**Usage**:
``` js
// gulpfile.js
const esm2cjs = require("gulp-esm2cjs");
const esm-to-cjs = require("gulp-esm-to-cjs");
function convert() {
return gulp
.src(src)
.pipe(esm2cjs(options))
.pipe(esm-to-cjs(options))
.pipe(gulp.dest(dest));
}
module.exports.convert = convert;
Expand All @@ -190,6 +190,6 @@ module.exports.convert = convert;

## Contributing

- If you've issues regarding the project - documentation, supported features and transformations etc., please file them on [GitHub](https://github.com/sidvishnoi/esm2cjs/issues) where we can discuss.
- If you've issues regarding the project - documentation, supported features and transformations etc., please file them on [GitHub](https://github.com/sidvishnoi/esm-to-cjs/issues) where we can discuss.
- Pull requests are welcome!
- Please bear in mind that I created this project in a hurry, so the code isn't very impressive. Also, I didn't add all the transformations. See limitations above. Would be nice if we can overcome them!
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "esm2cjs",
"name": "esm-to-cjs",
"version": "1.0.0",
"description": "Transform ESM to Common JS for present NodeJS, without any junk wrappers or useless renaming",
"keywords": [
Expand All @@ -8,11 +8,11 @@
"esm",
"module"
],
"homepage": "https://github.com/sidvishnoi/esm2cjs#readme",
"homepage": "https://github.com/sidvishnoi/esm-to-cjs#readme",
"bugs": {
"url": "https://github.com/sidvishnoi/esm2cjs/issues"
"url": "https://github.com/sidvishnoi/esm-to-cjs/issues"
},
"repository": "sidvishnoi/esm2cjs",
"repository": "sidvishnoi/esm-to-cjs",
"license": "MIT",
"author": {
"name": "Sid Vishnoi",
Expand All @@ -26,8 +26,8 @@
"scripts": {
"build:core": "node scripts/core.js",
"build:gulp": "node scripts/gulp.js",
"publish:core": "node scripts/backup.js && node scripts/core.js && node scripts/restore.js",
"publish:gulp": "node scripts/backup.js && node scripts/gulp.js && node scripts/restore.js",
"publish:core": "node scripts/backup.js && node scripts/core.js",
"publish:gulp": "node scripts/backup.js && node scripts/gulp.js && npm publish && node scripts/restore.js",
"test": "node test/test.js",
"util:backup": "node scripts/backup.js",
"util:restore": "node scripts/restore.js"
Expand Down
4 changes: 2 additions & 2 deletions scripts/gulp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ try {
json.tests = undefined;
json.devDependencies = undefined;
json.keywords.push("gulpplugin");
json.name = "gulp-esm2cjs";
json.name = "gulp-esm-to-cjs";
});
copyFile("./src/gulp.js", "./index.js", str => {
return str.replace("./core", "esm2cjs");
return str.replace("./core", "esm-to-cjs");
});
} catch (err) {
console.error(err);
Expand Down
2 changes: 1 addition & 1 deletion src/gulp.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const through = require("through2");
const { runTransform } = require("./core");

const PLUGIN_NAME = "gulp-esm2cjs";
const PLUGIN_NAME = "gulp-esm-to-cjs";

module.exports = options => {
return through.obj(function(file, enc, cb) {
Expand Down

0 comments on commit 027b1f6

Please sign in to comment.