Closed thedevopsguyblog closed 2 years ago
@thedevopsguyblog This is working using the example project: https://github.com/amclin/aem-packager-example as well as in unit tests. For troubleshooting can you provide:
Lastly, please doublecheck your package.json as the groupId
belongs under defines
rather than options
(I'll probably modify this in a future release to simplify the normalization). Example: https://github.com/amclin/aem-packager-example/blob/master/package.json#L29-L31
Hey @amclin, thanks for responding.
I noticed that the example project works on my local and my Jenkins server, so I'm pretty confident i'm just missing something.
To be clear, the aem-packager-example has a clientlib.config.js file, do i need my own? For troubleshooting I created my own clientlib.config.js file but it didn't make a difference, still failing.
I also switched from package.json to a .yml file for troubleshooting and the build is still failing (locally and on Jenkins).
Now I'm running this command "aem-packager --config ./aem-packager.yml"
options:
srcDir: /app/public/applications
buildDir: target
jcrPath: /apps/corporate-commons/clientlibs/foundation/resources/corporate-frontend-svelte
defines:
artifactId: corporate-frontend-svelte
description: Corporate frontend svelte
groupId: au.industry.city
version: '2.2.2'
Below is my package.json. Yesterday i removed aem-packager{} and tried the yaml file.
{
"name": "corporate-frontend-svelte",
"description": "Frontend codebase using the Svelte framework",
"version": "2.27.2",
"scripts": {
"esdoc": "./node_modules/.bin/esdoc -c ./.esdoc.json",
"postinstall": "husky install",
"styleguide-ds-build": "cross-env NODE_ENV=production webpack --config config/webpack-styleguide-ds/prod.js",
"styleguide-ds-dev": "webpack serve --config config/webpack-styleguide-ds/dev.js",
"d-styleguide-ds-build": "docker-compose -f ./docker-compose-styleguide-ds.yml up styleguide-ds-build",
"d-styleguide-ds-dev": "docker-compose -f ./docker-compose-styleguide-ds.yml up styleguide-ds-dev",
"courses-build": "npm run test; cross-env NODE_ENV=production webpack --config config/webpack-courses/prod.js",
"courses-dev": "webpack serve --config config/webpack-courses/dev.js",
"courses-spc-dev": "cross-env PAGE_TYPE=spc webpack serve --config config/webpack-courses/dev.js",
"courses-pc-dev": "cross-env PAGE_TYPE=pc webpack serve --config config/webpack-courses/dev.js",
"d-courses-build": "docker-compose -f ./docker-compose-courses.yml up courses-build",
"d-courses-dev": "docker-compose -f ./docker-compose-courses.yml up courses-dev",
"campaign-build": "npm run test; cross-env NODE_ENV=production webpack --config config/webpack-campaign/prod.js",
"campaign-dev": "webpack serve --config config/webpack-campaign/dev.js",
"d-campaign-build": "docker-compose -f ./docker-compose-campaign.yml up campaign-build",
"d-campaign-dev": "docker-compose -f ./docker-compose-campaign.yml up campaign-dev",
"release": "standard-version",
"release-patch": "npm run release -- --release-as patch",
"release-minor": "npm run release -- --release-as minor",
"lint:js": "eslint src/ webpack.*.js --cache --fix",
"test": "NODE_ENV=test jest --runInBand --passWithNoTests",
"d-test": "docker-compose up test",
"test:watch": "npm test -- --watch",
"d-test:watch": "docker-compose up test-watch",
"test:coverage": "npm test -- --coverage",
"test:integration": "cypress run",
"prepare": "husky install",
"build": "clientlib --verbose",
"package": "aem-packager"
},
"dependencies": {
"@xstate/fsm": "^1.6.1",
"@xstate/svelte": "^0.1.0",
"dayjs": "^1.10.6",
"lodash": "^4.17.21",
"md5": "^2.3.0",
"ramda": "^0.27.1",
"rxjs": "^7.3.0",
"rxjs-compat": "^6.6.7",
"smartcrop": "^2.0.5",
"svelte-inline-svg": "^1.0.8",
"svelte-scrollto": "^0.2.0",
"svelte-spa-router": "^3.2.0",
"xstate": "^4.23.1"
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
"@babel/preset-env": "^7.14.8",
"@rollup/plugin-replace": "^2.4.2",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/svelte": "^3.0.3",
"autoprefixer": "^10.3.1",
"babel-jest": "^26.6.3",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^8.1.0",
"cross-env": "^7.0.3",
"css-loader": "^5.0.1",
"esdoc": "^1.1.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^7.23.0",
"eslint-loader": "^4.0.2",
"fetch-mock": "^9.11.0",
"fetch-mock-jest": "^1.5.1",
"file-loader": "^6.2.0",
"html-loader": "^0.5.5",
"html-webpack-partials-plugin": "^0.8.0",
"html-webpack-plugin": "^5.3.1",
"husky": "^5.2.0",
"jest": "^26.6.3",
"jest-extended": "^0.11.5",
"jest-junit": "^12.2.0",
"jest-localstorage-mock": "^2.4.14",
"jest-location-mock": "^1.0.9",
"jest-puppeteer": "^4.4.0",
"jest-svg-transformer": "^1.0.0",
"jest-transform-svelte": "^2.1.1",
"jsdom": "^16.7.0",
"lint-staged": "^10.5.4",
"mini-css-extract-plugin": "^1.3.4",
"mocha": "^9.1.3",
"mq-polyfill": "^1.1.8",
"node-fetch": "^2.6.1",
"node-sass": "^6.0.1",
"postcss-loader": "^5.2.0",
"prettier": "^2.3.2",
"require-dir": "^1.2.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-svelte": "^7.1.0",
"sass-loader": "^11.1.1",
"sass-resources-loader": "^2.2.3",
"standard-version": "^9.3.1",
"svelte": "^3.41.0",
"svelte-jester": "^1.7.0",
"svelte-loader": "^3.0.0",
"svelte-preprocess": "^4.7.4",
"svg-sprite-loader": "^6.0.9",
"svg-spritemap-webpack-plugin": "^4.2.0",
"svg-transform-loader": "^2.0.13",
"svgo-loader": "^3.0.0",
"terser-webpack-plugin": "^5.1.1",
"webpack": "^5.16.0",
"webpack-cli": "^4.4.0",
"webpack-dev-server": "^3.11.2",
"webpack-merge": "^5.7.3",
"aem-clientlib-generator": "^1.7.7"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"prettier --write",
"git add"
],
"*.svelte": [
"prettier --write",
"git add"
]
},
"standard": {
"globals": [
"cy",
"Cypress"
]
}
}
@amclin what do you think?
@thedevopsguyblog the clientlib.config.js isn't necessary, that's just for the separate aem-clientlib-generator
script to make it easy to generate a standard clientlibs folder structure in an automated consistent way. I've tested removing it with no side-effects. I also tried your groupId
in both the package.json and a config yml, (au.industry.city
), and it's working here, so it's not something weird about the group name. I've even used the same yaml file and command as you.
Starting AEM Packager.
Processing list of Defines.
Generating a default JCR installation path.
Package contents will be installed to /apps/au.industry.city/npm-packager-example/clientlibs
Running AEM Packager for au.industry.city.npm-packager-example
[INFO] Scanning for projects...
The only thing I can think of is perhaps a typo in groupId
(lowercase g
, capital i
) but that looks right in your yaml example and you correctly put it in defines
, and not options
.
Try deleting the target
folder entirely and let it run from a clean Maven state.
Closing as it's getting stale and I cannot reproduce
A note to this. We experienced the same problem and came up to this:
With npm 8 (and 7 - but not sure if it was a subversion or 7 overall) adding aem-packager config into package.json will no longer work as the searched keys "npmpackage*" are no longer in process.env (in getFromEnv function). None of the settings are honoured, it looks like mostly due to version is extracted correctly from package.json and the path most likely fits the artifactId, that's why it looks like only groupId is not honoured.
I switched to seperate yaml and now it works again, for the moment. Maybe this helps to track it down.
Interesting.... When I test with NPM 8, the npm_package_*
variables are present:
console.debug(process.env)
npm_package_version: '0.0.0-development',
.....
npm_config_user_agent: 'npm/8.1.0 node/v16.13.0 darwin x64 workspaces/false',
If you are running the command directly from node CLI, or otherwise not from NPM, I could see why the process might not contain the NPM package as environment data.
Edit:
Ahhh.... but I see now the other npm_package_*
variables are no longer included. sigh I think I have a fix for this, something I abandoned long ago because getting from process.env
was so much more reliable, but it probably will break one of the methods of providing configuration values. That seems to be an NPM 8 issue though, and original reporter is on NPM 6, so I'll log a different bug #395
When building my project (either locally or via Jenkins), the default groupId is loaded instead of what is in "aem-packager" under package.json
Steps to reproduce the behavior:
aem-packager
Expected behavior
Environment (please complete the following information):