mirror of
https://github.com/flarum/framework.git
synced 2025-02-20 22:00:24 +08:00
Webpack (#33)
See https://github.com/flarum/core/pull/1367 * Replace gulp with webpack and npm scripts for JS compilation * Set up Travis CI to commit compiled JS * Restructure `js` directory; only one instance of npm, forum/admin are "submodules" * Restructure `less` directory
This commit is contained in:
parent
87f2966bf9
commit
d1f4d5a739
BIN
extensions/mentions/.deploy.enc
Normal file
BIN
extensions/mentions/.deploy.enc
Normal file
Binary file not shown.
2
extensions/mentions/.gitattributes
vendored
2
extensions/mentions/.gitattributes
vendored
@ -2,4 +2,4 @@
|
||||
.gitignore export-ignore
|
||||
.travis.yml export-ignore
|
||||
|
||||
js/*/dist/*.js -diff
|
||||
js/dist/* -diff
|
||||
|
4
extensions/mentions/.gitignore
vendored
4
extensions/mentions/.gitignore
vendored
@ -2,5 +2,5 @@
|
||||
composer.phar
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
bower_components
|
||||
node_modules
|
||||
node_modules
|
||||
js/dist/*
|
||||
|
15
extensions/mentions/.travis.yml
Normal file
15
extensions/mentions/.travis.yml
Normal file
@ -0,0 +1,15 @@
|
||||
language: minimal
|
||||
|
||||
sudo: false
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: build
|
||||
if: branch = master AND type = push
|
||||
script: curl -s https://raw.githubusercontent.com/flarum/core/master/.travis/build.sh | bash -s -
|
||||
-k $encrypted_e5bd9d54e015_key
|
||||
-i $encrypted_e5bd9d54e015_iv
|
@ -16,9 +16,9 @@ use Illuminate\Contracts\View\Factory;
|
||||
|
||||
return [
|
||||
(new Extend\Assets('forum'))
|
||||
->asset(__DIR__.'/js/forum/dist/extension.js')
|
||||
->asset(__DIR__.'/less/forum/extension.less')
|
||||
->bootstrapper('flarum/mentions/main'),
|
||||
->js(__DIR__.'/js/dist/forum.js')
|
||||
->asset(__DIR__.'/less/forum.less'),
|
||||
|
||||
function (Dispatcher $events, Factory $views) {
|
||||
$events->subscribe(Listener\AddPostMentionedByRelationship::class);
|
||||
$events->subscribe(Listener\FormatPostMentions::class);
|
||||
|
10
extensions/mentions/js/forum.js
Normal file
10
extensions/mentions/js/forum.js
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
export * from './src/forum';
|
@ -1,10 +0,0 @@
|
||||
var gulp = require('flarum-gulp');
|
||||
|
||||
gulp({
|
||||
modules: {
|
||||
'flarum/mentions': 'src/**/*.js'
|
||||
},
|
||||
files: [
|
||||
'node_modules/textarea-caret/index.js'
|
||||
]
|
||||
});
|
1322
extensions/mentions/js/forum/dist/extension.js
vendored
1322
extensions/mentions/js/forum/dist/extension.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,8 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"flarum-gulp": "^0.2.0",
|
||||
"textarea-caret": "~3.0.0"
|
||||
}
|
||||
}
|
4700
extensions/mentions/js/package-lock.json
generated
Normal file
4700
extensions/mentions/js/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
extensions/mentions/js/package.json
Normal file
14
extensions/mentions/js/package.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@flarum/flarum-ext-mentions",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"flarum-webpack-config": "^0.1.0-beta.8",
|
||||
"textarea-caret": "^3.1.0",
|
||||
"webpack": "^4.0.0",
|
||||
"webpack-cli": "^3.0.7"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --mode production --progress",
|
||||
"watch": "webpack --mode development --watch"
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/*global getCaretCoordinates*/
|
||||
import getCaretCoordinates from 'textarea-caret';
|
||||
|
||||
import { extend } from 'flarum/extend';
|
||||
import ComposerBody from 'flarum/components/ComposerBody';
|
||||
@ -8,7 +8,7 @@ import highlight from 'flarum/helpers/highlight';
|
||||
import KeyboardNavigatable from 'flarum/utils/KeyboardNavigatable';
|
||||
import { truncate } from 'flarum/utils/string';
|
||||
|
||||
import AutocompleteDropdown from 'flarum/mentions/components/AutocompleteDropdown';
|
||||
import AutocompleteDropdown from './components/AutocompleteDropdown';
|
||||
|
||||
export default function addComposerAutocomplete() {
|
||||
extend(ComposerBody.prototype, 'config', function(original, isInitialized) {
|
@ -1,8 +1,8 @@
|
||||
import { extend } from 'flarum/extend';
|
||||
import CommentPost from 'flarum/components/CommentPost';
|
||||
|
||||
import PostQuoteButton from 'flarum/mentions/components/PostQuoteButton';
|
||||
import selectedText from 'flarum/mentions/utils/selectedText';
|
||||
import PostQuoteButton from './components/PostQuoteButton';
|
||||
import selectedText from './utils/selectedText';
|
||||
|
||||
export default function addPostQuoteButton() {
|
||||
extend(CommentPost.prototype, 'config', function(original, isInitialized) {
|
@ -2,7 +2,7 @@ import { extend } from 'flarum/extend';
|
||||
import Button from 'flarum/components/Button';
|
||||
import CommentPost from 'flarum/components/CommentPost';
|
||||
|
||||
import reply from 'flarum/mentions/utils/reply';
|
||||
import reply from './utils/reply';
|
||||
|
||||
export default function () {
|
||||
extend(CommentPost.prototype, 'actionItems', function (items) {
|
@ -1,7 +1,7 @@
|
||||
import Button from 'flarum/components/Button';
|
||||
import extract from 'flarum/utils/extract';
|
||||
|
||||
import reply from 'flarum/mentions/utils/reply';
|
||||
import reply from '../utils/reply';
|
||||
|
||||
export default class PostQuoteButton extends Button {
|
||||
view() {
|
@ -3,16 +3,16 @@ import app from 'flarum/app';
|
||||
import NotificationGrid from 'flarum/components/NotificationGrid';
|
||||
import { getPlainContent } from 'flarum/utils/string';
|
||||
|
||||
import addPostMentionPreviews from 'flarum/mentions/addPostMentionPreviews';
|
||||
import addMentionedByList from 'flarum/mentions/addMentionedByList';
|
||||
import addPostReplyAction from 'flarum/mentions/addPostReplyAction';
|
||||
import addPostQuoteButton from 'flarum/mentions/addPostQuoteButton';
|
||||
import addComposerAutocomplete from 'flarum/mentions/addComposerAutocomplete';
|
||||
import PostMentionedNotification from 'flarum/mentions/components/PostMentionedNotification';
|
||||
import UserMentionedNotification from 'flarum/mentions/components/UserMentionedNotification';
|
||||
import addPostMentionPreviews from './addPostMentionPreviews';
|
||||
import addMentionedByList from './addMentionedByList';
|
||||
import addPostReplyAction from './addPostReplyAction';
|
||||
import addPostQuoteButton from './addPostQuoteButton';
|
||||
import addComposerAutocomplete from './addComposerAutocomplete';
|
||||
import PostMentionedNotification from './components/PostMentionedNotification';
|
||||
import UserMentionedNotification from './components/UserMentionedNotification';
|
||||
import UserPage from 'flarum/components/UserPage'
|
||||
import LinkButton from 'flarum/components/LinkButton';
|
||||
import MentionsUserPage from 'flarum/mentions/components/MentionsUserPage';
|
||||
import MentionsUserPage from './components/MentionsUserPage';
|
||||
|
||||
app.initializers.add('flarum-mentions', function() {
|
||||
// For every mention of a post inside a post's content, set up a hover handler
|
3
extensions/mentions/js/webpack.config.js
Normal file
3
extensions/mentions/js/webpack.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
const config = require('flarum-webpack-config');
|
||||
|
||||
module.exports = config();
|
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script compiles the extension so that it can be used in a Flarum
|
||||
# installation. It should be run from the root directory of the extension.
|
||||
|
||||
base=$PWD
|
||||
|
||||
cd "${base}/js"
|
||||
|
||||
if [ -f bower.json ]; then
|
||||
bower install
|
||||
fi
|
||||
|
||||
for app in forum admin; do
|
||||
cd "${base}/js"
|
||||
|
||||
if [ -d $app ]; then
|
||||
cd $app
|
||||
|
||||
if [ -f bower.json ]; then
|
||||
bower install
|
||||
fi
|
||||
|
||||
npm install
|
||||
gulp --production
|
||||
fi
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user