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

Update the build structure #1122

Merged
merged 6 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ When writing docs, make sure your updates are writtern in `versioned_docs/{versi

## Publishing

1. `lerna publish`
1. `npm run publish`
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"lint": "eslint packages/**/*.ts",
"postinstall": "npm run prepare",
"prepare": "husky install"
"prepare": "husky install",
"publish": "lerna publish --contents dist"
},
"private": true,
"workspaces": [
Expand Down
2 changes: 2 additions & 0 deletions packages/datx-jsonapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"jest": "^28.1.1",
"lodash": "^4.17.21",
"rollup": "^2.75.6",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.22",
"rollup-plugin-generate-package-json": "^3.2.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^28.0.4",
"tslib": "~2.4.0",
Expand Down
40 changes: 21 additions & 19 deletions packages/datx-jsonapi/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import excludeDependenciesFromBundle from 'rollup-plugin-exclude-dependencies-from-bundle';
import generatePackageJson from 'rollup-plugin-generate-package-json';
import copy from 'rollup-plugin-copy';

import pkg from './package.json';

export default [
{
input: './src/index.ts',
output: [{ file: pkg.main, format: 'cjs' }],
output: [
{ file: pkg.main, format: 'cjs', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
plugins: [
resolve(),
commonjs(),
Expand All @@ -28,24 +33,21 @@ export default [
comments: false,
},
}),
],
onwarn(warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
},
{
input: './src/index.ts',
output: [{ file: pkg.module, format: 'es' }],
plugins: [
resolve(),
commonjs(),
excludeDependenciesFromBundle(),
typescript({
typescript: require('typescript'),
tslib: require('tslib'),
tsconfig: './tsconfig.build.json',
generatePackageJson({
outputFolder: 'dist',
baseContents: (pack) => ({
...pack,
main: './index.cjs.js',
module: './index.esm.js',
typings: './index.d.ts',
jest: undefined,
scripts: undefined,
devDependencies: {},
husky: undefined,
}),
}),
copy({
targets: [{ src: 'README.md', dest: 'dist' }],
}),
],
onwarn(warning, rollupWarn) {
Expand Down
2 changes: 2 additions & 0 deletions packages/datx-network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"@types/react": "^18.0.12",
"jest": "^28.1.1",
"rollup": "^2.75.6",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.22",
"rollup-plugin-generate-package-json": "^3.2.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^28.0.4",
"tslib": "~2.4.0",
Expand Down
40 changes: 21 additions & 19 deletions packages/datx-network/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import excludeDependenciesFromBundle from 'rollup-plugin-exclude-dependencies-from-bundle';
import generatePackageJson from 'rollup-plugin-generate-package-json';
import copy from 'rollup-plugin-copy';

import pkg from './package.json';

export default [
{
input: './src/index.ts',
output: [{ file: pkg.main, format: 'cjs' }],
output: [
{ file: pkg.main, format: 'cjs', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
plugins: [
resolve(),
commonjs(),
Expand All @@ -28,24 +33,21 @@ export default [
comments: false,
},
}),
],
onwarn(warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
},
{
input: './src/index.ts',
output: [{ file: pkg.module, format: 'es' }],
plugins: [
resolve(),
commonjs(),
excludeDependenciesFromBundle(),
typescript({
typescript: require('typescript'),
tslib: require('tslib'),
tsconfig: './tsconfig.build.json',
generatePackageJson({
outputFolder: 'dist',
baseContents: (pack) => ({
...pack,
main: './index.cjs.js',
module: './index.esm.js',
typings: './index.d.ts',
jest: undefined,
scripts: undefined,
devDependencies: {},
husky: undefined,
}),
}),
copy({
targets: [{ src: 'README.md', dest: 'dist' }],
}),
],
onwarn(warning, rollupWarn) {
Expand Down
1 change: 1 addition & 0 deletions packages/datx-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"mobx": "^6.6.0",
"rollup": "^2.75.6",
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.22",
"rollup-plugin-generate-package-json": "^3.2.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^28.0.4",
"tslib": "~2.4.0",
Expand Down
36 changes: 17 additions & 19 deletions packages/datx-utils/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import excludeDependenciesFromBundle from 'rollup-plugin-exclude-dependencies-from-bundle';
import generatePackageJson from 'rollup-plugin-generate-package-json';

import pkg from './package.json';

export default [
{
input: './src/index.ts',
output: [{ file: pkg.main, format: 'cjs' }],
output: [
{ file: pkg.main, format: 'cjs', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
plugins: [
resolve(),
commonjs(),
Expand All @@ -28,24 +32,18 @@ export default [
comments: false,
},
}),
],
onwarn(warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
},
{
input: './src/index.ts',
output: [{ file: pkg.module, format: 'es' }],
plugins: [
resolve(),
commonjs(),
excludeDependenciesFromBundle(),
typescript({
typescript: require('typescript'),
tslib: require('tslib'),
tsconfig: './tsconfig.build.json',
generatePackageJson({
outputFolder: 'dist',
baseContents: (pack) => ({
...pack,
main: './index.cjs.js',
module: './index.esm.js',
typings: './index.d.ts',
jest: undefined,
scripts: undefined,
devDependencies: {},
husky: undefined,
}),
}),
],
onwarn(warning, rollupWarn) {
Expand Down
2 changes: 2 additions & 0 deletions packages/datx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"@types/node": "^18.7.6",
"jest": "^28.1.1",
"rollup": "^2.75.6",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.22",
"rollup-plugin-generate-package-json": "^3.2.0",
"ts-jest": "^28.0.4",
"tslib": "~2.4.0",
"typescript": "~4.7.3"
Expand Down
42 changes: 22 additions & 20 deletions packages/datx/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import excludeDependenciesFromBundle from 'rollup-plugin-exclude-dependencies-from-bundle';
import generatePackageJson from 'rollup-plugin-generate-package-json';
import copy from 'rollup-plugin-copy';

import pkg from './package.json';

export default [
{
input: './src/index.ts',
output: [{ file: pkg.main, format: 'cjs' }],
output: [
{ file: pkg.main, format: 'cjs', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
plugins: [
resolve(),
commonjs(),
Expand All @@ -28,24 +33,21 @@ export default [
comments: false,
},
}),
],
onwarn(warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
},
{
input: './src/index.ts',
output: [{ file: pkg.module, format: 'es' }],
plugins: [
resolve(),
commonjs(),
excludeDependenciesFromBundle(),
typescript({
typescript: require('typescript'),
tslib: require('tslib'),
tsconfig: './tsconfig.build.json',
generatePackageJson({
outputFolder: 'dist',
baseContents: (pack) => ({
...pack,
main: './index.cjs.js',
module: './index.esm.js',
typings: './index.d.ts',
jest: undefined,
scripts: undefined,
devDependencies: {},
husky: undefined,
}),
}),
copy({
targets: [{ src: 'README.md', dest: 'dist' }],
}),
],
onwarn(warning, rollupWarn) {
Expand All @@ -56,7 +58,7 @@ export default [
},
{
input: './src/disable-mobx.ts',
output: [{ file: './disable-mobx.js', format: 'cjs' }],
output: [{ file: './dist/disable-mobx.js', format: 'cjs' }],
plugins: [
resolve(),
commonjs(),
Expand Down
Loading