Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration of extension-port-stream to typescript #4

Merged
merged 7 commits into from
Nov 23, 2020
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
66 changes: 66 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
version: 2.1

workflows:
build-test:
jobs:
- prep-deps
- test-build:
requires:
- prep-deps
- test-lint:
requires:
- prep-deps
- all-tests-pass:
requires:
- test-build
- test-lint

jobs:
prep-deps:
docker:
- image: circleci/node:10
steps:
- checkout
- run:
name: Install deps
command: |
.circleci/scripts/deps-install.sh
- run:
name: Collect yarn install HAR logs
command: |
.circleci/scripts/collect-har-artifact.sh
- persist_to_workspace:
root: .
paths:
- node_modules
- build-artifacts

test-build:
docker:
- image: circleci/node:10
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Build project
command: yarn build

test-lint:
docker:
- image: circleci/node:10
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Lint
command: yarn lint

all-tests-pass:
docker:
- image: circleci/node:10
steps:
- run:
name: All tests passed
command: echo 'Great success'
9 changes: 9 additions & 0 deletions .circleci/scripts/collect-har-artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -x
set -e
set -u
set -o pipefail

mkdir -p build-artifacts/yarn-install-har
mv ./*.har build-artifacts/yarn-install-har/
8 changes: 8 additions & 0 deletions .circleci/scripts/deps-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -x
set -e
set -u
set -o pipefail

yarn --frozen-lockfile --ignore-scripts --har
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
},
extends: [
'@metamask/eslint-config',
'@metamask/eslint-config/config/nodejs',
'@metamask/eslint-config/config/typescript',
],
plugins: [
'json',
],
overrides: [{
files: [
'*.js',
'*.json',
],
parserOptions: {
sourceType: 'script',
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
}],
ignorePatterns: [
'!eslintrc.js',
'dist/',
'node_modules/',
],
};
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
node_modules/
package-lock.json
dist/

# IDEs
.idea
.vscode
.sublime-project

# VIM
*.swp
*.swo

temp
.tmp
.DS_Store
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Extension Port Stream

A module for creating a node-style stream over a WebExtension port object.
A module for creating a Node-style stream over a WebExtension [Runtime.Port](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port) object.

## Usage

Expand All @@ -12,4 +12,3 @@ const portStream = new PortStream(remotePort)

// Enjoy!
```

80 changes: 0 additions & 80 deletions index.js

This file was deleted.

68 changes: 0 additions & 68 deletions package-lock.json

This file was deleted.

23 changes: 19 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
"name": "extension-port-stream",
"version": "1.0.0",
"description": "A module for creating a node style stream over a WebExtension port object.",
"main": "index.js",
"main": "dist/index.js",
"scripts": {
"build": "tsc --project .",
"lint": "eslint . --ext ts,js,json",
"lint:fix": "yarn lint --fix",
"test": "echo \"Error: no test specified\" && exit 1"
},
"files": [
"dist/"
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/MetaMask/extension-port-stream.git"
Expand All @@ -20,8 +26,17 @@
"url": "https://github.com/MetaMask/extension-port-stream/issues"
},
"homepage": "https://github.com/MetaMask/extension-port-stream#readme",
"dependencies": {
"readable-stream": "^2.3.6",
"util": "^0.11.0"
"dependencies": {},
"devDependencies": {
"@metamask/eslint-config": "^4.1.0",
"@types/node": "14.14.7",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.13.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-node": "^11.1.0",
"typescript": "^4.0.5",
"webextension-polyfill-ts": "^0.22.0"
}
}
Loading