From d4d828569630eb7c7b557fc09da717012363ac8e Mon Sep 17 00:00:00 2001 From: Bindu Wavell Date: Sat, 25 Mar 2017 17:35:11 -0600 Subject: [PATCH] ncu (#156) * Drop node 0.10 & 0.12, add 7, deps++, fix test * Update dependencies * Bump version and update README.md * Add OOTB Support Tools to README.md * Use `yarn` instead of `npm install` in `.travis.yml` --- .eslintrc.js | 19 ++------ .travis.yml | 8 ++-- README.md | 15 ++++-- ci.js | 2 +- generators/amp-add-local/index.js | 1 - generators/common/alfresco-module-manager.js | 30 ++++++------ package.json | 48 ++++++++++---------- test/test-alfresco-module-manager.js | 14 +++++- 8 files changed, 69 insertions(+), 68 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index dc45e71..0db3279 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,16 +1,3 @@ -/* eslint-env node */ -module.exports = { - "env": { - "node": true - }, - "extends": "standard", - "plugins": [ - "standard" - ], - "rules": { - "comma-dangle": ["error", "always-multiline"], - "no-template-curly-in-string": ["off"], - "operator-linebreak": ["error", "before"], - "semi": ["error", "always", { "omitLastInOneLineBlock": true}], - } -}; +{ + +} diff --git a/.travis.yml b/.travis.yml index 6a6161c..02220df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,20 +4,20 @@ jdk: - oraclejdk8 env: + - NODE_VERSION=v7 - NODE_VERSION=v6 - NODE_VERSION=v5 - NODE_VERSION=v4 - - NODE_VERSION=v0.12 - - NODE_VERSION=v0.10 cache: + yarn: true directories: - - node_modules - $HOME/.m2 install: - nvm install $NODE_VERSION - - npm install + - npm install -g yarn + - yarn script: - nvm use $NODE_VERSION diff --git a/README.md b/README.md index 3dd3f9f..446119c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Alfresco SDK and specifically the All in One maven archetype. ### What is [Yeoman](http://yeoman.io)? Yeoman is a command line tool that helps you to automate coding tasks. Out of the box, Yeoman -doesn't do very much. It relies on a library of thousands of +doesn't do very much. It relies on a library of thousands of [generators](http://yeoman.io/generators/) to actually perform the coding tasks for you. Yeoman lives in the [npm](https://npmjs.org) package repository. Assuming you have a recent @@ -24,21 +24,24 @@ to install Yeoman. npm install -g yo ``` +NOTE: that we now require Node 4.x or above. Information on installing Node is linked from +our [Supported Platforms / Node Versions][installing-node] wiki page. + ### Installing and using the generator -You have a couple of options for installing the Alfresco generator for Yeoman. Your choice will +You have a couple of options for installing the Alfresco generator for Yeoman. Your choice will depend on if you plan to extend the generator or if you simply want to use it. > _Checkout the next section for what to do if you plan to work on the generator code._ -We have not pushed a version of the Alfresco generator to npmjs.org yet, so if you don't +We have not pushed a version of the Alfresco generator to npmjs.org yet, so if you don't plan to make changes to the generator itself, run: ```bash npm install -g binduwavell/generator-alfresco ``` -WARNING: you will likely need to update this occasionally as the project is under active +WARNING: you will likely need to update this occasionally as the project is under active development. Now, assuming you have all of the pre-requisites installed (including appropriate @@ -198,10 +201,11 @@ of the SDK: | | SDK 2.2.0
Community | SDK 2.2.0
Enterprise | SDK 2.1.1
Community | SDK 2.1.1
Enterprise | SDK 2.1.0
Community | SDK 2.1.0
Enterprise | SDK 2.0.0
Community | SDK 2.0.0
Enterprise | local SDK
Community | local SDK
Enterprise | | ------------------------------ | --------- | ---------- | --------- | ---------- | --------- | ---------- | --------- | ---------- | --------- | ---------- | | Alfresco Office Services | 1.1 | 1.1.3 | | | | | | | | | -| Developer Helper | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | +| Developer Helper | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 | | JavaMelody | 1.62.0 | 1.62.0 | | | | | | | | | | JavaScript Console | 0.6 | 0.6 | 0.6 | 0.6 | 0.6 | 0.6 | 0.6 | 0.6 | 0.6 | 0.6 | | JScript Extensions | 1.2 | 1.2 | | | | | | | | | +| Order of the Bee Support Tools | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | 0.0.1.0 | | Records Management | 2.5.a | 2.5.0 | 2.3 | 2.3 | 2.3 | 2.3 | | | | | | Share Inbound Calendar Invites | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | | Share Site Announcements | 0.0.2 | 0.0.2 | 0.0.2 | 0.0.2 | 0.0.2 | 0.0.2 | 0.0.2 | 0.0.2 | 0.0.2 | 0.0.2 | @@ -335,3 +339,4 @@ Apache 2.0 [gitter-url]: https://gitter.im/binduwavell/generator-alfresco?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge [codenvy-image]: http://beta.codenvy.com/factory/resources/codenvy-contribute.svg [codenvy-url]: http://beta.codenvy.com/f?id=zia672875qiibfzv +[installing-node]: https://github.com/binduwavell/generator-alfresco/wiki/Supported-Platforms-Node-Versions#user-content-installing-node diff --git a/ci.js b/ci.js index 9e7ccdc..38ddd65 100755 --- a/ci.js +++ b/ci.js @@ -5,7 +5,7 @@ require('shelljs/global'); var nodeVersion = String(process.argv[2]); var cmd; -if (nodeVersion === 'v6') { +if (nodeVersion === 'v7') { cmd = 'npm run codecov:color'; } else { cmd = 'npm run test:color'; diff --git a/generators/amp-add-local/index.js b/generators/amp-add-local/index.js index 3561258..90408d3 100644 --- a/generators/amp-add-local/index.js +++ b/generators/amp-add-local/index.js @@ -97,7 +97,6 @@ module.exports = SubGenerator.extend({ return this.subgeneratorPrompt(this.prompts, '', function (props) { this.props = props; - this.props.warType; if (_.startsWith(this.props.path, path.join(constants.FOLDER_CUSTOMIZATIONS, constants.FOLDER_AMPS, path.sep))) { this.props.warType = 'repo'; } diff --git a/generators/common/alfresco-module-manager.js b/generators/common/alfresco-module-manager.js index 854ab88..b3e6ded 100644 --- a/generators/common/alfresco-module-manager.js +++ b/generators/common/alfresco-module-manager.js @@ -27,7 +27,7 @@ module.exports = function (yo) { module.addModule = function (modOrGroupId, artifactId, ver, packaging, war, loc, path) { debug('attempting to addModule: %s %s %s %s %s %s %s', modOrGroupId, artifactId, ver, packaging, war, loc, path); var mod = this.moduleRegistry.findModule(modOrGroupId, artifactId, ver, packaging, war, loc, path); - // console.log("Existing module: " + JSON.stringify(mod)); + debug("Existing module: " + JSON.stringify(mod)); if (!mod) { mod = this.moduleRegistry.normalizeModule(modOrGroupId, artifactId, ver, packaging, war, loc, path); debug('normalized result: %j', mod); @@ -37,7 +37,7 @@ module.exports = function (yo) { // Stuff we only need to do for source amps if (mod.location === 'source') { - // console.log('Scheduling ops for ' + mod.artifactId); + debug('Scheduling ops for ' + mod.artifactId); ops.push(function () { copyTemplateForModule(mod) }); ops.push(function () { renamePathElementsForModule(mod) }); ops.push(function () { addModuleToParentPom(mod) }); @@ -56,17 +56,17 @@ module.exports = function (yo) { function copyTemplateForModule (mod) { debug('copyTemplateForModule()'); var toPath = yo.destinationPath(mod.path); - // console.log('Copy destination: ' + toPath); + debug('Copy destination: ' + toPath); if (!yo.fs.exists(toPath)) { var prefix = yo.sdk.sdkVersionPrefix.call(yo); yo.config.get('artifactId'); var fromPath = yo.destinationPath(constants.FOLDER_SOURCE_TEMPLATES + '/' + prefix + mod.war + '-' + mod.packaging); yo.out.info('Copying template for ' + mod.artifactId + ' module ' + fromPath + ' to ' + toPath); if (memFsUtils.existsInMemory(yo.fs, fromPath)) { - // console.log('IN-MEMORY COPY: ' + fromPath + ' to: ' + toPath); + debug('IN-MEMORY COPY: ' + fromPath + ' to: ' + toPath); memFsUtils.inMemoryCopy(yo.fs, fromPath, toPath); } else { - // console.log('PHYSICAL COPY: ' + fromPath + '/** to: ' + toPath); + debug('PHYSICAL COPY: ' + fromPath + '/** to: ' + toPath); yo.fs.copy(path.join(fromPath, '/**'), toPath); } } else { @@ -96,12 +96,12 @@ module.exports = function (yo) { mod.artifactId ); yo.out.info('Renaming path elements from ' + fromPath + ' to ' + toPath); - // console.log("MOVING FROM: " + fromPath + " to: " + toPath); + debug("MOVING FROM: " + fromPath + " to: " + toPath); if (memFsUtils.existsInMemory(yo.fs, fromPath)) { - // console.log('IN-MEMORY MOVE: ' + fromPath + ' to: ' + toPath); + debug('IN-MEMORY MOVE: ' + fromPath + ' to: ' + toPath); memFsUtils.inMemoryMove(yo.fs, fromPath, toPath); } else { - // console.log('PHYSICAL MOVE: ' + fromPath + '/** to: ' + toPath); + debug('PHYSICAL MOVE: ' + fromPath + '/** to: ' + toPath); yo.fs.move(fromPath + '/**', toPath); } } @@ -238,9 +238,9 @@ module.exports = function (yo) { var parentArtifactId = (parentArtifactIdEl ? parentArtifactIdEl.textContent : yo.projectArtifactId || yo.config.get(constants.PROP_PROJECT_ARTIFACT_ID)); var parentVersion = (parentVersionEl ? parentVersionEl.textContent : yo.projectVersion || yo.config.get(constants.PROJECT_VERSION)); - // console.log("POM EXISTS: " + projectPomPath + " [" + yo.fs.exists(projectPomPath) + "]"); + debug("POM EXISTS: " + projectPomPath + " [" + yo.fs.exists(projectPomPath) + "]"); var projectPom = yo.fs.read(projectPomPath); - // console.log("POM CONTENTS: " + projectPom); + debug("POM CONTENTS: " + projectPom); var pom = require('generator-alfresco-common').maven_pom(projectPom); // Unless we are in the customizations folder we can use provided values with // inheritance magic for project.blah references. In the customizations folder @@ -303,7 +303,7 @@ module.exports = function (yo) { var configuration = domutils.getOrCreateChild(plugin, 'pom', 'configuration'); domutils.getOrCreateChild(configuration, 'pom', 'overlays'); pom.addOverlay(mod.groupId, mod.artifactId, mod.packaging); - // console.log(pom.getPOMString()); + debug(pom.getPOMString()); yo.fs.write(wrapperPomPath, pom.getPOMString()); debug('addModuleToWarWrapper() finished'); } @@ -333,12 +333,12 @@ module.exports = function (yo) { yo.out.warn('Deleting source module: ' + mod.path); var absPath = yo.destinationPath(mod.path); // if we have files on disk already this will get them - // console.log("DELETING EXISTING FILES FROM: " + absPath); + debug("DELETING EXISTING FILES FROM: " + absPath); yo.fs.delete(absPath); // if we have files in mem-fs, this should get those yo.fs.store.each(function (file, idx) { if (file.path.indexOf(absPath) === 0) { - // console.log("DELETING: " + file.path); + debug("DELETING: " + file.path); yo.fs.delete(file.path); } }); @@ -380,12 +380,12 @@ module.exports = function (yo) { // now if we find executions for this module remove them too var mft = domutils.getFirstNodeMatchingXPath('pom:execution[pom:id="functional-tests-' + mod.artifactId + '"]', pluginExs); if (mft) { - console.log('Removing functional-tests-' + mod.artifactId); + debug('Removing functional-tests-' + mod.artifactId); domutils.removeParentsChild(pluginExs, mft); } var mvt = domutils.getFirstNodeMatchingXPath('pom:execution[pom:id="verify-tests-' + mod.artifactId + '"]', pluginExs); if (mvt) { - console.log('Removing verify-tests-' + mod.artifactId); + debug('Removing verify-tests-' + mod.artifactId); domutils.removeParentsChild(pluginExs, mvt); } yo.fs.write(runnerPomPath, domutils.prettyPrint(pomDoc)); diff --git a/package.json b/package.json index d263611..40dd2be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-alfresco", - "version": "0.9.1", + "version": "0.9.5", "description": "Yeoman generator", "license": "Apache-2.0", "main": "app/index.js", @@ -27,46 +27,44 @@ "adm-zip": "0.4.7", "ascii-table": "0.0.9", "chalk": "1.1.3", - "debug": "2.3.2", - "generator-alfresco-common": "0.9.2", - "lodash": "4.16.6", + "debug": "2.6.3", + "generator-alfresco-common": "0.9.5", + "lodash": "4.17.4", "pinkie-promise": "2.0.1", "rmdir": "1.2.0", - "run-async": "2.2.0", + "run-async": "2.3.0", "semver": "5.3.0", "yeoman-generator": "0.24.1", - "yosay": "1.2.1" + "yosay": "2.0.0" }, "devDependencies": { - "codecov": "1.0.1", - "coveralls": "2.11.15", - "eslint": "3.10.0", - "eslint-config-standard": "6.2.1", - "eslint-plugin-promise": "3.3.2", - "eslint-plugin-standard": "2.0.1", - "fixme": "0.4.2", - "ghooks": "1.3.2", + "codecov": "2.1.0", + "coveralls": "2.12.0", + "eslint": "3.18.0", + "eslint-config-standard": "7.1.0", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "2.1.1", + "fixme": "0.4.3", + "husky": "0.13.3", "istanbul": "0.4.5", "mem-fs": "1.1.3", - "mem-fs-editor": "2.3.0", - "mocha": "3.1.2", + "mem-fs-editor": "3.0.2", + "mocha": "3.2.0", "mocha-eslint": "3.0.1", - "mocha-lcov-reporter": "1.2.0", - "npm-check-updates": "2.8.6", - "shelljs": "0.5.3", - "yeoman-assert": "2.2.1", - "yeoman-test": "1.5.1" + "mocha-lcov-reporter": "1.3.0", + "npm-check-updates": "2.10.4", + "shelljs": "0.7.7", + "yeoman-assert": "3.0.0", + "yeoman-test": "1.6.0" }, "config": { - "ghooks": { - "pre-commit": "eslint generators test" - } }, "scripts": { "eslint": "eslint generators test || echo DONE", "fixme": "node -e \"require('fixme')()\"", "ncu": "ncu", - "ncu:upgrade": "ncu -u -x shelljs", + "ncu:upgrade": "ncu -u -x run-async -x yeoman-generator", + "precommit": "eslint generators test", "test": "mocha --reporter spec test", "test:color": "mocha --colors --reporter spec test", "test:one": "mocha --reporter spec", diff --git a/test/test-alfresco-module-manager.js b/test/test-alfresco-module-manager.js index 1a628c2..34a85ff 100644 --- a/test/test-alfresco-module-manager.js +++ b/test/test-alfresco-module-manager.js @@ -38,6 +38,8 @@ describe('generator-alfresco:alfresco-module-manager', function () { yomock.fs.write(yomock.wrapperPomPath, ''); yomock.templatePomPath = yomock.destinationPath(constants.FOLDER_SOURCE_TEMPLATES + '/repo-packaging/pom.xml'); yomock.fs.write(yomock.templatePomPath, ''); + yomock.modulePropertiesPath = yomock.destinationPath(constants.FOLDER_SOURCE_TEMPLATES + '/repo-packaging/src/main/amp/config/alfresco/module/repo-amp/module.properties'); + yomock.fs.write(yomock.modulePropertiesPath, ''); yomock.projectPomPath = yomock.destinationPath('path/pom.xml'); yomock.moduleManager.addModule('groupId', 'artifactId', 'version', 'packaging', 'repo', 'source', 'path'); yomock.moduleManager.save(); @@ -83,7 +85,13 @@ describe('generator-alfresco:alfresco-module-manager', function () { assert.equal(packagingNode.textContent, 'packaging'); var parentNode = pom.getOrCreateTopLevelElement('pom', 'parent'); assert.ok(parentNode); - assert.equal(parentNode.toString(), '\n com.example\n placeholder\n 0.0.1-SNAPSHOT\n '); + assert.equal(parentNode.toString(), [ + '', + ' com.example', + ' placeholder', + ' 0.0.1-SNAPSHOT', + ' ', + ].join('\n')); }); it('adds a module to the top pom', function () { @@ -139,6 +147,10 @@ describe('generator-alfresco:alfresco-module-manager', function () { yomock.fs.write(yomock.wrapperPomPath, ''); yomock.targetPomPath = yomock.destinationPath('path/pom.xml'); yomock.fs.write(yomock.targetPomPath, ''); + yomock.templatePomPath = yomock.destinationPath(constants.FOLDER_SOURCE_TEMPLATES + '/war-packaging/pom.xml'); + yomock.fs.write(yomock.templatePomPath, ''); + yomock.modulePropertiesPath = yomock.destinationPath(constants.FOLDER_SOURCE_TEMPLATES + '/war-packaging/src/main/amp/config/alfresco/module/repo-amp/module.properties'); + yomock.fs.write(yomock.modulePropertiesPath, ''); yomock.moduleManager.addModule('groupId', 'artifactId', 'version', 'packaging', 'war', 'source', 'path'); yomock.moduleManager.removeModule('groupId', 'artifactId', 'version', 'packaging', 'war', 'source', 'path'); yomock.moduleManager.save();