Skip to content

Commit

Permalink
Updated altair-static and altair-express-middleware packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed May 12, 2018
1 parent ce1d130 commit 95f6f04
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -17,7 +17,7 @@
"ng": "ng",
"start": "ng serve",
"start:prod": "node server",
"build": "ng build -prod --aot",
"build": "ng build -prod --aot --stats-json",
"test": "ng test",
"test-build": "ng lint && npm run build && karma start karma.conf.js --single-run",
"local-verify": "ng test --single-run && ng lint && ng e2e && yarn build",
Expand All @@ -31,7 +31,7 @@
"make": "electron-forge make",
"dist-electron": "build",
"postinstall": "opencollective postinstall",
"publish-packages": "npm run build && lerna publish --skip-git --force-publish"
"publish-packages": "npm run build && lerna publish --skip-git --force-publish --conventional-commits --yes"
},
"engines": {
"node": ">= 6.9.1"
Expand Down
81 changes: 81 additions & 0 deletions packages/altair-express-middleware/CHANGELOG.md
@@ -0,0 +1,81 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="1.0.5"></a>
## [1.0.5](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.5) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.4"></a>
## [1.0.4](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.4) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.3"></a>
## [1.0.3](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.3) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.2"></a>
## [1.0.2](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.2) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.3"></a>
## [1.0.3](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.3) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.2"></a>
## [1.0.2](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.2) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.2"></a>
## [1.0.2](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.2) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.4"></a>
## [1.0.4](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.4) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware





<a name="1.0.3"></a>
## [1.0.3](https://github.com/imolorhe/altair/compare/altair-express-middleware@0.1.0...altair-express-middleware@1.0.3) (2018-05-12)

**Note:** Version bump only for package altair-express-middleware
5 changes: 2 additions & 3 deletions packages/altair-express-middleware/index.ts
Expand Up @@ -2,15 +2,14 @@

const path = require('path');
const express = require('express');
const altairStatic = require('altair-static');

module.exports = {
altairExpress: (opts) => {
const app = express();

app.use(express.static(path.join(__dirname, '../dist')));

app.get('*', (req, res) => {
return res.sendFile(path.join(__dirname, '../dist/index.html'));
return res.send(altairStatic.renderAltair());
});

return app;
Expand Down
2 changes: 1 addition & 1 deletion packages/altair-express-middleware/package.json
Expand Up @@ -8,7 +8,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"prepare-dist": "node scripts/prepare_dist.js",
"declarations": "tsc --declaration",
"prepare": "npm run prepare-dist; npm run declarations"
"prepare": "npm run declarations"
},
"engines": {
"node": ">= 6.9.1"
Expand Down
81 changes: 81 additions & 0 deletions packages/altair-static/CHANGELOG.md
@@ -0,0 +1,81 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="1.0.4"></a>
## 1.0.4 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.3"></a>
## 1.0.3 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.2"></a>
## 1.0.2 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.1"></a>
## 1.0.1 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.2"></a>
## 1.0.2 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.1"></a>
## 1.0.1 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.1"></a>
## 1.0.1 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.3"></a>
## 1.0.3 (2018-05-12)

**Note:** Version bump only for package altair-static





<a name="1.0.2"></a>
## 1.0.2 (2018-05-12)

**Note:** Version bump only for package altair-static
8 changes: 7 additions & 1 deletion packages/altair-static/scripts/prepare_dist.js
Expand Up @@ -11,6 +11,8 @@ const buildDir = path.resolve(__dirname, '../build');

const indexHtmlFile = path.join(distDestination, 'index.html');

const cdnFile = fileName => `https://cdn.jsdelivr.net/npm/altair-static/dist/${fileName}`;

ncp(distSrc, distDestination, function (err) {
if (err) {
return console.error(err);
Expand All @@ -20,7 +22,8 @@ ncp(distSrc, distDestination, function (err) {
let indexHtmlStr = fs.readFileSync(indexHtmlFile, 'utf8');

// Adjust the base URL to be relative to the current path
indexHtmlStr = indexHtmlStr.replace('<base href="/">', '<base href="./">');
indexHtmlStr = indexHtmlStr.replace('<base href="/">', '<base href="https://cdn.jsdelivr.net/npm/altair-static/dist/">'
/*'<base href="./">'*/);

// Write the new string back to file
fs.writeFileSync(indexHtmlFile, indexHtmlStr, 'utf8');
Expand All @@ -29,6 +32,9 @@ ncp(distSrc, distDestination, function (err) {
const stats = JSON.parse(fs.readFileSync(path.resolve(distSrc, 'stats.json')));

let buildIndexHtmlStr = fs.readFileSync(path.resolve(srcDir, 'index.html'), 'utf8');
buildIndexHtmlStr = buildIndexHtmlStr.replace('<base href="/">', '<base href="https://cdn.jsdelivr.net/npm/altair-static/dist/">'
/*'<base href="./">'*/
);
buildIndexHtmlStr = buildIndexHtmlStr.replace('[% STYLES_FILE %]', stats.assetsByChunkName.styles);
buildIndexHtmlStr = buildIndexHtmlStr.replace('[% INLINE_SCRIPT %]', stats.assetsByChunkName.inline);
buildIndexHtmlStr = buildIndexHtmlStr.replace('[% POLYFILLS_SCRIPT %]', stats.assetsByChunkName.polyfills);
Expand Down
3 changes: 2 additions & 1 deletion packages/altair-static/src/index.ts
Expand Up @@ -3,5 +3,6 @@ const path = require('path');

export const renderAltair = (opts) => {
const altairHtml = fs.readFileSync(path.resolve(__dirname, 'index.html'), 'utf8');
console.log(altairHtml);
// console.log(altairHtml);
return altairHtml;
};

0 comments on commit 95f6f04

Please sign in to comment.