Skip to content

Commit 5f382b7

Browse files
committed
code updates
1 parent 6978e3e commit 5f382b7

19 files changed

+14684
-160
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ publish/
1010
/*.tgz
1111
/*.json
1212
!package.json
13+
!package-lock.json
1314
!tsconfig.json

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017
3+
Copyright agracio (c) 2017
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+3-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
> This is based on excellent `react-json-table` https://github.com/arqex/react-json-table.
7-
The component is written in TypeScript and supports React 16.x.
7+
The component is written in TypeScript and supports React 19.x.
88
It attempts to be backward compatible with `react-json-table`.
99

1010
## Features
@@ -23,8 +23,7 @@ Features are similar to original `react-json-table`
2323
npm install ts-react-json-table
2424
```
2525

26-
Or use the pre-built UMD files [ts-react-json-table.js](https://github.com/agracio/ts-react-json-table/blob/master/build/ts-react-json-table.js)
27-
and [ts-react-json-table.min.js](https://github.com/agracio/ts-react-json-table/blob/master/build/ts-react-json-table.min.js)
26+
Or use the pre-built UMD file [ts-react-json-table.js](https://github.com/agracio/ts-react-json-table/blob/master/build/ts-react-json-table.js)
2827

2928
## Quickstart
3029

@@ -170,18 +169,7 @@ var columns = [
170169
### Exclude columns
171170

172171
This allows to exclude columns from table without defining all columns.
173-
For `rows` example above, if you wanted to show all columns except 'id' instead of passing `columns` prop
174-
175-
```js
176-
var columns = [
177-
'name',
178-
'age',
179-
'phone',
180-
'color'
181-
];
182-
```
183-
184-
You can pass `excludeColumns` prop
172+
For `rows` example above, if you want to show all columns except 'id'
185173

186174
```js
187175
var excludeColumns = [
@@ -190,5 +178,3 @@ var columns = [
190178
```
191179

192180
If both `columns` and `excludeColumns` props are passed, columns will be excluded even if they are defined in `columns` prop.
193-
194-
## README update in progress...

build/ts-react-json-table.js

+92-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ts-react-json-table.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ts-react-json-table.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

+22-30
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
const gulp = require('gulp');
22
const del = require('del');
33
const webpack = require('webpack-stream');
4-
const sequence = require('run-sequence');
5-
const tsb = require('gulp-tsb');
4+
const sequence = require('gulp4-run-sequence');
5+
var ts = require('gulp-typescript');
66
const chalk = require('chalk');
77
const minify = require('gulp-minify');
88
const run = require('gulp-run');
9+
const sourcemaps = require('gulp-sourcemaps');
910

1011
let buildDone = false;
1112

1213
const paths = {
13-
src: ['src/**', 'test/**', './*.ts', 'node_modules/@types/**/*.d.ts'],
14+
src: ['src/*ts*', './ts-react-json-table.d.ts'],
1415
out: './dist',
1516
test: './dist/test/**/*.js',
1617
webpack: './build/',
1718
webpackEntry: './dist/grid.js',
1819
webpackName: 'ts-react-json-table.js'
1920
};
2021

21-
function handleBuildError (error) {
22-
console.log(chalk.red(error.toString()));
23-
buildDone = false;
24-
}
25-
26-
function createCompilation(){
27-
return tsb.create('tsconfig.json', false, null, function(error){handleBuildError(error)});
28-
//return tsb.create(tsconfig.compilerOptions, false, null, function(error){handleBuildError(error)});
29-
}
22+
let tsProject = ts.createProject('tsconfig.json');
3023

3124
function logBuildResult(){
3225
console.log(buildDone ? chalk.green('Build succeeded.') : chalk.red('Build failed.'));
@@ -35,10 +28,11 @@ function logBuildResult(){
3528
gulp.task('build', function() {
3629
console.log(chalk.blue('Typescript compile.'));
3730
buildDone = true;
38-
return gulp.src(paths.src, {base: '.'})
39-
.pipe(createCompilation()())
40-
// .pipe(compilation())
41-
.pipe(gulp.dest(paths.out));
31+
return gulp.src(paths.src)
32+
.pipe(tsProject())
33+
.pipe(sourcemaps.init())
34+
.pipe(sourcemaps.write('.'))
35+
.pipe(gulp.dest(paths.out));
4236
});
4337

4438
gulp.task('clean', function() {
@@ -51,7 +45,7 @@ gulp.task('clean_webpack', function() {
5145
return del([paths.webpack + '/**/*']);
5246
});
5347

54-
gulp.task('webpack', ['clean_webpack', 'build'], function() {
48+
gulp.task('webpack', gulp.series('clean_webpack', 'build', function() {
5549
logBuildResult();
5650
if(!buildDone){ return;}
5751
console.log(chalk.blue('Creating webpack in', paths.webpack));
@@ -63,11 +57,6 @@ gulp.task('webpack', ['clean_webpack', 'build'], function() {
6357
library: 'JsonTable',
6458
//libraryExport: 'JsonTable',
6559
},
66-
module: {
67-
rules: [
68-
{test: /\.js$/, loader: "source-map-loader"}
69-
],
70-
},
7160
externals: {
7261
react: {
7362
commonjs: null,
@@ -76,20 +65,23 @@ gulp.task('webpack', ['clean_webpack', 'build'], function() {
7665
root: 'React'
7766
}
7867
},
68+
optimization: {
69+
minimize: false
70+
},
7971
devtool: "#source-map"
8072
}))
8173
.pipe(gulp.dest(paths.webpack));
82-
});
74+
}));
8375

84-
gulp.task('minify',['webpack'], function() {
85-
gulp.src(paths.webpack + paths.webpackName)
76+
gulp.task('minify', gulp.series('webpack', function() {
77+
return gulp.src(paths.webpack + paths.webpackName)
8678
.pipe(minify({
8779
ext:{
8880
min:'.min.js'
8981
}
9082
}))
9183
.pipe(gulp.dest(paths.webpack))
92-
});
84+
}));
9385

9486
gulp.task('copy-css', function() {
9587
return gulp.src('./src/**/*.css').pipe(gulp.dest(paths.webpack))
@@ -99,14 +91,14 @@ gulp.task('publish_npm', function () {
9991
return run('npm publish').exec();
10092
});
10193

102-
gulp.task('publish', function () {
103-
sequence('clean', 'minify','copy-css', 'publish_pack', 'publish_npm');
94+
gulp.task('publish', function (cb) {
95+
sequence('clean', 'minify', 'copy-css', 'publish_pack', 'publish_npm', cb);
10496
});
10597

10698
gulp.task('publish_pack', function () {
10799
return run('npm pack').exec();
108100
});
109101

110-
gulp.task('pack', function () {
111-
sequence('clean', 'minify', 'copy-css', 'publish_pack');
102+
gulp.task('pack', function (cb) {
103+
sequence('clean', 'minify', 'copy-css', 'publish_pack', cb);
112104
});

0 commit comments

Comments
 (0)