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

New repository for stackedit #1805

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Webpage shows up.
  • Loading branch information
SamTV12345 committed Oct 29, 2022
commit 71071142954601d547dd7e366f5fc0522ff8f3d3
16 changes: 8 additions & 8 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ await import('./check-versions')

process.env.NODE_ENV = 'production'

var ora = require('ora')
var rm = require('rimraf')
var path = require('path')
var chalk = require('chalk')
var webpack = require('webpack')
var config = require('../config')
var webpackConfig = require('./webpack.prod.conf')
const ora = require('ora');
const rm = require('rimraf');
const path = require('path');
const chalk = require('chalk');
const webpack = require('webpack');
const config = require('../config');
const webpackConfig = require('./webpack.prod.conf');

var spinner = ora('building for production...')
const spinner = ora('building for production...');
spinner.start()

rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
Expand Down
37 changes: 19 additions & 18 deletions build/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,34 @@ import index from '../server/index.js'
import connectHistory from 'connect-history-api-fallback'

// default port where dev server listens for incoming traffic
var port = process.env.PORT || config.dev.port
const port = process.env.PORT || config.dev.port;
// automatically open browser, if not set will be false
var autoOpenBrowser = !!config.dev.autoOpenBrowser
const autoOpenBrowser = !!config.dev.autoOpenBrowser;
// Define HTTP proxies to your custom API backend
// https://github.com/chimurai/http-proxy-middleware
var proxyTable = config.dev.proxyTable
const proxyTable = config.dev.proxyTable;

var app = express()
const app = express();


var compiler = webpack(webpackConfig.res)
const compiler = webpack(webpackConfig.res);

// StackEdit custom middlewares
index(app);

var devMiddleware = devMiddlewareFunc(compiler, {
const devMiddleware = devMiddlewareFunc(compiler, {
publicPath: webpackConfig.res.output.publicPath,
})
});

var hotMiddleware = webpackHot(compiler, {
log: () => {}
})
const hotMiddleware = webpackHot(compiler, {
log: () => {
}
});


