Skip to content

Commit

Permalink
migrate remaining cjs files to mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Dec 26, 2022
1 parent b386957 commit 677d2fd
Show file tree
Hide file tree
Showing 123 changed files with 865 additions and 926 deletions.
2 changes: 1 addition & 1 deletion cli/environment-builder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { dirname } from 'path';
import { fileURLToPath } from 'url';

import { CLI_NAME, logger } from './utils.mjs';
import generatorUtils from '../generators/utils.cjs';
import generatorUtils from '../generators/utils.mjs';
import { parseBlueprintInfo, loadBlueprintsFromConfiguration, mergeBlueprints } from '../utils/blueprint.mjs';

const { packageNameToNamespace } = generatorUtils;
Expand Down
5 changes: 3 additions & 2 deletions cli/import-jdl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ import { fork as forkProcess } from 'child_process';
import EnvironmentBuilder from './environment-builder.mjs';
import { CLI_NAME, GENERATOR_NAME, logger, printSuccess, getOptionAsArgs } from './utils.mjs';
import { packageJson as packagejs } from '../lib/index.mjs';
import statistics from '../generators/statistics.cjs';
import { JHIPSTER_CONFIG_DIR } from '../generators/generator-constants.mjs';
import statistics from '../generators/statistics.mjs';
import constants from '../generators/generator-constants.mjs';
import { writeConfigFile } from './export-utils.mjs';

const { JHIPSTER_CONFIG_DIR } = constants;
const jhipsterCli = join(dirname(fileURLToPath(import.meta.url)), 'cli.mjs');

const getDeploymentType = deployment => deployment && deployment[GENERATOR_NAME] && deployment[GENERATOR_NAME].deploymentType;
Expand Down
2 changes: 1 addition & 1 deletion cli/program.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import SUB_GENERATORS from './commands.mjs';
import JHipsterCommand from './jhipster-command.mjs';
import { CLI_NAME, logger, getCommand, done } from './utils.mjs';
import { packageJson } from '../lib/index.mjs';
import generatorUtils from '../generators/utils.cjs';
import generatorUtils from '../generators/utils.mjs';

