package / lerna config

This commit is contained in:
Richard Ramos 2020-04-03 14:07:30 -04:00
parent 0468ef55c7
commit 0332ffe099
10 changed files with 1030 additions and 81 deletions

View File

@ -17,15 +17,20 @@
"@babel/preset-env": "^7.8.4",
"babel-eslint": "^10.0.3",
"babel-jest": "24.9.0",
"babel-loader": "^8.0.6",
"cross-env": "^7.0.0",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-standard": "^4.0.1",
"find-up": "^4.1.0",
"jest": "24.9.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.1",
"lerna": "^3.20.2"
"lerna": "^3.20.2",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"webpack-bundle-analyzer": "^3.4.1"
},
"dependencies": {
"@babel/runtime": "^7.8.4",
@ -33,10 +38,18 @@
"core-js": "^3.6.4"
},
"scripts": {
"build": "lerna run --parallel 'build'",
"build": "run-s build:packages",
"build:packages": "lerna run --ignore subspace-docs --stream build",
"build:site": "lerna run --scope subspace-docs --stream build",
"clean": "lerna run --parallel clean",
"lerna:bootstrap": "lerna bootstrap",
"bootstrap": "npm-run-all lerna:bootstrap build",
"ganache": "ganache-cli -s 0 -b 5",
"lint": "cross-env eslint 'packages/**/*.js{,x}'"
"lint": "cross-env eslint 'packages/**/*.js{,x}'",
"test": "lerna run --stream test"
},
"engines": {
"node": ">=10.17.0",
"npm": ">=6.11.3",
"yarn": ">=1.19.1"
}
}

3
packages/core/.npmrc Normal file
View File

@ -0,0 +1,3 @@
engine-strict = true
package-lock = false
scripts-prepend-node-path = true

View File

@ -3,7 +3,7 @@ module.exports = api => {
return {
env: {
development: {
node: {
presets: [
[
"@babel/preset-env",

View File

@ -24,17 +24,24 @@
"url": "https://github.com/embarklabs/subspace/issues"
},
"license": "MIT",
"main": "./dist/index.js",
"browser": "./lib/index.js",
"module": "./module/index.js",
"main": "./dist/node/index.js",
"browser": "./dist/browser/index.js",
"module": "./dist/module/index.js",
"types": "types/index.d.ts",
"scripts": {
"clean": "rimraf dist; rimraf lib; rimraf module;",
"build:browser": "cross-env BABEL_ENV=browser babel ./src --out-dir ./lib --source-maps --copy-files",
"build:module": "cross-env BABEL_ENV=module babel ./src --out-dir ./module --source-maps --copy-files",
"build:node": "babel ./src --out-dir ./dist --source-maps --copy-files",
"analyze": "cross-env WEBPACK_ANALYZE=t npm run build:umd",
"clean": "rimraf dist;",
"build": "npm-run-all clean build:*",
"test": "jest"
"build:browser": "cross-env BABEL_ENV=browser babel ./src --out-dir ./dist/browser --source-maps --copy-files",
"build:module": "cross-env BABEL_ENV=module babel ./src --out-dir ./dist/module --source-maps --copy-files",
"build:node": "cross-env BABEL_ENV=node babel ./src --out-dir ./dist/dist/node --source-maps --copy-files",
"build:umd": "cross-env BABEL_ENV=module webpack",
"test": "jest",
"watch": "yarn run-p watch:*",
"watch:node": "yarn run build:node -- --verbose --watch",
"watch:browser": "yarn run build:browser -- --verbose --watch",
"watch:module": "yarn run build:module -- --verbose --watch",
"watch:umd": "yarn run build:umd -- --info-verbosity verbose --watch"
},
"devDependencies": {
"ganache-core": "^2.10.1",
@ -70,5 +77,10 @@
}
]
}
},
"engines": {
"node": ">=10.17.0",
"npm": ">=6.11.3",
"yarn": ">=1.19.1"
}
}

View File

@ -0,0 +1,15 @@
const {join} = require("path");
const {sync: findUp} = require("find-up");
/* eslint-disable import/no-dynamic-require */
const config = require(
findUp("webpack.config.js", {cwd: join(__dirname, '..')})
);
config.entry = join(__dirname, "src/index.js");
config.output.filename = "subspace.min.js";
config.output.path = __dirname + "/dist/umd/";
config.output.library = "Subspace";
config.output.libraryExport = "default";
module.exports = config;

View File

@ -3,7 +3,7 @@ module.exports = api => {
return {
env: {
development: {
node: {
presets: [
[
"@babel/preset-env",

View File

@ -25,15 +25,23 @@
},
"license": "MIT",
"types": "types/index.d.ts",
"main": "./dist/index.js",
"browser": "./lib/index.js",
"module": "./module/index.js",
"main": "./dist/node/index.js",
"browser": "./dist/browser/index.js",
"module": "./dist/module/index.js",
"scripts": {
"clean": "rimraf lib; rimraf module;",
"build:browser": "cross-env BABEL_ENV=browser babel ./src --out-dir ./lib --source-maps --copy-files",
"build:module": "cross-env BABEL_ENV=module babel ./src --out-dir ./module --source-maps --copy-files",
"build:node": "babel ./src --out-dir ./dist --source-maps --copy-files",
"build": "npm-run-all clean build:*"
"analyze": "cross-env WEBPACK_ANALYZE=t npm run build:umd",
"clean": "rimraf dist;",
"build": "npm-run-all clean build:*",
"build:browser": "cross-env BABEL_ENV=browser babel ./src --out-dir ./dist/browser --source-maps --copy-files",
"build:module": "cross-env BABEL_ENV=module babel ./src --out-dir ./dist/module --source-maps --copy-files",
"build:node": "cross-env BABEL_ENV=node babel ./src --out-dir ./dist/dist/node --source-maps --copy-files",
"build:umd": "cross-env BABEL_ENV=module webpack",
"test": "jest",
"watch": "yarn run-p watch:*",
"watch:node": "yarn run build:node -- --verbose --watch",
"watch:browser": "yarn run build:browser -- --verbose --watch",
"watch:module": "yarn run build:module -- --verbose --watch",
"watch:umd": "yarn run build:umd -- --info-verbosity verbose --watch"
},
"devDependencies": {
"react": "^16.9.0",

View File

@ -0,0 +1,33 @@
const {join} = require("path");
const {sync: findUp} = require("find-up");
/* eslint-disable import/no-dynamic-require */
const config = require(
findUp("webpack.config.js", {cwd: join(__dirname, '..')})
);
config.externals = {
"@embarklabs/subspace": "Subspace",
react: {
commonjs: 'react',
commonjs2: 'react',
amd: 'React',
root: 'React',
},
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react-dom',
amd: 'ReactDOM',
root: 'ReactDOM',
}
};
// TODO: set subspace as a dependency
config.entry = join(__dirname, "src/index.js");
config.output.filename = "subspace-react.min.js";
config.output.path = __dirname + "/dist/umd/";
config.output.library = "SubspaceReact";
config.output.libraryExport = "default";
module.exports = config;

47
webpack.config.js Normal file
View File

@ -0,0 +1,47 @@
const {BundleAnalyzerPlugin} = require("webpack-bundle-analyzer");
const config = {
devtool: "source-map",
/* entry: ..., */
mode: "production",
module: {
rules: [
{
test: /\.js?$/,
exclude: /(node_modules)/,
use: [
{
loader: "babel-loader",
options: {
rootMode: "upward"
}
}
]
}
]
},
output: {
/* filename: ..., */
globalObject: "this",
/* path: ..., */
/* library: ..., */
libraryTarget: "umd"
},
plugins: [],
resolve: {
extensions: [
// webpack defaults
// see: https://webpack.js.org/configuration/resolve/#resolveextensions
".wasm", ".mjs", ".js", ".json",
// additional extensions
".jsx"
]
},
target: "web",
};
if (process.env.WEBPACK_ANALYZE) {
config.plugins.push(new BundleAnalyzerPlugin());
}
module.exports = config;

936
yarn.lock

File diff suppressed because it is too large Load Diff