// proxy api requests
Object.keys(proxyTable).forEach(function (context) {
var options = proxyTable[context]
let options = proxyTable[context];
if (typeof options === 'string') {
options = { target: options }
}
Expand All @@ -63,15 +64,15 @@ app.use(devMiddleware)
app.use(hotMiddleware)

// serve pure static assets
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory);
app.use(staticPath, express.static('./static'))

var uri = 'http:https://localhost:' + port
const uri = 'http:https://localhost:' + port;

var _resolve
var readyPromise = new Promise(resolve => {
_resolve = resolve
})
let _resolve;
const readyPromise = new Promise(resolve => {
_resolve = resolve;
});

console.log('> Starting dev server...')
devMiddleware.waitUntilValid(() => {
Expand All @@ -83,7 +84,7 @@ devMiddleware.waitUntilValid(() => {
_resolve()
})

var server = app.listen(port)
const server = app.listen(port);

export default {
ready: readyPromise,
Expand Down
18 changes: 9 additions & 9 deletions build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ import config from '../config/index.js'
import ExtractTextPlugin from 'extract-text-webpack-plugin'

const assetsPath = function (_path) {
var assetsSubDirectory = process.env.NODE_ENV === 'production'
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
: config.dev.assetsSubDirectory;
return path.posix.join(assetsSubDirectory, _path)
}

const cssLoaders = function (options) {
options = options || {}

var cssLoader = {
const cssLoader = {
loader: 'css-loader',
options: {
minimize: process.env.NODE_ENV === 'production',
sourceMap: options.sourceMap
}
}
};

// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
var loaders = [cssLoader]
const loaders = [cssLoader];
if (loader) {
loaders.push({
loader: loader + '-loader',
Expand Down Expand Up @@ -58,10 +58,10 @@ const cssLoaders = function (options) {

// Generate loaders for standalone style files (outside of .vue)
const styleLoaders = function (options) {
var output = []
var loaders = cssLoaders(options)
for (var extension in loaders) {
var loader = loaders[extension]
const output = [];
const loaders = cssLoaders(options);
for (let extension in loaders) {
const loader = loaders[extension];
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
Expand Down
46 changes: 28 additions & 18 deletions build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
import path from 'path'
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var CopyWebpackPlugin = require('copy-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
var OfflinePlugin = require('offline-plugin');
var WebpackPwaManifest = require('webpack-pwa-manifest')
var FaviconsWebpackPlugin = require('favicons-webpack-plugin')
import webpack from 'webpack';

import utils from './utils';

import config from '../config';

import merge from 'webpack-merge';

import baseWebpackConfig from './webpack.base.conf.js'
import CopyWebpackPlugin from 'copy-webpack-plugin'

import HtmlWebpackPlugin from 'html-webpack-plugin';

import ExtractTextPlugin from 'extract-text-webpack-plugin';

import OptimizeCSSPlugin from 'optimize-css-assets-webpack-plugin';

import OfflinePlugin from 'offline-plugin';

import WebpackPwaManifest from 'webpack-pwa-manifest';

import FaviconsWebpackPlugin from 'favicons-webpack-plugin';

function resolve (dir) {
return path.join(__dirname, '..', dir)
}

var env = config.build.env
const env = config.build.env;

var webpackConfig = merge(baseWebpackConfig, {
const webpackConfig = merge(baseWebpackConfig, {
mode: 'production', //add this line here
module: {
rules: utils.styleLoaders({
Expand Down Expand Up @@ -84,7 +94,7 @@ var webpackConfig = merge(baseWebpackConfig, {
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
);
}
}),
// extract webpack runtime and module manifest to its own file in order to
Expand Down Expand Up @@ -127,10 +137,10 @@ var webpackConfig = merge(baseWebpackConfig, {
externals: ['/', '/app', '/oauth2/callback']
}),
]
})
});

if (config.build.productionGzip) {
var CompressionWebpackPlugin = require('compression-webpack-plugin')
const CompressionWebpackPlugin = require('compression-webpack-plugin');

webpackConfig.plugins.push(
new CompressionWebpackPlugin({
Expand All @@ -148,7 +158,7 @@ if (config.build.productionGzip) {
}

if (config.build.bundleAnalyzerReport) {
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}

Expand Down
21 changes: 21 additions & 0 deletions gulpfile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const gulp = require('gulp')
const path = require('path')
const concat = require('gulp-concat')

const prismScripts = [
'prismjs/components/prism-core',
'prismjs/components/prism-markup',
'prismjs/components/prism-clike',
'prismjs/components/prism-c',
'prismjs/components/prism-javascript',
'prismjs/components/prism-css',
'prismjs/components/prism-ruby',
'prismjs/components/prism-cpp',
].map(require.resolve);

prismScripts.push(
path.join(path.dirname(require.resolve('prismjs/components/prism-core')), 'prism-!(*.min).js'));

gulp.task('build-prism', () => gulp.src(prismScripts)
.pipe(concat('prism.js'))
.pipe(gulp.dest(path.dirname(require.resolve('prismjs')))));
21 changes: 1 addition & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
const path = require('path');
const gulp = require('gulp');
const concat = require('gulp-concat');

const prismScripts = [
'prismjs/components/prism-core',
'prismjs/components/prism-markup',
'prismjs/components/prism-clike',
'prismjs/components/prism-c',
'prismjs/components/prism-javascript',
'prismjs/components/prism-css',
'prismjs/components/prism-ruby',
'prismjs/components/prism-cpp',
].map(require.resolve);
prismScripts.push(
path.join(path.dirname(require.resolve('prismjs/components/prism-core')), 'prism-!(*.min).js'));

gulp.task('build-prism', () => gulp.src(prismScripts)
.pipe(concat('prism.js'))
.pipe(gulp.dest(path.dirname(require.resolve('prismjs')))));
import './gulpfile.cjs'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"clipboard": "^2.0.11",
"compression": "^1.7.4",
"diff-match-patch": "^1.0.5",
"eslint-loader": "^4.0.0",
"file-saver": "^2.0.5",
"google-id-token-verifier": "^0.2.3",
"handlebars": "^4.7.7",
Expand Down Expand Up @@ -84,7 +85,6 @@
"eslint-config-airbnb-base": "^15.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-loader": "^4.0.2",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.11.0",
"eventsource-polyfill": "^0.9.6",
Expand Down
2 changes: 1 addition & 1 deletion server/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function waitForJavaScript() {
if (window.MathJax) {
// Amazon EC2: fix TeX font detection
MathJax.Hub.Register.StartupHook('HTML-CSS Jax Startup', function () {
var htmlCss = MathJax.OutputJax['HTML-CSS'];
const htmlCss = MathJax.OutputJax['HTML-CSS'];
htmlCss.Font.checkWebFont = function (check, font, callback) {
if (check.time(callback)) {
return;
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ if (!localStorage.installPrompted) {
});
}

Vue.config.productionTip = false;
Vue.VueElement.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
new Vue.VueElement({
el: '#app',
store,
render: h => h(App),
});
console.log("Started")
Loading