Merge pull request #64 from hugomrdias/feat/aegir

feat: use aegir
This commit is contained in:
Marin Petrunić 2020-06-19 11:15:53 +02:00 committed by GitHub
commit 7f2a37f692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 6974 additions and 1387 deletions

View File

@ -1,21 +0,0 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "10"
}
}
],
["@babel/preset-typescript", {
"allowNamespaces": true
}]
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-async-generator-functions",
"@babel/plugin-proposal-class-properties"
]
}

View File

@ -1,21 +0,0 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"env": {
"mocha": true
},
"plugins": ["@typescript-eslint"],
"extends": ["plugin:@typescript-eslint/recommended"],
"rules": {
"new-parens": "error",
"no-caller": "error",
"no-bitwise": "off",
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/interface-name-prefix": ["error", { "prefixWithI": "always" }],
"no-console": "warn"
}
}

View File

@ -1,12 +1,52 @@
language: node_js
cache: yarn
stages:
- check
- test
- cov
cache: false
node_js:
- '12'
- '14'
install:
- yarn install --frozen-lockfile --network-timeout 1000000
os:
- linux
- osx
- windows
script:
set -e;
yarn run lint;
yarn run build;
yarn run test
script: npx nyc -s yarn run test:node --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
jobs:
include:
- stage: check
script:
- yarn aegir dep-check
- yarn run lint
- stage: test
name: chrome
addons:
chrome: stable
script: npx aegir test -t browser -t webworker --ts
- stage: test
name: firefox
addons:
firefox: latest
script: npx aegir test -t browser -t webworker --ts -- --browsers FirefoxHeadless
- stage: test
name: electron-main
os: osx
script:
- npx aegir test -t electron-main --bail --ts
- stage: test
name: electron-renderer
os: osx
script:
- npx aegir test -t electron-renderer --bail --ts
notifications:
email: false

View File

@ -1,4 +0,0 @@
require('@babel/register')({
extensions: ['.ts'],
ignore: ['node_modules'],
})

View File

@ -1,21 +0,0 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "10"
}
}
],
["@babel/preset-typescript", {
"allowNamespaces": true
}]
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-async-generator-functions",
"@babel/plugin-proposal-class-properties"
]
}

View File

@ -1,22 +0,0 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": ">1% and not ie <= 11 and not dead"
},
"modules": false
}
],
["@babel/preset-typescript", {
"allowNamespaces": true
}]
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-async-generator-functions",
"@babel/plugin-proposal-class-properties"
]
}

View File

@ -1,26 +0,0 @@
// eslint-disable-next-line @typescript-eslint/no-require-imports
const webpackConfig = require("./webpack.config");
module.exports = function(config) {
config.set({
basePath: "",
frameworks: ["mocha", "chai"],
files: ["test/**/*.test.ts"],
exclude: [],
preprocessors: {
"test/**/*.ts": ["webpack"]
},
webpack: {
mode: "production",
node: webpackConfig.node,
module: webpackConfig.module,
resolve: webpackConfig.resolve
},
reporters: ["spec"],
browsers: ["ChromeHeadless"],
singleRun: true
});
};

View File

@ -1,13 +1,9 @@
{
"name": "libp2p-noise",
"version": "1.1.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "lib/index.js",
"main": "dist/src/index.js",
"files": [
"dist",
"lib",
"src"
"dist"
],
"repository": "git@github.com:NodeFactoryIo/js-libp2p-noise.git",
"author": "NodeFactory <info@nodefactory.io>",
@ -18,53 +14,21 @@
"crypto"
],
"scripts": {
"prebuild": "rm -rf lib && rm -rf dist",
"build": "yarn run build:node && yarn run build:web && yarn run build:types",
"bundle": "webpack --config webpack.bundle.config.js",
"build:node": "babel --no-babelrc --config-file ./babel.config.json src --copy-files -x .ts -d dist --source-maps",
"build:web": "babel --no-babelrc --config-file ./babel.web.config.json src --copy-files -x .ts -d lib --source-maps",
"build:types": "tsc --declaration --outDir dist --emitDeclarationOnly",
"proto:gen": "pbjs -t static-module -o ./src/proto/payload.js ./src/proto/payload.proto && pbts -o ./src/proto/payload.d.ts ./src/proto/payload.js && yarn run lint --fix",
"check-types": "tsc --noEmit",
"lint": "eslint --ext .ts src/",
"pretest": "yarn check-types",
"test": "yarn run test:node && yarn run test:web",
"test:node": "mocha -r ./babel-register.js \"test/**/*.test.ts\"",
"test:web": "karma start"
"build": "aegir build --ts",
"lint": "aegir lint --ts",
"test": "aegir test --ts",
"test:node": "aegir test -t node --ts",
"test:browser": "aegir test -t browser --ts",
"proto:gen": "pbjs -t static-module -o ./src/proto/payload.js ./src/proto/payload.proto && pbts -o ./src/proto/payload.d.ts ./src/proto/payload.js && yarn run lint --fix"
},
"devDependencies": {
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-async-generator-functions": "^7.7.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/preset-env": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@babel/register": "^7.6.2",
"@babel/runtime": "^7.6.3",
"@types/bl": "^2.1.0",
"@types/chai": "^4.2.4",
"@types/mocha": "^5.2.7",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"babel-loader": "^8.1.0",
"aegir": "ipfs/aegir#feat/cosmiconfig",
"chai": "^4.2.0",
"eslint": "^6.6.0",
"karma": "^4.4.1",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-mocha": "^1.3.0",
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^4.0.2",
"mocha": "^6.2.2",
"sinon": "^8.1.0",
"ts-loader": "^6.2.1",
"typescript": "^3.6.4",
"webpack": "^4.41.5",
"webpack-bundle-analyzer": "^3.6.1",
"webpack-cli": "^3.3.11"
"sinon": "^8.1.0"
},
"dependencies": {
"bcrypto": "5.1.0",
@ -81,5 +45,8 @@
},
"resolutions": {
"bn.js": "4.4.0"
},
"eslintConfig": {
"extends": "./node_modules/aegir/src/config/eslintrc-ts.js"
}
}

View File

@ -1,8 +1,9 @@
{
"compilerOptions": {
"target": "es6",
"target": "ES2018",
"module": "commonjs",
"strict": true,
"allowJs": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"noImplicitAny": false,
@ -12,9 +13,11 @@
]
},
"include": [
"**/src/**/*.ts"
"**/src/**/*.ts",
"**/src/**/*.js"
],
"exclude": [
"node_modules"
"node_modules",
"dist"
]
}

View File

@ -1,24 +0,0 @@
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
entry: "./src/index.ts",
mode: "production",
output: {
filename: "../bundle/bundle.js"
},
node: {
fs: "empty"
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{test: /\.ts$/, exclude: [/node_modules/], use: {loader: "babel-loader", options: require("./babel.web.config")}}
],
},
plugins: [
new BundleAnalyzerPlugin()
]
};

View File

@ -1,19 +0,0 @@
module.exports = {
entry: "./src/index.ts",
mode: "production",
output: {
filename: "dist/bundle.js"
},
node: {
fs: "empty"
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{test: /\.ts$/, use: {loader: "ts-loader", options: {transpileOnly: true}}}
],
},
};

8079
yarn.lock

File diff suppressed because it is too large Load Diff