const { packageNameToNamespace } = generatorUtils;
const __filename = fileURLToPath(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/generator.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Generator from './index.mjs';
import { defaultHelpers as helpers } from '../../test/support/helpers.mjs';

import { clientFrameworkTypes } from '../../jdl/jhipster/index.mjs';
import constants from '../generator-constants.cjs';
import constants from '../generator-constants.mjs';
import BaseApplicationGenerator from '../base-application/index.mjs';

const { snakeCase } = lodash;
Expand Down
2 changes: 1 addition & 1 deletion generators/app/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import serverOptions from '../server/options.mjs';
import { cleanupOldFiles, upgradeFiles } from '../cleanup.mjs';
import prompts from './prompts.mjs';
import { packageJson as packagejs } from '../../lib/index.mjs';
import statistics from '../statistics.cjs';
import statistics from '../statistics.mjs';
import generatorDefaults from '../generator-defaults.mjs';
import {
GENERATOR_APP,
Expand Down
2 changes: 1 addition & 1 deletion generators/app/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/
import chalk from 'chalk';
import statistics from '../statistics.cjs';
import statistics from '../statistics.mjs';
import { packageJson as packagejs } from '../../lib/index.mjs';
import generatorsDefaults from '../generator-defaults.mjs';
import { applicationTypes, testFrameworkTypes } from '../../jdl/jhipster/index.mjs';
Expand Down
4 changes: 2 additions & 2 deletions generators/aws/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import chalk from 'chalk';
import BaseGenerator from '../base/index.mjs';

import prompts from './prompts.mjs';
import AwsFactory from './lib/aws.cjs';
import statistics from '../statistics.cjs';
import AwsFactory from './lib/aws.mjs';
import statistics from '../statistics.mjs';
import { GENERATOR_AWS } from '../generator-list.mjs';
import { applicationOptions, databaseTypes } from '../../jdl/jhipster/index.mjs';

Expand Down
14 changes: 8 additions & 6 deletions generators/aws/lib/aws.cjs → generators/aws/lib/aws.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const S3 = require('./s3.cjs');
const Rds = require('./rds.cjs');
const Eb = require('./eb.cjs');
const Iam = require('./iam.cjs');
import S3 from './s3.mjs';
import Rds from './rds.mjs';
import Eb from './eb.mjs';
import Iam from './iam.mjs';

let Aws;
let generator;

const AwsFactory = (module.exports = function AwsFactory(generatorRef, cb) {
const AwsFactory = function AwsFactory(generatorRef, cb) {
generator = generatorRef;
try {
Aws = require('aws-sdk'); // eslint-disable-line
cb();
} catch (e) {
generator.error(`Something went wrong while running jhipster:aws:\n${e}`);
}
});
};

AwsFactory.prototype.init = function initAws(options) {
Aws.config.region = options.region;
Expand All @@ -53,3 +53,5 @@ AwsFactory.prototype.getEb = function getEb() {
AwsFactory.prototype.getIam = function getIa() {
return new Iam(Aws, generator);
};

export default AwsFactory;
5 changes: 3 additions & 2 deletions generators/aws/lib/eb.cjs → generators/aws/lib/eb.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
let aws;
let uuidV4;

const Eb = (module.exports = function Eb(Aws, generator) {
const Eb = function Eb(Aws, generator) {
aws = Aws;
try {
const { v4 } = require('uuid'); // eslint-disable-line
uuidV4 = v4;
} catch (e) {
generator.error(`Something went wrong while running jhipster:aws:\n${e}`);
}
});
};

Eb.prototype.createApplication = function createApplication(params, callback) {
const applicationName = params.applicationName;
Expand Down Expand Up @@ -245,3 +245,4 @@ function updateEnvironment(params, callback) {
}
});
}
export default Eb;
5 changes: 3 additions & 2 deletions generators/aws/lib/iam.cjs → generators/aws/lib/iam.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const AWS_SERVICE_ARN = suffix => `arn:aws:iam::aws:policy/service-role/${suffix
let aws;
let log;

const Iam = (module.exports = function Iam(Aws, generator) {
const Iam = function Iam(Aws, generator) {
aws = Aws;
log = generator.log;
});
};

const createRole = (RoleName, Description, AssumeRolePolicyDocument) => {
const iam = new aws.IAM();
Expand Down Expand Up @@ -219,3 +219,4 @@ Iam.prototype.verifyRoles = function verifyRoles(params, callback) {
);
});
};
export default Iam;
5 changes: 3 additions & 2 deletions generators/aws/lib/rds.cjs → generators/aws/lib/rds.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
let aws;

const Rds = (module.exports = function Rds(Aws) {
const Rds = function Rds(Aws) {
aws = Aws;
});
};

Rds.prototype.createDatabase = function createDatabase(params, callback) {
const dbInstanceClass = params.dbInstanceClass;
Expand Down Expand Up @@ -148,3 +148,4 @@ function createDbInstance(params, callback) {
}
});
}
export default Rds;
12 changes: 7 additions & 5 deletions generators/aws/lib/s3.cjs → generators/aws/lib/s3.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const fs = require('fs');

const { GRADLE } = require('../../../jdl/jhipster/build-tool-types');
import fs from 'fs';
import { buildToolTypes } from '../../../jdl/jhipster/index.mjs';

const { GRADLE } = buildToolTypes;
const FILE_EXTENSION = '.war';
const S3_STANDARD_REGION = 'us-east-1';

let Progressbar;

const S3 = (module.exports = function S3(Aws, generator) {
const S3 = function S3(Aws, generator) {
this.Aws = Aws;
try {
Progressbar = require('progress'); // eslint-disable-line
} catch (e) {
generator.error(`Something went wrong while running jhipster:aws:\n${e}`);
}
});
};

S3.prototype.createBucket = function createBucket(params, callback) {
const bucket = params.bucket;
Expand Down Expand Up @@ -161,3 +161,5 @@ function success(message, callback) {
function error(message, callback) {
callback({ message }, null);
}

export default S3;
4 changes: 2 additions & 2 deletions generators/azure-app-service/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import { exec } from 'child_process';
import chalk from 'chalk';
import BaseGenerator from '../base/index.mjs';

import statistics from '../statistics.cjs';
import statistics from '../statistics.mjs';
import generatorDefaults from '../generator-defaults.mjs';

// Global constants
import constants from '../generator-constants.cjs';
import constants from '../generator-constants.mjs';

import { GENERATOR_AZURE_APP_SERVICE } from '../generator-list.mjs';
import { buildToolTypes } from '../../jdl/jhipster/index.mjs';
Expand Down
4 changes: 2 additions & 2 deletions generators/azure-spring-cloud/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { exec } from 'child_process';
import chalk from 'chalk';
import BaseGenerator from '../base/index.mjs';

import statistics from '../statistics.cjs';
import statistics from '../statistics.mjs';

import constants from '../generator-constants.cjs';
import constants from '../generator-constants.mjs';

import { cacheTypes, buildToolTypes } from '../../jdl/jhipster/index.mjs';
import { GENERATOR_AZURE_SPRING_CLOUD } from '../generator-list.mjs';
Expand Down
3 changes: 2 additions & 1 deletion generators/base-application/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import _ from 'lodash';

import BaseGenerator from '../base/index.mjs';
import { CUSTOM_PRIORITIES, PRIORITY_NAMES, QUEUES } from './priorities.mjs';
import { JHIPSTER_CONFIG_DIR } from '../generator-constants.mjs';
import constants from '../generator-constants.mjs';

const { JHIPSTER_CONFIG_DIR } = constants;
const {
LOADING,
PREPARING,
Expand Down
138 changes: 0 additions & 138 deletions generators/base-application/priorities.cjs

This file was deleted.

Loading

0 comments on commit 677d2fd

Please sign in to comment.