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
location = "container:spec">
</FileRef>
<FileRef
location = "container:styles">
</FileRef>
<FileRef
location = "container:web">
</FileRef>

View File

@ -46,9 +46,9 @@ statics
.addResources('/', BASEDIR, [
'index.html',
'library.htm',
'styles',
'lib',
'weblib',
'web/lib',
'web/styles',
'favicon.png',
'apple-touch-icon.png',
], devMapper);
@ -57,7 +57,7 @@ if(DEV) {
statics.addResources('/', BASEDIR, [
'node_modules/requirejs/require.js',
'scripts',
'web',
'web/scripts',
]);
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 minify`: runs the `minify-lib` and `minify-web` commands
* `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
@ -93,8 +93,7 @@ The high-level structure is:
Useful helpers can also be found in `/scripts/core/*` and
`/scripts/svg/*`.
The live editor (index.htm) uses the source in `/web/editor.mjs` and
`/web/interface/*`.
The live editor (index.htm) uses the sources in `/web/scripts/`.
## Testing
@ -157,7 +156,7 @@ minified library (this is preferred but not required):
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`
script, with some boiler-plate added to allow loading into a page in a
variety of ways.

View File

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

View File

@ -25,7 +25,7 @@
integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs="
crossorigin="anonymous"
>
<link rel="stylesheet" href="styles/library.css">
<link rel="stylesheet" href="web/styles/library.css">
<script
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",
"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-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",
"prepublishOnly": "npm run minify-lib && npm run generate-screenshots && npm test",
"start": "bin/server.js",

View File

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

View File

@ -37,7 +37,7 @@ module.exports = (config) => {
usePhantomJS: false,
},
exclude: ['node_modules/**/*_spec.*', 'lib/**', 'weblib/**'],
exclude: ['node_modules/**/*_spec.*', 'lib/**', 'web/lib/**'],
files: [
'node_modules/codemirror/lib/codemirror.js',
{
@ -51,7 +51,7 @@ module.exports = (config) => {
{included: false, pattern: 'screenshots/**/*'},
{included: false, pattern: 'scripts/**/*'},
{included: false, pattern: 'spec/**/*'},
{included: false, pattern: 'web/**/*'},
{included: false, pattern: 'web/scripts/**/*'},
{included: false, pattern: 'bin/**/*'},
{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 Interface from './interface/Interface.mjs';
import SequenceDiagram from '../scripts/sequence/SequenceDiagram.mjs';
import SequenceDiagram from '../../scripts/sequence/SequenceDiagram.mjs';
import {require} from './requireCDN.mjs';
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 SequenceDiagram from '../../scripts/sequence/SequenceDiagram.mjs';
import {nodejs} from '../../scripts/core/browser.mjs';
import SequenceDiagram from '../../../scripts/sequence/SequenceDiagram.mjs';
import {nodejs} from '../../../scripts/core/browser.mjs';
const themes = SequenceDiagram.getDefaultThemeNames().slice(1);

View File

@ -1,6 +1,6 @@
/* eslint-disable max-lines */
import DOMWrapper from '../../scripts/core/DOMWrapper.mjs';
import DOMWrapper from '../../../scripts/core/DOMWrapper.mjs';
const DELAY_AGENTCHANGE = 500;
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 stubRequire from '../../spec/stubs/require.mjs';
import stubRequire from '../../../spec/stubs/require.mjs';
describe('Interface', () => {
const defaultCode = 'my default code';

View File

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