Socket
Socket
Sign inDemoInstall

aemfed

Package Overview
Dependencies
654
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.5 to 0.0.6

lib/clientlib-tree.spec.d.ts

18

CHANGELOG.md
# aemfed changelog
## 0.0.6
### Error logging improvements
- Add support for error logging in JSP files
- Add initial error log support for json requests
- Add more types of Sightly errors for requests (messages are limited since the stacktrace is missing)
- Show only the first message in case of repeating, nested exception messages (HTL/JSP)
- Use absolute path for local file reference, since not all environments understand paths relative to project folder
- Show HTL/JSP errors, even when there are no actual exceptions in the request
### Other
- Use the css browser cache buster also for javascript, to prevent caching issues in case no [Versioned Clientlibs](https://adobe-consulting-services.github.io/acs-aem-commons/features/versioned-clientlibs/index.html) are used
- Updated dependencies
- Browsersync 2.26.0 fixes the issue preventing navigation in Firefox: [#1570](https://github.com/BrowserSync/browser-sync/issues/1570)
- aemsync ignore pattern module was updated, so check if yours is still working
## 0.0.5

@@ -4,0 +22,0 @@

75

lib/bs-wrapper.js

@@ -119,2 +119,6 @@ "use strict";

};
const slingSightlyProfile = {
level: "error",
logger: "org.apache.sling.scripting.sightly"
};
const profiles = [

@@ -128,7 +132,8 @@ yuiProfile,

acsProfile,
slingProcessorProfile
slingProcessorProfile,
slingSightlyProfile
];
const tracerConfigs = [
{
pattern: /\.html(\?.*|$)/,
pattern: /\.(html|jsp)(\?.*|$)/,
profiles: [

@@ -142,3 +147,4 @@ yuiProfile,

acsProfile,
slingProcessorProfile
slingProcessorProfile,
slingSightlyProfile
]

@@ -159,2 +165,6 @@ },

]
},
{
pattern: /\.json(\?.*|$)/,
profiles: [slingProcessorProfile]
}

@@ -203,7 +213,5 @@ ];

const trace = data;
if (trace.logs.length) {
generateReport(instance, url, slingTracerRequestId, trace).then(report => {
report.map(line => console.log(line));
});
}
generateReport(instance, url, slingTracerRequestId, trace).then(report => {
report.map(line => console.log(line));
});
}

@@ -226,4 +234,2 @@ });

const report = [];
report.push(chalk_1.default `[{blue ${instance.name}}] Tracer output for [{yellow ${url ||
"[url missing]"}}] (${slingTracerRequestId})`);
const reportMessages = [];

