Skip to content

Commit

Permalink
Fix JDL Import command (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Raible committed Nov 24, 2019
1 parent 532ed34 commit 0915089
Show file tree
Hide file tree
Showing 10 changed files with 1,162 additions and 1,026 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ atlassian-ide-plugin.xml
test/temp/
*debug.log*
.vscode
*.tgz
Binary file added generator-jhipster-ionic-4.3.1.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ module.exports = class extends BaseGenerator {

let installAuthCmd;
const params = '--configUri=http://localhost:8080/api/auth-info --issuer=null --clientId=null';
const schematicsVersion = '1.0.0';
const schematicsVersion = '1.0.1';

// use `schematics` when testing and expect it to be installed
if (this.installDeps) {
Expand Down Expand Up @@ -318,6 +318,6 @@ module.exports = class extends BaseGenerator {
process.exit(0);
}
}
}
};
}
};
2 changes: 1 addition & 1 deletion generators/import-jdl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const fs = require('fs-extra');
function importJDL() {
logger.info('The JDL is being parsed...');

const jdlImporter = new jhiCore.JDLImporter(this.jdlFiles, {
const jdlImporter = jhiCore.jdl.import.JDLImporter.createImporterFromFiles(this.jdlFiles, {
databaseType: this.prodDatabaseType,
applicationType: this.applicationType,
applicationName: this.baseName
Expand Down
2,059 changes: 1,099 additions & 960 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
"chalk": "3.0.0",
"cross-spawn": "7.0.1",
"fs-extra": "8.1.0",
"generator-jhipster": ">=6.4.1",
"generator-jhipster": ">=6.5.1",
"jsonfile": "5.0.0",
"lodash": "4.17.15",
"pluralize": "8.0.0",
"semver": "6.3.0",
"shelljs": "0.8.3"
},
"devDependencies": {
"@angular-devkit/schematics-cli": "0.803.15",
"@oktadev/schematics": "1.0.0",
"@angular-devkit/schematics-cli": "0.803.19",
"@oktadev/schematics": "1.0.1",
"chai": "4.2.0",
"eslint": "6.6.0",
"eslint": "6.7.0",
"eslint-config-airbnb-base": "14.0.0",
"eslint-plugin-import": "2.18.2",
"jsdoc": "3.6.3",
Expand Down
2 changes: 1 addition & 1 deletion test/templates/backend-jwt/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packageName": "com.okta.developer",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.4.1",
"jhipsterVersion": "6.5.1",
"baseName": "backend",
"reactive": false,
"packageName": "com.okta.developer",
Expand Down
2 changes: 1 addition & 1 deletion test/templates/backend-oauth2/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packageName": "com.okta.developer",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.4.1",
"jhipsterVersion": "6.5.1",
"baseName": "backend",
"reactive": false,
"packageName": "com.okta.developer",
Expand Down
48 changes: 23 additions & 25 deletions test/test-app.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
/* global describe, beforeEach, it */

const path = require('path');
const fse = require('fs-extra');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');

describe('JHipster generator jhipster-generator-ionic', () => {
describe('Test Generating Ionic App with JWT', () => {
beforeEach((done) => {
helpers
.run(path.join(__dirname, '../generators/app'))
.inTmpDir((dir) => {
fse.copySync(path.join(__dirname, '../test/templates'), dir);
})
.withOptions({
interactive: false,
installDeps: false
})
.withPrompts({
appName: 'ionic4j-jwt',
directoryPath: 'backend-jwt'
})
.on('end', done);
});
describe('Test Generating Ionic App with JWT', () => {
beforeEach((done) => {
helpers
.run(path.join(__dirname, '../generators/app'))
.inTmpDir((dir) => {
fse.copySync(path.join(__dirname, '../test/templates'), dir);
})
.withOptions({
interactive: false,
installDeps: false
})
.withPrompts({
appName: 'ionic4j-jwt',
directoryPath: 'backend-jwt'
})
.on('end', done);
});

it('generates a ionic4j-jwt/package.json file', () => {
assert.file(['ionic4j-jwt/package.json']);
});
it('generates a ionic4j-jwt/package.json file', () => {
assert.file(['ionic4j-jwt/package.json']);
});

it('does not delete app/services/auth/auth-jwt.service.ts', () => {
assert.file('ionic4j-jwt/src/app/services/auth/auth-jwt.service.ts');
});
it('does not delete app/services/auth/auth-jwt.service.ts', () => {
assert.file('ionic4j-jwt/src/app/services/auth/auth-jwt.service.ts');
});
});
});
62 changes: 30 additions & 32 deletions test/test-oauth.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
/* global describe, beforeEach, it */

const path = require('path');
const fse = require('fs-extra');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');

describe('JHipster generator jhipster-generator-ionic', () => {
describe('Test Generating Ionic App with OAuth', () => {
beforeEach((done) => {
helpers
.run(path.join(__dirname, '../generators/app'))
.inTmpDir((dir) => {
fse.copySync(path.join(__dirname, '../test/templates'), dir);
})
.withOptions({
interactive: false,
installDeps: false
})
.withPrompts({
appName: 'ionic4j-oauth2',
directoryPath: 'backend-oauth2'
})
.on('end', done);
});
describe('Test Generating Ionic App with OAuth', () => {
beforeEach((done) => {
helpers
.run(path.join(__dirname, '../generators/app'))
.inTmpDir((dir) => {
fse.copySync(path.join(__dirname, '../test/templates'), dir);
})
.withOptions({
interactive: false,
installDeps: false
})
.withPrompts({
appName: 'ionic4j-oauth2',
directoryPath: 'backend-oauth2'
})
.on('end', done);
});

it('deletes files that only apply to JWT', () => {
assert.noFile([
'ionic4j-oauth2/src/app/login',
'ionic4j-oauth2/src/app/tab1',
'ionic4j-oauth2/src/app/pages/signup',
'ionic4j-oauth2/src/app/services/auth/auth-jwt.service.ts',
'ionic4j-oauth2/src/app/services/auth/auth-jwt.service.spec.ts'
]);
});
it('deletes files that only apply to JWT', () => {
assert.noFile([
'ionic4j-oauth2/src/app/login',
'ionic4j-oauth2/src/app/tab1',
'ionic4j-oauth2/src/app/pages/signup',
'ionic4j-oauth2/src/app/services/auth/auth-jwt.service.ts',
'ionic4j-oauth2/src/app/services/auth/auth-jwt.service.spec.ts'
]);
});

it('adds @oktadev/schematics and keeps cordova-plugin-camera', () => {
assert.fileContent('ionic4j-oauth2/package.json', /@oktadev\/schematics/);
assert.fileContent('ionic4j-oauth2/package.json', /CAMERA_USAGE_DESCRIPTION/);
});
it('adds @oktadev/schematics and keeps cordova-plugin-camera', () => {
assert.fileContent('ionic4j-oauth2/package.json', /@oktadev\/schematics/);
assert.fileContent('ionic4j-oauth2/package.json', /CAMERA_USAGE_DESCRIPTION/);
});
});
});

0 comments on commit 0915089

Please sign in to comment.