Skip to content

Commit

Permalink
Merge pull request #15950 from mshima/skip_ci-esm
Browse files Browse the repository at this point in the history
Add esm entry points.
  • Loading branch information
mshima authored Aug 13, 2021
2 parents e14dae5 + c66abde commit 3f23be6
Show file tree
Hide file tree
Showing 88 changed files with 2,615 additions and 45 deletions.
20 changes: 18 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
{
"env": {
"node": true,
"es6": true,
"mocha": true
"es2020": true
},
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"plugins": ["mocha", "prettier", "chai-friendly"],
"settings": {
"import/core-modules": ["generator-jhipster", "generator-jhipster/support"]
},
"overrides": [
{
"files": ["**/*.mjs"],
"parserOptions": {
"ecmaVersion": 11
},
"rules": {
"import/extensions": [0, { "pattern": { "{c,m,}js": "always" } }]
}
},
{
"files": ["**/*.spec.{c,m,}js", "test/**/*.{c,m,}js"],
"env": {
"mocha": true
}
}
],
"rules": {
"prettier/prettier": "error",
"linebreak-style": 0,
Expand Down
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
slow: 0,
timeout: 30000,
ui: 'bdd',
extension: ['js', 'cjs'],
extension: ['js', 'spec.cjs', 'spec.mjs'],
require: 'mocha-expect-snapshot',
parallel: true,
};
21 changes: 21 additions & 0 deletions generators/app/esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import generator from './index.js';

export default generator;
47 changes: 47 additions & 0 deletions generators/app/generator.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import expect from 'expect';
import lodash from 'lodash';
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';

import testSupport from '../../test/support/index.cjs';
import Generator from './index.js';

const { snakeCase } = lodash;
const { testBlueprintSupport } = testSupport;

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const generator = basename(__dirname);

describe(`JHipster ${generator} generator`, () => {
it('generator-list constant matches folder name', async () => {
await expect((await import('../generator-list.js')).default[`GENERATOR_${snakeCase(generator).toUpperCase()}`]).toBe(generator);
});
it('should be exported at package.json', async () => {
await expect((await import(`generator-jhipster/generators/${generator}`)).default).toBe(Generator);
});
it('should support features parameter', () => {
const instance = new Generator([], { help: true }, { bar: true });
expect(instance.features.bar).toBe(true);
});
describe('blueprint support', () => testBlueprintSupport(generator));
});
21 changes: 21 additions & 0 deletions generators/aws/esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import generator from './index.js';

export default generator;
47 changes: 47 additions & 0 deletions generators/aws/generator.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import expect from 'expect';
import lodash from 'lodash';
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';

import testSupport from '../../test/support/index.cjs';
import Generator from './index.js';

const { snakeCase } = lodash;
const { testBlueprintSupport } = testSupport;

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const generator = basename(__dirname);

describe(`JHipster ${generator} generator`, () => {
it('generator-list constant matches folder name', async () => {
await expect((await import('../generator-list.js')).default[`GENERATOR_${snakeCase(generator).toUpperCase()}`]).toBe(generator);
});
it('should be exported at package.json', async () => {
await expect((await import(`generator-jhipster/generators/${generator}`)).default).toBe(Generator);
});
it('should support features parameter', () => {
const instance = new Generator([], { help: true }, { bar: true });
expect(instance.features.bar).toBe(true);
});
describe('blueprint support', () => testBlueprintSupport(generator));
});
21 changes: 21 additions & 0 deletions generators/azure-app-service/esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import generator from './index.js';

export default generator;
47 changes: 47 additions & 0 deletions generators/azure-app-service/generator.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import expect from 'expect';
import lodash from 'lodash';
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';

import testSupport from '../../test/support/index.cjs';
import Generator from './index.js';

const { snakeCase } = lodash;
const { testBlueprintSupport } = testSupport;

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const generator = basename(__dirname);

describe(`JHipster ${generator} generator`, () => {
it('generator-list constant matches folder name', async () => {
await expect((await import('../generator-list.js')).default[`GENERATOR_${snakeCase(generator).toUpperCase()}`]).toBe(generator);
});
it('should be exported at package.json', async () => {
await expect((await import(`generator-jhipster/generators/${generator}`)).default).toBe(Generator);
});
it('should support features parameter', () => {
const instance = new Generator([], { help: true }, { bar: true });
expect(instance.features.bar).toBe(true);
});
describe('blueprint support', () => testBlueprintSupport(generator));
});
21 changes: 21 additions & 0 deletions generators/azure-spring-cloud/esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import generator from './index.js';

export default generator;
47 changes: 47 additions & 0 deletions generators/azure-spring-cloud/generator.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import expect from 'expect';
import lodash from 'lodash';
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';

import testSupport from '../../test/support/index.cjs';
import Generator from './index.js';

const { snakeCase } = lodash;
const { testBlueprintSupport } = testSupport;

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const generator = basename(__dirname);

describe(`JHipster ${generator} generator`, () => {
it('generator-list constant matches folder name', async () => {
await expect((await import('../generator-list.js')).default[`GENERATOR_${snakeCase(generator).toUpperCase()}`]).toBe(generator);
});
it('should be exported at package.json', async () => {
await expect((await import(`generator-jhipster/generators/${generator}`)).default).toBe(Generator);
});
it('should support features parameter', () => {
const instance = new Generator([], { help: true }, { bar: true });
expect(instance.features.bar).toBe(true);
});
describe('blueprint support', () => testBlueprintSupport(generator));
});
21 changes: 21 additions & 0 deletions generators/base/esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import generator from './index.js';

export default generator;
44 changes: 44 additions & 0 deletions generators/base/generator.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright 2013-2021 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import expect from 'expect';
import lodash from 'lodash';
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';

import Generator from './index.js';

const { snakeCase } = lodash;

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const generator = basename(__dirname);

describe(`JHipster ${generator} generator`, () => {
it('generator-list constant matches folder name', async () => {
await expect((await import('../generator-list.js')).default[`GENERATOR_${snakeCase(generator).toUpperCase()}`]).toBe(generator);
});
it('should be exported at package.json', async () => {
await expect((await import(`generator-jhipster/generators/${generator}`)).default).toBe(Generator);
});
it('should support features parameter', () => {
const instance = new Generator([], { help: true }, { bar: true });
expect(instance.features.bar).toBe(true);
});
});
Loading

0 comments on commit 3f23be6

Please sign in to comment.