Skip to content

Commit db04808

Browse files
authored
Merge pull request #7 from grimmer0125/revert-6-tsdx
Revert "Use TSDX to replace typescript-starter for building"
2 parents b763bdf + 70fefda commit db04808

File tree

7 files changed

+148
-4914
lines changed

7 files changed

+148
-4914
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ bower_components
2121
*.DS_Store
2222
.nyc_output
2323
build
24-
coverage
25-
26-
dist
24+
coverage

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ This project is forked from https://github.com/nicolaspanel/numjs and does below
88
- Remove the feature of images manipulation. You could consider [ndarray-pixels](https://github.com/donmccurdy/ndarray-pixels) if you need this feature.
99
- Add TypeScript typings and `.d.ts` is out of box, JavaScript is supported, too. Also, it includes
1010
- ES6 build (ES2015) with CommonJS module for main build in package.json.
11-
- ES6 build (ES2015) with ES6 module for module build.
11+
- ES6 build (ES2015) with ES6 module for module build. Some tools will follow the module field in package.json, like Rollup, Webpack, or Parcel. It is good to let build tools can tree-shake this module build to import only the code they need.
1212
- Refactor internal code via ES6 syntax and does not change the core algorithm code.
1313
- Add "uint8_clamped" (Uint8ClampedArray) support.
14-
- Requires Node.js 12+.
1514

1615
You can check the [changelog](https://github.com/grimmer0125/numjs/blob/master/CHANGELOG.md).
1716

package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "@d4c/numjs",
33
"version": "0.17.17",
44
"description": "Like NumPy, in TypeScript and JavaScript",
5-
"main": "dist/index.js",
6-
"typings": "dist/index.d.ts",
7-
"module": "dist/numjs.esm.js",
5+
"main": "build/main/index.js",
6+
"typings": "build/main/index.d.ts",
7+
"module": "build/module/index.js",
88
"repository": "https://github.com/grimmer0125/numjs",
99
"homepage": "https://grimmer0125.github.io/numjs",
1010
"license": "MIT",
@@ -31,21 +31,18 @@
3131
"npm-run-all": "^4.1.5",
3232
"nyc": "^15.1.0",
3333
"ts-node": "^10.2.1",
34-
"tsdx": "^0.14.1",
35-
"tslib": "^2.3.1",
3634
"typedoc": "^0.22.7",
3735
"typescript": "^4.4.2"
3836
},
3937
"scripts": {
40-
"build": "tsdx build",
41-
"lint": "tsdx lint",
42-
"build_depreciated": "run-p build:*",
38+
"build": "run-p build:*",
4339
"build:main": "tsc -p tsconfig.json",
40+
"build:module": "tsc -p tsconfig.module.json",
4441
"cov:html": "nyc report --reporter=html",
4542
"doc:html": "typedoc src/lib/index.ts src/lib/ndarray.ts src/lib/errors.ts --out build/docs",
4643
"doc:publish": "touch build/docs/.nojekyll && gh-pages -m \"[ci skip] Updates\" -d build/docs -t -r https://github.com/grimmer0125/numjs.git",
47-
"build:test": "run-s test",
48-
"test": "env TS_NODE_PROJECT=\"tsconfig.test.json\" mocha --require ts-node/register test/mocha/*.spec.ts",
44+
"buildtest": "run-s build test:*",
45+
"test": "mocha --require ts-node/register test/mocha/*.spec.ts",
4946
"cov": "nyc mocha --require ts-node/register test/mocha/*.spec.ts",
5047
"postversion": "npm publish"
5148
},
@@ -75,8 +72,13 @@
7572
"volume"
7673
],
7774
"files": [
78-
"dist",
79-
"src"
75+
"build/main",
76+
"build/module",
77+
"!**/*.spec.*",
78+
"!**/*.json",
79+
"CHANGELOG.md",
80+
"LICENSE",
81+
"README.md"
8082
],
8183
"ava": {
8284
"failFast": true,

tsconfig.json

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,47 @@
11
{
2-
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
3-
"include": [
4-
"src",
5-
"types"
6-
],
72
"compilerOptions": {
8-
// "incremental": true,
3+
"incremental": true,
94
"target": "es6",
10-
// "outDir": "build/main",
11-
// "inlineSourceMap": true,
12-
// "resolveJsonModule": true /* Include modules imported with .json extension. */,
13-
/* Debugging Options */
14-
// "traceResolution": false /* Report module resolution log messages. */,
15-
// "listEmittedFiles": false /* Print names of generated files part of the compilation. */,
16-
// "listFiles": false /* Print names of files part of the compilation. */,
17-
// "pretty": true /* Stylize errors and messages using color and context. */,
18-
// /* Experimental Options */
19-
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
20-
"module": "esnext",
21-
"lib": [
22-
"dom",
23-
"esnext"
24-
],
25-
"importHelpers": true,
26-
// output .d.ts declaration files for consumers
27-
"declaration": true,
28-
// output .js.map sourcemap files for consumers
29-
"sourceMap": true,
30-
// match output dir to input dir. e.g. dist/index instead of dist/src/index
31-
"rootDir": "./src",
32-
// stricter type-checking for stronger correctness. Recommended by TS
33-
"strict": false, // turn off temporarily
34-
// linter checks for common issues
35-
"noImplicitReturns": false, // turn off temporarily
36-
"noFallthroughCasesInSwitch": true,
37-
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
38-
"noUnusedLocals": false, // turn off temporarily
39-
"noUnusedParameters": false, // turn off temporarily
40-
// use Node's module resolution algorithm, instead of the legacy TS one
5+
"outDir": "build/main",
6+
"rootDir": "src",
417
"moduleResolution": "node",
42-
// transpile JSX to React.createElement
43-
"jsx": "react",
44-
// interop between ESM and CJS modules. Recommended by TS
45-
"esModuleInterop": true,
46-
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
47-
"skipLibCheck": true,
48-
// error out if import and file system have a casing mismatch. Recommended by TS
49-
"forceConsistentCasingInFileNames": true,
50-
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
51-
"noEmit": true,
52-
}
53-
}
8+
"module": "commonjs",
9+
"declaration": true,
10+
"inlineSourceMap": true,
11+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
12+
"resolveJsonModule": true /* Include modules imported with .json extension. */,
13+
14+
// "strict": true /* Enable all strict type-checking options. */,
15+
16+
/* Strict Type-Checking Options */
17+
// "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
18+
// "strictNullChecks": true /* Enable strict null checks. */,
19+
// "strictFunctionTypes": true /* Enable strict checking of function types. */,
20+
// "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
21+
// "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
22+
// "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
23+
24+
/* Additional Checks */
25+
// "noUnusedLocals": true /* Report errors on unused locals. */,
26+
// "noUnusedParameters": true /* Report errors on unused parameters. */,
27+
"noImplicitReturns": false /* Report error when not all code paths in function return a value. */,
28+
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
29+
30+
/* Debugging Options */
31+
"traceResolution": false /* Report module resolution log messages. */,
32+
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
33+
"listFiles": false /* Print names of files part of the compilation. */,
34+
"pretty": true /* Stylize errors and messages using color and context. */,
35+
36+
/* Experimental Options */
37+
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
38+
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
39+
40+
"lib": ["es6", "DOM"],
41+
"types": ["node", "mocha"],
42+
"typeRoots": ["node_modules/@types", "src/types"]
43+
},
44+
"include": ["src/**/*.ts"],
45+
"exclude": ["node_modules/**"],
46+
"compileOnSave": false
47+
}

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",
3+
"compilerOptions": {
4+
"target": "es6",
5+
"outDir": "build/module",
6+
"module": "es6"
7+
},
8+
"exclude": [
9+
"node_modules/**"
10+
]
11+
}

tsconfig.test.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)