[mobile] added f7 build scripts
This commit is contained in:
parent
480f07e289
commit
1d6730f65d
12
vendor/framework7-react/babel.config.js
vendored
Normal file
12
vendor/framework7-react/babel.config.js
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
'@babel/preset-react',
|
||||||
|
['@babel/preset-env', {
|
||||||
|
modules: false,
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'@babel/plugin-transform-runtime',
|
||||||
|
'@babel/plugin-syntax-dynamic-import',
|
||||||
|
],
|
||||||
|
};
|
36
vendor/framework7-react/build/build.js
vendored
Normal file
36
vendor/framework7-react/build/build.js
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const ora = require('ora');
|
||||||
|
const rm = require('rimraf');
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const config = require('./webpack.config.js');
|
||||||
|
|
||||||
|
const env = process.env.NODE_ENV || 'development';
|
||||||
|
const target = process.env.TARGET || 'web';
|
||||||
|
const isCordova = target === 'cordova'
|
||||||
|
|
||||||
|
const spinner = ora(env === 'production' ? 'building for production...' : 'building development version...');
|
||||||
|
spinner.start();
|
||||||
|
|
||||||
|
rm(isCordova ? './cordova/www' : './www/', (removeErr) => {
|
||||||
|
if (removeErr) throw removeErr;
|
||||||
|
|
||||||
|
webpack(config, (err, stats) => {
|
||||||
|
if (err) throw err;
|
||||||
|
spinner.stop();
|
||||||
|
|
||||||
|
process.stdout.write(`${stats.toString({
|
||||||
|
colors: true,
|
||||||
|
modules: false,
|
||||||
|
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
||||||
|
chunks: false,
|
||||||
|
chunkModules: false,
|
||||||
|
})}\n\n`);
|
||||||
|
|
||||||
|
if (stats.hasErrors()) {
|
||||||
|
console.log(chalk.red('Build failed with errors.\n'));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(chalk.cyan('Build complete.\n'));
|
||||||
|
});
|
||||||
|
});
|
192
vendor/framework7-react/build/webpack.config.js
vendored
Normal file
192
vendor/framework7-react/build/webpack.config.js
vendored
Normal file
|
@ -0,0 +1,192 @@
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||||
|
|
||||||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
|
||||||
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
|
const WorkboxPlugin = require('workbox-webpack-plugin');
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
function resolvePath(dir) {
|
||||||
|
return path.join(__dirname, '..', dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
const env = process.env.NODE_ENV || 'development';
|
||||||
|
const target = process.env.TARGET || 'web';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: env,
|
||||||
|
entry: {
|
||||||
|
app: '../../apps/documenteditor/mobile/src/js/app.js',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: resolvePath('../../apps/documenteditor/mobile'), // path above depends on it
|
||||||
|
filename: 'dist/js/[name].js', // in such form will be injected in index.html
|
||||||
|
chunkFilename: 'dist/js/[name].js',
|
||||||
|
publicPath: '',
|
||||||
|
hotUpdateChunkFilename: 'hot/hot-update.js',
|
||||||
|
hotUpdateMainFilename: 'hot/hot-update.json',
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.jsx', '.json'],
|
||||||
|
alias: {
|
||||||
|
'@': resolvePath('../../apps/documenteditor/mobile/src'),
|
||||||
|
},
|
||||||
|
modules: [path.resolve(__dirname, '..', 'node_modules'), 'node_modules'],
|
||||||
|
},
|
||||||
|
watch: true,
|
||||||
|
watchOptions: {
|
||||||
|
aggregateTimeout: 600,
|
||||||
|
poll: 1000,
|
||||||
|
},
|
||||||
|
externals: {
|
||||||
|
jquery: 'jQuery'
|
||||||
|
},
|
||||||
|
|
||||||
|
devtool: env === 'production' ? 'source-map' : 'source-map',
|
||||||
|
optimization: {
|
||||||
|
minimizer: [new TerserPlugin({
|
||||||
|
sourceMap: true,
|
||||||
|
})],
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(mjs|js|jsx)$/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
include: [
|
||||||
|
resolvePath('../../apps/documenteditor/mobile/src'),
|
||||||
|
resolvePath('node_modules/framework7'),
|
||||||
|
|
||||||
|
resolvePath('node_modules/framework7-react'),
|
||||||
|
|
||||||
|
resolvePath('node_modules/template7'),
|
||||||
|
resolvePath('node_modules/dom7'),
|
||||||
|
resolvePath('node_modules/ssr-window'),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: [
|
||||||
|
(env === 'development' ? 'style-loader' : {
|
||||||
|
loader: MiniCssExtractPlugin.loader,
|
||||||
|
options: {
|
||||||
|
publicPath: '../'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
'css-loader',
|
||||||
|
{
|
||||||
|
loader: 'postcss-loader',
|
||||||
|
options: {
|
||||||
|
config: {
|
||||||
|
path: path.resolve(__dirname, '..'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.less$/,
|
||||||
|
use: [
|
||||||
|
(env === 'development' ? 'style-loader' : {
|
||||||
|
loader: MiniCssExtractPlugin.loader,
|
||||||
|
options: {
|
||||||
|
publicPath: '../'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
'css-loader',
|
||||||
|
{
|
||||||
|
loader: 'postcss-loader',
|
||||||
|
options: {
|
||||||
|
config: {
|
||||||
|
path: path.resolve(__dirname, '..'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
name: 'images/[name].[ext]',
|
||||||
|
outputPath: '../../../apps/documenteditor/mobile/dist',
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
name: 'fonts/[name].[ext]',
|
||||||
|
outputPath: '../../../apps/documenteditor/mobile/dist/assets',
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(env),
|
||||||
|
'process.env.TARGET': JSON.stringify(target),
|
||||||
|
}),
|
||||||
|
|
||||||
|
...(env === 'production' ? [
|
||||||
|
new OptimizeCSSPlugin({
|
||||||
|
cssProcessorOptions: {
|
||||||
|
safe: true,
|
||||||
|
map: { inline: false },
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||||
|
] : [
|
||||||
|
// Development only plugins
|
||||||
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
|
new webpack.NamedModulesPlugin(),
|
||||||
|
]),
|
||||||
|
// new CleanWebpackPlugin(),
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
filename: '../../../apps/documenteditor/mobile/index.html',
|
||||||
|
template: '../../apps/documenteditor/mobile/src/index_dev.html',
|
||||||
|
inject: true,
|
||||||
|
minify: env === 'production' ? {
|
||||||
|
collapseWhitespace: true,
|
||||||
|
removeComments: true,
|
||||||
|
removeRedundantAttributes: true,
|
||||||
|
removeScriptTypeAttributes: true,
|
||||||
|
removeStyleLinkTypeAttributes: true,
|
||||||
|
useShortDoctype: true
|
||||||
|
} : false,
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: 'css/[name].css',
|
||||||
|
}),
|
||||||
|
new CopyWebpackPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
noErrorOnMissing: true,
|
||||||
|
from: resolvePath('src/static'),
|
||||||
|
to: resolvePath('www/static'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
noErrorOnMissing: true,
|
||||||
|
from: resolvePath('src/manifest.json'),
|
||||||
|
to: resolvePath('www/manifest.json'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
68
vendor/framework7-react/package.json
vendored
Normal file
68
vendor/framework7-react/package.json
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
{
|
||||||
|
"name": "documenteditor",
|
||||||
|
"private": true,
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "DocumentEditor",
|
||||||
|
"repository": "",
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"scripts": {
|
||||||
|
"start": "npm run dev",
|
||||||
|
"dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js",
|
||||||
|
"build-dev": "cross-env NODE_ENV=development node ./build/build.js",
|
||||||
|
"build-prod": "cross-env NODE_ENV=production node ./build/build.js",
|
||||||
|
"postinstall": "cpy ./node_modules/framework7-icons/fonts/*.* ./src/fonts/"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"Android >= 7",
|
||||||
|
"IOS >= 11",
|
||||||
|
"Safari >= 11",
|
||||||
|
"Chrome >= 49",
|
||||||
|
"Firefox >= 31",
|
||||||
|
"Samsung >= 5"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"dom7": "^2.1.5",
|
||||||
|
"framework7": "^5.7.10",
|
||||||
|
"framework7-icons": "^3.0.1",
|
||||||
|
"framework7-react": "^5.7.10",
|
||||||
|
"i18next": "^19.6.3",
|
||||||
|
"i18next-fetch-backend": "^3.0.0",
|
||||||
|
"prop-types": "^15.7.2",
|
||||||
|
"react": "^16.13.1",
|
||||||
|
"react-dom": "^16.13.1",
|
||||||
|
"react-i18next": "^11.7.0",
|
||||||
|
"template7": "^1.4.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.11.0",
|
||||||
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||||
|
"@babel/plugin-transform-runtime": "^7.11.0",
|
||||||
|
"@babel/preset-env": "^7.11.0",
|
||||||
|
"@babel/preset-react": "^7.10.4",
|
||||||
|
"@babel/runtime": "^7.11.0",
|
||||||
|
"babel-loader": "^8.1.0",
|
||||||
|
"chalk": "^4.1.0",
|
||||||
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
|
"copy-webpack-plugin": "^6.0.3",
|
||||||
|
"cpy-cli": "^3.1.1",
|
||||||
|
"cross-env": "^7.0.2",
|
||||||
|
"css-loader": "^4.2.0",
|
||||||
|
"file-loader": "^6.0.0",
|
||||||
|
"html-webpack-plugin": "^4.3.0",
|
||||||
|
"less": "^3.12.2",
|
||||||
|
"less-loader": "^6.2.0",
|
||||||
|
"mini-css-extract-plugin": "^0.9.0",
|
||||||
|
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
||||||
|
"ora": "^4.0.5",
|
||||||
|
"postcss-loader": "^3.0.0",
|
||||||
|
"postcss-preset-env": "^6.7.0",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"style-loader": "^1.2.1",
|
||||||
|
"terser-webpack-plugin": "^3.1.0",
|
||||||
|
"url-loader": "^4.1.0",
|
||||||
|
"webpack": "^4.44.1",
|
||||||
|
"webpack-cli": "^3.3.12",
|
||||||
|
"webpack-dev-server": "^3.11.0",
|
||||||
|
"workbox-webpack-plugin": "^5.1.3"
|
||||||
|
}
|
||||||
|
}
|
5
vendor/framework7-react/postcss.config.js
vendored
Normal file
5
vendor/framework7-react/postcss.config.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports = (ctx) => ({
|
||||||
|
plugins: {
|
||||||
|
'postcss-preset-env': {},
|
||||||
|
},
|
||||||
|
});
|
Loading…
Reference in a new issue