Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Convert library to ES modules #1077

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"presets": [
["@babel/preset-env", {
"targets": { "node": "current" }
"targets": { "node": "14" },
// Leave import/export statements unchanged in the babel transpiling output.
"modules": false
}]
]
}
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dist/
lib/
node_modules/
tests/fixtures/
8 changes: 4 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"rules": {
"import/no-extraneous-dependencies": ["error", {
"devDependencies": [
"Gruntfile.js",
willdurand marked this conversation as resolved.
Show resolved Hide resolved
"tests/**/*.js",
"webpack.config.js",
"tests/**/*.js"
]
}
],
Expand All @@ -28,6 +26,8 @@
// We almost only use anonymous functions...
"func-names": "off",
// We don't use .tsx files
"amo/only-tsx-files": "off"
"amo/only-tsx-files": "off",
// Disabled due to https://github.com/import-js/eslint-plugin-import/issues/2104
"import/extensions": [0, "never"]
}
}
16 changes: 5 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# OSX
.DS_Store
willdurand marked this conversation as resolved.
Show resolved Hide resolved

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
.cache

# Build artifacts.
npm-debug.log
node_modules
dist/*
coverage
/coverage/
/lib/*
/node_modules/
/npm-debug.log
/*.tgz
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Dockerfile
/bin/
/build/
/coverage/
/dist/
/lib/
/docker/
/node_modules/
# white-list files we want to process
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Currently, this is intended for use in [NodeJS](https://nodejs.org/) only and sh
Here is how to retrieve a signed version of an [XPI file](https://developer.mozilla.org/en-US/docs/Mozilla/XPI):

```javascript
var { signAddon } = require('sign-addon');
import { signAddon } from 'sign-addon';

signAddon({
// Required arguments:
Expand Down Expand Up @@ -81,12 +81,6 @@ signAddon({
});
```

In ES6 code, you can import it more concisely:

```javascript
import { signAddon } from 'sign-addon';
```

## Dealing With Extension IDs

Here are some notes about dealing with IDs when using `signAddon()`:
Expand Down
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module.exports = {
export default {
// See: https://jestjs.io/docs/ecmascript-modules
transform: {},
testEnvironment: 'node',
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/node_modules/'],
};
Loading