Restructure web resources to be within one folder

This commit is contained in:
David Evans 2018-05-01 19:31:52 +01:00
parent 176ce07bf2
commit 044d6bd776
20 changed files with 26 additions and 87 deletions

View File

@ -10,9 +10,6 @@
<FileRef <FileRef
location = "container:spec"> location = "container:spec">
</FileRef> </FileRef>
<FileRef
location = "container:styles">
</FileRef>
<FileRef <FileRef
location = "container:web"> location = "container:web">
</FileRef> </FileRef>

View File

@ -46,9 +46,9 @@ statics
.addResources('/', BASEDIR, [ .addResources('/', BASEDIR, [
'index.html', 'index.html',
'library.htm', 'library.htm',
'styles',
'lib', 'lib',
'weblib', 'web/lib',
'web/styles',
'favicon.png', 'favicon.png',
'apple-touch-icon.png', 'apple-touch-icon.png',
], devMapper); ], devMapper);
@ -57,7 +57,7 @@ if(DEV) {
statics.addResources('/', BASEDIR, [ statics.addResources('/', BASEDIR, [
'node_modules/requirejs/require.js', 'node_modules/requirejs/require.js',
'scripts', 'scripts',
'web', 'web/scripts',
]); ]);
statics.setFileWatch(true); statics.setFileWatch(true);
} }

View File

@ -68,7 +68,7 @@ The available commands are:
* `npm run lint`: runs the linter against all source and test files * `npm run lint`: runs the linter against all source and test files
* `npm run minify`: runs the `minify-lib` and `minify-web` commands * `npm run minify`: runs the `minify-lib` and `minify-web` commands
* `npm run minify-lib`: minifies the library code in `/lib` * `npm run minify-lib`: minifies the library code in `/lib`
* `npm run minify-web`: minifies the web code in `/weblib` * `npm run minify-web`: minifies the web code in `/web/lib`
## Project Structure ## Project Structure
@ -93,8 +93,7 @@ The high-level structure is:
Useful helpers can also be found in `/scripts/core/*` and Useful helpers can also be found in `/scripts/core/*` and
`/scripts/svg/*`. `/scripts/svg/*`.
The live editor (index.htm) uses the source in `/web/editor.mjs` and The live editor (index.htm) uses the sources in `/web/scripts/`.
`/web/interface/*`.
## Testing ## Testing
@ -157,7 +156,7 @@ minified library (this is preferred but not required):
npm run minify; npm run minify;
``` ```
This will update the files in `/lib` and `/weblib`. The minified code This will update the files in `/lib` and `/web/lib`. The minified code
is a self-contained copy of the `/scripts/sequence/SequenceDiagram.mjs` is a self-contained copy of the `/scripts/sequence/SequenceDiagram.mjs`
script, with some boiler-plate added to allow loading into a page in a script, with some boiler-plate added to allow loading into a page in a
variety of ways. variety of ways.

View File

@ -31,7 +31,7 @@
crossorigin="anonymous" crossorigin="anonymous"
> >
<link rel="stylesheet" href="styles/editor.css"> <link rel="stylesheet" href="web/styles/editor.css">
<meta <meta
name="cdn-split" name="cdn-split"
@ -68,7 +68,7 @@
src="node_modules/requirejs/require.js" src="node_modules/requirejs/require.js"
crossorigin="anonymous" crossorigin="anonymous"
></script> ></script>
<script src="web/editor.mjs" type="module"></script> <script src="web/scripts/editor.mjs" type="module"></script>
/DEV --> /DEV -->
<!-- LIVE --> <!-- LIVE -->
@ -78,7 +78,7 @@
integrity="sha256-0SGl1PJNDyJwcV5T+weg2zpEMrh7xvlwO4oXgvZCeZk=" integrity="sha256-0SGl1PJNDyJwcV5T+weg2zpEMrh7xvlwO4oXgvZCeZk="
crossorigin="anonymous" crossorigin="anonymous"
></script> ></script>
<script src="weblib/editor.min.js"></script> <script src="web/lib/editor.min.js"></script>
<!-- /LIVE --> <!-- /LIVE -->
</head> </head>

View File

@ -25,7 +25,7 @@
integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs=" integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs="
crossorigin="anonymous" crossorigin="anonymous"
> >
<link rel="stylesheet" href="styles/library.css"> <link rel="stylesheet" href="web/styles/library.css">
<script <script
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.min.js" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.min.js"

View File

@ -27,7 +27,7 @@
"lint": "eslint . --config spec/support/eslintrc.js --ignore-path spec/support/eslintignore --ext .js --ext .mjs", "lint": "eslint . --config spec/support/eslintrc.js --ignore-path spec/support/eslintignore --ext .js --ext .mjs",
"generate-screenshots": "bin/generate-screenshots.js README.md", "generate-screenshots": "bin/generate-screenshots.js README.md",
"minify-lib": "rollup --config scripts/rollup.config.js && uglifyjs --compress --mangle --warn --output lib/sequence-diagram-web.min.js -- lib/sequence-diagram-web.js", "minify-lib": "rollup --config scripts/rollup.config.js && uglifyjs --compress --mangle --warn --output lib/sequence-diagram-web.min.js -- lib/sequence-diagram-web.js",
"minify-web": "rollup --config web/rollup.config.js && uglifyjs --compress --mangle --warn --output weblib/editor.min.js -- weblib/editor.js", "minify-web": "rollup --config web/scripts/rollup.config.js && uglifyjs --compress --mangle --warn --output web/lib/editor.min.js -- web/lib/editor.js",
"minify": "npm run minify-lib && npm run minify-web", "minify": "npm run minify-lib && npm run minify-web",
"prepublishOnly": "npm run minify-lib && npm run generate-screenshots && npm test", "prepublishOnly": "npm run minify-lib && npm run generate-screenshots && npm test",
"start": "bin/server.js", "start": "bin/server.js",

