diff --git a/angular/examples/my-angular-env/config/jest.config.cjs b/angular/examples/my-angular-env/config/jest.config.cjs index fdc8d87..257e87b 100644 --- a/angular/examples/my-angular-env/config/jest.config.cjs +++ b/angular/examples/my-angular-env/config/jest.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -const { jestConfig } = require('@bitdev/angular.angular-env'); +const { jestConfig } = require('@bitdev/angular.envs.angular-v17-env/jest/jest.config.cjs'); const { generateNodeModulesPattern } = require('@teambit/dependencies.modules.packages-excluder'); const { defaultTransformerOptions } = require('jest-preset-angular/presets'); diff --git a/angular/examples/my-angular-env/config/prettier.config.cjs b/angular/examples/my-angular-env/config/prettier.config.cjs index 81493b2..222b241 100644 --- a/angular/examples/my-angular-env/config/prettier.config.cjs +++ b/angular/examples/my-angular-env/config/prettier.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@bitdev/angular.envs.base-env'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env/config/prettier.config.cjs'); module.exports = { ...prettierConfig, diff --git a/angular/examples/my-angular-env/my-angular-env.bit-env.ts b/angular/examples/my-angular-env/my-angular-env.bit-env.ts index 8a11be4..369cf10 100644 --- a/angular/examples/my-angular-env/my-angular-env.bit-env.ts +++ b/angular/examples/my-angular-env/my-angular-env.bit-env.ts @@ -51,7 +51,7 @@ export class MyAngularEnv extends AngularEnv { eslint: ESLintLib, configPath: require.resolve('./config/eslintrc.cjs'), // resolve all plugins from the angular environment. - pluginsPath: __dirname, + pluginsPath: import.meta.dirname, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }; } diff --git a/angular/examples/my-angular-v13-env/config/jest.config.cjs b/angular/examples/my-angular-v13-env/config/jest.config.cjs index abb9e4d..9e5504a 100644 --- a/angular/examples/my-angular-v13-env/config/jest.config.cjs +++ b/angular/examples/my-angular-v13-env/config/jest.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -const { jestConfig } = require('@bitdev/angular.envs.angular-v13-env'); +const { jestConfig } = require('@bitdev/angular.envs.angular-v13-env/jest/jest.config.cjs'); const { generateNodeModulesPattern } = require('@teambit/dependencies.modules.packages-excluder'); const packagesToExclude = ['@angular', '@ngrx', 'apollo-angular']; diff --git a/angular/examples/my-angular-v13-env/config/prettier.config.cjs b/angular/examples/my-angular-v13-env/config/prettier.config.cjs index 81493b2..222b241 100644 --- a/angular/examples/my-angular-v13-env/config/prettier.config.cjs +++ b/angular/examples/my-angular-v13-env/config/prettier.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@bitdev/angular.envs.base-env'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env/config/prettier.config.cjs'); module.exports = { ...prettierConfig, diff --git a/angular/examples/my-angular-v13-env/my-angular-v13-env.bit-env.ts b/angular/examples/my-angular-v13-env/my-angular-v13-env.bit-env.ts index e76a68d..6cff137 100644 --- a/angular/examples/my-angular-v13-env/my-angular-v13-env.bit-env.ts +++ b/angular/examples/my-angular-v13-env/my-angular-v13-env.bit-env.ts @@ -51,7 +51,7 @@ export class MyAngularV13Env extends AngularV13Env { eslint: ESLintLib, configPath: require.resolve('./config/eslintrc.cjs'), // resolve all plugins from the angular environment. - pluginsPath: __dirname, + pluginsPath: import.meta.dirname, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }; } diff --git a/angular/examples/my-angular-v14-env/config/jest.config.cjs b/angular/examples/my-angular-v14-env/config/jest.config.cjs index 11cf8dd..c8d3d22 100644 --- a/angular/examples/my-angular-v14-env/config/jest.config.cjs +++ b/angular/examples/my-angular-v14-env/config/jest.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -const { jestConfig } = require('@bitdev/angular.envs.angular-v14-env'); +const { jestConfig } = require('@bitdev/angular.envs.angular-v14-env/jest/jest.config.cjs'); const { generateNodeModulesPattern } = require('@teambit/dependencies.modules.packages-excluder'); const packagesToExclude = ['@angular', '@ngrx', 'apollo-angular']; diff --git a/angular/examples/my-angular-v14-env/config/prettier.config.cjs b/angular/examples/my-angular-v14-env/config/prettier.config.cjs index 81493b2..222b241 100644 --- a/angular/examples/my-angular-v14-env/config/prettier.config.cjs +++ b/angular/examples/my-angular-v14-env/config/prettier.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@bitdev/angular.envs.base-env'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env/config/prettier.config.cjs'); module.exports = { ...prettierConfig, diff --git a/angular/examples/my-angular-v14-env/my-angular-v14-env.bit-env.ts b/angular/examples/my-angular-v14-env/my-angular-v14-env.bit-env.ts index b1f57c5..1455c63 100644 --- a/angular/examples/my-angular-v14-env/my-angular-v14-env.bit-env.ts +++ b/angular/examples/my-angular-v14-env/my-angular-v14-env.bit-env.ts @@ -51,7 +51,7 @@ export class MyAngularV14Env extends AngularV14Env { eslint: ESLintLib, configPath: require.resolve('./config/eslintrc.cjs'), // resolve all plugins from the angular environment. - pluginsPath: __dirname, + pluginsPath: import.meta.dirname, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }; } diff --git a/angular/examples/my-angular-v15-env/config/jest.config.cjs b/angular/examples/my-angular-v15-env/config/jest.config.cjs index cea6d0e..220c083 100644 --- a/angular/examples/my-angular-v15-env/config/jest.config.cjs +++ b/angular/examples/my-angular-v15-env/config/jest.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -const { jestConfig } = require('@bitdev/angular.envs.angular-v15-env'); +const { jestConfig } = require('@bitdev/angular.envs.angular-v15-env/jest/jest.config.cjs'); const { generateNodeModulesPattern } = require('@teambit/dependencies.modules.packages-excluder'); const packagesToExclude = ['@angular', '@ngrx', 'apollo-angular']; diff --git a/angular/examples/my-angular-v15-env/config/prettier.config.cjs b/angular/examples/my-angular-v15-env/config/prettier.config.cjs index 81493b2..222b241 100644 --- a/angular/examples/my-angular-v15-env/config/prettier.config.cjs +++ b/angular/examples/my-angular-v15-env/config/prettier.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@bitdev/angular.envs.base-env'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env/config/prettier.config.cjs'); module.exports = { ...prettierConfig, diff --git a/angular/examples/my-angular-v15-env/my-angular-v15-env.bit-env.ts b/angular/examples/my-angular-v15-env/my-angular-v15-env.bit-env.ts index 44a0276..3fe6638 100644 --- a/angular/examples/my-angular-v15-env/my-angular-v15-env.bit-env.ts +++ b/angular/examples/my-angular-v15-env/my-angular-v15-env.bit-env.ts @@ -51,7 +51,7 @@ export class MyAngularV15Env extends AngularV15Env { eslint: ESLintLib, configPath: require.resolve('./config/eslintrc.cjs'), // resolve all plugins from the angular environment. - pluginsPath: __dirname, + pluginsPath: import.meta.dirname, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }; } diff --git a/angular/examples/my-angular-v16-env/config/jest.config.cjs b/angular/examples/my-angular-v16-env/config/jest.config.cjs index 893d04b..ef7f30f 100644 --- a/angular/examples/my-angular-v16-env/config/jest.config.cjs +++ b/angular/examples/my-angular-v16-env/config/jest.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -const { jestConfig } = require('@bitdev/angular.envs.angular-v16-env'); +const { jestConfig } = require('@bitdev/angular.envs.angular-v16-env/jest/jest.config.cjs'); const { generateNodeModulesPattern } = require('@teambit/dependencies.modules.packages-excluder'); const { defaultTransformerOptions } = require('jest-preset-angular/presets'); diff --git a/angular/examples/my-angular-v16-env/config/prettier.config.cjs b/angular/examples/my-angular-v16-env/config/prettier.config.cjs index 81493b2..222b241 100644 --- a/angular/examples/my-angular-v16-env/config/prettier.config.cjs +++ b/angular/examples/my-angular-v16-env/config/prettier.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@bitdev/angular.envs.base-env'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env/config/prettier.config.cjs'); module.exports = { ...prettierConfig, diff --git a/angular/examples/my-angular-v16-env/my-angular-v16-env.bit-env.ts b/angular/examples/my-angular-v16-env/my-angular-v16-env.bit-env.ts index fa9bb06..0cd4876 100644 --- a/angular/examples/my-angular-v16-env/my-angular-v16-env.bit-env.ts +++ b/angular/examples/my-angular-v16-env/my-angular-v16-env.bit-env.ts @@ -51,7 +51,7 @@ export class MyAngularV16Env extends AngularV16Env { eslint: ESLintLib, configPath: require.resolve('./config/eslintrc.cjs'), // resolve all plugins from the angular environment. - pluginsPath: __dirname, + pluginsPath: import.meta.dirname, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }; } diff --git a/angular/examples/my-angular-v17-env/config/jest.config.cjs b/angular/examples/my-angular-v17-env/config/jest.config.cjs index 5dbcf9b..009e4d6 100644 --- a/angular/examples/my-angular-v17-env/config/jest.config.cjs +++ b/angular/examples/my-angular-v17-env/config/jest.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -const { jestConfig } = require('@bitdev/angular.envs.angular-v17-env'); +const { jestConfig } = require('@bitdev/angular.envs.angular-v17-env/jest/jest.config.cjs'); const { generateNodeModulesPattern } = require('@teambit/dependencies.modules.packages-excluder'); const { defaultTransformerOptions } = require('jest-preset-angular/presets'); diff --git a/angular/examples/my-angular-v17-env/config/prettier.config.cjs b/angular/examples/my-angular-v17-env/config/prettier.config.cjs index 81493b2..222b241 100644 --- a/angular/examples/my-angular-v17-env/config/prettier.config.cjs +++ b/angular/examples/my-angular-v17-env/config/prettier.config.cjs @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@bitdev/angular.envs.base-env'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env/config/prettier.config.cjs'); module.exports = { ...prettierConfig, diff --git a/angular/examples/my-angular-v17-env/my-angular-v17-env.bit-env.ts b/angular/examples/my-angular-v17-env/my-angular-v17-env.bit-env.ts index e0a522f..0b76e6d 100644 --- a/angular/examples/my-angular-v17-env/my-angular-v17-env.bit-env.ts +++ b/angular/examples/my-angular-v17-env/my-angular-v17-env.bit-env.ts @@ -51,7 +51,7 @@ export class MyAngularV17Env extends AngularV17Env { eslint: ESLintLib, configPath: require.resolve('./config/eslintrc.cjs'), // resolve all plugins from the angular environment. - pluginsPath: __dirname, + pluginsPath: import.meta.dirname, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }; } diff --git a/angular/templates/generators/ng-env/files/config/jest.config.ts b/angular/templates/generators/ng-env/files/config/jest.config.ts index 48b6047..59eeae3 100644 --- a/angular/templates/generators/ng-env/files/config/jest.config.ts +++ b/angular/templates/generators/ng-env/files/config/jest.config.ts @@ -4,7 +4,7 @@ export const jestConfigFile = (angularVersion: number, envPkgName: string) => { content: `/** * @see https://bit.dev/reference/jest/jest-config */ -const { jestConfig } = require('${envPkgName}'); +const { jestConfig } = require('${envPkgName}/jest/jest.config.cjs'); const { generateNodeModulesPattern } = require('@teambit/dependencies.modules.packages-excluder'); ${angularVersion >= 16 ? ` const { defaultTransformerOptions } = require('jest-preset-angular/presets'); diff --git a/angular/templates/generators/ng-env/files/config/prettier.config.ts b/angular/templates/generators/ng-env/files/config/prettier.config.ts index 22d2c8e..b7b4005 100644 --- a/angular/templates/generators/ng-env/files/config/prettier.config.ts +++ b/angular/templates/generators/ng-env/files/config/prettier.config.ts @@ -4,7 +4,7 @@ export const prettierConfigFile = () => { content: `/** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@bitdev/angular.envs.base-env'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env/config/prettier.config.cjs'); module.exports = { ...prettierConfig, diff --git a/angular/templates/generators/ng-env/files/env.ts b/angular/templates/generators/ng-env/files/env.ts index da97822..ac79c7b 100644 --- a/angular/templates/generators/ng-env/files/env.ts +++ b/angular/templates/generators/ng-env/files/env.ts @@ -52,7 +52,7 @@ export class ${Name} extends ${envName} { eslint: ESLintLib, configPath: require.resolve('./config/eslintrc.cjs'), // resolve all plugins from the angular environment. - pluginsPath: __dirname, + pluginsPath: import.meta.dirname, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }; } diff --git a/angular/templates/generators/ng-env/index.ts b/angular/templates/generators/ng-env/index.ts index f20613b..9916076 100644 --- a/angular/templates/generators/ng-env/index.ts +++ b/angular/templates/generators/ng-env/index.ts @@ -38,13 +38,17 @@ export class NgEnvTemplate implements ComponentTemplate { const aspectId: ComponentID = typeof context.aspectId === 'string' ? ComponentID.fromString(context.aspectId) : context.aspectId; const envId = aspectId.toStringWithoutVersion(); let envPkgName: string; + let jestEnvPkgName: string; if (this.workspace) { const envComponent = await this.workspace!.get(aspectId); envPkgName = this.pkg.getPackageName(envComponent); + jestEnvPkgName = this.pkg.getPackageName(envComponent); } else if (envId === 'bitdev.angular/angular-env') { // mostly for ci / ripple envPkgName = '@bitdev/angular.angular-env'; + jestEnvPkgName = `@bitdev/angular.envs.angular-v${ this.angularVersion }-env`; } else { envPkgName = `@bitdev/angular.envs.angular-v${ this.angularVersion }-env`; + jestEnvPkgName = `@bitdev/angular.envs.angular-v${ this.angularVersion }-env`; } return [ { @@ -62,7 +66,7 @@ export class NgEnvTemplate implements ComponentTemplate { content: envFile(context, this.envName, this.angularVersion, envPkgName) }, eslintConfigFile(), - jestConfigFile(this.angularVersion, envPkgName), + jestConfigFile(this.angularVersion, jestEnvPkgName), prettierConfigFile(), tsConfigFile(), tsConfigSpecFile(),