代码拉取完成,页面将自动刷新
同步操作将从 小龙/tinymce_attachment_plugin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const {
CheckerPlugin
} = require('awesome-typescript-loader');
const LiveReloadPlugin = require('webpack-livereload-plugin');
const path = require('path');
const swag = require('@ephox/swag');
module.exports = function (grunt) {
var packageData = grunt.file.readJSON('package.json');
var BUILD_VERSION = packageData.version + '-' + (process.env.BUILD_NUMBER ? process.env.BUILD_NUMBER : '0');
const libPluginPath = 'lib/main/ts/Main.js';
const scratchPluginPath = 'scratch/compiled/plugin.js';
const scratchPluginMinPath = 'scratch/compiled/plugin.min.js';
const tsDemoSourceFile = path.resolve('src/demo/ts/Demo.ts');
const jsDemoDestFile = path.resolve('scratch/compiled/demo.js');
grunt.initConfig({
pkg: packageData,
clean: {
dirs: ['dist', 'scratch']
},
tslint: {
options: {
configuration: 'tslint.json'
},
plugin: ['src/**/*.ts']
},
shell: {
command: 'tsc'
},
rollup: {
options: {
treeshake: true,
format: 'iife',
onwarn: swag.onwarn,
plugins: [
swag.nodeResolve({
basedir: __dirname,
prefixes: {}
}),
swag.remapImports()
]
},
plugin: {
files: [{
src: libPluginPath,
dest: scratchPluginPath
}]
}
},
uglify: {
plugin: {
files: [{
src: scratchPluginPath,
dest: scratchPluginMinPath
}]
}
},
concat: {
license: {
options: {
process: function (src) {
var buildSuffix = process.env.BUILD_NUMBER ?
'-' + process.env.BUILD_NUMBER :
'';
return src.replace(
/@BUILD_NUMBER@/g,
packageData.version + buildSuffix
);
}
},
// scratchPluginMinPath is used twice on purpose, all outputs will be minified for premium plugins
files: {
'dist/attachment/plugin.js': [
'src/text/license-header.js',
scratchPluginMinPath
],
'dist/attachment/plugin.min.js': [
'src/text/license-header.js',
scratchPluginMinPath
]
}
}
},
copy: {
css: {
files: [{
cwd: 'src/text',
src: ['license.txt'],
dest: 'dist/attachment',
expand: true
},
{
src: ['changelog.txt'],
dest: 'dist/attachment',
expand: true
}
]
}
},
webpack: {
options: {
mode: 'development',
watch: true
},
dev: {
entry: tsDemoSourceFile,
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [{
test: /\.js$/,
use: ['source-map-loader'],
enforce: 'pre'
},
{
test: /\.ts$/,
use: [{
loader: 'ts-loader',
options: {
transpileOnly: true,
experimentalWatchApi: true
}
}]
}
]
},
plugins: [new LiveReloadPlugin(), new CheckerPlugin()],
output: {
filename: path.basename(jsDemoDestFile),
path: path.dirname(jsDemoDestFile)
}
}
}
});
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('@ephox/swag');
grunt.registerTask('version', 'Creates a version file', function () {
grunt.file.write('dist/attachment/version.txt', BUILD_VERSION);
});
grunt.registerTask('default', [
'clean',
'tslint',
'shell',
'rollup',
'uglify',
'concat',
'copy',
'version'
]);
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。