Skip to content

Commit 8c497a7

Browse files
Merge branch 'feature/npm-publish' of github.com:bytesonus/juno-node into feature/npm-publish
2 parents 32dd643 + b38d8e0 commit 8c497a7

7 files changed

Lines changed: 478 additions & 450 deletions

File tree

package-lock.json

Lines changed: 430 additions & 430 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"description": "",
55
"keywords": [],
6-
"main": "dist/juno-node.umd.js",
6+
"main": "dist/juno-node.cjs.js",
77
"module": "dist/juno-node.es5.js",
88
"typings": "dist/types/juno-node.d.ts",
99
"files": [
@@ -21,9 +21,9 @@
2121
"scripts": {
2222
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
2323
"prebuild": "rimraf dist",
24-
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
24+
"build": "rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
2525
"start": "rollup -c rollup.config.ts -w",
26-
"test": "ts-mocha -p ./tsconfig.json test/**/*.test.ts",
26+
"test": "ts-mocha -p ./tsconfig/tsconfig.test.json test/**/*.test.ts",
2727
"test:coverage": "nyc --reporter=html --reporter=text --reporter=text-summary npm test",
2828
"test:prod": "npm run lint && npm run test",
2929
"deploy-docs": "ts-node tools/gh-pages-publish",
@@ -61,7 +61,6 @@
6161
"@types/chai-as-promised": "^7.1.2",
6262
"@types/expect": "^24.3.0",
6363
"@types/mocha": "^7.0.2",
64-
"@types/node": "^13.13.4",
6564
"@types/sinon": "^9.0.0",
6665
"@types/sinon-chai": "^3.2.4",
6766
"chai": "^4.2.0",

rollup.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ const libraryName = 'juno-node'
1212
export default {
1313
input: `src/${libraryName}.ts`,
1414
output: [
15-
{ file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true },
15+
{ file: pkg.main, name: camelCase(libraryName), format: 'cjs', sourcemap: true },
1616
{ file: pkg.module, format: 'es', sourcemap: true },
1717
],
1818
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
19-
external: [],
19+
external: ['net'],
2020
watch: {
2121
include: 'src/**',
2222
},
2323
plugins: [
2424
// Allow json resolution
2525
json(),
2626
// Compile TypeScript files
27-
typescript({ useTsconfigDeclarationDir: true }),
27+
typescript({ useTsconfigDeclarationDir: true, tsconfig:"tsconfig/tsconfig.module.json" }),
2828
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
2929
commonjs(),
3030
// Allow node_modules resolution, so you can use 'external' to control
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
22
"compilerOptions": {
33
"moduleResolution": "node",
4-
"target": "es5",
5-
"module": "es2015",
64
"lib": [
75
"es2015",
86
"es2016",
97
"es2017",
10-
"dom"
118
],
129
"strict": true,
1310
"sourceMap": true,
@@ -16,14 +13,9 @@
1613
"esModuleInterop": true,
1714
"experimentalDecorators": true,
1815
"emitDecoratorMetadata": true,
19-
"declarationDir": "dist/types",
20-
"outDir": "dist/lib",
21-
"typeRoots": [
22-
"node_modules/@types",
23-
"types"
24-
]
25-
},
26-
"include": [
27-
"src"
28-
]
16+
"typeRoots": [
17+
"./typings",
18+
"../node_modules/@types"
19+
]
20+
}
2921
}

tsconfig/tsconfig.module.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.base",
3+
"compilerOptions": {
4+
"module": "es2015",
5+
"declarationDir": "../dist/types",
6+
"outDir": "../dist/lib",
7+
},
8+
"include": [
9+
"../src"
10+
]
11+
}

tsconfig/tsconfig.test.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "commonjs"
5+
},
6+
"include": [
7+
"../test"
8+
]
9+
}

typings/mocha/index.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import BaseConnection from "../../src/connection/base-connection";
2+
import { DummyJunoConnection } from "../../test/helpers";
3+
import JunoModule from "../../src/juno-node";
4+
import { SinonSpy } from "sinon";
5+
6+
interface JunoTest {
7+
connection: BaseConnection;
8+
}
9+
10+
declare module 'mocha' {
11+
interface Runnable {
12+
conn: DummyJunoConnection;
13+
module: JunoModule;
14+
sendFunc: SinonSpy;
15+
getLatestSent: Function
16+
}
17+
}

0 commit comments

Comments
 (0)