Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne-dldc committed May 28, 2021
1 parent 09c9700 commit e17504a
Show file tree
Hide file tree
Showing 8 changed files with 2,250 additions and 1 deletion.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v15.12.0
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# esm-ts-experiment
Package to experiment with ESM in NPM packages

Package to experiment with ESM and TypeScript in NPM packages
55 changes: 55 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@etienne-dldc/esm-ts-experiment",
"version": "0.0.0",
"description": "Package to experiment with ESM in NPM packages",
"keywords": [],
"homepage": "https://github.com/etienne-dldc/esm-ts-experiment#readme",
"bugs": {
"url": "https://github.com/etienne-dldc/esm-ts-experiment/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/etienne-dldc/esm-ts-experiment.git"
},
"license": "MIT",
"author": "Etienne Dldc",
"type": "module",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc",
"pub": "npx np",
"prepublish": "tsc",
"test": "c8 --reporter=html --reporter=text ava",
"test:watch": "ava --watch"
},
"ava": {
"extensions": {
"ts": "module"
},
"nodeArguments": [
"--loader=ts-node/esm"
],
"nonSemVerExperiments": {
"configurableModuleFormat": true
}
},
"dependencies": {
"tslib": "^2.2.0"
},
"devDependencies": {
"ava": "^3.15.0",
"c8": "^7.7.2",
"ts-node": "^10.0.0",
"typescript": "^4.3.2"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"publishConfig": {
"access": "public"
}
}
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createNum } from "./internal.js";

export function createNums() {
return [createNum(), createNum()];
}
7 changes: 7 additions & 0 deletions src/internal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function createNum(): number {
return Math.random();
}

export function createStr(): string {
return Math.random().toString(32);
}
6 changes: 6 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createNums } from "../src/index.js";
import test from "ava";

test("createNums", (t) => {
t.is(createNums().length, 2);
});
23 changes: 23 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es5",
"module": "ES2020",
"lib": ["esnext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./src",
"outDir": "dist",
"strict": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"esModuleInterop": true
},
"include": ["src"]
}
Loading

0 comments on commit e17504a

Please sign in to comment.