Skip to content

Commit

Permalink
Merge pull request #113 from abelljs/next
Browse files Browse the repository at this point in the history
v0.9.0
  • Loading branch information
saurabhdaware authored Jan 23, 2021
2 parents 9793790 + 68e6f1d commit 240ec9c
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 17 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## v0.9.0 `abell@latest`

1. **feat: ignoreInOutput**
Adds `ignoreInOutput` configuration again (It was possible in earlier Abell versions)

You can pass an array of file/folder which should be ignored when generating output.

If there are files that output some other file. You can use this to ignore source files.

```js
// abell.config.js
module.exports = {
ignoreInOutput: ['styles.scss']
};
```

2. **fix: dev-server changes not reflecting in multiple devices**
If you connect to dev-server from multiple devices, your changes will now reflect in all of them without manual reload.

3. "Built Static Files" Added to Logs.
4. Upgrade abell-renderer. (Removes scopedSelector is declared bug)

## v0.8.0 `abell@latest`

- Add `Abell.programInfo` variable with information about paths and abell process.
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "abell",
"version": "0.8.0",
"version": "0.9.0",
"description": "Abell is a static blog generator that generates blog in Vanilla JavaScript",
"funding": {
"type": "patreon",
Expand Down Expand Up @@ -41,7 +41,7 @@
},
"homepage": "https://abelljs.org",
"dependencies": {
"abell-renderer": "^0.4.0",
"abell-renderer": "^0.4.1",
"chokidar": "^3.4.0",
"commander": "^5.0.0",
"remarkable": "^2.0.0",
Expand All @@ -63,4 +63,4 @@
"pre-commit": "npm run prettier && eslint . --fix && npm run eslint"
}
}
}
}
3 changes: 3 additions & 0 deletions src/abell-dev-server/http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ async function createServer(options, retry) {
const port = (retry && retry.nextPort) || (options && options.port) || 5000;
const socketCode = /* html */ `
<script>
if (window.location === window.parent.location) {
// Check if page is not in iframe
const socketProtocol = location.protocol === 'http:' ? 'ws://' : 'wss://';
const url = socketProtocol + location.host;
const connection = new WebSocket(url);
Expand All @@ -132,6 +134,7 @@ async function createServer(options, retry) {
location.reload();
}
});
}
</script>
`;
let httpServer;
Expand Down
15 changes: 9 additions & 6 deletions src/abell-dev-server/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const WebSocket = require('ws');
const { createServer } = require('./http-server.js');
let socketServer;
const socketServers = {};

/**
* Creates socketServer
Expand All @@ -11,9 +11,10 @@ async function create(options) {
const httpServer = await createServer(options);
const wss = new WebSocket.Server({ server: httpServer });
console.log('Socket Server Listening...');
wss.on('connection', (ws) => {
if (!socketServer) console.log('>> Watcher Connected');
socketServer = ws;
wss.on('connection', (ws, req) => {
const remoteAddress = req.connection.remoteAddress;
if (!socketServers[remoteAddress]) console.log('>> Watcher Connected');
socketServers[remoteAddress] = ws;
});
return { httpServer, wss };
}
Expand All @@ -22,8 +23,10 @@ async function create(options) {
* Reloads the page
*/
function reload() {
if (socketServer) {
socketServer.send('abell-dev-server-reload');
if (Object.keys(socketServers).length > 0) {
for (const socketServer of Object.values(socketServers)) {
socketServer.send('abell-dev-server-reload');
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/utils/generate-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ async function generateSite(programInfo) {

const ignoreCopying = [
...importedFiles,
...recursiveFindFiles(programInfo.abellConfig.themePath, '.abell')
...recursiveFindFiles(programInfo.abellConfig.themePath, '.abell'),
...(programInfo.abellConfig.ignoreInOutput || []).map((pathToIgnore) =>
path.join(programInfo.abellConfig.themePath, pathToIgnore)
)
];

// Copy everything from src to dist except the ones mentioned in ignoreCopying.
Expand All @@ -242,6 +245,10 @@ async function generateSite(programInfo) {
programInfo.abellConfig.outputPath,
ignoreCopying
);

if (programInfo.logs === 'complete') {
console.log(`...Built Static Files`);
}
}

module.exports = { createHTMLFile, generateSite };

0 comments on commit 240ec9c

Please sign in to comment.