distribution and site management
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
/node_modules
|
||||
/build
|
||||
/dist
|
||||
@@ -17,7 +17,8 @@ node build.sh
|
||||
|
||||
## Usage
|
||||
|
||||
How to use (theorically)
|
||||
### With node
|
||||
|
||||
```javascript
|
||||
const diag = require('fa-diagrams');
|
||||
|
||||
@@ -54,4 +55,25 @@ Will produce the following diagram :
|
||||
|
||||

|
||||
|
||||
### On web page
|
||||
|
||||
```html
|
||||
<head>
|
||||
...
|
||||
<script src="fa-diagrams-data.min.js"></script>
|
||||
<script src="fa-diagrams.min.js"></script>
|
||||
...
|
||||
</head>
|
||||
<body>
|
||||
...
|
||||
<script>
|
||||
...
|
||||
const svg = faDiagrams.compute(data); // string containing xml data
|
||||
...
|
||||
</script>
|
||||
...
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -97,11 +97,10 @@ svn.commands.checkout(FA_SVG_FOLDER_URL, svgDir, (err) => {
|
||||
console.log(`\t\t${type}: ${Object.keys(svgs[type]).length} SVGs`);
|
||||
});
|
||||
|
||||
const argIndex = process.argv.indexOf('--output');
|
||||
const output = (argIndex === -1 || !process.argv[argIndex + 1]) ? path.join(buildDir, 'svg_list.json') : process.argv[argIndex + 1];
|
||||
|
||||
fs.writeFileSync(output, JSON.stringify(svgs), {encoding: 'utf8'});
|
||||
const output = path.join(__dirname, 'svg_list.json');
|
||||
|
||||
fs.writeFileSync(output, JSON.stringify(svgs, null, 4), {encoding: 'utf8'});
|
||||
console.log(`\tSVG list saved at "${output}"`);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# temporary file
|
||||
|
||||
npm run prepublishOnly
|
||||
cp dist/*.min.js site
|
||||
Vendored
+6162
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
(function (global){
|
||||
let list = {};
|
||||
try {
|
||||
list = require('../svg_list.json');
|
||||
}catch(err){
|
||||
console.error('fa-diagrams: SVG list could not be loaded', err);
|
||||
}
|
||||
|
||||
const self = {
|
||||
list: list
|
||||
};
|
||||
|
||||
module.exports = self; // Node
|
||||
global.faDiagrams = self; // Browserify
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../svg_list.json":undefined}]},{},[1]);
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(){return function e(n,r,o){function t(f,u){if(!r[f]){if(!n[f]){var l="function"==typeof require&&require;if(!u&&l)return l(f,!0);if(i)return i(f,!0);var s=new Error("Cannot find module '"+f+"'");throw s.code="MODULE_NOT_FOUND",s}var a=r[f]={exports:{}};n[f][0].call(a.exports,function(e){return t(n[f][1][e]||e)},a,a.exports,e,n,r,o)}return r[f].exports}for(var i="function"==typeof require&&require,f=0;f<o.length;f++)t(o[f]);return t}}()({1:[function(e,n,r){(function(r){let o={};try{o=e("../svg_list.json")}catch(e){console.error("fa-diagrams: SVG list could not be loaded",e)}const t={list:o};n.exports=t,r.faDiagrams=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../svg_list.json":void 0}]},{},[1]);
|
||||
Generated
+1043
-2
File diff suppressed because it is too large
Load Diff
+7
-2
@@ -5,11 +5,12 @@
|
||||
"main": "src/index.js",
|
||||
"files": [
|
||||
"/src",
|
||||
"/dist",
|
||||
"/svg_list.json"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "jest --silent",
|
||||
"prepublishOnly": "node build.js --output svg_list.json"
|
||||
"prepublishOnly": "browserify --require ./svg_list.json:../svg_list.json -o dist/fa-diagrams-data.js && browserify --exclude ../svg_list.json src/index.js -o dist/fa-diagrams.js && uglifyjs -m -c -o dist/fa-diagrams.min.js -- dist/fa-diagrams.js && uglifyjs -m -c -o dist/fa-diagrams-data.min.js -- dist/fa-diagrams-data.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -26,7 +27,9 @@
|
||||
"url": "https://github.com/Klemek/fa-diagrams/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Klemek/fa-diagrams#readme",
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
|
||||
},
|
||||
"jest": {
|
||||
"collectCoverageFrom": [
|
||||
"src/**/*.js",
|
||||
@@ -34,6 +37,8 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"uglify-es": "^3.3.9",
|
||||
"browserify": "^16.3.0",
|
||||
"coveralls": "^3.0.4",
|
||||
"jest": "^24.8.0",
|
||||
"jshint": "^2.10.2",
|
||||
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(){return function e(n,r,o){function t(f,u){if(!r[f]){if(!n[f]){var l="function"==typeof require&&require;if(!u&&l)return l(f,!0);if(i)return i(f,!0);var s=new Error("Cannot find module '"+f+"'");throw s.code="MODULE_NOT_FOUND",s}var a=r[f]={exports:{}};n[f][0].call(a.exports,function(e){return t(n[f][1][e]||e)},a,a.exports,e,n,r,o)}return r[f].exports}for(var i="function"==typeof require&&require,f=0;f<o.length;f++)t(o[f]);return t}}()({1:[function(e,n,r){(function(r){let o={};try{o=e("../svg_list.json")}catch(e){console.error("fa-diagrams: SVG list could not be loaded",e)}const t={list:o};n.exports=t,r.faDiagrams=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../svg_list.json":void 0}]},{},[1]);
|
||||
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>fa-diagrams example</title>
|
||||
<script src="fa-diagrams-data.min.js"></script>
|
||||
<script src="fa-diagrams.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="title">WIP</h1>
|
||||
</body>
|
||||
</html>
|
||||
+8
-20
@@ -1,25 +1,13 @@
|
||||
const path = require('path');
|
||||
|
||||
const loadList = () => {
|
||||
const paths = [
|
||||
path.join(__dirname, '..', 'build', 'svg_list.json'),
|
||||
path.join(__dirname, '..', 'svg_list.json'),
|
||||
];
|
||||
for (let p = 0; p < paths.length; p++) {
|
||||
try {
|
||||
return require(paths[p]);
|
||||
} catch (err) {
|
||||
//ignored
|
||||
}
|
||||
}
|
||||
console.error('fa-diagrams: SVG list was not found at the following paths:\n\t* ' + paths.join('\n\t* '));
|
||||
return {};
|
||||
};
|
||||
|
||||
const list = loadList();
|
||||
let list = {};
|
||||
try {
|
||||
list = require('../svg_list.json');
|
||||
}catch(err){
|
||||
console.error('fa-diagrams: SVG list could not be loaded', err);
|
||||
}
|
||||
|
||||
const self = {
|
||||
list: list
|
||||
};
|
||||
|
||||
module.exports = self;
|
||||
module.exports = self; // Node
|
||||
global['faDiagrams'] = self; // Browserify
|
||||
Reference in New Issue
Block a user