@@ -310,9 +316,30 @@ const onlyLines = [];

}
const requestProgressErrorLogs = trace.requestProgressLogs
.map(message => {
const match = /\d+ LOG SCRIPT ERROR: (.*)/.exec(message);
if (match) {
const requestProgressErrorLogsRaw = [];
const requestProgressErrorLogs = !trace.requestProgressLogs
? []
: trace.requestProgressLogs
.map(message => {
const match = /\d+ LOG SCRIPT ERROR: (.*)/.exec(message);
if (!match) {
return;
}
const postMessage = match[1];
if (!/ScriptEvaluationException:$/.test(postMessage)) {
const ref = messages.getRef(message, /([^:[\]*'"|\s]+) at line number (\d+) at column number (\d+)/, config.jcrContentRoots);
if (/ScriptEvaluationException:$/.test(postMessage)) {
return;
}
const matchingMessages = requestProgressErrorLogsRaw.filter(logMessage => postMessage.endsWith(logMessage));
if (matchingMessages.length === 0) {
requestProgressErrorLogsRaw.push(postMessage);
let ref;
const progressLogPatterns = [
/([^:[\]*'"|\s]+) at line number (\d+) at column number (\d+)/,
/([^:[\]*'"|\s]+)\((\d+),(\d+)\)/
];
progressLogPatterns.some(pattern => {
const patternMatches = pattern.test(message);
if (patternMatches) {
ref = messages.getRef(message, pattern, config.jcrContentRoots);
}
return patternMatches;
});
if (ref) {

@@ -326,5 +353,4 @@ reportMessages.push({

}
}
})
.filter(message => typeof message === "string");
})
.filter(message => typeof message === "string");
const promises = [];

@@ -343,3 +369,8 @@ for (const { sourceRef, profile } of reportMessages) {

.filter(onlyUnique);
return report.concat(requestProgressErrorLogs, uniqueLocalPaths);
const finalReport = report.concat(requestProgressErrorLogs, uniqueLocalPaths);
if (finalReport.length > 0) {
finalReport.unshift(chalk_1.default `[{blue ${instance.name}}] Tracer output for [{yellow ${url ||
"[url missing]"}}] (${slingTracerRequestId})`);
}
return finalReport;
});

@@ -401,3 +432,5 @@ }

config = args;
config.jcrContentRoots = config.jcrContentRoots || ["src/content/jcr_root/"];
config.jcrContentRoots = config.jcrContentRoots || [
"ui.apps/src/main/content/jcr_root/"
];
args.servers.forEach((server, index) => {

@@ -404,0 +437,0 @@ const host = server.substring(server.indexOf("@") + 1);

@@ -92,2 +92,16 @@ "use strict";

const styleLinkPattern = '(<link rel="stylesheet" href="/[^">]*?)(.min)?(.[0-9a-f]{32})?(.css)("[^>]*>)';
const jsScriptPattern = '(<script type=".*?/javascript" src="/[^">]*?(.min)?(.[0-9a-f]{32})?)(.js)("[^>]*>)';
function rewriteClientlibIncludes(matchedLinkElement, pattern) {
const regex = new RegExp(pattern, "i");
const match = regex.exec(matchedLinkElement);
if (match) {
return match[1] + match[4] + "?browsersync=" + Date.now() + match[5];
}
else {
console.warn("Could not rematch " +
matchedLinkElement +
" to rewrite url w/o .min and .hash");
return matchedLinkElement;
}
}
bsWrapper.create({

@@ -98,15 +112,11 @@ bsOptions: {

fn: (req, res, matchedLinkElement) => {
const regex = new RegExp(styleLinkPattern, "i");
const match = regex.exec(matchedLinkElement);
if (match) {
return (match[1] + match[4] + "?browsersync=" + Date.now() + match[5]);
}
else {
console.warn("Could not rematch " +
matchedLinkElement +
" to rewrite url w/o .min and .hash");
return matchedLinkElement;
}
return rewriteClientlibIncludes(matchedLinkElement, styleLinkPattern);
},
match: new RegExp(styleLinkPattern, "gi")
},
{
fn: (req, res, matchedLinkElement) => {
return rewriteClientlibIncludes(matchedLinkElement, jsScriptPattern);
},
match: new RegExp(jsScriptPattern, "gi")
}

@@ -113,0 +123,0 @@ ]

@@ -32,3 +32,3 @@ "use strict";

function getLocalSourceLine({ absoluteFilePath, relativeFilePath, line, column }) {
const filePath = relativeFilePath || absoluteFilePath;
const filePath = absoluteFilePath;
if (filePath) {

@@ -35,0 +35,0 @@ const fragments = [filePath];

{
"name": "aemfed",
"version": "0.0.5",
"description": "Upload front-end changes into AEM and refresh relevant resources in the page for easier development.",
"version": "0.0.6",
"description": "Upload front-end changes into AEM, refresh relevant resources in the page and get instant notifications from the error.log, all for easier and faster development.",
"author": {

@@ -18,15 +18,15 @@ "name": "Matthijs Abma"

"dependencies": {
"aemsync": "abmaonline/aemsync#da8877c",
"browser-sync": "^2.24.5",
"aemsync": "github:abmaonline/aemsync#a2bed54",
"browser-sync": "^2.26.0",
"chalk": "^2.4.1",
"decode-html": "^2.0.0",
"graceful-fs": "^4.1.9",
"less-tree": "abmaonline/less-tree#6168498",
"less-tree": "github:abmaonline/less-tree#6168498",
"minimist": "^1.2.0",
"opn": "^5.3.0",
"opn": "^5.4.0",
"path": "^0.12.7",
"recursive-readdir": "^2.2.2",
"request": "^2.85.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"tree-model": "^1.0.6"
"tree-model": "^1.0.7"
},

@@ -38,17 +38,16 @@ "devDependencies": {

"@types/minimist": "^1.2.0",
"@types/node": "^9.4.5",
"@types/node": "^9.6.34",
"@types/opn": "^5.1.0",
"@types/recursive-readdir": "^2.2.0",
"@types/request": "^2.47.0",
"@types/request-promise-native": "^1.0.14",
"@types/request": "^2.47.1",
"@types/request-promise-native": "^1.0.15",
"@types/vinyl": "^2.0.2",
"husky": "^0.14.3",
"husky": "^1.1.1",
"precise-commits": "^1.0.2",
"prettier": "1.13.5",
"tslint": "^5.10.0",
"tslint-config-prettier": "1.13.0",
"typescript": "^2.9.2"
"prettier": "1.14.3",
"tslint": "^5.11.0",
"tslint-config-prettier": "1.15.0",
"typescript": "^3.1.1"
},
"scripts": {
"precommit": "precise-commits --check-only && npm run tslint-hook && npm run build",
"prepare": "npm run build",

@@ -62,2 +61,7 @@ "prettier": "prettier --write \"src/**/*.ts\"",

},
"husky": {
"hooks": {
"pre-commit": "precise-commits --check-only && npm run tslint-hook && npm run build"
}
},
"keywords": [

@@ -64,0 +68,0 @@ "aem",

# aemfed
Speed up your AEM front-end development using [aemsync](https://www.npmjs.com/package/aemsync), [BrowserSync](https://www.npmjs.com/package/browser-sync) and [this](https://github.com/abmaonline/aemfed).
Speed up your AEM front-end development using [aemfed](https://aemfed.io). Powered by [aemsync](https://www.npmjs.com/package/aemsync), [Browsersync](https://www.npmjs.com/package/browser-sync) and [Sling Log Tracer](https://sling.apache.org/documentation/bundles/log-tracers.html).
[![Demo of aemfed changing some styling in the WKND project](https://user-images.githubusercontent.com/4146168/42420783-74cf2b58-82cb-11e8-8b36-15bcea9c621e.gif)](https://www.youtube.com/watch?v=sHIHSISOL0w)
> aemfed doing its thing: listening for file changes, uploading them to the running AEM instance, triggering a refresh of the styling in the browser, showing AEM error messages with a reference to the issue in the local file, all within a minute (disclaimer: this is a [special branch](https://github.com/abmaonline/aem-guides-wknd/tree/move-clientlibs-to-components) of the WKND project, optimized for the aemfed workflow).
## Features

@@ -9,4 +13,4 @@

- Determines which clientlibs are affected by the uploaded changes
- Runs [BrowserSync](https://www.npmjs.com/package/browser-sync) in proxy modus so it can communicate with all open instances of your site without any browser plugins. It reloads these pages when the changes have been uploaded, or it only injects the new styling when only styling changes were made, maintaining the state of the page.
- Show serverside errors related to clientlibs for each request (so no more digging in the error.log to see why your styling changes won't show up). It captures errors related to HTL templates, Less compilation, Javascript minification (YUI and GCC), .content.xml, etc.
- Runs [Browsersync](https://www.npmjs.com/package/browser-sync) in proxy modus so it can communicate with all open instances of your site without any browser plugins. It reloads these pages when the changes have been uploaded, or it only injects the new styling when only styling changes were made, maintaining the state of the page.
- Show serverside errors related to clientlibs for each request (so no more digging in the error.log to see why your styling changes won't show up). It captures errors related to HTL templates, JSP files, Less compilation, Javascript minification (YUI and GCC), .content.xml, etc.
- If the error messages contain references to nodes in the jcr, it tries to translate them back to the files on your local file system, so you can navigate directly to the file, line and column mentioned in the error (if your IDE/shell supports the pattern).

@@ -43,3 +47,3 @@

```sh
aemfed -t "http://admin:admin@localhost:4502" -e "**/*___jb_(old|tmp)___" -w "src/content/jcr_root/"
aemfed -t "http://admin:admin@localhost:4502" -e "**/*___jb_+(old|tmp)___" -w "ui.apps/src/main/content/jcr_root/"
```

@@ -66,3 +70,2 @@

```json
[...]
"devDependencies": {

@@ -72,5 +75,4 @@ "aemfed": "^0.0.5"

"scripts": {
"aemfed": "aemfed -t \"http://admin:admin@localhost:4502\" -e \"**/*___jb_(old|tmp)___\" -w \"src/content/jcr_root/\""
"aemfed": "aemfed -t \"http://admin:admin@localhost:4502\" -e \"**/*___jb_+(old|tmp)___\" -w \"ui.apps/src/main/content/jcr_root/\""
},
[...]
```

@@ -100,3 +102,3 @@

If you connect your browsers to the `Local` or `External` Access URL, the BrowserSync reload script will be injected into the pages you visit, allowing aemfed to reload pages automatically after changes have been uploaded to AEM.
If you connect your browsers to the `Local` or `External` Access URL, the Browsersync reload script will be injected into the pages you visit, allowing aemfed to reload pages automatically after changes have been uploaded to AEM.

@@ -132,3 +134,4 @@ Navigate to the page you want to work on and make some changes to the clientlib files under the path provided during startup. When saving the file, aemfed reports the detected file changes:

```
[localhost:4502] Tracer output for [/etc.clientlibs/wknd/clientlibs/clientlib-base.css?browsersync=1530965506424] (62c5e8ac-69e9-491c-8658-2bbed119d0c2)
[localhost:4502] Tracer output for [/etc.clientlibs/wknd/clientlibs/clientlib-base.css?browsersync=
1530965506424] (62c5e8ac-69e9-491c-8658-2bbed119d0c2)
```

@@ -139,3 +142,5 @@

```
[ERROR] LessCompilerImpl: failed to compile less /apps/wknd/components/content/list/clientlib/less/list.less: NameError: variable @brand-secondary2 is undefined in /apps/wknd/components/content/list/clientlib/less/styles/default.less on line 17, column 25:
[ERROR] LessCompilerImpl: failed to compile less /apps/wknd/components/content/list/clientlib/less/
list.less: NameError: variable @brand-secondary2 is undefined in /apps/wknd/components/content/list
/clientlib/less/styles/default.less on line 17, column 25:
16 &:hover {

@@ -149,3 +154,4 @@ 17 background: @brand-secondary2;

```
Local source: ui.apps/src/main/content/jcr_root/apps/wknd/components/content/list/clientlib/less/styles/default.less:17:25
Local source: ui.apps/src/main/content/jcr_root/apps/wknd/components/content/list/clientlib/less/st
yles/default.less:17:25
```

@@ -176,2 +182,3 @@

- aemsync does not respect your projects `filter.xml`, so please be very careful when removing high level items when running aemfed. Changes to root nodes like `/apps`, `/content` and `/etc` are skipped, but when you remove `/etc/clientlibs` from your project (for example after you moved all your clientlibs to proxies in `/apps`) it does exactly that...
- Using ~ (homedir) in paths to watch does not work as expected when aemfed does all the path processing (paths are surrounded with quotes)

@@ -183,5 +190,4 @@ - YUI minification generates errors for each request if there is an error (Less and GCC generate errors only first time after a resource was changed)

- Importing css files in a Less file using `@import` doesn't work, since it appends `.less` to all `@imports`. But since the css probably doesn't need any Less processing anyway, it is better to include it directly in a css.txt (in older versions of AEM it also speeds up the Less processing)
- The issue, where BrowserSync was reloading all css when it could not find one of the patterns, is fixed with this version. Another issue is introduced however. When visiting the web console (`/system/console`) in Firefox, the links from the top menu stop working correctly. After one or two clicks it keeps redirecting you to the bundles page. This behaviour has not been seen in Chrome or Safari.
- The new log processing code is all over the place, needs it own module(s).
Thanks to the [BrowserSync](https://www.npmjs.com/package/browser-sync) team, to [gavoja](https://github.com/gavoja) for [aemsync](https://www.npmjs.com/package/aemsync) and [kevinweber](https://github.com/kevinweber) for [aem-front](https://www.npmjs.com/package/aem-front).
Thanks to the [Browsersync](https://www.npmjs.com/package/browser-sync) team, to [gavoja](https://github.com/gavoja) for [aemsync](https://www.npmjs.com/package/aemsync) and [kevinweber](https://github.com/kevinweber) for [aem-front](https://www.npmjs.com/package/aem-front).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc