-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a sample based on webpack->fusebox transition.
- Loading branch information
Showing
12 changed files
with
4,647 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
const Modelkit = require('./lib/modelkit').default; | ||
const modelkitConfig = require('./modelkit.config'); | ||
const randomConfig = require('./samples/random-files/modelkit.config'); | ||
const modelkitConfig = require('./samples/modelkit/modelkit.config'); | ||
|
||
const modelkit = new Modelkit(); | ||
modelkit.run(modelkitConfig); | ||
modelkit.run(randomConfig); | ||
modelkit.run(modelkitConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const { FuseBox, BabelPlugin } = require('fuse-box'); // eslint-disable-line import/no-extraneous-dependencies | ||
|
||
const isProduction = process.env.NODE_ENV === 'production'; | ||
|
||
const fuse = FuseBox.init({ | ||
globals: { modelkit: '*' }, | ||
package: { | ||
name: 'modelkit', | ||
entry: 'src/index.js', | ||
}, | ||
homeDir: 'src', | ||
output: 'lib/$name.js', | ||
plugins: [ | ||
BabelPlugin({ | ||
config: { | ||
sourceMaps: true, | ||
presets: ['env'], | ||
plugins: [ | ||
'lodash', | ||
], | ||
}, | ||
}), | ||
], | ||
}); | ||
|
||
const bundle = fuse.bundle('modelkit') | ||
.instructions('>[index.js]') | ||
.sourceMaps(true); | ||
|
||
if (!isProduction) { | ||
bundle.watch(); | ||
} | ||
|
||
fuse.run(); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "modelkit", | ||
"version": "0.0.2", | ||
"main": "lib/modelkit.js", | ||
"module": "src/index.js", | ||
"author": "Li0liQ <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
"babel-loader": "^7.0.0", | ||
"babel-plugin-lodash": "^3.2.11", | ||
"babel-preset-env": "^1.4.0", | ||
"cross-env": "^4.0.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-airbnb-base": "^11.1.3", | ||
"eslint-plugin-import": "^2.2.0", | ||
"lodash-webpack-plugin": "^0.11.3", | ||
"rimraf": "^2.6.1", | ||
"webpack": "^2.5.1", | ||
"webpack-node-externals": "^1.6.0" | ||
}, | ||
"dependencies": { | ||
"escape-string-regexp": "^1.0.5", | ||
"grasp": "^0.5.0", | ||
"lodash": "^4.17.4", | ||
"mkdirp": "^0.5.1", | ||
"yarn": "^0.23.4" | ||
}, | ||
"scripts": { | ||
"dev": "webpack --progress --colors --watch", | ||
"build": "cross-env NODE_ENV=production webpack", | ||
"lint": "eslint ./src", | ||
"clean": "rimraf ./output" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Li0liQ/modelkit" | ||
}, | ||
"keywords": [ | ||
"config", | ||
"feature", | ||
"flag" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/Li0liQ/modelkit/issues" | ||
}, | ||
"homepage": "https://github.com/Li0liQ/modelkit" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const webpack = require('webpack'); | ||
const path = require('path'); | ||
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); | ||
const nodeExternals = require('webpack-node-externals'); | ||
const libraryName = 'modelkit'; | ||
const outputFile = libraryName + '.js'; | ||
|
||
const config = { | ||
entry: __dirname + '/src/index.js', | ||
devtool: 'source-map', | ||
output: { | ||
path: __dirname + '/lib', | ||
filename: outputFile, | ||
library: libraryName, | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true, | ||
}, | ||
module: { | ||
rules: [{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['env'], | ||
plugins: ['lodash'], | ||
} | ||
} | ||
}] | ||
}, | ||
plugins: [ | ||
new webpack.ContextReplacementPlugin( | ||
/node_modules[\/\\]grasp/, | ||
path.resolve(__dirname, 'node_modules'), | ||
{ | ||
'grasp-equery': 'grasp-equery', | ||
'grasp-squery': 'grasp-squery', | ||
'acorn': 'acorn', | ||
} | ||
), | ||
new LodashModuleReplacementPlugin({ | ||
'collections': true, | ||
'flattening': true, | ||
}), | ||
], | ||
target: 'node', | ||
externals: [nodeExternals()] | ||
}; | ||
|
||
module.exports = config; |
Oops, something went wrong.