Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Fix typings and packages assets #339

Merged
merged 12 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"packages/x-license",
"packages/grid/data-grid",
"packages/grid/x-grid",
"packages/grid/x-grid-data-generator"
"packages/x-grid-data-generator"
],
"publishDirectory": {
"@material-ui/x-license": "packages/x-license",
"@material-ui/data-grid": "packages/grid/data-grid",
"@material-ui/x-grid": "packages/grid/x-grid",
"@material-ui/x-grid-data-generator": "packages/grid/x-grid-data-generator"
"@material-ui/x-grid-data-generator": "packages/x-grid-data-generator"
},
"sandboxes": [
"new",
Expand Down
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
/docs/export
/lerna.json
/packages/demo-app/public/static-data
/packages/grid/lib/lodash
/packages/grid/x-grid-modules/lib/autosizer
/packages/grid/x-grid-modules/lib/lodash
lib
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
CHANGELOG.md
dist
node_modules
3 changes: 1 addition & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ if (process.env.BABEL_ENV === 'es') {

const defaultAlias = {
'@material-ui/data-grid': './packages/grid/data-grid/src',
'@material-ui/x-grid-data-generator': './packages/grid/x-grid-data-generator/src',
'@material-ui/x-grid-modules': './packages/grid/x-grid-modules/src',
'@material-ui/x-grid-data-generator': './packages/x-grid-data-generator/src',
'@material-ui/x-grid': './packages/grid/x-grid/src',
'@material-ui/x-license': './packages/x-license/src',
};
Expand Down
3 changes: 1 addition & 2 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ function resolvePath(sourcePath, currentFile, opts) {

const alias = {
'@material-ui/data-grid': '../packages/grid/data-grid/src',
'@material-ui/x-grid-data-generator': '../packages/grid/x-grid-data-generator/src',
'@material-ui/x-grid-modules': '../packages/grid/x-grid-modules/src',
'@material-ui/x-grid-data-generator': '../packages/x-grid-data-generator/src',
'@material-ui/x-grid': '../packages/grid/x-grid/src',
'@material-ui/x-license': '../packages/x-license/src',
// Help in the event npm and git are significantly desynchronized.
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"eslint:ci": "eslint . --report-unused-disable-directives --ext .js,.ts,.tsx",
"jsonlint": "node scripts/jsonlint.js",
"typescript": "lerna run typescript --parallel",
"build:codesandbox": "yarn lerna:build",
"lerna:build": "cd packages/x-license && yarn build && cd ../grid/x-grid-modules && yarn build && cd ../data-grid && yarn build && cd ../x-grid && yarn build && cd ../x-grid-data-generator && yarn build",
"lerna:publish": "lerna publish"
"build:codesandbox": "yarn build",
"build": "cd packages/x-license && yarn build && cd ../grid && yarn build && cd ../x-grid-data-generator && yarn build",
"publish": "yarn build && lerna publish",
"fake-publish": "lerna publish --no-git-tag-version --no-push --registry=\"http://localhost:4873/\""
},
"devDependencies": {
"@babel/core": "^7.10.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/grid/_modules_/grid/components/autosizer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import AutoSizer from '../lib/autosizer';

export const AutoSizerWrapper = AutoSizer;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _debounce from '../../lib/lodash/debounce';
import isEqual from '../../lib/lodash/isEqual';
import _debounce from '../lib/lodash/debounce';
import isEqual from '../lib/lodash/isEqual';

export { isEqual };

Expand Down
1 change: 1 addition & 0 deletions packages/grid/_modules_/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './grid';
6 changes: 1 addition & 5 deletions packages/grid/data-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Material-UI Team",
"main": "dist/index-cjs.js",
"module": "dist/index-esm.js",
"types": "dist/data-grid.all.d.ts",
"types": "dist/data-grid.d.ts",
"files": [
"dist/*"
],
Expand All @@ -26,19 +26,15 @@
],
"scripts": {
"precommit": "npm run lint",
"build": "rollup -c ",
"start": "rollup -cw",
"lint": "eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js",
"test": "../../../node_modules/.bin/jest --config jest.config.js",
"typescript": "tsc -p tsconfig.json"
},
"dependencies": {
"prop-types": "^15.7.2",
"tslib": "^2.0.0"
},
"devDependencies": {
"@material-ui/x-grid-modules": "^4.0.0-alpha.2",
"@rollup/plugin-node-resolve": "^8.0.1",
"rollup": "^2.6.1",
"rollup-plugin-cleaner": "^1.0.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/grid/data-grid/src/DataGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { chainPropTypes } from '@material-ui/utils';
import { GridComponent, GridComponentProps, classnames } from '@material-ui/x-grid-modules';
import { GridComponent, GridComponentProps, classnames } from '../../_modules_/grid';

// TODO: Refactor to import when moving to material-ui v5
const chainPropTypes = require('@material-ui/utils').chainPropTypes;
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved

const FORCED_PROPS: Partial<GridComponentProps> = {
disableColumnResize: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/data-grid/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from '@material-ui/x-grid-modules';
export * from '../../_modules_';
export * from './DataGrid';
22 changes: 0 additions & 22 deletions packages/grid/data-grid/tsconfig.build.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
preset: 'ts-jest',
rootDir: './',
rootDir: './_modules_',
testEnvironment: 'node',
transform: {
'^.+\\.(t|j)sx?$': 'ts-jest',
Expand Down
13 changes: 13 additions & 0 deletions packages/grid/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"private": true,
"scripts": {
"build:data-grid": "rollup --config rollup.data-grid.config.js",
"build:x": "rollup --config rollup.x-grid.config.js",
"build": "yarn build:data-grid && yarn build:x",
"start": "rollup -cw",
"start:x": "rollup -w --config rollup.x-grid.config.js",
"test:modules": "../../node_modules/.bin/jest --config jest.config.js",
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js"
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
import resolve from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import cleaner from 'rollup-plugin-cleaner';
import sourceMaps from 'rollup-plugin-sourcemaps';
import { terser } from 'rollup-plugin-terser';
import dts from 'rollup-plugin-dts';
import command from 'rollup-plugin-command';
import pkg from './package.json';
import pkg from './data-grid/package.json';

// dev build if watching, prod build if not
const production = !process.env.ROLLUP_WATCH;
export default [
{
input: 'src/index.ts',
input: './data-grid/src/index.ts',
output: [
{
file: 'dist/index-esm.js',
file: './data-grid/dist/index-esm.js',
format: 'esm',
sourcemap: !production,
},
{
file: 'dist/index-cjs.js',
file: './data-grid/dist/index-cjs.js',
format: 'cjs',
sourcemap: !production,
},
],

external: [...Object.keys(pkg.peerDependencies || {})],
plugins: [
resolve({
resolveOnly: [/^@material-ui\/x-.*$/], // we bundle x-license and x-grid-modules
}),
production &&
cleaner({
targets: ['./dist/'],
targets: ['./data-grid/dist/'],
}),
typescript({ tsconfig: 'tsconfig.build.json' }),
!production && sourceMaps(),
production && terser(),
],
},
{
input: './dist/index.d.ts',
output: [{ file: 'dist/data-grid.d.ts', format: 'es' }],
input: './data-grid/dist/data-grid/src/index.d.ts',
output: [{ file: './data-grid/dist/data-grid.d.ts', format: 'es' }],
plugins: [
dts(),
command(
`cat ../x-grid-modules/dist/x-grid-modules.d.ts ./dist/data-grid.d.ts > ./dist/data-grid.all.d.ts`,
{
exitOnFail: true,
wait: true,
},
),
!production && sourceMaps(),
production &&
command(
[
`rm -rf ./data-grid/dist/data-grid/`,
`rm -rf ./data-grid/dist/_modules_ `,
`rm -rf ./data-grid/dist/x-grid`,
],
{
exitOnFail: true,
wait: true,
},
),
],
},
];
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import typescript from 'rollup-plugin-typescript2';
import { generateReleaseInfo } from '@material-ui/x-license';
import replace from '@rollup/plugin-replace';
import typescript from 'rollup-plugin-typescript2';
import cleaner from 'rollup-plugin-cleaner';
import sourceMaps from 'rollup-plugin-sourcemaps';
import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import dts from 'rollup-plugin-dts';
import command from 'rollup-plugin-command';
import pkg from './package.json';
import pkg from './x-grid/package.json';

// dev build if watching, prod build if not
const production = !process.env.ROLLUP_WATCH;
export default [
{
input: 'src/index.ts',
input: './x-grid/src/index.ts',
output: [
{
file: 'dist/index-esm.js',
file: './x-grid/dist/index-esm.js',
format: 'esm',
sourcemap: !production,
},
{
file: 'dist/index-cjs.js',
file: './x-grid/dist/index-cjs.js',
format: 'cjs',
sourcemap: !production,
},
Expand All @@ -32,28 +31,33 @@ export default [
replace({
__RELEASE_INFO__: generateReleaseInfo(),
}),
resolve({
resolveOnly: [/^@material-ui\/x-.*$/], // we bundle x-license and x-grid-modules
}),
production &&
cleaner({
targets: ['./dist/'],
targets: ['./x-grid/dist/'],
}),
typescript(),
typescript({ tsconfig: 'tsconfig.build.json' }),
!production && sourceMaps(),
production && terser(),
],
},
{
input: './dist/index.d.ts',
output: [{ file: 'dist/x-grid.d.ts', format: 'es' }],
input: './x-grid/dist/x-grid/src/index.d.ts',
output: [{ file: './x-grid/dist/x-grid.d.ts', format: 'es' }],
plugins: [
dts(),
command(
`cat ../../x-license/dist/x-license.d.ts ../x-grid-modules/dist/x-grid-modules.d.ts ./dist/x-grid.d.ts > ./dist/x-grid.all.d.ts`,
{ exitOnFail: true, wait: true },
!production && sourceMaps(),
),
!production && sourceMaps(),
production &&
command(
[
`rm -rf ./x-grid/dist/x-grid`,
`rm -rf ./x-grid/dist/_modules_`,
`rm -rf ./x-grid/dist/data-grid`,
],
{
exitOnFail: true,
wait: true,
},
),
],
},
];
27 changes: 27 additions & 0 deletions packages/grid/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"baseUrl": "./",
"declaration": true,
"declarationDir": "./dist",
"module": "es6",
"noImplicitAny": false,
"strict": true,
"outDir": "./dist",
"target": "es6",
"sourceMap": true,
"lib": ["dom", "dom.iterable", "esnext", "ES6"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react",
"types": ["jest", "node"],
"rootDir": "./"
},
"include": ["./data-grid/src", "./x-grid/src", "./_modules_/**/*"],
"exclude": ["__tests__", "**/*.test.ts", "node_modules"]
}
10 changes: 0 additions & 10 deletions packages/grid/x-grid-modules/jest.config.js

This file was deleted.

Loading