forked from p96170835/amis
添加 gh-pages
This commit is contained in:
parent
2ed5a31cc4
commit
2d4905eebf
|
@ -13,6 +13,7 @@ node_modules
|
||||||
/dist
|
/dist
|
||||||
/lib
|
/lib
|
||||||
/public
|
/public
|
||||||
|
/gh-pages
|
||||||
/.vscode
|
/.vscode
|
||||||
/output
|
/output
|
||||||
/toolkit/amis-renderer
|
/toolkit/amis-renderer
|
||||||
|
|
|
@ -14,4 +14,5 @@ fis-conf.js
|
||||||
/__tests__
|
/__tests__
|
||||||
/__mocks__
|
/__mocks__
|
||||||
/coverage
|
/coverage
|
||||||
/publish.sh
|
/publish.sh
|
||||||
|
/gh-pages
|
|
@ -6,7 +6,7 @@ import {AlertComponent, ToastComponent} from '../../src/components/index';
|
||||||
import {
|
import {
|
||||||
mapTree
|
mapTree
|
||||||
} from '../../src/utils/helper';
|
} from '../../src/utils/helper';
|
||||||
import { Router, Route, IndexRoute, browserHistory, Link, Redirect } from 'react-router';
|
import { Router, Route, IndexRoute, browserHistory, hashHistory, Link, Redirect } from 'react-router';
|
||||||
import makeSchemaRenderer from './SchemaRender';
|
import makeSchemaRenderer from './SchemaRender';
|
||||||
|
|
||||||
|
|
||||||
|
@ -712,9 +712,14 @@ export class App extends React.PureComponent {
|
||||||
|
|
||||||
export default function entry({pathPrefix}) {
|
export default function entry({pathPrefix}) {
|
||||||
PathPrefix = pathPrefix || '/examples';
|
PathPrefix = pathPrefix || '/examples';
|
||||||
|
let history = browserHistory;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
history = hashHistory;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router history={ browserHistory }>
|
<Router history={ history }>
|
||||||
<Route component={App}>
|
<Route component={App}>
|
||||||
<Redirect from={`${PathPrefix}/`} to={`${PathPrefix}/pages/simple`} />
|
<Redirect from={`${PathPrefix}/`} to={`${PathPrefix}/pages/simple`} />
|
||||||
{navigations2route(PathPrefix)}
|
{navigations2route(PathPrefix)}
|
||||||
|
|
125
fis-conf.js
125
fis-conf.js
|
@ -5,6 +5,7 @@ const path = require('path');
|
||||||
const parserMarkdown = require('./build/md-parser');
|
const parserMarkdown = require('./build/md-parser');
|
||||||
fis.get('project.ignore').push(
|
fis.get('project.ignore').push(
|
||||||
'public/**',
|
'public/**',
|
||||||
|
'gh-pages/**',
|
||||||
'.*/**'
|
'.*/**'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -225,4 +226,128 @@ if (fis.project.currentMedia() === 'publish') {
|
||||||
});
|
});
|
||||||
// publishEnv.unhook('node_modules');
|
// publishEnv.unhook('node_modules');
|
||||||
publishEnv.hook('relative');
|
publishEnv.hook('relative');
|
||||||
|
} else if (fis.project.currentMedia() === 'gh-pages') {
|
||||||
|
const ghPages = fis.media('gh-pages');
|
||||||
|
|
||||||
|
ghPages.match('/node_modules/(**)', {
|
||||||
|
release: '/n/$1'
|
||||||
|
});
|
||||||
|
|
||||||
|
ghPages.match('/examples/(**)', {
|
||||||
|
release: '/$1'
|
||||||
|
});
|
||||||
|
|
||||||
|
ghPages.match('/{examples,docs}/**', {
|
||||||
|
preprocessor: function(contents, file) {
|
||||||
|
if (!file.isText() || typeof contents !== 'string') {
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
return contents.replace(/(\\?(?:'|"))\/api\/mock2?\//g, function(_, qutoa) {
|
||||||
|
return qutoa + 'https://houtai.baidu.com/api/mock2/';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
ghPages.match('mock/**.{json,js,conf}', {
|
||||||
|
release: false
|
||||||
|
});
|
||||||
|
|
||||||
|
ghPages.match('::package', {
|
||||||
|
packager: fis.plugin('deps-pack', {
|
||||||
|
'pkg/npm.js': [
|
||||||
|
'/mod.js',
|
||||||
|
'node_modules/**.js',
|
||||||
|
'!monaco-editor/**',
|
||||||
|
'!flv.js/**',
|
||||||
|
'!hls.js/**',
|
||||||
|
'!amis/lib/editor/**',
|
||||||
|
'!froala-editor/**',
|
||||||
|
'!amis/lib/components/RichText.js',
|
||||||
|
'!jquery/**',
|
||||||
|
'!zrender/**',
|
||||||
|
'!echarts/**',
|
||||||
|
],
|
||||||
|
'pkg/rich-text.js': [
|
||||||
|
'amis/lib/components/RichText.js',
|
||||||
|
'froala-editor/**',
|
||||||
|
'jquery/**'
|
||||||
|
],
|
||||||
|
'pkg/echarts.js': [
|
||||||
|
'zrender/**',
|
||||||
|
'echarts/**'
|
||||||
|
],
|
||||||
|
'pkg/api-mock.js': [
|
||||||
|
'mock/*.ts'
|
||||||
|
],
|
||||||
|
'pkg/app.js': [
|
||||||
|
'/app.tsx',
|
||||||
|
'/app.tsx:deps'
|
||||||
|
],
|
||||||
|
'pkg/rest.js': [
|
||||||
|
'**.{js,jsx,ts,tsx}',
|
||||||
|
'!static/mod.js',
|
||||||
|
'!monaco-editor/**',
|
||||||
|
'!echarts/**',
|
||||||
|
'!flv.js/**',
|
||||||
|
'!hls.js/**',
|
||||||
|
'!froala-editor/**',
|
||||||
|
'!jquery/**',
|
||||||
|
'!amis/lib/components/RichText.js',
|
||||||
|
'!zrender/**',
|
||||||
|
'!echarts/**',
|
||||||
|
],
|
||||||
|
// css 打包
|
||||||
|
'pkg/style.css': [
|
||||||
|
'node_modules/*/**.css',
|
||||||
|
'*.scss',
|
||||||
|
'!/scss/*.scss',
|
||||||
|
'/scss/*.scss'
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
ghPages.match('*.{css,less,scss}', {
|
||||||
|
optimizer: fis.plugin('clean-css'),
|
||||||
|
useHash: true
|
||||||
|
});
|
||||||
|
|
||||||
|
ghPages.match('::image', {
|
||||||
|
useHash: true
|
||||||
|
});
|
||||||
|
|
||||||
|
ghPages.match('*.{js,ts,tsx}', {
|
||||||
|
optimizer: fis.plugin('uglify-js'),
|
||||||
|
useHash: true
|
||||||
|
});
|
||||||
|
|
||||||
|
ghPages.match('*.map', {
|
||||||
|
release: false,
|
||||||
|
url: 'null',
|
||||||
|
useHash: false
|
||||||
|
});
|
||||||
|
ghPages.match('{*.jsx,*.tsx,*.ts}', {
|
||||||
|
moduleId: function (m, path) {
|
||||||
|
return fis.util.md5('amis' + path);
|
||||||
|
},
|
||||||
|
parser: fis.plugin('typescript', {
|
||||||
|
sourceMap: false,
|
||||||
|
importHelpers: true
|
||||||
|
})
|
||||||
|
});
|
||||||
|
ghPages.match('*', {
|
||||||
|
domain: '/amis',
|
||||||
|
deploy: [
|
||||||
|
fis.plugin('skip-packed'),
|
||||||
|
fis.plugin('local-deliver', {
|
||||||
|
to: './gh-pages'
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
||||||
|
ghPages.match('{*.min.js,monaco-editor/**.js}', {
|
||||||
|
optimizer: null
|
||||||
|
});
|
||||||
|
ghPages.match('monaco-editor/**.js', {
|
||||||
|
useHash: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue