parent
6daa1120e0
commit
6d416b260a
@ -1,32 +0,0 @@ |
||||
export default { |
||||
babelrc: false, |
||||
runtimeHelpers: true, |
||||
presets: [ |
||||
[ |
||||
'@babel/env', |
||||
{ |
||||
modules: false, |
||||
targets: { |
||||
browsers: ['>0.25%'], |
||||
}, |
||||
useBuiltIns: 'usage', |
||||
}, |
||||
], |
||||
'@babel/typescript', |
||||
], |
||||
plugins: [ |
||||
['@babel/transform-runtime'], |
||||
'@babel/proposal-object-rest-spread', |
||||
'@babel/proposal-export-default-from', |
||||
'@babel/proposal-export-namespace-from', |
||||
[ |
||||
'@babel/plugin-proposal-decorators', |
||||
{ |
||||
legacy: true, |
||||
}, |
||||
], |
||||
'@babel/proposal-class-properties', |
||||
'add-module-exports', |
||||
], |
||||
exclude: 'packages/**/node_modules/**', |
||||
}; |
@ -1,31 +0,0 @@ |
||||
export default { |
||||
babelrc: false, |
||||
// runtimeHelpers: true,
|
||||
presets: [ |
||||
[ |
||||
'@babel/env', |
||||
{ |
||||
modules: false, |
||||
targets: { |
||||
node: 'current' |
||||
} |
||||
} |
||||
] |
||||
], |
||||
|
||||
plugins: [ |
||||
// ['@babel/transform-runtime'],
|
||||
'@babel/proposal-object-rest-spread', |
||||
'@babel/proposal-export-default-from', |
||||
'@babel/proposal-export-namespace-from', |
||||
[ |
||||
'@babel/plugin-proposal-decorators', |
||||
{ |
||||
legacy: true |
||||
} |
||||
], |
||||
'@babel/proposal-class-properties', |
||||
'add-module-exports' |
||||
], |
||||
exclude: 'packages/**/node_modules/**' |
||||
} |
@ -1,18 +0,0 @@ |
||||
module.exports = { |
||||
babelrc: false, |
||||
presets: ['@babel/env'], |
||||
plugins: [ |
||||
['@babel/transform-runtime'], |
||||
'@babel/proposal-object-rest-spread', |
||||
'@babel/proposal-export-default-from', |
||||
'@babel/proposal-export-namespace-from', |
||||
[ |
||||
'@babel/plugin-proposal-decorators', |
||||
{ |
||||
legacy: true |
||||
} |
||||
], |
||||
'@babel/proposal-class-properties', |
||||
'add-module-exports' |
||||
] |
||||
} |
@ -1,19 +0,0 @@ |
||||
module.exports = { |
||||
babelrc: false, |
||||
presets: ['@babel/env'], |
||||
plugins: [ |
||||
['@babel/transform-runtime'], |
||||
'@babel/proposal-object-rest-spread', |
||||
'@babel/proposal-export-default-from', |
||||
'@babel/proposal-export-namespace-from', |
||||
[ |
||||
'@babel/plugin-proposal-decorators', |
||||
{ |
||||
legacy: true |
||||
} |
||||
], |
||||
'@babel/proposal-class-properties', |
||||
'add-module-exports' |
||||
], |
||||
sourceMaps: 'inline' |
||||
} |
@ -1,9 +0,0 @@ |
||||
export default [ |
||||
'harmony-core', |
||||
'harmony-utils', |
||||
'harmony-crypto', |
||||
'harmony-account', |
||||
'harmony-contract', |
||||
'harmony-network', |
||||
'harmony-transaction', |
||||
]; |
@ -1,9 +0,0 @@ |
||||
module.exports = [ |
||||
{ name: 'HarmonyJs', dest: 'harmony-core' }, |
||||
{ name: 'HarmonyNetwork', dest: 'harmony-network' }, |
||||
{ name: 'HarmonyUtils', dest: 'harmony-utils' }, |
||||
{ name: 'HarmonyCrypto', dest: 'harmony-crypto' }, |
||||
{ name: 'HarmonyContract', dest: 'harmony-contract' }, |
||||
{ name: 'HarmonyAccount', dest: 'harmony-account' }, |
||||
{ name: 'HarmonyTransaction', dest: 'harmony-transaction' }, |
||||
]; |
@ -1,166 +0,0 @@ |
||||
import * as path from 'path'; |
||||
import * as fs from 'fs'; |
||||
import * as rollup from 'rollup'; |
||||
import alias from 'rollup-plugin-alias'; |
||||
import babel from 'rollup-plugin-babel'; |
||||
import commonjs from 'rollup-plugin-commonjs'; |
||||
import license from 'rollup-plugin-license'; |
||||
import json from 'rollup-plugin-json'; |
||||
import globals from 'rollup-plugin-node-globals'; |
||||
import resolve from 'rollup-plugin-node-resolve'; |
||||
import typescript2 from 'rollup-plugin-typescript2'; |
||||
import camelCase from 'camelcase'; |
||||
|
||||
import ts from 'typescript'; |
||||
import packages from '../packages'; |
||||
import browserConfig from '../babel/babel.browser.config.js'; |
||||
import { getKeys } from './getDependencies'; |
||||
import { |
||||
rootPath, |
||||
includesPath, |
||||
packagesPath, |
||||
projects, |
||||
preProcessFunc, |
||||
preProcessProjects, |
||||
} from '../projects'; |
||||
|
||||
async function bundles() { |
||||
await preProcessFunc(preProcessProjects); |
||||
|
||||
for (const pkg of projects) { |
||||
const externals = projects |
||||
.filter((p) => p.name !== pkg.name) |
||||
.map((p) => p.scopedName); |
||||
|
||||
const base = { |
||||
input: path.join(pkg.src, 'index.ts'), |
||||
plugins: [ |
||||
alias({ |
||||
elliptic: path.resolve( |
||||
__dirname, |
||||
'../', |
||||
'includes/elliptic/elliptic.js', |
||||
), |
||||
}), |
||||
resolve({ |
||||
browser: true, |
||||
jsnext: true, |
||||
preferBuiltins: true, |
||||
}), |
||||
// babel(browserConfig),
|
||||
globals(), |
||||
commonjs(), |
||||
json(), |
||||
typescript2({ |
||||
typescript: ts, // ensure we're using the same typescript (3.x) for rollup as for regular builds etc
|
||||
tsconfig: `${packagesPath}/${p.name}/tsconfig.json`, |
||||
tsconfigOverride: { |
||||
module: 'esnext', |
||||
stripInternal: true, |
||||
emitDeclarationOnly: false, |
||||
composite: false, |
||||
declaration: false, |
||||
declarationMap: false, |
||||
sourceMap: true, |
||||
}, |
||||
}), |
||||
license({ |
||||
banner: `Test Banner`, |
||||
}), |
||||
], |
||||
external: projects |
||||
.filter((p) => p.name !== pkg.name) |
||||
.map((p) => p.scopedName) |
||||
.concat(['cross-fetch']), |
||||
}; |
||||
|
||||
const pkgBundler = await rollup.rollup(base); |
||||
|
||||
await pkgBundler.write({ |
||||
file: pkg.esm, |
||||
name: pkg.globalName, |
||||
format: 'esm', |
||||
sourcemap: true, |
||||
}); |
||||
await bundle.write({ |
||||
file: pkg.umd, |
||||
exports: 'named', |
||||
name: pkg.globalName, |
||||
globals: { |
||||
...projects.reduce((g, pkg) => { |
||||
g[pkg.scopedName] = pkg.globalName; |
||||
return g; |
||||
}, {}), |
||||
tslib: 'tslib', |
||||
}, |
||||
format: 'umd', |
||||
sourcemap: true, |
||||
}); |
||||
} |
||||
|
||||
// return projects.map((p) => {
|
||||
// const external = getKeys(p.name).filter(
|
||||
// (pkg) => !pkg.startsWith('@harmony'),
|
||||
// );
|
||||
// const externalSetting = getKeys(p.name).length > 0 ? { external } : {};
|
||||
// const externalObject = external.reduce((g, pkg) => {
|
||||
// g[`${pkg}`] = !pkg.startsWith('@harmony')
|
||||
// ? pkg
|
||||
// : `@harmony/${p.name.replace('harmony-', '')}`;
|
||||
// return g;
|
||||
// }, {});
|
||||
|
||||
// const normal = {
|
||||
// input: `packages/${p.name}/src/index.ts`,
|
||||
// plugins: [
|
||||
// alias({
|
||||
// elliptic: path.resolve(
|
||||
// __dirname,
|
||||
// '../',
|
||||
// 'includes/elliptic/elliptic.js',
|
||||
// ),
|
||||
// }),
|
||||
// resolve({
|
||||
// browser: true,
|
||||
// jsnext: true,
|
||||
// preferBuiltins: true,
|
||||
// }),
|
||||
// // babel(browserConfig),
|
||||
// globals(),
|
||||
// commonjs(),
|
||||
// json(),
|
||||
// typescript2({
|
||||
// typescript: ts, // ensure we're using the same typescript (3.x) for rollup as for regular builds etc
|
||||
// tsconfig: `${packagesPath}/${p.name}/tsconfig.json`,
|
||||
// tsconfigOverride: {
|
||||
// module: 'esnext',
|
||||
// stripInternal: true,
|
||||
// emitDeclarationOnly: false,
|
||||
// composite: false,
|
||||
// declaration: false,
|
||||
// declarationMap: false,
|
||||
// sourceMap: true,
|
||||
// },
|
||||
// }),
|
||||
// license({
|
||||
// banner: `Test Banner`,
|
||||
// }),
|
||||
// ],
|
||||
// output: {
|
||||
// file: `packages/${p.name}/dist/index.js`,
|
||||
// exports: 'named',
|
||||
// format: 'umd',
|
||||
// sourcemap: true,
|
||||
// name: camelCase(p.name),
|
||||
// globals: {
|
||||
// ...externalObject,
|
||||
// tslib: 'tslib',
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
// // return normal;
|
||||
// return Object.assign(normal, externalSetting);
|
||||
// });
|
||||
} |
||||
|
||||
export default bundles(); |
@ -1,49 +0,0 @@ |
||||
import babel from 'rollup-plugin-babel' |
||||
import json from 'rollup-plugin-json' |
||||
import license from 'rollup-plugin-license' |
||||
import vuedoc from 'vuepress-jsdoc/cmds/index' |
||||
import packages from '../packages' |
||||
import serverConfig from '../babel/babel.server.config.js' |
||||
import { getKeys } from './getDependencies' |
||||
|
||||
function bundles() { |
||||
return packages.map(p => { |
||||
const external = getKeys(p) |
||||
const externalSetting = getKeys(p).length > 0 ? { external } : {} |
||||
vuedoc.generate({ |
||||
source: `packages/${p}/src`, |
||||
dist: `packages/${p}`, |
||||
folder: 'doc', |
||||
readme: `packages/${p}/README.md` |
||||
}) |
||||
const normal = { |
||||
input: `packages/${p}/src/index.js`, |
||||
output: { |
||||
file: `packages/${p}/node/index.js`, |
||||
format: 'umd', |
||||
name: 'Laksa' |
||||
}, |
||||
plugins: [ |
||||
babel(serverConfig), |
||||
json(), |
||||
license({ |
||||
banner: `This source code is being disclosed to you solely for the purpose of your participation in
|
||||
testing Zilliqa and Laksa. You may view, compile and run the code for that purpose and pursuant to
|
||||
the protocols and algorithms that are programmed into, and intended by, the code. You may
|
||||
not do anything else with the code without express permission from Zilliqa Research Pte. Ltd.,
|
||||
including modifying or publishing the code (or any part of it), and developing or forming
|
||||
another public or private blockchain network. This source code is provided ‘as is’ and no
|
||||
warranties are given as to title or non-infringement, merchantability or fitness for purpose
|
||||
and, to the extent permitted by law, all liability for your use of the code is disclaimed.
|
||||
Some programs in this code are governed by the GNU General Public License v3.0 (available at
|
||||
https://www.gnu.org/licenses/gpl-3.0.en.html) (‘GPLv3’). The programs that are governed by
|
||||
GPLv3.0 are those programs that are located in the folders src/depends and tests/depends
|
||||
and which include a reference to GPLv3 in their program files.` |
||||
}) |
||||
] |
||||
} |
||||
return Object.assign(normal, externalSetting) |
||||
}) |
||||
} |
||||
|
||||
export default bundles() |
@ -1,13 +0,0 @@ |
||||
import fs from 'fs'; |
||||
|
||||
export function getKeys(p) { |
||||
const packageJsonFile = `${process.cwd()}/packages/${p}/package.json`; |
||||
const data = fs.readFileSync(packageJsonFile, 'utf-8'); |
||||
|
||||
const { dependencies } = JSON.parse(data); |
||||
|
||||
const keys = dependencies |
||||
? Object.keys(dependencies) //.filter((d) => !/harmony/.test(d))
|
||||
: []; |
||||
return keys; |
||||
} |
@ -0,0 +1,24 @@ |
||||
// tslint:disable-next-line: no-implicit-dependencies
|
||||
import webpack from 'webpack'; |
||||
// tslint:disable-next-line: no-implicit-dependencies
|
||||
|
||||
import batch from './webpack/webpack.config'; |
||||
|
||||
webpack(batch).run((err, stats) => { |
||||
if (err) { |
||||
console.error(err); |
||||
return; |
||||
} |
||||
console.log( |
||||
stats.toString({ |
||||
all: false, |
||||
modules: false, |
||||
errors: true, |
||||
warnings: false, |
||||
moduleTrace: true, |
||||
errorDetails: true, |
||||
chunks: true, |
||||
colors: true, |
||||
}), |
||||
); |
||||
}); |
@ -0,0 +1,22 @@ |
||||
// tslint:disable-next-line: no-implicit-dependencies
|
||||
import camelCase from 'camelcase'; |
||||
import {packages} from '../packagesTs'; |
||||
|
||||
export interface PackageItem { |
||||
name: string; |
||||
dest: string; |
||||
} |
||||
|
||||
function generatePackageList(rawArray: string[]): PackageItem[] { |
||||
const resultArray: PackageItem[] = []; |
||||
for (const item of rawArray) { |
||||
const name = camelCase(item) |
||||
.replace('har', 'Har') |
||||
.replace('Core', 'Js'); |
||||
const dest = item; |
||||
resultArray.push({name, dest}); |
||||
} |
||||
return resultArray; |
||||
} |
||||
|
||||
export const packageList = generatePackageList(packages); |
Loading…
Reference in new issue