View File

@ -1,6 +1,6 @@
node_modules node_modules
lib lib
weblib web/lib
ephemeral ephemeral
*FontData.mjs *FontData.mjs

View File

@ -37,7 +37,7 @@ module.exports = (config) => {
usePhantomJS: false, usePhantomJS: false,
}, },
exclude: ['node_modules/**/*_spec.*', 'lib/**', 'weblib/**'], exclude: ['node_modules/**/*_spec.*', 'lib/**', 'web/lib/**'],
files: [ files: [
'node_modules/codemirror/lib/codemirror.js', 'node_modules/codemirror/lib/codemirror.js',
{ {
@ -51,7 +51,7 @@ module.exports = (config) => {
{included: false, pattern: 'screenshots/**/*'}, {included: false, pattern: 'screenshots/**/*'},
{included: false, pattern: 'scripts/**/*'}, {included: false, pattern: 'scripts/**/*'},
{included: false, pattern: 'spec/**/*'}, {included: false, pattern: 'spec/**/*'},
{included: false, pattern: 'web/**/*'}, {included: false, pattern: 'web/scripts/**/*'},
{included: false, pattern: 'bin/**/*'}, {included: false, pattern: 'bin/**/*'},
{included: false, pattern: 'README.md'}, {included: false, pattern: 'README.md'},
], ],

View File

@ -1,60 +0,0 @@
html, body {
margin: 0;
padding: 0;
}
body {
margin-bottom: 50px;
background: #EEEEEE;
}
.status {
text-align: center;
font-size: 2em;
margin: 10px;
}
.hold {
display: block;
width: 920px;
background: #FFFFFF;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
padding: 5px;
margin: 10px auto;
border-radius: 3px;
overflow: hidden;
}
.hold > svg {
width: 300px;
height: auto;
margin-right: 10px;
}
.hold > .raster {
width: 300px;
margin-right: 10px;
}
.hold > .original {
width: 300px;
background: #F8F8F8;
}
.hold a {
display: block;
text-align: center;
font-family: sans-serif;
padding: 15px;
margin: 5px -5px -5px;
}
.hold a:link, .hold a:visited {
color: #666699;
text-decoration: none;
cursor: pointer;
}
.hold a:active, .hold a:hover {
background: #EEEEEE;
color: #6666CC;
}

View File

@ -1,6 +1,6 @@
import ComponentsLibrary from './interface/ComponentsLibrary.mjs'; import ComponentsLibrary from './interface/ComponentsLibrary.mjs';
import Interface from './interface/Interface.mjs'; import Interface from './interface/Interface.mjs';
import SequenceDiagram from '../scripts/sequence/SequenceDiagram.mjs'; import SequenceDiagram from '../../scripts/sequence/SequenceDiagram.mjs';
import {require} from './requireCDN.mjs'; import {require} from './requireCDN.mjs';
const defaultCode = ( const defaultCode = (

View File

@ -1,7 +1,10 @@
import {VirtualDocument, textSizerFactory} from '../../spec/stubs/TestDOM.mjs'; import {
VirtualDocument,
textSizerFactory,
} from '../../../spec/stubs/TestDOM.mjs';
import ComponentsLibrary from './ComponentsLibrary.mjs'; import ComponentsLibrary from './ComponentsLibrary.mjs';
import SequenceDiagram from '../../scripts/sequence/SequenceDiagram.mjs'; import SequenceDiagram from '../../../scripts/sequence/SequenceDiagram.mjs';
import {nodejs} from '../../scripts/core/browser.mjs'; import {nodejs} from '../../../scripts/core/browser.mjs';
const themes = SequenceDiagram.getDefaultThemeNames().slice(1); const themes = SequenceDiagram.getDefaultThemeNames().slice(1);

View File

@ -1,6 +1,6 @@
/* eslint-disable max-lines */ /* eslint-disable max-lines */
import DOMWrapper from '../../scripts/core/DOMWrapper.mjs'; import DOMWrapper from '../../../scripts/core/DOMWrapper.mjs';
const DELAY_AGENTCHANGE = 500; const DELAY_AGENTCHANGE = 500;
const DELAY_STAGECHANGE = 250; const DELAY_STAGECHANGE = 250;

View File

@ -1,6 +1,6 @@
import {Event, VirtualDocument} from '../../spec/stubs/TestDOM.mjs'; import {Event, VirtualDocument} from '../../../spec/stubs/TestDOM.mjs';
import Interface from './Interface.mjs'; import Interface from './Interface.mjs';
import stubRequire from '../../spec/stubs/require.mjs'; import stubRequire from '../../../spec/stubs/require.mjs';
describe('Interface', () => { describe('Interface', () => {
const defaultCode = 'my default code'; const defaultCode = 'my default code';

View File

@ -2,9 +2,9 @@ import hypothetical from 'rollup-plugin-hypothetical';
export default [ export default [
{ {
input: 'web/editor.mjs', input: 'web/scripts/editor.mjs',
output: { output: {
file: 'weblib/editor.js', file: 'web/lib/editor.js',
format: 'iife', format: 'iife',
name: 'SequenceDiagramEditor', name: 'SequenceDiagramEditor',
}, },