diff --git a/.bitmap b/.bitmap index 9717d030..eddc6336 100644 --- a/.bitmap +++ b/.bitmap @@ -9,161 +9,167 @@ */ { - "angular": { - "scope": "teambit.angular", - "version": "4.1.17", + "angular-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/angular" + "rootDir": "angular/envs/angular-env" }, - "dev-services/compiler/angular-elements": { - "scope": "teambit.angular", - "version": "1.0.24", + "app-types/angular-app-type": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/compiler/angular-elements" + "rootDir": "angular/app-types/angular-app-type" }, - "dev-services/compiler/ng-multi-compiler": { - "scope": "teambit.angular", - "version": "1.1.9", + "dev-services/common": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/compiler/ng-multi-compiler" + "rootDir": "angular/devkit/common" }, - "dev-services/compiler/ng-packagr": { - "scope": "teambit.angular", - "version": "2.1.9", + "dev-services/compiler/elements": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/compiler/ng-packagr" + "rootDir": "angular/devkit/compiler/elements" }, - "dev-services/compiler/ngcc": { - "scope": "teambit.angular", - "version": "0.1.7", + "dev-services/compiler/multi-compiler": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/compiler/ngcc" + "rootDir": "angular/devkit/compiler/multi-compiler" }, - "dev-services/compiler/webpack": { - "scope": "teambit.angular", - "version": "1.0.29", + "dev-services/compiler/ng-packagr": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/compiler/webpack" + "rootDir": "angular/devkit/compiler/ng-packagr" }, - "dev-services/linter/angular-eslint-config": { - "scope": "teambit.angular", - "version": "2.0.6", + "dev-services/linter/eslint": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.js", - "rootDir": "scopes/dev-services/linter/eslint-config" + "rootDir": "angular/devkit/linter/eslint" }, - "dev-services/preview/angular-runtime": { - "scope": "teambit.angular", - "version": "1.0.5", + "dev-services/ngcc": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/preview/angular-runtime" + "rootDir": "angular/devkit/ngcc" }, "dev-services/preview/mounter": { - "scope": "teambit.angular", - "version": "1.0.6", + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/preview/mounter" + "rootDir": "angular/devkit/preview/mounter" }, "dev-services/preview/preview": { - "scope": "teambit.angular", - "version": "1.0.14", + "scope": "bitdev.angular", + "version": "1.0.0", + "mainFile": "index.ts", + "rootDir": "angular/devkit/preview/preview" + }, + "dev-services/preview/runtime": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/dev-services/preview/preview" + "rootDir": "angular/devkit/preview/runtime" }, - "forks/angular-env-default": { - "scope": "teambit.angular", - "version": "0.1.18", + "dev-services/webpack": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/forks/angular-env-default" + "rootDir": "angular/devkit/webpack" }, - "forks/angular-env-v12": { - "scope": "teambit.angular", - "version": "0.2.17", + "envs/angular-v12-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/forks/angular-env-v12" + "rootDir": "angular/envs/angular-v12-env" }, - "forks/angular-env-v13": { - "scope": "teambit.angular", - "version": "0.2.17", + "envs/angular-v13-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/forks/angular-env-v13" + "rootDir": "angular/envs/angular-v13-env" }, - "forks/angular-env-v14": { - "scope": "teambit.angular", - "version": "0.2.19", + "envs/angular-v14-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/forks/angular-env-v14" + "rootDir": "angular/envs/angular-v14-env" }, - "forks/angular-env-v15": { - "scope": "teambit.angular", - "version": "0.2.17", + "envs/angular-v15-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/forks/angular-env-v15" + "rootDir": "angular/envs/angular-v15-env" }, - "forks/angular-env-v16": { - "scope": "teambit.angular", - "version": "0.2.18", + "envs/angular-v16-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/forks/angular-env-v16" + "rootDir": "angular/envs/angular-v16-env" }, - "generators/angular-starters": { - "scope": "teambit.angular", - "version": "1.1.19", + "envs/base-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/generators/angular-starters" + "rootDir": "angular/envs/base-env" }, - "generators/angular-templates": { - "scope": "teambit.angular", - "version": "1.0.20", + "examples/my-angular-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/generators/angular-templates" + "rootDir": "angular/examples/my-angular-env" }, - "versions/angular-v12": { - "scope": "teambit.angular", - "version": "2.2.16", + "examples/my-angular-v12-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/versions/angular-v12" + "rootDir": "angular/examples/my-angular-v12-env" }, - "versions/angular-v13": { - "scope": "teambit.angular", - "version": "2.2.16", + "examples/my-angular-v13-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/versions/angular-v13" + "rootDir": "angular/examples/my-angular-v13-env" }, - "versions/angular-v14": { - "scope": "teambit.angular", - "version": "2.2.18", + "examples/my-angular-v14-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/versions/angular-v14" + "rootDir": "angular/examples/my-angular-v14-env" }, - "versions/angular-v15": { - "scope": "teambit.angular", - "version": "2.2.16", + "examples/my-angular-v15-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/versions/angular-v15" + "rootDir": "angular/examples/my-angular-v15-env" }, - "versions/angular-v16": { - "scope": "teambit.angular", - "version": "1.1.17", + "examples/my-angular-v16-env": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/versions/angular-v16" + "rootDir": "angular/examples/my-angular-v16-env" }, - "versions/common/angular-apps": { - "scope": "teambit.angular", - "version": "1.0.23", + "readme": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/versions/common/angular-apps" + "rootDir": "angular/readme" }, - "versions/common/angular-base": { - "scope": "teambit.angular", - "version": "1.2.15", + "templates/generators": { + "scope": "bitdev.angular", + "version": "1.0.0", "mainFile": "index.ts", - "rootDir": "scopes/versions/common/angular-base" + "rootDir": "angular/templates/generators" }, - "versions/common/angular-common": { - "scope": "teambit.angular", - "version": "1.0.10", + "templates/starters": { + "scope": "bitdev.angular", + "version": "1.0.1", "mainFile": "index.ts", - "rootDir": "scopes/versions/common/angular-common" + "rootDir": "angular/templates/starters" }, "$schema-version": "16.0.0" } \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index c08777b6..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,108 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - ignorePatterns: ["node_modules/"], - parserOptions: { - createDefaultProgram: true - }, - env: { - browser: true, - node: true, - es6: true, - jest: true - }, - extends: [ - 'plugin:@typescript-eslint/recommended', - "plugin:markdown/recommended" - ], - plugins: [ - '@typescript-eslint', - 'import' - ], - overrides: [ - { - files: ['*.ts', '*.js'], - parserOptions: { - project: require.resolve('./tsconfig.json'), - createDefaultProgram: true, - } - } - ], - rules: { - complexity: ['error', { max: 25 }], - 'no-console': ['error'], - '@typescript-eslint/no-unused-vars': ['error', { args: 'after-used' }], - '@typescript-eslint/no-use-before-define': [ - 'error', - { functions: false, classes: true, variables: true, typedefs: true }, - ], - '@typescript-eslint/return-await': 'error', - 'no-return-await': 'off', - '@typescript-eslint/no-misused-promises': 'error', - '@typescript-eslint/no-floating-promises': 'error', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/ban-types': 'off', - 'no-shadow': 'off', - '@typescript-eslint/no-shadow': ['error'], - // ERRORS OF plugin:@typescript-eslint/recommended - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/ban-ts-ignore': 'off', - '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/no-explicit-any': 'off', - // END ERRORS OF plugin:@typescript-eslint/recommended - - // ERRORS OF 'plugin:promise/recommended' - 'promise/always-return': 'off', - 'promise/no-nesting': 'off', - // END ERRORS OF 'plugin:promise/recommended' - 'import/prefer-default-export': 'off', // typescript works better without default export - 'import/export': 'off', // typescript does allow multiple export default when overloading. not sure why it's enabled here. rule source: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md - 'prefer-object-spread': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - 'import/no-cycle': 'off', - 'import/no-useless-path-segments': 'off', - 'no-restricted-imports': [ - 'error', - { - name: '@teambit/ui-foundation.ui.react-router.link', - message: 'use @teambit/base-ui.routing.link', - }, - { - name: '@teambit/ui-foundation.ui.react-router.nav-link', - message: 'use @teambit/base-ui.routing.nav-link', - }, - ], - 'lines-between-class-members': 'off', - radix: 'off', - 'no-underscore-dangle': 'off', - 'no-param-reassign': 'off', - 'no-return-assign': [0, 'except-parens'], - 'class-methods-use-this': 'off', - // 'simple-import-sort/sort': 'error', - // 'sort-imports': 'off', - // 'import/first': 'error', - // 'import/newline-after-import': 'error', - 'import/no-duplicates': 'error', - 'prefer-destructuring': 'off', - 'import/no-extraneous-dependencies': 'off', - 'no-restricted-syntax': [2, 'ForInStatement', 'LabeledStatement', 'WithStatement'], - 'no-unused-expressions': 'off', - 'max-len': [ - 2, - 200, - 2, - { - ignoreUrls: true, - ignoreComments: true, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, - }, - ], - 'max-lines': [2, 1800], - 'func-names': [0], - - // ERRORS OF plugin:react/recommended - 'react/no-unescaped-entities': 'off', - } -}; diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..6bf1abb4 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,6 @@ +// bit-generated-eslint-config +{ + "extends": [ + "./node_modules/.cache/.eslintrc.bit.8865293c0e0bd0932b8a2aefcc803073814e705f.json" + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index e5a792e8..bf90e2e9 100644 --- a/.gitignore +++ b/.gitignore @@ -106,6 +106,3 @@ yarn.lock # cypress cypress/videos - -# other -/scopes/versions/angular-v15/backup/ diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 00000000..426b3883 --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1,4 @@ +// bit-generated-prettier-config +module.exports = { + ...require('./node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs') +} \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index b3ad16e2..00000000 --- a/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tabWidth": 2, - "printWidth": 120, - "parser": "typescript", - "singleQuote": true -} \ No newline at end of file diff --git a/scopes/versions/common/angular-apps/angular-app-options.ts b/angular/app-types/angular-app-type/angular-app-options.ts similarity index 92% rename from scopes/versions/common/angular-apps/angular-app-options.ts rename to angular/app-types/angular-app-type/angular-app-options.ts index ce942ae1..f80a233f 100644 --- a/scopes/versions/common/angular-apps/angular-app-options.ts +++ b/angular/app-types/angular-app-type/angular-app-options.ts @@ -1,4 +1,4 @@ -import { BrowserOptions, DevServerOptions } from '@teambit/angular-common'; +import { BrowserOptions, DevServerOptions } from '@bitdev/angular.dev-services.common'; import { Bundler } from '@teambit/bundler'; import { WebpackConfigTransformer } from '@teambit/webpack'; import { AngularDeployContext } from './deploy-context'; diff --git a/scopes/versions/common/angular-apps/angular-build-result.ts b/angular/app-types/angular-app-type/angular-build-result.ts similarity index 100% rename from scopes/versions/common/angular-apps/angular-build-result.ts rename to angular/app-types/angular-app-type/angular-build-result.ts diff --git a/scopes/versions/common/angular-apps/angular.app-type.ts b/angular/app-types/angular-app-type/angular.app-type.ts similarity index 94% rename from scopes/versions/common/angular-apps/angular.app-type.ts rename to angular/app-types/angular-app-type/angular.app-type.ts index cd339982..319a2f51 100644 --- a/scopes/versions/common/angular-apps/angular.app-type.ts +++ b/angular/app-types/angular-app-type/angular.app-type.ts @@ -1,4 +1,4 @@ -import { GenericAngularEnv, getWorkspace } from '@teambit/angular-common'; +import { GenericAngularEnv, getWorkspace } from '@bitdev/angular.dev-services.common'; import { Application, ApplicationType } from '@teambit/application'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import { EnvContext, EnvHandler } from '@teambit/envs'; diff --git a/scopes/versions/common/angular-apps/angular.application.ts b/angular/app-types/angular-app-type/angular.application.ts similarity index 97% rename from scopes/versions/common/angular-apps/angular.application.ts rename to angular/app-types/angular-app-type/angular.application.ts index 97c40dd2..9e6029ec 100644 --- a/scopes/versions/common/angular-apps/angular.application.ts +++ b/angular/app-types/angular-app-type/angular.application.ts @@ -1,5 +1,5 @@ -import { GenericAngularEnv } from '@teambit/angular-common'; -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; +import { GenericAngularEnv } from '@bitdev/angular.dev-services.common'; +import { AngularPreview, BundlerProvider, DevServerProvider } from '@bitdev/angular.dev-services.preview.preview'; import { AppBuildContext, AppContext, Application } from '@teambit/application'; import { Bundler, BundlerContext, DevServer, DevServerContext } from '@teambit/bundler'; import { Component } from '@teambit/component'; @@ -23,8 +23,11 @@ const writeHash = new Map(); export class AngularApp implements Application { readonly name: string; + readonly preview: EnvHandler; + readonly tempFolder: string; + readonly tsconfigPath: string; constructor( @@ -36,7 +39,7 @@ export class AngularApp implements Application { ) { this.name = options.name; - const idName = `teambit.angular/${this.name}`; + const idName = `bitdev.angular/${this.name}`; this.tempFolder = workspace?.getTempDir(idName) || join(CACHE_ROOT, idName); if (!existsSync(this.tempFolder)) { mkdirSync(this.tempFolder, { recursive: true }); diff --git a/angular/app-types/angular-app-type/component.json b/angular/app-types/angular-app-type/component.json new file mode 100644 index 00000000..945b50f7 --- /dev/null +++ b/angular/app-types/angular-app-type/component.json @@ -0,0 +1,22 @@ +{ + "componentId": { + "scope": "bitdev.angular", + "name": "app-types/angular-app-type" + }, + "propagate": true, + "extensions": { + "teambit.dependencies/dependency-resolver": { + "policy": { + "dependencies": { + "@angular-devkit/build-angular": "-", + "typescript": "-" + }, + "peerDependencies": { + "@angular-devkit/build-angular": ">= 0.0.1", + "typescript": ">= 3.5.3" + } + } + }, + "teambit.node/node@1.0.16": {} + } +} diff --git a/scopes/versions/common/angular-apps/deploy-context.ts b/angular/app-types/angular-app-type/deploy-context.ts similarity index 100% rename from scopes/versions/common/angular-apps/deploy-context.ts rename to angular/app-types/angular-app-type/deploy-context.ts diff --git a/scopes/versions/common/angular-apps/index.ts b/angular/app-types/angular-app-type/index.ts similarity index 100% rename from scopes/versions/common/angular-apps/index.ts rename to angular/app-types/angular-app-type/index.ts diff --git a/scopes/versions/common/angular-apps/utils.ts b/angular/app-types/angular-app-type/utils.ts similarity index 92% rename from scopes/versions/common/angular-apps/utils.ts rename to angular/app-types/angular-app-type/utils.ts index b6679a2e..f95cc50b 100644 --- a/scopes/versions/common/angular-apps/utils.ts +++ b/angular/app-types/angular-app-type/utils.ts @@ -24,9 +24,11 @@ export function componentIsApp(component: Component, application: ApplicationMai * @returns the tsConfig object. */ export function expandIncludeExclude(tsconfigJSON: any, targetPath: string, compDirs: string[]): string { + // eslint-disable-next-line no-param-reassign targetPath = dirname(targetPath); if (tsconfigJSON.include) { + // eslint-disable-next-line no-param-reassign tsconfigJSON.include = flatten( tsconfigJSON.include.map((includedPath: string) => { return compDirs.map((compDir: string) => { @@ -37,6 +39,7 @@ export function expandIncludeExclude(tsconfigJSON: any, targetPath: string, comp ); } if (tsconfigJSON.exclude) { + // eslint-disable-next-line no-param-reassign tsconfigJSON.exclude = flatten( tsconfigJSON.exclude.map((excludedPath: string) => { return compDirs.map((compDir: string) => { @@ -47,6 +50,7 @@ export function expandIncludeExclude(tsconfigJSON: any, targetPath: string, comp ); } if (tsconfigJSON.files) { + // eslint-disable-next-line no-param-reassign tsconfigJSON.files = flatten( tsconfigJSON.files.map((filesPath: string) => { return compDirs.map((compDir: string) => { diff --git a/angular/devkit/common/component.json b/angular/devkit/common/component.json new file mode 100644 index 00000000..ac99f3e6 --- /dev/null +++ b/angular/devkit/common/component.json @@ -0,0 +1,22 @@ +{ + "componentId": { + "scope": "bitdev.angular", + "name": "dev-services/common" + }, + "propagate": true, + "extensions": { + "teambit.dependencies/dependency-resolver": { + "policy": { + "dependencies": { + "@angular-devkit/build-angular": "-", + "typescript": "-" + }, + "peerDependencies": { + "@angular-devkit/build-angular": ">= 0.0.1", + "typescript": ">= 3.5.3" + } + } + }, + "teambit.node/node@1.0.16": {} + } +} diff --git a/scopes/versions/common/angular-common/env-options.ts b/angular/devkit/common/env-options.ts similarity index 100% rename from scopes/versions/common/angular-common/env-options.ts rename to angular/devkit/common/env-options.ts diff --git a/scopes/versions/common/angular-common/generic-angular-env.ts b/angular/devkit/common/generic-angular-env.ts similarity index 100% rename from scopes/versions/common/angular-common/generic-angular-env.ts rename to angular/devkit/common/generic-angular-env.ts diff --git a/scopes/versions/common/angular-common/index.ts b/angular/devkit/common/index.ts similarity index 100% rename from scopes/versions/common/angular-common/index.ts rename to angular/devkit/common/index.ts diff --git a/scopes/versions/common/angular-common/templates.ts b/angular/devkit/common/templates.ts similarity index 100% rename from scopes/versions/common/angular-common/templates.ts rename to angular/devkit/common/templates.ts diff --git a/scopes/versions/common/angular-common/utils.ts b/angular/devkit/common/utils.ts similarity index 97% rename from scopes/versions/common/angular-common/utils.ts rename to angular/devkit/common/utils.ts index 6460f2af..23ec8600 100644 --- a/scopes/versions/common/angular-common/utils.ts +++ b/angular/devkit/common/utils.ts @@ -62,6 +62,7 @@ export async function loadEsmModule(modulePath: string): Promise { try { return await import(modulePath); } catch (e) { + // eslint-disable-next-line @typescript-eslint/no-implied-eval return new Function('modulePath', `return import(modulePath)`)(modulePath) as Promise; } } diff --git a/scopes/dev-services/compiler/angular-elements/angular-elements.compiler.ts b/angular/devkit/compiler/elements/angular-elements.compiler.ts similarity index 90% rename from scopes/dev-services/compiler/angular-elements/angular-elements.compiler.ts rename to angular/devkit/compiler/elements/angular-elements.compiler.ts index d155da94..b657be4a 100644 --- a/scopes/dev-services/compiler/angular-elements/angular-elements.compiler.ts +++ b/angular/devkit/compiler/elements/angular-elements.compiler.ts @@ -1,7 +1,7 @@ import type { AngularCompilerOptions } from '@angular/compiler-cli'; -import { componentIsApp } from '@teambit/angular-apps'; -import type { AngularEnvOptions } from '@teambit/angular-common'; -import { getNodeModulesPaths, getWorkspace } from '@teambit/angular-common'; +import { componentIsApp } from '@bitdev/angular.app-types.angular-app-type'; +import type { AngularEnvOptions } from '@bitdev/angular.dev-services.common'; +import { getNodeModulesPaths, getWorkspace } from '@bitdev/angular.dev-services.common'; import { ApplicationAspect, ApplicationMain } from '@teambit/application'; import { ArtifactDefinition, @@ -16,8 +16,8 @@ import { EnvContext, EnvHandler } from '@teambit/envs'; import { IsolatorAspect, IsolatorMain } from '@teambit/isolator'; import { Timer } from '@teambit/legacy/dist/toolbox/timer'; import { Logger } from '@teambit/logger'; -import { NgccProcessor } from '@teambit/ngcc'; -import { Workspace, WorkspaceAspect } from '@teambit/workspace'; +import { NgccProcessor } from '@bitdev/angular.dev-services.ngcc'; +import { Workspace } from '@teambit/workspace'; import chalk from 'chalk'; import { extname, join } from 'path'; import { RollupCompiler } from './rollup/rollup.compiler'; @@ -34,9 +34,12 @@ interface AngularElementsCompilerOptions { } export class AngularElementsCompiler implements Compiler { - readonly id = 'teambit.angular/dev-services/compiler/angular-elements'; + readonly id = 'bitdev.angular/dev-services/compiler/elements'; + displayName = 'Angular elements compiler'; + ngccProcessor?: NgccProcessor; + rollupCompiler: RollupCompiler; private constructor( @@ -62,7 +65,9 @@ export class AngularElementsCompiler implements Compiler { async compositionsCompilation(component: Component, componentDir: string, outputDir: string, watch = false) { // Process all node_modules folders (only works if the modules are hoisted) if (this.ngEnvOptions.useNgcc) { + // eslint-disable-next-line no-plusplus for (let i = 0; i < this.nodeModulesPaths.length; i++) { + // eslint-disable-next-line no-await-in-loop await this.ngccProcessor?.process(this.nodeModulesPaths[i]); } } @@ -103,13 +108,15 @@ Built Angular Compositions // if (params.initiator === CompilationInitiator.PreStart || params.initiator === CompilationInitiator.Start) { // Process all node_modules folders (only works if the modules are hoisted) if (this.ngEnvOptions.useNgcc) { + // eslint-disable-next-line no-plusplus for (let i = 0; i < this.nodeModulesPaths.length; i++) { + // eslint-disable-next-line no-await-in-loop await this.ngccProcessor?.process(this.nodeModulesPaths[i]); } } // Build compositions await this.compositionsCompilation(params.component, params.componentDir, params.outputDir, true); - + // } // TODO: implement compilation of components as webcomponents // throw new Error('not implemented'); @@ -132,11 +139,14 @@ Built Angular Compositions // Process all node_modules folders (only works if the modules are hoisted) if (this.ngEnvOptions.useNgcc) { + // eslint-disable-next-line no-plusplus for (let i = 0; i < this.nodeModulesPaths.length; i++) { + // eslint-disable-next-line no-await-in-loop await this.ngccProcessor?.process(this.nodeModulesPaths[i]); } } + // eslint-disable-next-line no-plusplus for (let i = 0; i < context.components.length; i++) { const component = context.components[i]; const capsule = capsules.getCapsule(component.id); @@ -149,6 +159,7 @@ Built Angular Compositions const isApp = componentIsApp(component, this.application); if (!isApp) { // No need to compile an app try { + // eslint-disable-next-line no-await-in-loop await this.compositionsCompilation(component, capsule.path, capsule.path, false); } catch (e: any) { currentComponentResult.errors = [e]; diff --git a/scopes/dev-services/compiler/angular-elements/component.json b/angular/devkit/compiler/elements/component.json similarity index 81% rename from scopes/dev-services/compiler/angular-elements/component.json rename to angular/devkit/compiler/elements/component.json index 7b43fd2d..085cc8e3 100644 --- a/scopes/dev-services/compiler/angular-elements/component.json +++ b/angular/devkit/compiler/elements/component.json @@ -1,22 +1,10 @@ { "componentId": { - "scope": "teambit.angular", - "name": "dev-services/compiler/angular-elements" + "scope": "bitdev.angular", + "name": "dev-services/compiler/elements" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-elements", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { @@ -58,6 +46,7 @@ "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/compiler/angular-elements/index.ts b/angular/devkit/compiler/elements/index.ts similarity index 100% rename from scopes/dev-services/compiler/angular-elements/index.ts rename to angular/devkit/compiler/elements/index.ts diff --git a/scopes/dev-services/compiler/angular-elements/preview/docs.tsx b/angular/devkit/compiler/elements/preview/docs.tsx similarity index 93% rename from scopes/dev-services/compiler/angular-elements/preview/docs.tsx rename to angular/devkit/compiler/elements/preview/docs.tsx index 2029c93f..be454565 100644 --- a/scopes/dev-services/compiler/angular-elements/preview/docs.tsx +++ b/angular/devkit/compiler/elements/preview/docs.tsx @@ -1,10 +1,9 @@ import { Type } from '@angular/core'; import { RenderingContext } from '@teambit/preview'; import DocsRoot from '@teambit/react.ui.docs-app'; -import React from 'react'; // required here to make sure that this is loaded before the compositions file import '@angular/compiler'; -import { ngToReact } from '@teambit/angular-runtime'; +import { ngToReact } from '@bitdev/angular.dev-services.preview.runtime'; export type DocsRootProps = { Provider: Type | undefined, diff --git a/scopes/dev-services/compiler/angular-elements/preview/mount.tsx b/angular/devkit/compiler/elements/preview/mount.tsx similarity index 89% rename from scopes/dev-services/compiler/angular-elements/preview/mount.tsx rename to angular/devkit/compiler/elements/preview/mount.tsx index 08634de2..f2264a03 100644 --- a/scopes/dev-services/compiler/angular-elements/preview/mount.tsx +++ b/angular/devkit/compiler/elements/preview/mount.tsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; // required here to make sure that this is loaded before the compositions file import '@angular/compiler'; -import { ngToReact } from '@teambit/angular-runtime'; +import { ngToReact } from '@bitdev/angular.dev-services.preview.runtime'; const root = document.getElementById('root') as HTMLElement; diff --git a/scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/compile.ts b/angular/devkit/compiler/elements/rollup/ngc-plugin/compile.ts similarity index 100% rename from scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/compile.ts rename to angular/devkit/compiler/elements/rollup/ngc-plugin/compile.ts diff --git a/scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/index.ts b/angular/devkit/compiler/elements/rollup/ngc-plugin/index.ts similarity index 98% rename from scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/index.ts rename to angular/devkit/compiler/elements/rollup/ngc-plugin/index.ts index ff0d4f57..bcc126d1 100644 --- a/scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/index.ts +++ b/angular/devkit/compiler/elements/rollup/ngc-plugin/index.ts @@ -60,6 +60,7 @@ export async function ngcPlugin(options: Options, logger: Logger): Promise files.set(fileName, contents) }, resolveId: resolver(), + // eslint-disable-next-line consistent-return async transform(code: string, id: string) { logger.setStatusLine(`Transforming ${id}`); if ((!id.includes('node_modules') || internals.some(exception => id.includes(exception))) && externals.every(external => !id.includes(external))) { diff --git a/scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/resolver.ts b/angular/devkit/compiler/elements/rollup/ngc-plugin/resolver.ts similarity index 82% rename from scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/resolver.ts rename to angular/devkit/compiler/elements/rollup/ngc-plugin/resolver.ts index ffe2ca11..fdbba5d9 100644 --- a/scopes/dev-services/compiler/angular-elements/rollup/ngc-plugin/resolver.ts +++ b/angular/devkit/compiler/elements/rollup/ngc-plugin/resolver.ts @@ -1,4 +1,4 @@ -export function resolver(extensions?: string[]) { +export function resolver() { return function resolveId(id: string, origin: string | undefined) { if (!origin || id.includes('node_modules')) { return id; diff --git a/scopes/dev-services/compiler/angular-elements/rollup/rollup.compiler.ts b/angular/devkit/compiler/elements/rollup/rollup.compiler.ts similarity index 99% rename from scopes/dev-services/compiler/angular-elements/rollup/rollup.compiler.ts rename to angular/devkit/compiler/elements/rollup/rollup.compiler.ts index 46917886..8a580edf 100644 --- a/scopes/dev-services/compiler/angular-elements/rollup/rollup.compiler.ts +++ b/angular/devkit/compiler/elements/rollup/rollup.compiler.ts @@ -164,6 +164,7 @@ export class RollupCompiler { entries: opts.entries, moduleName: opts.moduleName, dest: opts.dest, + // eslint-disable-next-line no-nested-ternary cache: opts.cache ? opts.cache : (watch && this.cache ? this.cache : undefined), cacheDirectory: opts.cacheDirectory, fileCache, diff --git a/scopes/dev-services/compiler/angular-elements/rollup/utils/cache.ts b/angular/devkit/compiler/elements/rollup/utils/cache.ts similarity index 100% rename from scopes/dev-services/compiler/angular-elements/rollup/utils/cache.ts rename to angular/devkit/compiler/elements/rollup/utils/cache.ts diff --git a/scopes/dev-services/compiler/angular-elements/rollup/utils/fs.ts b/angular/devkit/compiler/elements/rollup/utils/fs.ts similarity index 100% rename from scopes/dev-services/compiler/angular-elements/rollup/utils/fs.ts rename to angular/devkit/compiler/elements/rollup/utils/fs.ts diff --git a/scopes/dev-services/compiler/angular-elements/rollup/utils/ng-compiler-cli.ts b/angular/devkit/compiler/elements/rollup/utils/ng-compiler-cli.ts similarity index 84% rename from scopes/dev-services/compiler/angular-elements/rollup/utils/ng-compiler-cli.ts rename to angular/devkit/compiler/elements/rollup/utils/ng-compiler-cli.ts index e7b79fb9..eb437bbd 100644 --- a/scopes/dev-services/compiler/angular-elements/rollup/utils/ng-compiler-cli.ts +++ b/angular/devkit/compiler/elements/rollup/utils/ng-compiler-cli.ts @@ -2,6 +2,7 @@ async function loadEsmModule(modulePath: string): Promise { try { return await import(modulePath); } catch (e) { + // eslint-disable-next-line @typescript-eslint/no-implied-eval return new Function('modulePath', `return import(modulePath)`)(modulePath) as Promise; } } @@ -18,10 +19,10 @@ export async function ngCompilerCli(): Promise { try { // Angular v13+ - return await loadEsmModule(`@angular/compiler-cli/linker/babel`); + return loadEsmModule(`@angular/compiler-cli/linker/babel`); } catch (e) { // Angular v12 - return await loadEsmModule(`@angular/compiler-cli/linker/babel/index.js`); + return loadEsmModule(`@angular/compiler-cli/linker/babel/index.js`); } } diff --git a/scopes/dev-services/compiler/angular-elements/rollup/utils/path.ts b/angular/devkit/compiler/elements/rollup/utils/path.ts similarity index 96% rename from scopes/dev-services/compiler/angular-elements/rollup/utils/path.ts rename to angular/devkit/compiler/elements/rollup/utils/path.ts index 12439b4f..a42ce554 100644 --- a/scopes/dev-services/compiler/angular-elements/rollup/utils/path.ts +++ b/angular/devkit/compiler/elements/rollup/utils/path.ts @@ -1,5 +1,6 @@ import * as nodePath from 'path'; +/* eslint-disable-next-line */ const PATH_REGEXP = new RegExp('\\' + nodePath.win32.sep, 'g'); const ensureUnixPathCache = new Map(); const IS_WINDOWS = process.platform === 'win32'; diff --git a/scopes/dev-services/compiler/ng-multi-compiler/component.json b/angular/devkit/compiler/multi-compiler/component.json similarity index 55% rename from scopes/dev-services/compiler/ng-multi-compiler/component.json rename to angular/devkit/compiler/multi-compiler/component.json index 5a7a0c85..ba62dfa2 100644 --- a/scopes/dev-services/compiler/ng-multi-compiler/component.json +++ b/angular/devkit/compiler/multi-compiler/component.json @@ -1,22 +1,10 @@ { "componentId": { - "scope": "teambit.angular", - "name": "dev-services/compiler/ng-multi-compiler" + "scope": "bitdev.angular", + "name": "dev-services/compiler/multi-compiler" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/ng-multi-compiler", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { @@ -27,13 +15,13 @@ "minimatch": "~3.0.4" }, "devDependencies": { - "@types/minimatch": "~3.0.4", - "@babel/runtime": "7.22.15" + "@types/minimatch": "~3.0.4" }, "peerDependencies": { "@angular/compiler-cli": ">= 8.0.0" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/compiler/ng-multi-compiler/index.ts b/angular/devkit/compiler/multi-compiler/index.ts similarity index 100% rename from scopes/dev-services/compiler/ng-multi-compiler/index.ts rename to angular/devkit/compiler/multi-compiler/index.ts diff --git a/scopes/dev-services/compiler/ng-multi-compiler/ng-multi-compiler.docs.md b/angular/devkit/compiler/multi-compiler/ng-multi-compiler.docs.md similarity index 100% rename from scopes/dev-services/compiler/ng-multi-compiler/ng-multi-compiler.docs.md rename to angular/devkit/compiler/multi-compiler/ng-multi-compiler.docs.md diff --git a/scopes/dev-services/compiler/ng-multi-compiler/ng-multi-compiler.task.ts b/angular/devkit/compiler/multi-compiler/ng-multi-compiler.task.ts similarity index 100% rename from scopes/dev-services/compiler/ng-multi-compiler/ng-multi-compiler.task.ts rename to angular/devkit/compiler/multi-compiler/ng-multi-compiler.task.ts diff --git a/scopes/dev-services/compiler/ng-multi-compiler/ng-multi-compiler.ts b/angular/devkit/compiler/multi-compiler/ng-multi-compiler.ts similarity index 93% rename from scopes/dev-services/compiler/ng-multi-compiler/ng-multi-compiler.ts rename to angular/devkit/compiler/multi-compiler/ng-multi-compiler.ts index 85adee5b..42f559ea 100644 --- a/scopes/dev-services/compiler/ng-multi-compiler/ng-multi-compiler.ts +++ b/angular/devkit/compiler/multi-compiler/ng-multi-compiler.ts @@ -1,7 +1,7 @@ import type { AngularCompilerOptions } from '@angular/compiler-cli'; -import { componentIsApp, NG_APP_PATTERN } from '@teambit/angular-apps'; -import type { AngularEnvOptions } from '@teambit/angular-common'; -import { AngularElementsCompiler } from '@teambit/angular-elements'; +import { componentIsApp, NG_APP_PATTERN } from '@bitdev/angular.app-types.angular-app-type'; +import type { AngularEnvOptions } from '@bitdev/angular.dev-services.common'; +import { AngularElementsCompiler } from '@bitdev/angular.dev-services.compiler.elements'; import { ApplicationAspect, ApplicationMain } from '@teambit/application'; import { BabelAspect, BabelCompiler, BabelMain } from '@teambit/babel'; import { @@ -22,7 +22,7 @@ import { import { Component } from '@teambit/component'; import { EnvContext, EnvHandler } from '@teambit/envs'; import { Capsule } from '@teambit/isolator'; -import { NgPackagrCompiler } from '@teambit/ng-packagr'; +import { NgPackagrCompiler } from '@bitdev/angular.dev-services.compiler.ng-packagr'; import { outputFileSync } from 'fs-extra'; import minimatch from 'minimatch'; import { join } from 'path'; @@ -41,7 +41,8 @@ export interface NgMultiCompilerOptions { } export class NgMultiCompiler implements Compiler { - readonly id = 'teambit.angular/dev-services/compiler/ng-multi-compiler'; + readonly id = 'bitdev.angular/dev-services/compiler/multi-compiler'; + mainCompiler: NgPackagrCompiler | AngularElementsCompiler; private constructor( @@ -95,10 +96,10 @@ export class NgMultiCompiler implements Compiler { return; } if (params.initiator === CompilationInitiator.PreStart || params.initiator === CompilationInitiator.Start) { - return this.mainCompiler.transpileComponent(params); + await this.mainCompiler.transpileComponent(params); + return; } - return this.ngPackagrCompiler.transpileComponent(params); - + await this.ngPackagrCompiler.transpileComponent(params); } transpileFile(fileContent: string, params: TranspileFileParams): TranspileFileOutput { diff --git a/scopes/dev-services/compiler/ng-packagr/component.json b/angular/devkit/compiler/ng-packagr/component.json similarity index 55% rename from scopes/dev-services/compiler/ng-packagr/component.json rename to angular/devkit/compiler/ng-packagr/component.json index d1be1d4b..03df1cab 100644 --- a/scopes/dev-services/compiler/ng-packagr/component.json +++ b/angular/devkit/compiler/ng-packagr/component.json @@ -1,22 +1,10 @@ { "componentId": { - "scope": "teambit.angular", + "scope": "bitdev.angular", "name": "dev-services/compiler/ng-packagr" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/ng-packagr", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { @@ -27,11 +15,9 @@ "peerDependencies": { "@angular/compiler-cli": ">= 8.0.0", "ng-packagr": ">=5.0.0" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/compiler/ng-packagr/index.ts b/angular/devkit/compiler/ng-packagr/index.ts similarity index 100% rename from scopes/dev-services/compiler/ng-packagr/index.ts rename to angular/devkit/compiler/ng-packagr/index.ts diff --git a/scopes/dev-services/compiler/ng-packagr/ng-packagr.compiler.ts b/angular/devkit/compiler/ng-packagr/ng-packagr.compiler.ts similarity index 94% rename from scopes/dev-services/compiler/ng-packagr/ng-packagr.compiler.ts rename to angular/devkit/compiler/ng-packagr/ng-packagr.compiler.ts index 9f0963aa..b49b3412 100644 --- a/scopes/dev-services/compiler/ng-packagr/ng-packagr.compiler.ts +++ b/angular/devkit/compiler/ng-packagr/ng-packagr.compiler.ts @@ -1,6 +1,6 @@ import type { AngularCompilerOptions, ParsedConfiguration } from '@angular/compiler-cli'; -import { componentIsApp } from '@teambit/angular-apps'; -import { AngularEnvOptions, getNodeModulesPaths, getWorkspace } from '@teambit/angular-common'; +import { componentIsApp } from '@bitdev/angular.app-types.angular-app-type'; +import { AngularEnvOptions, getNodeModulesPaths, getWorkspace } from '@bitdev/angular.dev-services.common'; import { ApplicationAspect, ApplicationMain } from '@teambit/application'; import { ArtifactDefinition, @@ -19,7 +19,7 @@ import PackageJsonFile from '@teambit/legacy/dist/consumer/component/package-jso import removeFilesAndEmptyDirsRecursively from '@teambit/legacy/dist/utils/fs/remove-files-and-empty-dirs-recursively'; import { Logger } from '@teambit/logger'; -import { NgccProcessor } from '@teambit/ngcc'; +import { NgccProcessor } from '@bitdev/angular.dev-services.ngcc'; import { Workspace } from '@teambit/workspace'; import chalk from 'chalk'; import { mkdirsSync, outputFileSync } from 'fs-extra'; @@ -67,10 +67,14 @@ interface NgPackagrCompilerOptions { } export class NgPackagrCompiler implements Compiler { - readonly id = 'teambit.angular/dev-services/compiler/ng-packagr'; + readonly id = 'bitdev.angular/dev-services/compiler/ng-packagr'; + displayName = 'NgPackagr compiler'; + readDefaultTsConfig: () => Promise; + ngPackagr: NgPackagr; + ngccProcessor?: NgccProcessor; private constructor( @@ -90,8 +94,10 @@ export class NgPackagrCompiler implements Compiler { if (this.ngEnvOptions.useNgcc) { this.ngccProcessor = new NgccProcessor(); } + // eslint-disable-next-line global-require,import/no-dynamic-require this.ngPackagr = require(ngPackagrPath).ngPackagr(); + // eslint-disable-next-line global-require,import/no-dynamic-require const module = require(ngEnvOptions.readDefaultTsConfig); if (typeof module.readDefaultTsConfig !== 'undefined') { // Angular v8 to v12 @@ -103,7 +109,7 @@ export class NgPackagrCompiler implements Compiler { const entryPoints: any = [{ data: { entryPoint: { - moduleId: '@teambit/ng-packagr', + moduleId: '@bitdev/angular.dev-services.compiler.ng-packagr', entryFilePath: '', flatModuleFile: '' }, @@ -181,13 +187,16 @@ export class NgPackagrCompiler implements Compiler { }; if (allowedNonPeerDependencies.length) { + // eslint-disable-next-line no-console console.warn(chalk.yellow(`\nWARNING: You have dependencies declared as "runtime dependencies" ("${allowedNonPeerDependencies.join('", "')}"). In most cases Angular recommends using peer dependencies instead (see: https://github.com/ng-packagr/ng-packagr/blob/main/docs/dependencies.md).\n`)); } outputFileSync(join(pathToOutputFolder, NG_PACKAGE_JSON), JSON.stringify(ngPackageJson, null, 2)); // add all node modules paths to TypeScript paths to ensure that it finds all existing dependencies + // eslint-disable-next-line no-param-reassign tsCompilerOptions.paths = tsCompilerOptions.paths || {}; + // eslint-disable-next-line no-param-reassign tsCompilerOptions.paths['*'] = ['*', ...this.nodeModulesPaths.map(path => join(path, '*'))]; const parsedTsConfig = await this.readDefaultTsConfig(); @@ -206,6 +215,7 @@ export class NgPackagrCompiler implements Compiler { // delete the [ng-]package.json file generated by ngPackagr await removeFilesAndEmptyDirsRecursively([resolve(join(pathToOutputFolder, this.distDir, PACKAGE_JSON))]); await removeFilesAndEmptyDirsRecursively([resolve(join(pathToOutputFolder, NG_PACKAGE_JSON))]); + // eslint-disable-next-line consistent-return }, (err: Error) => { if (err.message === ViewEngineTemplateError && !tsCompilerOptions.fullTemplateTypeCheck) { // eslint-disable-next-line no-console @@ -228,7 +238,7 @@ export class NgPackagrCompiler implements Compiler { const dist = join(params.outputDir, this.distDir); mkdirsSync(dist); // We do not need to compile using ng-packagr (except for builds) because Angular reads the source files directly - + /* const isApp = componentIsApp(params.component, this.application); // No need to compile an app if (isApp) { @@ -268,7 +278,9 @@ export class NgPackagrCompiler implements Compiler { async build(context: BuildContext): Promise { // Process all node_modules folders (only works if the modules are hoisted) if (this.ngEnvOptions.useNgcc) { + // eslint-disable-next-line no-plusplus for (let i = 0; i < this.nodeModulesPaths.length; i++) { + // eslint-disable-next-line no-await-in-loop await this.ngccProcessor?.process(this.nodeModulesPaths[i]); } } @@ -288,6 +300,7 @@ export class NgPackagrCompiler implements Compiler { const componentCapsules = capsules.filter(capsule => componentIds.includes(capsule.component.id.toString())); const componentsResults: ComponentResult[] = []; + // eslint-disable-next-line no-restricted-syntax for (const capsule of componentCapsules) { const {component} = capsule; const currentComponentResult: ComponentResult = { @@ -298,6 +311,7 @@ export class NgPackagrCompiler implements Compiler { try { // disable logger temporarily so that it doesn't mess up with ngPackagr logs this.logger.off(); + // eslint-disable-next-line no-await-in-loop await this.ngPackagrCompilation(capsule.path, capsule.path, this.tsCompilerOptions, componentIds, true); this.logger.on(); // @ts-ignore diff --git a/scopes/dev-services/compiler/ng-packagr/ng-packagr.docs.md b/angular/devkit/compiler/ng-packagr/ng-packagr.docs.md similarity index 100% rename from scopes/dev-services/compiler/ng-packagr/ng-packagr.docs.md rename to angular/devkit/compiler/ng-packagr/ng-packagr.docs.md diff --git a/scopes/dev-services/linter/eslint-config/bit-angular-eslint.docs.md b/angular/devkit/linter/eslint/bit-angular-eslint.docs.md similarity index 63% rename from scopes/dev-services/linter/eslint-config/bit-angular-eslint.docs.md rename to angular/devkit/linter/eslint/bit-angular-eslint.docs.md index 62ddac96..89bc4d6e 100644 --- a/scopes/dev-services/linter/eslint-config/bit-angular-eslint.docs.md +++ b/angular/devkit/linter/eslint/bit-angular-eslint.docs.md @@ -3,6 +3,6 @@ description: ESLint configurations for the Angular env labels: ['eslint', 'configurations', 'angular', 'env'] --- -The default [Angular ESLint](https://github.com/angular-eslint/angular-eslint) configuration for the Angular environment ([@teambit.angular/angular](https://bit.dev/teambit/angular/angular)). +The default [Angular ESLint](https://github.com/angular-eslint/angular-eslint) configuration for the Angular environment ([@bitdev.angular/angular-env](https://bit.cloud/bitdev/angular/angular-env)). Review the configuration [here](bit-angular-eslint.ts). diff --git a/scopes/dev-services/linter/eslint-config/component.json b/angular/devkit/linter/eslint/component.json similarity index 57% rename from scopes/dev-services/linter/eslint-config/component.json rename to angular/devkit/linter/eslint/component.json index d87e22b1..a83eef91 100644 --- a/scopes/dev-services/linter/eslint-config/component.json +++ b/angular/devkit/linter/eslint/component.json @@ -1,22 +1,10 @@ { "componentId": { - "name": "dev-services/linter/angular-eslint-config", - "scope": "teambit.angular" + "scope": "bitdev.angular", + "name": "dev-services/linter/eslint" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-eslint-config", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { @@ -30,11 +18,9 @@ "@typescript-eslint/eslint-plugin": ">= 4", "@typescript-eslint/parser": ">= 4", "eslint": ">= 7.0.0" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/linter/eslint-config/config/tsconfig.json b/angular/devkit/linter/eslint/config/tsconfig.json similarity index 100% rename from scopes/dev-services/linter/eslint-config/config/tsconfig.json rename to angular/devkit/linter/eslint/config/tsconfig.json diff --git a/scopes/dev-services/linter/eslint-config/eslintrc.js b/angular/devkit/linter/eslint/eslintrc.js similarity index 100% rename from scopes/dev-services/linter/eslint-config/eslintrc.js rename to angular/devkit/linter/eslint/eslintrc.js diff --git a/scopes/dev-services/linter/eslint-config/index.js b/angular/devkit/linter/eslint/index.js similarity index 100% rename from scopes/dev-services/linter/eslint-config/index.js rename to angular/devkit/linter/eslint/index.js diff --git a/angular/devkit/ngcc/component.json b/angular/devkit/ngcc/component.json new file mode 100644 index 00000000..adf7034e --- /dev/null +++ b/angular/devkit/ngcc/component.json @@ -0,0 +1,20 @@ +{ + "componentId": { + "scope": "bitdev.angular", + "name": "dev-services/ngcc" + }, + "propagate": true, + "extensions": { + "teambit.dependencies/dependency-resolver": { + "policy": { + "dependencies": { + "@angular/compiler-cli": "-" + }, + "peerDependencies": { + "@angular/compiler-cli": ">= 8.0.0" + } + } + }, + "teambit.node/node@1.0.16": {} + } +} diff --git a/scopes/dev-services/compiler/ngcc/index.ts b/angular/devkit/ngcc/index.ts similarity index 100% rename from scopes/dev-services/compiler/ngcc/index.ts rename to angular/devkit/ngcc/index.ts diff --git a/scopes/dev-services/compiler/ngcc/ngcc-processor.ts b/angular/devkit/ngcc/ngcc-processor.ts similarity index 96% rename from scopes/dev-services/compiler/ngcc/ngcc-processor.ts rename to angular/devkit/ngcc/ngcc-processor.ts index a4b849db..ae9d6864 100644 --- a/scopes/dev-services/compiler/ngcc/ngcc-processor.ts +++ b/angular/devkit/ngcc/ngcc-processor.ts @@ -15,7 +15,9 @@ import * as path from 'path'; export class NgccProcessor { lockFile?: string; + lockData?: string; + runHashFilePath?: string; getLockFile(projectBasePath: string): { lockData: string, lockFile: string } { @@ -28,10 +30,13 @@ export class NgccProcessor { } else { const LOCK_FILES = ['pnpm-lock.yaml', 'yarn.lock', 'package-lock.json']; if (existsSync(path.join(projectBasePath, LOCK_FILES[0]))) { + // eslint-disable-next-line prefer-destructuring lockFile = LOCK_FILES[0]; } else if (existsSync(path.join(projectBasePath, LOCK_FILES[1]))) { + // eslint-disable-next-line prefer-destructuring lockFile = LOCK_FILES[1]; } else { + // eslint-disable-next-line prefer-destructuring lockFile = LOCK_FILES[2]; } lockData = readFileSync(path.join(projectBasePath, lockFile), { encoding: 'utf8' }); diff --git a/scopes/dev-services/compiler/ngcc/ngcc.docs.md b/angular/devkit/ngcc/ngcc.docs.md similarity index 100% rename from scopes/dev-services/compiler/ngcc/ngcc.docs.md rename to angular/devkit/ngcc/ngcc.docs.md diff --git a/scopes/dev-services/preview/mounter/component.json b/angular/devkit/preview/mounter/component.json similarity index 58% rename from scopes/dev-services/preview/mounter/component.json rename to angular/devkit/preview/mounter/component.json index a18474d2..f7a5e580 100644 --- a/scopes/dev-services/preview/mounter/component.json +++ b/angular/devkit/preview/mounter/component.json @@ -1,22 +1,10 @@ { "componentId": { - "name": "dev-services/preview/mounter", - "scope": "teambit.angular" + "scope": "bitdev.angular", + "name": "dev-services/preview/mounter" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-mounter", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "peerDependencies": { @@ -29,11 +17,9 @@ "@angular/platform-browser-dynamic": ">= 8.0.0", "typescript": ">= 3.5.3", "zone.js": ">= 0.9.1" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/preview/mounter/index.ts b/angular/devkit/preview/mounter/index.ts similarity index 100% rename from scopes/dev-services/preview/mounter/index.ts rename to angular/devkit/preview/mounter/index.ts diff --git a/scopes/dev-services/preview/mounter/mounter.ts b/angular/devkit/preview/mounter/mounter.ts similarity index 88% rename from scopes/dev-services/preview/mounter/mounter.ts rename to angular/devkit/preview/mounter/mounter.ts index 01ba807f..610535de 100644 --- a/scopes/dev-services/preview/mounter/mounter.ts +++ b/angular/devkit/preview/mounter/mounter.ts @@ -1,7 +1,7 @@ // required here to make sure that this is loaded before the compositions file import '@angular/compiler'; import { Type } from '@angular/core'; -import { ngBootstrap, NgBootstrapOptions } from '@teambit/angular-runtime'; +import { ngBootstrap, NgBootstrapOptions } from '@bitdev/angular.dev-services.preview.runtime'; export interface MounterOptions extends Omit { hostElement?: HTMLElement; diff --git a/scopes/dev-services/preview/preview/angular-preview.ts b/angular/devkit/preview/preview/angular-preview.ts similarity index 92% rename from scopes/dev-services/preview/preview/angular-preview.ts rename to angular/devkit/preview/preview/angular-preview.ts index f7bb304c..3b55bee3 100644 --- a/scopes/dev-services/preview/preview/angular-preview.ts +++ b/angular/devkit/preview/preview/angular-preview.ts @@ -1,4 +1,4 @@ -import { AngularEnvOptions, BrowserOptions, DevServerOptions } from '@teambit/angular-common'; +import { AngularEnvOptions, BrowserOptions, DevServerOptions } from '@bitdev/angular.dev-services.common'; import { AppContext } from '@teambit/application'; import { Bundler, BundlerContext, DevServer, DevServerContext } from '@teambit/bundler'; import { AsyncEnvHandler, EnvHandler } from '@teambit/envs'; @@ -109,6 +109,11 @@ export class AngularPreview implements Preview { return this.bundlerProvider(context); } + /** + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. + * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. + */ getHostDependencies(): string[] { return ( this.hostDependencies || [ diff --git a/scopes/dev-services/preview/preview/component.json b/angular/devkit/preview/preview/component.json similarity index 60% rename from scopes/dev-services/preview/preview/component.json rename to angular/devkit/preview/preview/component.json index 59bfcfeb..4265ac2a 100644 --- a/scopes/dev-services/preview/preview/component.json +++ b/angular/devkit/preview/preview/component.json @@ -1,22 +1,10 @@ { "componentId": { - "name": "dev-services/preview/preview", - "scope": "teambit.angular" + "scope": "bitdev.angular", + "name": "dev-services/preview/preview" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-preview", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": {}, @@ -31,11 +19,9 @@ "rxjs": "^6.5.5 || ^7.4.0", "typescript": ">= 3.5.3", "zone.js": ">= 0.9.1" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/preview/preview/docs.ts b/angular/devkit/preview/preview/docs.ts similarity index 100% rename from scopes/dev-services/preview/preview/docs.ts rename to angular/devkit/preview/preview/docs.ts diff --git a/scopes/dev-services/preview/preview/index.ts b/angular/devkit/preview/preview/index.ts similarity index 100% rename from scopes/dev-services/preview/preview/index.ts rename to angular/devkit/preview/preview/index.ts diff --git a/angular/devkit/preview/preview/mounter.ts b/angular/devkit/preview/preview/mounter.ts new file mode 100644 index 00000000..60171057 --- /dev/null +++ b/angular/devkit/preview/preview/mounter.ts @@ -0,0 +1,4 @@ +/* eslint-disable import/no-unresolved */ +import { createMounter } from '@bitdev/angular.dev-services.preview.mounter'; + +export default createMounter(); diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/app.component.scss b/angular/devkit/preview/preview/preview-app/src/app/app.component.scss similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/app/app.component.scss rename to angular/devkit/preview/preview/preview-app/src/app/app.component.scss diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/app.component.ts b/angular/devkit/preview/preview/preview-app/src/app/app.component.ts similarity index 81% rename from scopes/dev-services/preview/preview/preview-app/src/app/app.component.ts rename to angular/devkit/preview/preview/preview-app/src/app/app.component.ts index 9d7ed21b..a9b5f21c 100644 --- a/scopes/dev-services/preview/preview/preview-app/src/app/app.component.ts +++ b/angular/devkit/preview/preview/preview-app/src/app/app.component.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { Component } from '@angular/core'; @Component({ diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/app.module.ts b/angular/devkit/preview/preview/preview-app/src/app/app.module.ts similarity index 90% rename from scopes/dev-services/preview/preview/preview-app/src/app/app.module.ts rename to angular/devkit/preview/preview/preview-app/src/app/app.module.ts index 314a08db..12aef59a 100644 --- a/scopes/dev-services/preview/preview/preview-app/src/app/app.module.ts +++ b/angular/devkit/preview/preview/preview-app/src/app/app.module.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { NgModule } from '@angular/core'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/docs/docs.component.ts b/angular/devkit/preview/preview/preview-app/src/app/docs/docs.component.ts similarity index 86% rename from scopes/dev-services/preview/preview/preview-app/src/app/docs/docs.component.ts rename to angular/devkit/preview/preview/preview-app/src/app/docs/docs.component.ts index 76f826be..56d3ffe9 100644 --- a/scopes/dev-services/preview/preview/preview-app/src/app/docs/docs.component.ts +++ b/angular/devkit/preview/preview/preview-app/src/app/docs/docs.component.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { Component, Input, ViewChild, ElementRef } from '@angular/core'; @Component({ @@ -7,5 +8,6 @@ import { Component, Input, ViewChild, ElementRef } from '@angular/core'; }) export class DocsComponent { @ViewChild('docsRoot', { static: true }) docsRoot!: ElementRef; + @Input() template = ''; } diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/docs/docs.style.scss b/angular/devkit/preview/preview/preview-app/src/app/docs/docs.style.scss similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/app/docs/docs.style.scss rename to angular/devkit/preview/preview/preview-app/src/app/docs/docs.style.scss diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/docs/safe-html.pipe.ts b/angular/devkit/preview/preview/preview-app/src/app/docs/safe-html.pipe.ts similarity index 88% rename from scopes/dev-services/preview/preview/preview-app/src/app/docs/safe-html.pipe.ts rename to angular/devkit/preview/preview/preview-app/src/app/docs/safe-html.pipe.ts index c16fa1dd..dcd5d7f5 100644 --- a/scopes/dev-services/preview/preview/preview-app/src/app/docs/safe-html.pipe.ts +++ b/angular/devkit/preview/preview/preview-app/src/app/docs/safe-html.pipe.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import { sanitize } from 'dompurify'; diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/global.d.ts b/angular/devkit/preview/preview/preview-app/src/app/global.d.ts similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/app/global.d.ts rename to angular/devkit/preview/preview/preview-app/src/app/global.d.ts diff --git a/scopes/dev-services/preview/preview/preview-app/src/app/lazy-load/lazy-load.component.ts b/angular/devkit/preview/preview/preview-app/src/app/lazy-load/lazy-load.component.ts similarity index 97% rename from scopes/dev-services/preview/preview/preview-app/src/app/lazy-load/lazy-load.component.ts rename to angular/devkit/preview/preview/preview-app/src/app/lazy-load/lazy-load.component.ts index 075bb7da..9c9888fe 100644 --- a/scopes/dev-services/preview/preview/preview-app/src/app/lazy-load/lazy-load.component.ts +++ b/angular/devkit/preview/preview/preview-app/src/app/lazy-load/lazy-load.component.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { Compiler, Component, diff --git a/examples/demo-app/src/assets/.gitkeep b/angular/devkit/preview/preview/preview-app/src/assets/.gitkeep similarity index 100% rename from examples/demo-app/src/assets/.gitkeep rename to angular/devkit/preview/preview/preview-app/src/assets/.gitkeep diff --git a/scopes/dev-services/preview/preview/preview-app/src/environments/environment.prod.ts b/angular/devkit/preview/preview/preview-app/src/environments/environment.prod.ts similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/environments/environment.prod.ts rename to angular/devkit/preview/preview/preview-app/src/environments/environment.prod.ts diff --git a/scopes/dev-services/preview/preview/preview-app/src/environments/environment.ts b/angular/devkit/preview/preview/preview-app/src/environments/environment.ts similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/environments/environment.ts rename to angular/devkit/preview/preview/preview-app/src/environments/environment.ts diff --git a/scopes/dev-services/preview/preview/preview-app/src/favicon.ico b/angular/devkit/preview/preview/preview-app/src/favicon.ico similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/favicon.ico rename to angular/devkit/preview/preview/preview-app/src/favicon.ico diff --git a/scopes/dev-services/preview/preview/preview-app/src/index.html b/angular/devkit/preview/preview/preview-app/src/index.html similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/index.html rename to angular/devkit/preview/preview/preview-app/src/index.html diff --git a/scopes/dev-services/preview/preview/preview-app/src/main.ts b/angular/devkit/preview/preview/preview-app/src/main.ts similarity index 69% rename from scopes/dev-services/preview/preview/preview-app/src/main.ts rename to angular/devkit/preview/preview/preview-app/src/main.ts index a26b08cc..d48879c2 100644 --- a/scopes/dev-services/preview/preview/preview-app/src/main.ts +++ b/angular/devkit/preview/preview/preview-app/src/main.ts @@ -2,7 +2,8 @@ import { NgModuleRef } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; -window.ngMainStart = async function(): Promise | void> { +window.ngMainStart = async function start(): Promise | void> { return platformBrowserDynamic().bootstrapModule(AppModule) + // eslint-disable-next-line no-console .catch((err: any) => console.error(err)); } diff --git a/scopes/dev-services/preview/preview/preview-app/src/polyfills.ts b/angular/devkit/preview/preview/preview-app/src/polyfills.ts similarity index 89% rename from scopes/dev-services/preview/preview/preview-app/src/polyfills.ts rename to angular/devkit/preview/preview/preview-app/src/polyfills.ts index 5812bad0..8494ac9c 100644 --- a/scopes/dev-services/preview/preview/preview-app/src/polyfills.ts +++ b/angular/devkit/preview/preview/preview-app/src/polyfills.ts @@ -14,7 +14,7 @@ * Learn more in https://angular.io/guide/browser-support */ -/*************************************************************************************************** +/** ************************************************************************************************* * BROWSER POLYFILLS */ @@ -54,11 +54,11 @@ * */ -/*************************************************************************************************** +/** ************************************************************************************************* * Zone JS is required by default for Angular itself. */ import 'zone.js/dist/zone'; // Included with Angular CLI. -/*************************************************************************************************** +/** ************************************************************************************************* * APPLICATION IMPORTS */ diff --git a/scopes/dev-services/preview/preview/preview-app/src/styles.scss b/angular/devkit/preview/preview/preview-app/src/styles.scss similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/styles.scss rename to angular/devkit/preview/preview/preview-app/src/styles.scss diff --git a/scopes/dev-services/preview/preview/preview-app/src/styles/prism-theme-vsc-dark-plus.scss b/angular/devkit/preview/preview/preview-app/src/styles/prism-theme-vsc-dark-plus.scss similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/styles/prism-theme-vsc-dark-plus.scss rename to angular/devkit/preview/preview/preview-app/src/styles/prism-theme-vsc-dark-plus.scss diff --git a/scopes/dev-services/preview/preview/preview-app/src/test.ts b/angular/devkit/preview/preview/preview-app/src/test.ts similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/test.ts rename to angular/devkit/preview/preview/preview-app/src/test.ts diff --git a/scopes/dev-services/preview/preview/preview-app/tsconfig.app.json b/angular/devkit/preview/preview/preview-app/tsconfig.app.json similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/tsconfig.app.json rename to angular/devkit/preview/preview/preview-app/tsconfig.app.json diff --git a/scopes/dev-services/preview/angular-runtime/component.json b/angular/devkit/preview/runtime/component.json similarity index 55% rename from scopes/dev-services/preview/angular-runtime/component.json rename to angular/devkit/preview/runtime/component.json index db38dfa4..6013e589 100644 --- a/scopes/dev-services/preview/angular-runtime/component.json +++ b/angular/devkit/preview/runtime/component.json @@ -1,22 +1,10 @@ { "componentId": { - "name": "dev-services/preview/angular-runtime", - "scope": "teambit.angular" + "scope": "bitdev.angular", + "name": "dev-services/preview/runtime" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-runtime", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "peerDependencies": { @@ -28,11 +16,9 @@ "react": "^17.0.2", "typescript": ">= 3.5.3", "zone.js": ">= 0.9.1" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/preview/angular-runtime/index.ts b/angular/devkit/preview/runtime/index.ts similarity index 100% rename from scopes/dev-services/preview/angular-runtime/index.ts rename to angular/devkit/preview/runtime/index.ts diff --git a/scopes/dev-services/preview/angular-runtime/loader-react.tsx b/angular/devkit/preview/runtime/loader-react.tsx similarity index 80% rename from scopes/dev-services/preview/angular-runtime/loader-react.tsx rename to angular/devkit/preview/runtime/loader-react.tsx index 851a565c..bb63c13d 100644 --- a/scopes/dev-services/preview/angular-runtime/loader-react.tsx +++ b/angular/devkit/preview/runtime/loader-react.tsx @@ -6,16 +6,16 @@ import { ngToCustomElements } from './loader'; * Creates React components from a list of custom element selectors */ export function customElementsToReact(selectors: string[]): React.ComponentType[] { - return selectors.map((Selector: string, index: number) => { + return selectors.map((Selector: string) => { return () => { - return ; + return ; }; }); } /** * Loads the given Angular modules/components as custom elements and returns them as React components. - * For modules, it creates a new React component for each Angular components that are in the "bootstrap" property. + * For modules, it creates a new React component for each Angular component that is in the "bootstrap" property. */ export async function ngToReact(modulesOrComponents: Type[]): Promise { return customElementsToReact(await ngToCustomElements(modulesOrComponents)); diff --git a/scopes/dev-services/preview/angular-runtime/loader.ts b/angular/devkit/preview/runtime/loader.ts similarity index 98% rename from scopes/dev-services/preview/angular-runtime/loader.ts rename to angular/devkit/preview/runtime/loader.ts index 76782d7a..30d01aec 100644 --- a/scopes/dev-services/preview/angular-runtime/loader.ts +++ b/angular/devkit/preview/runtime/loader.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ // Only load those if we are in the browser if (typeof window !== 'undefined') { require('./native-shim.js'); @@ -218,11 +219,11 @@ export async function ngBootstrap(modulesOrComponents: Type | Type[ } throw new Error('Unable to load any composition, the Angular env can only load modules or components'); - } else { // for v13 and below we need to use angular elements to be able to load standalone components + } else { // for v13 and below, we need to use angular elements to be able to load standalone components // if (options.wrapperComponent) { // throw new Error('WrapperComponent is only supported in Angular v14 and above'); // } - let hostElement: Element | ShadowRoot = options.hostElement; + let { hostElement }: { hostElement: Element | ShadowRoot } = options; if (options.wrapper) { const wrapperSelector = await ngToCustomElements([options.wrapper], options.appConfig); const wrapperElement = replaceDomElements(hostElement, wrapperSelector)[0]; diff --git a/scopes/dev-services/preview/angular-runtime/main.ts b/angular/devkit/preview/runtime/main.ts similarity index 98% rename from scopes/dev-services/preview/angular-runtime/main.ts rename to angular/devkit/preview/runtime/main.ts index a57eb826..21d4af82 100644 --- a/scopes/dev-services/preview/angular-runtime/main.ts +++ b/angular/devkit/preview/runtime/main.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ require('zone.js/dist/zone'); const i0 = require('@angular/core') as any; import { BrowserModule } from '@angular/platform-browser'; diff --git a/scopes/dev-services/preview/angular-runtime/native-shim.js b/angular/devkit/preview/runtime/native-shim.js similarity index 96% rename from scopes/dev-services/preview/angular-runtime/native-shim.js rename to angular/devkit/preview/runtime/native-shim.js index 28ab1983..2087d7e6 100644 --- a/scopes/dev-services/preview/angular-runtime/native-shim.js +++ b/angular/devkit/preview/runtime/native-shim.js @@ -1,4 +1,3 @@ -'use strict'; /** * @license * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. @@ -15,7 +14,7 @@ * this.constructor so that the native HTMLElement constructor can access the * current under-construction element's definition. */ -(function() { +(function shim() { if ( // No Reflect, no classes, no need for shim because native custom elements // require ES2015 classes or Reflect. @@ -38,9 +37,9 @@ return Reflect.construct(BuiltInHTMLElement, [], this.constructor); } }; + /* eslint-disable @typescript-eslint/dot-notation */ window.HTMLElement = wrapperForTheName['HTMLElement']; HTMLElement.prototype = BuiltInHTMLElement.prototype; HTMLElement.prototype.constructor = HTMLElement; Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement); })(); -//# sourceMappingURL=native-shim.js.map diff --git a/scopes/dev-services/compiler/webpack/component.json b/angular/devkit/webpack/component.json similarity index 55% rename from scopes/dev-services/compiler/webpack/component.json rename to angular/devkit/webpack/component.json index a4dfedb2..99a12604 100644 --- a/scopes/dev-services/compiler/webpack/component.json +++ b/angular/devkit/webpack/component.json @@ -1,22 +1,10 @@ { "componentId": { - "scope": "teambit.angular", - "name": "dev-services/compiler/webpack" + "scope": "bitdev.angular", + "name": "dev-services/webpack" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-webpack", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { @@ -30,6 +18,7 @@ "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/scopes/dev-services/compiler/webpack/index.ts b/angular/devkit/webpack/index.ts similarity index 100% rename from scopes/dev-services/compiler/webpack/index.ts rename to angular/devkit/webpack/index.ts diff --git a/scopes/dev-services/compiler/webpack/ng-webpack-bundler.ts b/angular/devkit/webpack/ng-webpack-bundler.ts similarity index 97% rename from scopes/dev-services/compiler/webpack/ng-webpack-bundler.ts rename to angular/devkit/webpack/ng-webpack-bundler.ts index fcb43799..e444b75a 100644 --- a/scopes/dev-services/compiler/webpack/ng-webpack-bundler.ts +++ b/angular/devkit/webpack/ng-webpack-bundler.ts @@ -4,7 +4,7 @@ import { DevServerOptions, getNodeModulesPaths, getWorkspace -} from '@teambit/angular-common'; +} from '@bitdev/angular.dev-services.common'; import { AppBuildContext, ApplicationAspect, ApplicationMain } from '@teambit/application'; import { BundlerContext } from '@teambit/bundler'; import { DevFilesAspect, DevFilesMain } from '@teambit/dev-files'; @@ -83,7 +83,7 @@ export class NgWebpackBundler { const devFilesMain = context.getAspect(DevFilesAspect.id); let tempFolder: string; - const idName = `teambit.angular/${name}`; + const idName = `bitdev.angular/${name}`; if (workspace) { tempFolder = workspace.getTempDir(idName); } else { @@ -143,6 +143,7 @@ export class NgWebpackBundler { throw new Error('ngEnvOptions.webpackModulePath is required to use the Webpack bundler'); } + // eslint-disable-next-line import/no-dynamic-require,global-require const webpack = require(options.ngEnvOptions.webpackModulePath); return new WebpackBundler(bundlerContext.targets, configs, webpackMain.logger, webpack, bundlerContext.metaData); }; diff --git a/scopes/dev-services/compiler/webpack/ng-webpack-dev-server.ts b/angular/devkit/webpack/ng-webpack-dev-server.ts similarity index 97% rename from scopes/dev-services/compiler/webpack/ng-webpack-dev-server.ts rename to angular/devkit/webpack/ng-webpack-dev-server.ts index c8c77b64..f6a35582 100644 --- a/scopes/dev-services/compiler/webpack/ng-webpack-dev-server.ts +++ b/angular/devkit/webpack/ng-webpack-dev-server.ts @@ -4,7 +4,7 @@ import { DevServerOptions, getNodeModulesPaths, getWorkspace -} from '@teambit/angular-common'; +} from '@bitdev/angular.dev-services.common'; import { ApplicationAspect, ApplicationMain } from '@teambit/application'; import { DevServer, DevServerContext } from '@teambit/bundler'; import { DevFilesAspect, DevFilesMain } from '@teambit/dev-files'; @@ -86,7 +86,7 @@ export class NgWebpackDevServer { const devFilesMain = context.getAspect(DevFilesAspect.id); let tempFolder: string; - const idName = `teambit.angular/${name}`; + const idName = `bitdev.angular/${name}`; if (workspace) { tempFolder = workspace.getTempDir(idName); } else { @@ -148,6 +148,7 @@ export class NgWebpackDevServer { throw new Error('ngEnvOptions.webpackDevServerModulePath is required to use the Webpack dev server'); } + // eslint-disable-next-line import/no-dynamic-require,global-require const webpack = require(options.ngEnvOptions.webpackModulePath); const webpackDevServer = options.ngEnvOptions.webpackDevServerModulePath; diff --git a/scopes/dev-services/compiler/webpack/utils.ts b/angular/devkit/webpack/utils.ts similarity index 94% rename from scopes/dev-services/compiler/webpack/utils.ts rename to angular/devkit/webpack/utils.ts index 9b796b16..352a89d5 100644 --- a/scopes/dev-services/compiler/webpack/utils.ts +++ b/angular/devkit/webpack/utils.ts @@ -1,4 +1,4 @@ -import { componentIsApp } from '@teambit/angular-apps'; +import { componentIsApp } from '@bitdev/angular.app-types.angular-app-type'; import { AppBuildContext, AppContext, ApplicationMain } from '@teambit/application'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { Component, ComponentID } from '@teambit/component'; @@ -15,7 +15,7 @@ import { join, posix, resolve } from 'path'; import { readConfigFile, sys } from 'typescript'; import { Configuration, WebpackPluginInstance } from 'webpack'; // Make sure bit recognizes the dependencies -import "@teambit/angular-preview"; +import "@bitdev/angular.dev-services.preview.preview"; export type WebpackConfig = Configuration; @@ -48,10 +48,10 @@ const writeHash = new Map(); const timestamp = Date.now(); export function getPreviewRootPath(workspace?: Workspace): string { - const defaultPath = () => resolve(require.resolve('@teambit/angular-preview'), '../../preview-app/'); + const defaultPath = () => resolve(require.resolve('@bitdev/angular.dev-services.preview.preview'), '../../preview-app/'); if(!workspace) return defaultPath(); try { - const rootPath = workspace?.componentDir(ComponentID.fromString('teambit.angular/dev-services/preview/preview'), { + const rootPath = workspace?.componentDir(ComponentID.fromString('bitdev.angular/dev-services/preview/preview'), { ignoreScopeAndVersion: true, ignoreVersion: true }, { relative: false }) || ''; diff --git a/scopes/dev-services/compiler/webpack/webpack-plugins/angular-resolver.ts b/angular/devkit/webpack/webpack-plugins/angular-resolver.ts similarity index 93% rename from scopes/dev-services/compiler/webpack/webpack-plugins/angular-resolver.ts rename to angular/devkit/webpack/webpack-plugins/angular-resolver.ts index 7939c219..50949ac9 100644 --- a/scopes/dev-services/compiler/webpack/webpack-plugins/angular-resolver.ts +++ b/angular/devkit/webpack/webpack-plugins/angular-resolver.ts @@ -5,8 +5,9 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ +// eslint-disable-next-line max-classes-per-file import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; -import { NgccProcessor } from '@teambit/ngcc'; +import { NgccProcessor } from '@bitdev/angular.dev-services.ngcc'; import { Compiler } from 'webpack'; import { NodeJSFileSystem } from './nodejs-file-system'; @@ -122,9 +123,13 @@ export interface EntryPointPackageJson extends JsonObject, PackageJsonFormatProp */ export class BitDedupeModuleResolvePlugin { modules = new Map(); + typings = new Map(); + pluginName = 'BitDedupeModuleResolvePlugin'; + private fs = new NodeJSFileSystem(); + private ngccProcessor?: NgccProcessor; constructor(private nodeModulesPaths: string[], private workspaceDir: string, private tempFolder: string, private useNgcc: boolean) { @@ -137,17 +142,17 @@ export class BitDedupeModuleResolvePlugin { if(cached) { return cached; } + // eslint-disable-next-line no-restricted-syntax for (const prop of SUPPORTED_FORMAT_PROPERTIES) { const field = entryPointPackageJson[prop]; - if (typeof field !== 'string') { - // Some crazy packages have things like arrays in these fields! - continue; - } - const relativeTypingsPath = field.replace(/\.js$/, '.d.ts'); - const typingsPath = fs.resolve(entryPointPath, relativeTypingsPath); - if (fs.exists(typingsPath)) { - this.typings.set(entryPointPath, typingsPath); - return typingsPath; + // Some packages have things like arrays in these fields! + if (typeof field === 'string') { + const relativeTypingsPath = field.replace(/\.js$/, '.d.ts'); + const typingsPath = fs.resolve(entryPointPath, relativeTypingsPath); + if (fs.exists(typingsPath)) { + this.typings.set(entryPointPath, typingsPath); + return typingsPath; + } } } return null; @@ -158,6 +163,7 @@ export class BitDedupeModuleResolvePlugin { return false; } if(entryPointPackageJson.exports && (entryPointPackageJson as any).exports['.']) { + // eslint-disable-next-line no-param-reassign entryPointPackageJson = (entryPointPackageJson as any).exports['.'] as EntryPointPackageJson; } const typings = entryPointPackageJson?.typings @@ -178,10 +184,10 @@ export class BitDedupeModuleResolvePlugin { || V16_ANGULAR_FORMATS.every(f => Object.keys(entryPointPackageJson as JsonObject).includes(f)) ) { return true; - } + } const metadataPath = this.fs.resolve(entryPointPath, `${typings.replace(/\.d\.ts$/, '') }.metadata.json`); return this.fs.exists(metadataPath); - + } getIssuer(result: any) { @@ -256,7 +262,7 @@ export class BitDedupeModuleResolvePlugin { const { resource: prevResource, request: prevRequest } = prevResolvedModule; if (resource === prevResource) { // No deduping needed. - // Current path and previously resolved path are the same. + // The Current path and previously resolved path are the same. return; } diff --git a/scopes/dev-services/compiler/webpack/webpack-plugins/nodejs-file-system.ts b/angular/devkit/webpack/webpack-plugins/nodejs-file-system.ts similarity index 98% rename from scopes/dev-services/compiler/webpack/webpack-plugins/nodejs-file-system.ts rename to angular/devkit/webpack/webpack-plugins/nodejs-file-system.ts index d3d91c68..e070335d 100644 --- a/scopes/dev-services/compiler/webpack/webpack-plugins/nodejs-file-system.ts +++ b/angular/devkit/webpack/webpack-plugins/nodejs-file-system.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line max-classes-per-file import * as fs from 'fs'; import * as p from 'path'; @@ -209,6 +210,7 @@ export class NodeJSFileSystem extends NodeJSReadonlyFileSystem implements FileSy const parents: AbsoluteFsPath[] = []; while (!this.isRoot(path) && !this.exists(path)) { parents.push(path); + // eslint-disable-next-line no-param-reassign path = this.dirname(path); } while (parents.length) { diff --git a/scopes/dev-services/compiler/webpack/webpack-plugins/stats-logger.ts b/angular/devkit/webpack/webpack-plugins/stats-logger.ts similarity index 92% rename from scopes/dev-services/compiler/webpack/webpack-plugins/stats-logger.ts rename to angular/devkit/webpack/webpack-plugins/stats-logger.ts index 075cd30e..f5c7f5de 100644 --- a/scopes/dev-services/compiler/webpack/webpack-plugins/stats-logger.ts +++ b/angular/devkit/webpack/webpack-plugins/stats-logger.ts @@ -1,5 +1,5 @@ import type { Compiler, Stats } from 'webpack'; -import { loadEsmModule } from '@teambit/angular-common'; +import { loadEsmModule } from '@bitdev/angular.dev-services.common'; const PLUGIN_NAME = 'angular-stats-logger-plugin'; diff --git a/scopes/dev-services/compiler/webpack/webpack-plugins/utils.ts b/angular/devkit/webpack/webpack-plugins/utils.ts similarity index 82% rename from scopes/dev-services/compiler/webpack/webpack-plugins/utils.ts rename to angular/devkit/webpack/webpack-plugins/utils.ts index 0b5faf31..962046e8 100644 --- a/scopes/dev-services/compiler/webpack/webpack-plugins/utils.ts +++ b/angular/devkit/webpack/webpack-plugins/utils.ts @@ -1,5 +1,5 @@ import { existsSync } from 'fs'; -import path, { resolve } from 'path'; +import { resolve } from 'path'; export function tryResolvePackage(resolver: any, moduleName: string, nodeModulesDir: string): string | undefined { try { @@ -13,7 +13,7 @@ export function tryResolvePackage(resolver: any, moduleName: string, nodeModules } catch { // Ex: @angular/compiler/src/i18n/i18n_ast/package.json // or local libraries which don't reside in node_modules - const packageJsonPath = path.resolve(nodeModulesDir, '../package.json'); + const packageJsonPath = resolve(nodeModulesDir, '../package.json'); return existsSync(packageJsonPath) ? packageJsonPath : undefined; } diff --git a/angular/envs/.eslintrc.json b/angular/envs/.eslintrc.json new file mode 100644 index 00000000..1e74992d --- /dev/null +++ b/angular/envs/.eslintrc.json @@ -0,0 +1,6 @@ +// bit-generated-eslint-config +{ + "extends": [ + "./../../node_modules/.cache/.eslintrc.bit.27fd94347a9113ba5e391c8f8c9355f1307b4854.json" + ] +} \ No newline at end of file diff --git a/scopes/angular/angular.bit-env.ts b/angular/envs/angular-env/angular.bit-env.ts similarity index 79% rename from scopes/angular/angular.bit-env.ts rename to angular/envs/angular-env/angular.bit-env.ts index e4b9f4d5..630356e4 100644 --- a/scopes/angular/angular.bit-env.ts +++ b/angular/envs/angular-env/angular.bit-env.ts @@ -1,4 +1,4 @@ -import { AngularV16Env } from '@teambit/angular-v16'; +import { AngularV16Env } from '@bitdev/angular.envs.angular-v16-env'; import { NativeCompileCache } from '@teambit/toolbox.performance.v8-cache'; // Disable v8-caching because it breaks ESM loaders diff --git a/scopes/versions/common/angular-base/angular-base.composition.tsx b/angular/envs/angular-env/angular.composition.tsx similarity index 85% rename from scopes/versions/common/angular-base/angular-base.composition.tsx rename to angular/envs/angular-env/angular.composition.tsx index 1c8e5426..d6926aab 100644 --- a/scopes/versions/common/angular-base/angular-base.composition.tsx +++ b/angular/envs/angular-env/angular.composition.tsx @@ -2,6 +2,6 @@ import React from 'react'; export const Logo = () => (
- + Angular
); diff --git a/scopes/angular/angular.docs.mdx b/angular/envs/angular-env/angular.docs.mdx similarity index 55% rename from scopes/angular/angular.docs.mdx rename to angular/envs/angular-env/angular.docs.mdx index fa0ad1e8..0b1242ec 100644 --- a/scopes/angular/angular.docs.mdx +++ b/angular/envs/angular-env/angular.docs.mdx @@ -12,63 +12,63 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; icon: 'https://static.bit.dev/brands/logo-angular.svg', background: '#0d47a1' }} - envId='teambit.angular/angular' + envId='bitdev.angular/angular-env' docsLink='https://bit.dev/docs/angular-introduction' tools={{ developmentTools: [ { name: 'Jest', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/angular-v16/~code/jest/jest.config.ts', + 'https://bit.cloud/bitdev/angular/envs/angular-v16/~code/jest/jest.config.ts', ], }, { name: 'ESLint', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/eslintrc.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/eslintrc.js', ], }, { name: 'Prettier', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/prettier.config.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/prettier.config.js', ], }, ], buildPipeline: [ { name: 'Ng-Packagr', - toolLink: 'https://bit.cloud/teambit/angular/dev-services/compiler/ng-packagr', + toolLink: 'https://bit.cloud/bitdev/angular/dev-services/compiler/ng-packagr', configFiles: [ ], }, { name: 'ESLint', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/eslintrc.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/eslintrc.js', ], }, { name: 'Jest', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/angular-v16/~code/jest/jest.config.ts', + 'https://bit.cloud/bitdev/angular/envs/angular-v16/~code/jest/jest.config.ts', ], }, ], previewsAndDocs: [ { name: 'Component Preview', - toolLink: 'https://bit.cloud/teambit/angular/dev-services/preview/mounter', + toolLink: 'https://bit.cloud/bitdev/angular/dev-services/preview/mounter', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/preview/mounter.ts', - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/preview/host-dependencies.ts', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/preview/mounter.ts', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/preview/host-dependencies.ts', ], }, { name: 'Component Docs', - toolLink: 'https://bit.cloud/teambit/angular/dev-services/preview/preview', + toolLink: 'https://bit.cloud/bitdev/angular/dev-services/preview/preview', configFiles: [ - 'https://bit.cloud/teambit/angular/dev-services/preview/preview/~code/docs.ts', + 'https://bit.cloud/bitdev/angular/dev-services/preview/preview/~code/docs.ts', ], }, { diff --git a/scopes/angular/component.json b/angular/envs/angular-env/component.json similarity index 87% rename from scopes/angular/component.json rename to angular/envs/angular-env/component.json index da1a5132..e5e90aa3 100644 --- a/scopes/angular/component.json +++ b/angular/envs/angular-env/component.json @@ -1,22 +1,10 @@ { "componentId": { - "name": "angular", - "scope": "teambit.angular" + "name": "envs/angular-env", + "scope": "bitdev.angular" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular", - "private": false, - "engines": { - "node": "^16.13.0 || >=18.10.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { diff --git a/scopes/angular/env.jsonc b/angular/envs/angular-env/env.jsonc similarity index 100% rename from scopes/angular/env.jsonc rename to angular/envs/angular-env/env.jsonc diff --git a/angular/envs/angular-env/index.ts b/angular/envs/angular-env/index.ts new file mode 100644 index 00000000..58140ecf --- /dev/null +++ b/angular/envs/angular-env/index.ts @@ -0,0 +1,2 @@ +export { AngularEnv } from './angular.bit-env'; +export { jestConfig } from '@bitdev/angular.envs.angular-v16-env'; diff --git a/scopes/versions/angular-v12/angular-v12.bit-env.ts b/angular/envs/angular-v12-env/angular-v12-env.bit-env.ts similarity index 86% rename from scopes/versions/angular-v12/angular-v12.bit-env.ts rename to angular/envs/angular-v12-env/angular-v12-env.bit-env.ts index e4044e15..03c0af58 100644 --- a/scopes/versions/angular-v12/angular-v12.bit-env.ts +++ b/angular/envs/angular-v12-env/angular-v12-env.bit-env.ts @@ -1,12 +1,13 @@ -import { AngularBaseEnv } from '@teambit/angular-base'; -import { AngularEnvOptions } from '@teambit/angular-common'; +import { AngularBaseEnv } from '@bitdev/angular.envs.base-env'; +import { AngularEnvOptions } from '@bitdev/angular.dev-services.common'; import { webpackConfigFactory } from './webpack-config.factory'; export class AngularV12Env extends AngularBaseEnv { /** * name of the environment. used for friendly mentions across bit. */ - name = 'Angular-v12'; + name = 'angular-v12-env'; + angularVersion = 12; ngEnvOptions: AngularEnvOptions = { diff --git a/scopes/versions/angular-v12/angular-v12.docs.mdx b/angular/envs/angular-v12-env/angular-v12-env.docs.mdx similarity index 54% rename from scopes/versions/angular-v12/angular-v12.docs.mdx rename to angular/envs/angular-v12-env/angular-v12-env.docs.mdx index 73aeaf54..97151883 100644 --- a/scopes/versions/angular-v12/angular-v12.docs.mdx +++ b/angular/envs/angular-v12-env/angular-v12-env.docs.mdx @@ -8,67 +8,67 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; =12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { diff --git a/scopes/versions/angular-v12/env.jsonc b/angular/envs/angular-v12-env/env.jsonc similarity index 100% rename from scopes/versions/angular-v12/env.jsonc rename to angular/envs/angular-v12-env/env.jsonc diff --git a/scopes/versions/angular-v12/index.ts b/angular/envs/angular-v12-env/index.ts similarity index 50% rename from scopes/versions/angular-v12/index.ts rename to angular/envs/angular-v12-env/index.ts index 466d037c..d87b60e8 100644 --- a/scopes/versions/angular-v12/index.ts +++ b/angular/envs/angular-v12-env/index.ts @@ -1,2 +1,2 @@ -export { AngularV12Env } from './angular-v12.bit-env'; +export { AngularV12Env } from './angular-v12-env.bit-env'; export { default as jestConfig } from './jest/jest.config'; diff --git a/scopes/versions/angular-v12/jest/jest.config.ts b/angular/envs/angular-v12-env/jest/jest.config.ts similarity index 93% rename from scopes/versions/angular-v12/jest/jest.config.ts rename to angular/envs/angular-v12-env/jest/jest.config.ts index affc36c3..99f2be74 100644 --- a/scopes/versions/angular-v12/jest/jest.config.ts +++ b/angular/envs/angular-v12-env/jest/jest.config.ts @@ -14,6 +14,7 @@ export default { }, moduleNameMapper: { // map angular modules to avoid duplicated modules + /* eslint-disable-next-line no-useless-escape */ "(@angular\/.*)$": ["/node_modules/$1", "$1"] }, transformIgnorePatterns: [ diff --git a/scopes/versions/angular-v10/jest/setup-jest.ts b/angular/envs/angular-v12-env/jest/setup-jest.ts similarity index 100% rename from scopes/versions/angular-v10/jest/setup-jest.ts rename to angular/envs/angular-v12-env/jest/setup-jest.ts diff --git a/scopes/versions/angular-v10/jest/tsconfig.spec.json b/angular/envs/angular-v12-env/jest/tsconfig.spec.json similarity index 100% rename from scopes/versions/angular-v10/jest/tsconfig.spec.json rename to angular/envs/angular-v12-env/jest/tsconfig.spec.json diff --git a/scopes/versions/angular-v12/webpack-config.factory.ts b/angular/envs/angular-v12-env/webpack-config.factory.ts similarity index 98% rename from scopes/versions/angular-v12/webpack-config.factory.ts rename to angular/envs/angular-v12-env/webpack-config.factory.ts index ba2522a0..969f55ab 100644 --- a/scopes/versions/angular-v12/webpack-config.factory.ts +++ b/angular/envs/angular-v12-env/webpack-config.factory.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; import { OutputHashing } from '@angular-devkit/build-angular/src/server/schema'; import { @@ -29,7 +30,7 @@ import { WebpackConfigFactoryOpts, WebpackServeConfigFactoryOpts, WebpackSetup -} from '@teambit/angular-webpack'; +} from '@bitdev/angular.dev-services.webpack'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { Logger } from '@teambit/logger'; import { @@ -228,7 +229,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp let overwriteConfig: WebpackConfigWithDevServer; if (opts.setup === WebpackSetup.Serve) { - overwriteConfig = await webpack5ServeConfigFactory( + overwriteConfig = webpack5ServeConfigFactory( opts.devServerID, opts.workspaceDir, opts.entryFiles, @@ -242,7 +243,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp opts.useNgcc ); } else { - overwriteConfig = await webpack5BuildConfigFactory( + overwriteConfig = webpack5BuildConfigFactory( opts.entryFiles, opts.outputPath, opts.nodeModulesPaths, diff --git a/scopes/versions/angular-v13/webpack/webpack5.build.config.ts b/angular/envs/angular-v12-env/webpack/webpack5.build.config.ts similarity index 96% rename from scopes/versions/angular-v13/webpack/webpack5.build.config.ts rename to angular/envs/angular-v12-env/webpack/webpack5.build.config.ts index a7678178..ff944c69 100644 --- a/scopes/versions/angular-v13/webpack/webpack5.build.config.ts +++ b/angular/envs/angular-v12-env/webpack/webpack5.build.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@bitdev/angular.dev-services.webpack'; import { fallbacks, fallbacksAliases, fallbacksProvidePluginConfig } from '@teambit/webpack'; import { sep } from 'path'; import RemarkFrontmatter from 'remark-frontmatter'; diff --git a/scopes/versions/angular-v12/webpack/webpack5.serve.config.ts b/angular/envs/angular-v12-env/webpack/webpack5.serve.config.ts similarity index 99% rename from scopes/versions/angular-v12/webpack/webpack5.serve.config.ts rename to angular/envs/angular-v12-env/webpack/webpack5.serve.config.ts index 3563cff7..938c73dd 100644 --- a/scopes/versions/angular-v12/webpack/webpack5.serve.config.ts +++ b/angular/envs/angular-v12-env/webpack/webpack5.serve.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@bitdev/angular.dev-services.webpack'; import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; import { PubsubMain } from '@teambit/pubsub'; import { diff --git a/scopes/versions/angular-v13/angular-v13.bit-env.ts b/angular/envs/angular-v13-env/angular-v13-env.bit-env.ts similarity index 87% rename from scopes/versions/angular-v13/angular-v13.bit-env.ts rename to angular/envs/angular-v13-env/angular-v13-env.bit-env.ts index 7ba7fc02..8740d2c7 100644 --- a/scopes/versions/angular-v13/angular-v13.bit-env.ts +++ b/angular/envs/angular-v13-env/angular-v13-env.bit-env.ts @@ -1,5 +1,5 @@ -import { AngularBaseEnv } from '@teambit/angular-base'; -import { AngularEnvOptions } from '@teambit/angular-common'; +import { AngularBaseEnv } from '@bitdev/angular.envs.base-env'; +import { AngularEnvOptions } from '@bitdev/angular.dev-services.common'; import { NativeCompileCache } from '@teambit/toolbox.performance.v8-cache'; import { webpackConfigFactory } from './webpack-config.factory'; @@ -10,7 +10,8 @@ export class AngularV13Env extends AngularBaseEnv { /** * name of the environment. used for friendly mentions across bit. */ - name = 'Angular-v13'; + name = 'angular-v13-env'; + angularVersion = 13; ngEnvOptions: AngularEnvOptions = { diff --git a/scopes/versions/angular-v13/angular-v13.docs.mdx b/angular/envs/angular-v13-env/angular-v13-env.docs.mdx similarity index 54% rename from scopes/versions/angular-v13/angular-v13.docs.mdx rename to angular/envs/angular-v13-env/angular-v13-env.docs.mdx index d51e886e..d7ec5171 100644 --- a/scopes/versions/angular-v13/angular-v13.docs.mdx +++ b/angular/envs/angular-v13-env/angular-v13-env.docs.mdx @@ -8,67 +8,67 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; =12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { diff --git a/scopes/versions/angular-v13/env.jsonc b/angular/envs/angular-v13-env/env.jsonc similarity index 100% rename from scopes/versions/angular-v13/env.jsonc rename to angular/envs/angular-v13-env/env.jsonc diff --git a/scopes/versions/angular-v13/index.ts b/angular/envs/angular-v13-env/index.ts similarity index 50% rename from scopes/versions/angular-v13/index.ts rename to angular/envs/angular-v13-env/index.ts index bb931266..a4f88d0d 100644 --- a/scopes/versions/angular-v13/index.ts +++ b/angular/envs/angular-v13-env/index.ts @@ -1,2 +1,2 @@ -export { AngularV13Env } from './angular-v13.bit-env'; +export { AngularV13Env } from './angular-v13-env.bit-env'; export { default as jestConfig } from './jest/jest.config'; diff --git a/scopes/versions/angular-v13/jest/jest.config.ts b/angular/envs/angular-v13-env/jest/jest.config.ts similarity index 93% rename from scopes/versions/angular-v13/jest/jest.config.ts rename to angular/envs/angular-v13-env/jest/jest.config.ts index 535d04b5..5d04b4b6 100644 --- a/scopes/versions/angular-v13/jest/jest.config.ts +++ b/angular/envs/angular-v13-env/jest/jest.config.ts @@ -14,6 +14,7 @@ export default { }, moduleNameMapper: { // map angular modules to avoid duplicated modules + /* eslint-disable-next-line no-useless-escape */ "(@angular\/.*)$": ["/node_modules/$1", "$1"] }, transformIgnorePatterns: [ diff --git a/scopes/versions/angular-v13/jest/tsconfig.spec.json b/angular/envs/angular-v13-env/jest/tsconfig.spec.json similarity index 100% rename from scopes/versions/angular-v13/jest/tsconfig.spec.json rename to angular/envs/angular-v13-env/jest/tsconfig.spec.json diff --git a/scopes/versions/angular-v13/webpack-config.factory.ts b/angular/envs/angular-v13-env/webpack-config.factory.ts similarity index 97% rename from scopes/versions/angular-v13/webpack-config.factory.ts rename to angular/envs/angular-v13-env/webpack-config.factory.ts index 4f025198..0f1b4014 100644 --- a/scopes/versions/angular-v13/webpack-config.factory.ts +++ b/angular/envs/angular-v13-env/webpack-config.factory.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; import { OutputHashing } from '@angular-devkit/build-angular'; import { @@ -26,7 +27,7 @@ import { WebpackConfigFactoryOpts, WebpackServeConfigFactoryOpts, WebpackSetup -} from '@teambit/angular-webpack'; +} from '@bitdev/angular.dev-services.webpack'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { Logger } from '@teambit/logger'; import { @@ -163,7 +164,7 @@ async function getWebpackConfig( getSystemPath(normalizedWorkspaceRoot), getSystemPath(projectRoot), getSystemPath(normalizedSourceRoot), - 'bit-angular-v13', // projectName + 'bit-angular-v13-env', // projectName normalizedOptions, (wco: BrowserWebpackConfigOptions) => [ setup === WebpackSetup.Serve ? getDevServerConfig(wco) : {}, @@ -212,7 +213,7 @@ async function getWebpackConfig( delete webpackConfig?.resolve?.modules; webpackConfig.stats = 'errors-only'; // uniqueName should not be an empty string - webpackConfig.output.uniqueName = 'angular-v13'; + webpackConfig.output.uniqueName = 'angular-v13-env'; if (setup === WebpackSetup.Serve) { webpackConfig = migrateConfiguration(webpackConfig); @@ -236,7 +237,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp let overwriteConfig: WebpackConfigWithDevServer; if (opts.setup === WebpackSetup.Serve) { - overwriteConfig = await webpack5ServeConfigFactory( + overwriteConfig = webpack5ServeConfigFactory( opts.devServerID, opts.workspaceDir, opts.entryFiles, @@ -250,7 +251,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp opts.useNgcc ); } else { - overwriteConfig = await webpack5BuildConfigFactory( + overwriteConfig = webpack5BuildConfigFactory( opts.entryFiles, opts.outputPath, opts.nodeModulesPaths, diff --git a/scopes/versions/angular-v12/webpack/webpack5.build.config.ts b/angular/envs/angular-v13-env/webpack/webpack5.build.config.ts similarity index 96% rename from scopes/versions/angular-v12/webpack/webpack5.build.config.ts rename to angular/envs/angular-v13-env/webpack/webpack5.build.config.ts index a7678178..ff944c69 100644 --- a/scopes/versions/angular-v12/webpack/webpack5.build.config.ts +++ b/angular/envs/angular-v13-env/webpack/webpack5.build.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@bitdev/angular.dev-services.webpack'; import { fallbacks, fallbacksAliases, fallbacksProvidePluginConfig } from '@teambit/webpack'; import { sep } from 'path'; import RemarkFrontmatter from 'remark-frontmatter'; diff --git a/scopes/versions/angular-v13/webpack/webpack5.serve.config.ts b/angular/envs/angular-v13-env/webpack/webpack5.serve.config.ts similarity index 99% rename from scopes/versions/angular-v13/webpack/webpack5.serve.config.ts rename to angular/envs/angular-v13-env/webpack/webpack5.serve.config.ts index 3563cff7..938c73dd 100644 --- a/scopes/versions/angular-v13/webpack/webpack5.serve.config.ts +++ b/angular/envs/angular-v13-env/webpack/webpack5.serve.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@bitdev/angular.dev-services.webpack'; import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; import { PubsubMain } from '@teambit/pubsub'; import { diff --git a/scopes/versions/angular-v14/angular-v14.bit-env.ts b/angular/envs/angular-v14-env/angular-v14-env.bit-env.ts similarity index 87% rename from scopes/versions/angular-v14/angular-v14.bit-env.ts rename to angular/envs/angular-v14-env/angular-v14-env.bit-env.ts index 2a07f9f3..1fe055cd 100644 --- a/scopes/versions/angular-v14/angular-v14.bit-env.ts +++ b/angular/envs/angular-v14-env/angular-v14-env.bit-env.ts @@ -1,5 +1,5 @@ -import { AngularBaseEnv } from '@teambit/angular-base'; -import { AngularEnvOptions } from '@teambit/angular-common'; +import { AngularBaseEnv } from '@bitdev/angular.envs.base-env'; +import { AngularEnvOptions } from '@bitdev/angular.dev-services.common'; import { NativeCompileCache } from '@teambit/toolbox.performance.v8-cache'; import { webpackConfigFactory } from './webpack-config.factory'; @@ -10,7 +10,8 @@ export class AngularV14Env extends AngularBaseEnv { /** * name of the environment. used for friendly mentions across bit. */ - name = 'Angular-v14'; + name = 'angular-v14-env'; + angularVersion = 14; ngEnvOptions: AngularEnvOptions = { diff --git a/angular/envs/angular-v14-env/angular-v14-env.docs.mdx b/angular/envs/angular-v14-env/angular-v14-env.docs.mdx new file mode 100644 index 00000000..097f08c1 --- /dev/null +++ b/angular/envs/angular-v14-env/angular-v14-env.docs.mdx @@ -0,0 +1,85 @@ +--- +description: A Bit development environment for Angular Components +labels: ['angular', 'environment', 'env', 'aspect', 'extension'] +--- + +import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; + + diff --git a/scopes/versions/angular-v14/component.json b/angular/envs/angular-v14-env/component.json similarity index 88% rename from scopes/versions/angular-v14/component.json rename to angular/envs/angular-v14-env/component.json index e059508a..98e20064 100644 --- a/scopes/versions/angular-v14/component.json +++ b/angular/envs/angular-v14-env/component.json @@ -1,21 +1,10 @@ { "componentId": { - "name": "versions/angular-v14" + "name": "envs/angular-v14-env", + "scope": "bitdev.angular" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-v14", - "private": false, - "engines": { - "node": ">=14.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { diff --git a/scopes/versions/angular-v14/env.jsonc b/angular/envs/angular-v14-env/env.jsonc similarity index 100% rename from scopes/versions/angular-v14/env.jsonc rename to angular/envs/angular-v14-env/env.jsonc diff --git a/scopes/versions/angular-v14/index.ts b/angular/envs/angular-v14-env/index.ts similarity index 50% rename from scopes/versions/angular-v14/index.ts rename to angular/envs/angular-v14-env/index.ts index 79e47f2e..a0f0d5f0 100644 --- a/scopes/versions/angular-v14/index.ts +++ b/angular/envs/angular-v14-env/index.ts @@ -1,2 +1,2 @@ -export { AngularV14Env } from './angular-v14.bit-env'; +export { AngularV14Env } from './angular-v14-env.bit-env'; export { default as jestConfig } from './jest/jest.config'; diff --git a/scopes/versions/angular-v14/jest/jest-global-mocks.ts b/angular/envs/angular-v14-env/jest/jest-global-mocks.ts similarity index 100% rename from scopes/versions/angular-v14/jest/jest-global-mocks.ts rename to angular/envs/angular-v14-env/jest/jest-global-mocks.ts diff --git a/scopes/versions/angular-v14/jest/jest.config.ts b/angular/envs/angular-v14-env/jest/jest.config.ts similarity index 100% rename from scopes/versions/angular-v14/jest/jest.config.ts rename to angular/envs/angular-v14-env/jest/jest.config.ts diff --git a/scopes/versions/angular-v14/jest/jest.resolver.ts b/angular/envs/angular-v14-env/jest/jest.resolver.ts similarity index 90% rename from scopes/versions/angular-v14/jest/jest.resolver.ts rename to angular/envs/angular-v14-env/jest/jest.resolver.ts index 26f06e80..7b076012 100644 --- a/scopes/versions/angular-v14/jest/jest.resolver.ts +++ b/angular/envs/angular-v14-env/jest/jest.resolver.ts @@ -23,7 +23,9 @@ module.exports = (path: string, options: any) => { ]); if (pkgNamesToTarget.has(pkg.name)) { + // eslint-disable-next-line no-param-reassign delete pkg.exports; + // eslint-disable-next-line no-param-reassign delete pkg.module; } diff --git a/scopes/versions/angular-v14/jest/tsconfig.spec.json b/angular/envs/angular-v14-env/jest/tsconfig.spec.json similarity index 100% rename from scopes/versions/angular-v14/jest/tsconfig.spec.json rename to angular/envs/angular-v14-env/jest/tsconfig.spec.json diff --git a/scopes/versions/angular-v14/webpack-config.factory.ts b/angular/envs/angular-v14-env/webpack-config.factory.ts similarity index 97% rename from scopes/versions/angular-v14/webpack-config.factory.ts rename to angular/envs/angular-v14-env/webpack-config.factory.ts index ef0f9f2e..34d7b4b6 100644 --- a/scopes/versions/angular-v14/webpack-config.factory.ts +++ b/angular/envs/angular-v14-env/webpack-config.factory.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; import { OutputHashing } from '@angular-devkit/build-angular'; import { @@ -26,7 +27,7 @@ import { WebpackConfigFactoryOpts, WebpackServeConfigFactoryOpts, WebpackSetup -} from '@teambit/angular-webpack'; +} from '@bitdev/angular.dev-services.webpack'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { Logger } from '@teambit/logger'; import { @@ -164,7 +165,7 @@ async function getWebpackConfig( getSystemPath(normalizedWorkspaceRoot), getSystemPath(projectRoot), getSystemPath(normalizedSourceRoot), - 'bit-angular-v14', // projectName + 'bit-angular-v14-env', // projectName normalizedOptions, (wco: BrowserWebpackConfigOptions) => [ setup === WebpackSetup.Serve ? getDevServerConfig(wco) : {}, @@ -214,7 +215,7 @@ async function getWebpackConfig( delete webpackConfig?.resolve?.modules; webpackConfig.stats = 'errors-only'; // uniqueName should not be an empty string - webpackConfig.output.uniqueName = 'angular-v14'; + webpackConfig.output.uniqueName = 'angular-v14-env'; if (setup === WebpackSetup.Serve) { webpackConfig = migrateConfiguration(webpackConfig); @@ -238,7 +239,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp let overwriteConfig: WebpackConfigWithDevServer; if (opts.setup === WebpackSetup.Serve) { - overwriteConfig = await webpack5ServeConfigFactory( + overwriteConfig = webpack5ServeConfigFactory( opts.devServerID, opts.workspaceDir, opts.entryFiles, @@ -252,7 +253,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp opts.useNgcc ); } else { - overwriteConfig = await webpack5BuildConfigFactory( + overwriteConfig = webpack5BuildConfigFactory( opts.entryFiles, opts.outputPath, opts.nodeModulesPaths, diff --git a/scopes/versions/angular-v14/webpack/module-rules.config.ts b/angular/envs/angular-v14-env/webpack/module-rules.config.ts similarity index 100% rename from scopes/versions/angular-v14/webpack/module-rules.config.ts rename to angular/envs/angular-v14-env/webpack/module-rules.config.ts diff --git a/scopes/versions/angular-v14/webpack/webpack5.build.config.ts b/angular/envs/angular-v14-env/webpack/webpack5.build.config.ts similarity index 95% rename from scopes/versions/angular-v14/webpack/webpack5.build.config.ts rename to angular/envs/angular-v14-env/webpack/webpack5.build.config.ts index bcd016d4..0d0d2c82 100644 --- a/scopes/versions/angular-v14/webpack/webpack5.build.config.ts +++ b/angular/envs/angular-v14-env/webpack/webpack5.build.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@bitdev/angular.dev-services.webpack'; import { fallbacks, fallbacksAliases, fallbacksProvidePluginConfig } from '@teambit/webpack'; import { sep } from 'path'; import webpack from 'webpack'; diff --git a/scopes/versions/angular-v14/webpack/webpack5.serve.config.ts b/angular/envs/angular-v14-env/webpack/webpack5.serve.config.ts similarity index 99% rename from scopes/versions/angular-v14/webpack/webpack5.serve.config.ts rename to angular/envs/angular-v14-env/webpack/webpack5.serve.config.ts index 19fd5ef7..fecf3e87 100644 --- a/scopes/versions/angular-v14/webpack/webpack5.serve.config.ts +++ b/angular/envs/angular-v14-env/webpack/webpack5.serve.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@bitdev/angular.dev-services.webpack'; import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; import { PubsubMain } from '@teambit/pubsub'; import { diff --git a/scopes/versions/angular-v15/angular-v15.bit-env.ts b/angular/envs/angular-v15-env/angular-v15-env.bit-env.ts similarity index 87% rename from scopes/versions/angular-v15/angular-v15.bit-env.ts rename to angular/envs/angular-v15-env/angular-v15-env.bit-env.ts index 9862b985..a3428362 100644 --- a/scopes/versions/angular-v15/angular-v15.bit-env.ts +++ b/angular/envs/angular-v15-env/angular-v15-env.bit-env.ts @@ -1,5 +1,5 @@ -import { AngularBaseEnv } from '@teambit/angular-base'; -import { AngularEnvOptions } from '@teambit/angular-common'; +import { AngularBaseEnv } from '@bitdev/angular.envs.base-env'; +import { AngularEnvOptions } from '@bitdev/angular.dev-services.common'; import { NativeCompileCache } from '@teambit/toolbox.performance.v8-cache'; import { webpackConfigFactory } from './webpack-config.factory'; @@ -10,7 +10,8 @@ export class AngularV15Env extends AngularBaseEnv { /** * name of the environment. used for friendly mentions across bit. */ - name = 'Angular-v15'; + name = 'Aangular-v15-env'; + angularVersion = 15; ngEnvOptions: AngularEnvOptions = { diff --git a/angular/envs/angular-v15-env/angular-v15-env.docs.mdx b/angular/envs/angular-v15-env/angular-v15-env.docs.mdx new file mode 100644 index 00000000..3f094bf9 --- /dev/null +++ b/angular/envs/angular-v15-env/angular-v15-env.docs.mdx @@ -0,0 +1,85 @@ +--- +description: A Bit development environment for Angular Components +labels: ['angular', 'environment', 'env', 'aspect', 'extension'] +--- + +import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; + + diff --git a/scopes/versions/angular-v15/component.json b/angular/envs/angular-v15-env/component.json similarity index 88% rename from scopes/versions/angular-v15/component.json rename to angular/envs/angular-v15-env/component.json index 2324c838..c11cd7e6 100644 --- a/scopes/versions/angular-v15/component.json +++ b/angular/envs/angular-v15-env/component.json @@ -1,21 +1,10 @@ { "componentId": { - "name": "versions/angular-v15" + "name": "envs/angular-v15-env", + "scope": "bitdev.angular" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-v15", - "private": false, - "engines": { - "node": ">=14.20.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { diff --git a/scopes/versions/angular-v15/env.jsonc b/angular/envs/angular-v15-env/env.jsonc similarity index 100% rename from scopes/versions/angular-v15/env.jsonc rename to angular/envs/angular-v15-env/env.jsonc diff --git a/scopes/versions/angular-v15/index.ts b/angular/envs/angular-v15-env/index.ts similarity index 50% rename from scopes/versions/angular-v15/index.ts rename to angular/envs/angular-v15-env/index.ts index ed5245cb..3c52439f 100644 --- a/scopes/versions/angular-v15/index.ts +++ b/angular/envs/angular-v15-env/index.ts @@ -1,2 +1,2 @@ -export { AngularV15Env } from './angular-v15.bit-env'; +export { AngularV15Env } from './angular-v15-env.bit-env'; export { default as jestConfig } from './jest/jest.config'; diff --git a/scopes/versions/angular-v15/jest/jest-global-mocks.ts b/angular/envs/angular-v15-env/jest/jest-global-mocks.ts similarity index 100% rename from scopes/versions/angular-v15/jest/jest-global-mocks.ts rename to angular/envs/angular-v15-env/jest/jest-global-mocks.ts diff --git a/scopes/versions/angular-v15/jest/jest.config.ts b/angular/envs/angular-v15-env/jest/jest.config.ts similarity index 100% rename from scopes/versions/angular-v15/jest/jest.config.ts rename to angular/envs/angular-v15-env/jest/jest.config.ts diff --git a/scopes/versions/angular-v15/jest/jest.resolver.ts b/angular/envs/angular-v15-env/jest/jest.resolver.ts similarity index 90% rename from scopes/versions/angular-v15/jest/jest.resolver.ts rename to angular/envs/angular-v15-env/jest/jest.resolver.ts index 26f06e80..7b076012 100644 --- a/scopes/versions/angular-v15/jest/jest.resolver.ts +++ b/angular/envs/angular-v15-env/jest/jest.resolver.ts @@ -23,7 +23,9 @@ module.exports = (path: string, options: any) => { ]); if (pkgNamesToTarget.has(pkg.name)) { + // eslint-disable-next-line no-param-reassign delete pkg.exports; + // eslint-disable-next-line no-param-reassign delete pkg.module; } diff --git a/scopes/versions/angular-v15/jest/tsconfig.spec.json b/angular/envs/angular-v15-env/jest/tsconfig.spec.json similarity index 100% rename from scopes/versions/angular-v15/jest/tsconfig.spec.json rename to angular/envs/angular-v15-env/jest/tsconfig.spec.json diff --git a/scopes/versions/angular-v15/webpack-config.factory.ts b/angular/envs/angular-v15-env/webpack-config.factory.ts similarity index 97% rename from scopes/versions/angular-v15/webpack-config.factory.ts rename to angular/envs/angular-v15-env/webpack-config.factory.ts index 5bb41413..9247e30f 100644 --- a/scopes/versions/angular-v15/webpack-config.factory.ts +++ b/angular/envs/angular-v15-env/webpack-config.factory.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; import { OutputHashing } from '@angular-devkit/build-angular'; import { @@ -26,7 +27,7 @@ import { WebpackConfigFactoryOpts, WebpackServeConfigFactoryOpts, WebpackSetup -} from '@teambit/angular-webpack'; +} from '@bitdev/angular.dev-services.webpack'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { Logger } from '@teambit/logger'; import { @@ -164,7 +165,7 @@ async function getWebpackConfig( getSystemPath(normalizedWorkspaceRoot), getSystemPath(projectRoot), getSystemPath(normalizedSourceRoot), - 'bit-angular-v15', // projectName + 'bit-angular-v15-env', // projectName normalizedOptions, (wco: BrowserWebpackConfigOptions) => [ setup === WebpackSetup.Serve ? getDevServerConfig(wco) : {}, @@ -214,7 +215,7 @@ async function getWebpackConfig( delete webpackConfig?.resolve?.modules; webpackConfig.stats = 'errors-only'; // uniqueName should not be an empty string - webpackConfig.output.uniqueName = 'angular-v15'; + webpackConfig.output.uniqueName = 'angular-v15-env'; if (setup === WebpackSetup.Serve) { webpackConfig = migrateConfiguration(webpackConfig); @@ -238,7 +239,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp let overwriteConfig: WebpackConfigWithDevServer; if (opts.setup === WebpackSetup.Serve) { - overwriteConfig = await webpack5ServeConfigFactory( + overwriteConfig = webpack5ServeConfigFactory( opts.devServerID, opts.workspaceDir, opts.entryFiles, @@ -252,7 +253,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp opts.useNgcc ); } else { - overwriteConfig = await webpack5BuildConfigFactory( + overwriteConfig = webpack5BuildConfigFactory( opts.entryFiles, opts.outputPath, opts.nodeModulesPaths, diff --git a/scopes/versions/angular-v15/webpack/module-rules.config.ts b/angular/envs/angular-v15-env/webpack/module-rules.config.ts similarity index 100% rename from scopes/versions/angular-v15/webpack/module-rules.config.ts rename to angular/envs/angular-v15-env/webpack/module-rules.config.ts diff --git a/scopes/versions/angular-v15/webpack/webpack5.build.config.ts b/angular/envs/angular-v15-env/webpack/webpack5.build.config.ts similarity index 95% rename from scopes/versions/angular-v15/webpack/webpack5.build.config.ts rename to angular/envs/angular-v15-env/webpack/webpack5.build.config.ts index d1791f4a..d263fc6e 100644 --- a/scopes/versions/angular-v15/webpack/webpack5.build.config.ts +++ b/angular/envs/angular-v15-env/webpack/webpack5.build.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@bitdev/angular.dev-services.webpack'; import { fallbacks, fallbacksAliases, fallbacksProvidePluginConfig } from '@teambit/webpack'; import { sep } from 'path'; import webpack from 'webpack'; diff --git a/scopes/versions/angular-v15/webpack/webpack5.serve.config.ts b/angular/envs/angular-v15-env/webpack/webpack5.serve.config.ts similarity index 99% rename from scopes/versions/angular-v15/webpack/webpack5.serve.config.ts rename to angular/envs/angular-v15-env/webpack/webpack5.serve.config.ts index 21f606ae..45d16db6 100644 --- a/scopes/versions/angular-v15/webpack/webpack5.serve.config.ts +++ b/angular/envs/angular-v15-env/webpack/webpack5.serve.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@bitdev/angular.dev-services.webpack'; import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; import { PubsubMain } from '@teambit/pubsub'; import { diff --git a/scopes/versions/angular-v16/angular-v16.bit-env.ts b/angular/envs/angular-v16-env/angular-v16-env.bit-env.ts similarity index 87% rename from scopes/versions/angular-v16/angular-v16.bit-env.ts rename to angular/envs/angular-v16-env/angular-v16-env.bit-env.ts index 5b34d3ae..c61aa190 100644 --- a/scopes/versions/angular-v16/angular-v16.bit-env.ts +++ b/angular/envs/angular-v16-env/angular-v16-env.bit-env.ts @@ -1,5 +1,5 @@ -import { AngularBaseEnv } from '@teambit/angular-base'; -import { AngularEnvOptions } from '@teambit/angular-common'; +import { AngularBaseEnv } from '@bitdev/angular.envs.base-env'; +import { AngularEnvOptions } from '@bitdev/angular.dev-services.common'; import { NativeCompileCache } from '@teambit/toolbox.performance.v8-cache'; import { webpackConfigFactory } from './webpack-config.factory'; @@ -10,7 +10,8 @@ export class AngularV16Env extends AngularBaseEnv { /** * name of the environment. used for friendly mentions across bit. */ - name = 'Angular-v16'; + name = 'angular-v16-env'; + angularVersion = 16; ngEnvOptions: AngularEnvOptions = { diff --git a/angular/envs/angular-v16-env/angular-v16-env.docs.mdx b/angular/envs/angular-v16-env/angular-v16-env.docs.mdx new file mode 100644 index 00000000..e0aac527 --- /dev/null +++ b/angular/envs/angular-v16-env/angular-v16-env.docs.mdx @@ -0,0 +1,85 @@ +--- +description: A Bit development environment for Angular Components +labels: ['angular', 'environment', 'env', 'aspect', 'extension'] +--- + +import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; + + diff --git a/scopes/versions/angular-v16/component.json b/angular/envs/angular-v16-env/component.json similarity index 87% rename from scopes/versions/angular-v16/component.json rename to angular/envs/angular-v16-env/component.json index 4f87b238..b2683272 100644 --- a/scopes/versions/angular-v16/component.json +++ b/angular/envs/angular-v16-env/component.json @@ -1,22 +1,10 @@ { "componentId": { - "name": "versions/angular-v16", - "scope": "teambit.angular" + "name": "envs/angular-v16-env", + "scope": "bitdev.angular" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-v16", - "private": false, - "engines": { - "node": "^16.13.0 || >=18.10.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { @@ -36,6 +24,7 @@ "@angular/elements": "~16.0.3", "@angular/platform-browser": "~16.0.3", "@angular/platform-browser-dynamic": "~16.0.3", + "@jest/globals": "^29.3.1", "@ngtools/webpack": "~16.0.3", "@types/eslint": "^8.40.0", "@types/jest": "^29.5.0", @@ -56,9 +45,9 @@ "postcss-flexbugs-fixes": "5.0.2", "postcss-loader": "7.2.4", "postcss-preset-env": "7.8.2", - "resolve-url-loader": "5.0.0", "remark": "~13.0.0", "remark-loader": "~4.0.0", + "resolve-url-loader": "5.0.0", "sass": "1.62.1", "sass-loader": "13.2.2", "style-loader": "^2.0.0", diff --git a/scopes/versions/angular-v16/env.jsonc b/angular/envs/angular-v16-env/env.jsonc similarity index 100% rename from scopes/versions/angular-v16/env.jsonc rename to angular/envs/angular-v16-env/env.jsonc diff --git a/angular/envs/angular-v16-env/index.ts b/angular/envs/angular-v16-env/index.ts new file mode 100644 index 00000000..7f72c4c7 --- /dev/null +++ b/angular/envs/angular-v16-env/index.ts @@ -0,0 +1,2 @@ +export { AngularV16Env } from './angular-v16-env.bit-env'; +export { default as jestConfig } from './jest/jest.config'; diff --git a/scopes/versions/angular-v16/jest/jest-global-mocks.ts b/angular/envs/angular-v16-env/jest/jest-global-mocks.ts similarity index 100% rename from scopes/versions/angular-v16/jest/jest-global-mocks.ts rename to angular/envs/angular-v16-env/jest/jest-global-mocks.ts diff --git a/scopes/versions/angular-v16/jest/jest.config.ts b/angular/envs/angular-v16-env/jest/jest.config.ts similarity index 100% rename from scopes/versions/angular-v16/jest/jest.config.ts rename to angular/envs/angular-v16-env/jest/jest.config.ts diff --git a/scopes/versions/angular-v16/jest/jest.resolver.ts b/angular/envs/angular-v16-env/jest/jest.resolver.ts similarity index 90% rename from scopes/versions/angular-v16/jest/jest.resolver.ts rename to angular/envs/angular-v16-env/jest/jest.resolver.ts index 26f06e80..7b076012 100644 --- a/scopes/versions/angular-v16/jest/jest.resolver.ts +++ b/angular/envs/angular-v16-env/jest/jest.resolver.ts @@ -23,7 +23,9 @@ module.exports = (path: string, options: any) => { ]); if (pkgNamesToTarget.has(pkg.name)) { + // eslint-disable-next-line no-param-reassign delete pkg.exports; + // eslint-disable-next-line no-param-reassign delete pkg.module; } diff --git a/scopes/versions/angular-v16/jest/tsconfig.spec.json b/angular/envs/angular-v16-env/jest/tsconfig.spec.json similarity index 100% rename from scopes/versions/angular-v16/jest/tsconfig.spec.json rename to angular/envs/angular-v16-env/jest/tsconfig.spec.json diff --git a/scopes/versions/angular-v16/webpack-config.factory.ts b/angular/envs/angular-v16-env/webpack-config.factory.ts similarity index 96% rename from scopes/versions/angular-v16/webpack-config.factory.ts rename to angular/envs/angular-v16-env/webpack-config.factory.ts index 268401ab..87eb9dca 100644 --- a/scopes/versions/angular-v16/webpack-config.factory.ts +++ b/angular/envs/angular-v16-env/webpack-config.factory.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; import { OutputHashing } from '@angular-devkit/build-angular'; import { @@ -26,7 +27,7 @@ import { WebpackConfigFactoryOpts, WebpackServeConfigFactoryOpts, WebpackSetup -} from '@teambit/angular-webpack'; +} from '@bitdev/angular.dev-services.webpack'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { Logger } from '@teambit/logger'; import { @@ -163,7 +164,7 @@ async function getWebpackConfig( getSystemPath(normalizedWorkspaceRoot), getSystemPath(projectRoot), getSystemPath(normalizedSourceRoot), - 'bit-angular-v16', // projectName + 'bit-angular-v16-env', // projectName normalizedOptions, (wco: BrowserWebpackConfigOptions) => [ setup === WebpackSetup.Serve ? getDevServerConfig(wco) : {}, @@ -213,7 +214,7 @@ async function getWebpackConfig( delete webpackConfig?.resolve?.modules; webpackConfig.stats = 'errors-only'; // uniqueName should not be an empty string - webpackConfig.output.uniqueName = 'angular-v16'; + webpackConfig.output.uniqueName = 'angular-v16-env'; if (setup === WebpackSetup.Serve) { webpackConfig = migrateConfiguration(webpackConfig); @@ -237,7 +238,7 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp let overwriteConfig: WebpackConfigWithDevServer; if (opts.setup === WebpackSetup.Serve) { - overwriteConfig = await webpack5ServeConfigFactory( + overwriteConfig = webpack5ServeConfigFactory( opts.devServerID, opts.workspaceDir, opts.entryFiles, @@ -248,17 +249,17 @@ export async function webpackConfigFactory(opts: WebpackConfigFactoryOpts & Webp opts.tempFolder, opts.plugins, opts.isApp, - false + opts.useNgcc ); } else { - overwriteConfig = await webpack5BuildConfigFactory( + overwriteConfig = webpack5BuildConfigFactory( opts.entryFiles, opts.outputPath, opts.nodeModulesPaths, opts.workspaceDir, opts.tempFolder, opts.plugins, - false + opts.useNgcc ) as WebpackConfigWithDevServer; } diff --git a/scopes/versions/angular-v16/webpack/module-rules.config.ts b/angular/envs/angular-v16-env/webpack/module-rules.config.ts similarity index 100% rename from scopes/versions/angular-v16/webpack/module-rules.config.ts rename to angular/envs/angular-v16-env/webpack/module-rules.config.ts diff --git a/scopes/versions/angular-v16/webpack/webpack5.build.config.ts b/angular/envs/angular-v16-env/webpack/webpack5.build.config.ts similarity index 93% rename from scopes/versions/angular-v16/webpack/webpack5.build.config.ts rename to angular/envs/angular-v16-env/webpack/webpack5.build.config.ts index f119a6dd..d263fc6e 100644 --- a/scopes/versions/angular-v16/webpack/webpack5.build.config.ts +++ b/angular/envs/angular-v16-env/webpack/webpack5.build.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, WebpackConfig } from '@bitdev/angular.dev-services.webpack'; import { fallbacks, fallbacksAliases, fallbacksProvidePluginConfig } from '@teambit/webpack'; import { sep } from 'path'; import webpack from 'webpack'; @@ -49,7 +49,7 @@ export function webpack5BuildConfigFactory( }, plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, false), + new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, useNgcc), new webpack.ProvidePlugin(fallbacksProvidePluginConfig), ...plugins ], diff --git a/scopes/versions/angular-v16/webpack/webpack5.serve.config.ts b/angular/envs/angular-v16-env/webpack/webpack5.serve.config.ts similarity index 98% rename from scopes/versions/angular-v16/webpack/webpack5.serve.config.ts rename to angular/envs/angular-v16-env/webpack/webpack5.serve.config.ts index a496a5b2..45d16db6 100644 --- a/scopes/versions/angular-v16/webpack/webpack5.serve.config.ts +++ b/angular/envs/angular-v16-env/webpack/webpack5.serve.config.ts @@ -1,4 +1,4 @@ -import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@teambit/angular-webpack'; +import { BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@bitdev/angular.dev-services.webpack'; import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; import { PubsubMain } from '@teambit/pubsub'; import { @@ -163,7 +163,7 @@ export function webpack5ServeConfigFactory( }, plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, false), + new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, useNgcc), new ProvidePlugin(fallbacksProvidePluginConfig), new WebpackBitReporterPlugin({ options: { pubsub, devServerID } diff --git a/angular/envs/base-env/.eslintrc.json b/angular/envs/base-env/.eslintrc.json new file mode 100644 index 00000000..6149e572 --- /dev/null +++ b/angular/envs/base-env/.eslintrc.json @@ -0,0 +1,6 @@ +// bit-generated-eslint-config +{ + "extends": [ + "./../../../node_modules/.cache/.eslintrc.bit.8865293c0e0bd0932b8a2aefcc803073814e705f.json" + ] +} \ No newline at end of file diff --git a/scopes/versions/common/angular-base/angular-base.bit-env.ts b/angular/envs/base-env/angular-base-env.bit-env.ts similarity index 93% rename from scopes/versions/common/angular-base/angular-base.bit-env.ts rename to angular/envs/base-env/angular-base-env.bit-env.ts index 662dfd40..ebd7c323 100644 --- a/scopes/versions/common/angular-base/angular-base.bit-env.ts +++ b/angular/envs/base-env/angular-base-env.bit-env.ts @@ -1,13 +1,13 @@ -import { AngularAppType, NG_APP_NAME } from '@teambit/angular-apps'; -import { AngularEnvOptions, BrowserOptions, DevServerOptions } from '@teambit/angular-common'; -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; +import { AngularAppType, NG_APP_NAME } from '@bitdev/angular.app-types.angular-app-type'; +import { AngularEnvOptions, BrowserOptions, DevServerOptions } from '@bitdev/angular.dev-services.common'; +import { AngularPreview, BundlerProvider, DevServerProvider } from '@bitdev/angular.dev-services.preview.preview'; import { AngularStarter, DesignSystemStarter, MaterialDesignSystemStarter -} from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; -import { NgWebpackBundler, NgWebpackDevServer } from '@teambit/angular-webpack'; +} from '@bitdev/angular.templates.starters'; +import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@bitdev/angular.templates.generators'; +import { NgWebpackBundler, NgWebpackDevServer } from '@bitdev/angular.dev-services.webpack'; import { AppTypeList } from '@teambit/application'; import { Pipeline } from '@teambit/builder'; import { Bundler, BundlerContext, DevServer, DevServerContext } from '@teambit/bundler'; @@ -19,7 +19,7 @@ import { AsyncEnvHandler, EnvHandler } from '@teambit/envs'; import { Formatter } from '@teambit/formatter'; import { StarterList, TemplateList } from '@teambit/generator'; import { Linter } from '@teambit/linter'; -import { NgMultiCompiler, NgMultiCompilerTask } from '@teambit/ng-multi-compiler'; +import { NgMultiCompiler, NgMultiCompilerTask } from '@bitdev/angular.dev-services.compiler.multi-compiler'; import { PackageGenerator } from '@teambit/pkg'; import { Preview } from '@teambit/preview'; import { SchemaExtractor } from '@teambit/schema'; @@ -39,11 +39,14 @@ import hostDependencies from './preview/host-dependencies'; */ export abstract class AngularBaseEnv implements AngularEnvInterface { icon = 'https://static.bit.dev/extensions-icons/angular.svg'; + private ngMultiCompiler: EnvHandler | undefined; /** Abstract functions & properties specific to the adapter * */ abstract ngEnvOptions: AngularEnvOptions; + abstract name: string; + abstract readonly angularVersion: number; [key: string]: any; @@ -97,7 +100,7 @@ export abstract class AngularBaseEnv implements AngularEnvInterface { getLinterConfig(): any { return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), eslint: ESLintLib, configPath: require.resolve('./config/eslintrc'), // resolve all plugins from the angular environment. diff --git a/scopes/angular/angular.composition.tsx b/angular/envs/base-env/angular-base-env.composition.tsx similarity index 58% rename from scopes/angular/angular.composition.tsx rename to angular/envs/base-env/angular-base-env.composition.tsx index 1ec854a2..4e53b738 100644 --- a/scopes/angular/angular.composition.tsx +++ b/angular/envs/base-env/angular-base-env.composition.tsx @@ -2,9 +2,6 @@ import React from 'react'; export const Logo = () => (
- + Angular
); diff --git a/scopes/versions/common/angular-base/angular-base.docs.md b/angular/envs/base-env/angular-base-env.docs.md similarity index 75% rename from scopes/versions/common/angular-base/angular-base.docs.md rename to angular/envs/base-env/angular-base-env.docs.md index 48962887..0dfee382 100644 --- a/scopes/versions/common/angular-base/angular-base.docs.md +++ b/angular/envs/base-env/angular-base-env.docs.md @@ -4,4 +4,4 @@ labels: ['angular', 'aspect', 'extension'] --- **Do not use this directly.** If you want to add Angular support to your workspace, install the development environment for a specific Angular version. -For example: [@teambit.angular/angular](https://bit.cloud/teambit/angular/angular). +For example: [@bitdev.angular/angular-env](https://bit.cloud/bitdev/angular/angular-env). diff --git a/scopes/versions/common/angular-base/angular-env.interface.ts b/angular/envs/base-env/angular-env.interface.ts similarity index 100% rename from scopes/versions/common/angular-base/angular-env.interface.ts rename to angular/envs/base-env/angular-env.interface.ts diff --git a/scopes/versions/common/angular-base/component.json b/angular/envs/base-env/component.json similarity index 81% rename from scopes/versions/common/angular-base/component.json rename to angular/envs/base-env/component.json index ead10a33..191ea87e 100644 --- a/scopes/versions/common/angular-base/component.json +++ b/angular/envs/base-env/component.json @@ -1,22 +1,10 @@ { "componentId": { - "scope": "teambit.angular", - "name": "versions/common/angular-base" + "scope": "bitdev.angular", + "name": "envs/base-env" }, "propagate": true, "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-base", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { @@ -30,6 +18,7 @@ "@babel/plugin-transform-class-properties": "7.22.5", "@babel/preset-env": "7.22.15", "@babel/preset-typescript": "7.22.15", + "@babel/runtime": "^7.12.18", "@types/dompurify": "^2.2.2", "@types/enhanced-resolve": "~3.0.7", "@types/node": "^12.11.1", @@ -63,11 +52,9 @@ "webpack": ">= 4.44.2", "webpack-dev-server": ">= 3.11.2", "zone.js": ">= 0.9.1" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" } } - } + }, + "teambit.node/node@1.0.16": {} } } diff --git a/angular/envs/base-env/config/eslintrc.js b/angular/envs/base-env/config/eslintrc.js new file mode 100644 index 00000000..1ce1f0b9 --- /dev/null +++ b/angular/envs/base-env/config/eslintrc.js @@ -0,0 +1,7 @@ +// force bit to recognize this as dependency +require('@bitdev/angular.dev-services.linter.eslint'); + +module.exports = { + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], + rules: {} +}; diff --git a/scopes/versions/common/angular-base/config/prettier.config.js b/angular/envs/base-env/config/prettier.config.js similarity index 100% rename from scopes/versions/common/angular-base/config/prettier.config.js rename to angular/envs/base-env/config/prettier.config.js diff --git a/scopes/versions/common/angular-base/config/tsconfig.json b/angular/envs/base-env/config/tsconfig.json similarity index 100% rename from scopes/versions/common/angular-base/config/tsconfig.json rename to angular/envs/base-env/config/tsconfig.json diff --git a/scopes/versions/common/angular-base/index.ts b/angular/envs/base-env/index.ts similarity index 50% rename from scopes/versions/common/angular-base/index.ts rename to angular/envs/base-env/index.ts index 9e2e30b2..6ac7d2de 100644 --- a/scopes/versions/common/angular-base/index.ts +++ b/angular/envs/base-env/index.ts @@ -1,4 +1,4 @@ -export { AngularBaseEnv } from './angular-base.bit-env'; -export { NgccProcessor } from '@teambit/ngcc'; +export { AngularBaseEnv } from './angular-base-env.bit-env'; +export { NgccProcessor } from '@bitdev/angular.dev-services.ngcc'; export { AngularEnvInterface } from './angular-env.interface'; export { default as prettierConfig } from './config/prettier.config'; diff --git a/scopes/forks/angular-env-default/preview/host-dependencies.ts b/angular/envs/base-env/preview/host-dependencies.ts similarity index 62% rename from scopes/forks/angular-env-default/preview/host-dependencies.ts rename to angular/envs/base-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/scopes/forks/angular-env-default/preview/host-dependencies.ts +++ b/angular/envs/base-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/scopes/forks/angular-env-v16/preview/mounter.ts b/angular/envs/base-env/preview/mounter.ts similarity index 86% rename from scopes/forks/angular-env-v16/preview/mounter.ts rename to angular/envs/base-env/preview/mounter.ts index 5ec70032..2d648776 100644 --- a/scopes/forks/angular-env-v16/preview/mounter.ts +++ b/angular/envs/base-env/preview/mounter.ts @@ -1,5 +1,5 @@ -/* eslint-disable import/no-unresolved */ -import { createMounter } from '@teambit/angular-mounter'; +import { createMounter } from '@bitdev/angular.dev-services.preview.mounter'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Component, ViewEncapsulation } from '@angular/core'; /** diff --git a/angular/envs/base-env/tsconfig.json b/angular/envs/base-env/tsconfig.json new file mode 100644 index 00000000..66725289 --- /dev/null +++ b/angular/envs/base-env/tsconfig.json @@ -0,0 +1,5 @@ +// bit-generated-typescript-config + +{ + "extends": "./../../../node_modules/.cache/tsconfig.bit.d3d4e4a560ca9ced8c4fb46e8e65bb230e5e21ef.json" +} \ No newline at end of file diff --git a/angular/envs/tsconfig.json b/angular/envs/tsconfig.json new file mode 100644 index 00000000..687db92f --- /dev/null +++ b/angular/envs/tsconfig.json @@ -0,0 +1,5 @@ +// bit-generated-typescript-config + +{ + "extends": "./../../node_modules/.cache/tsconfig.bit.f3b87b1c18fb9e87952d48c4888ed71964a4999d.json" +} \ No newline at end of file diff --git a/angular/examples/.eslintrc.json b/angular/examples/.eslintrc.json new file mode 100644 index 00000000..1e74992d --- /dev/null +++ b/angular/examples/.eslintrc.json @@ -0,0 +1,6 @@ +// bit-generated-eslint-config +{ + "extends": [ + "./../../node_modules/.cache/.eslintrc.bit.27fd94347a9113ba5e391c8f8c9355f1307b4854.json" + ] +} \ No newline at end of file diff --git a/scopes/forks/angular-env-v16/component.json b/angular/examples/my-angular-env/component.json similarity index 68% rename from scopes/forks/angular-env-v16/component.json rename to angular/examples/my-angular-env/component.json index 76e5a31a..493ca05b 100644 --- a/scopes/forks/angular-env-v16/component.json +++ b/angular/examples/my-angular-env/component.json @@ -1,13 +1,14 @@ { "componentId": { - "name": "forks/angular-env-v16" + "name": "examples/my-angular-env", + "scope": "bitdev.angular" }, "propagate": true, "extensions": { "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { - "@teambit/angular-eslint-config": ">= 2.0.1", + "@bitdev/angular.dev-services.linter.eslint": ">= 1.0.0", "@types/jest": "^29.5.0", "jest": "^29.5.0", "jest-preset-angular": "~13.1.0" diff --git a/scopes/forks/angular-env-default/config/eslintrc.js b/angular/examples/my-angular-env/config/eslintrc.js similarity index 56% rename from scopes/forks/angular-env-default/config/eslintrc.js rename to angular/examples/my-angular-env/config/eslintrc.js index 1a96ec4b..68b9519b 100644 --- a/scopes/forks/angular-env-default/config/eslintrc.js +++ b/angular/examples/my-angular-env/config/eslintrc.js @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/eslint/eslint-config */ module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], rules: {}, }; diff --git a/scopes/forks/angular-env-v12/config/jest.config.ts b/angular/examples/my-angular-env/config/jest.config.ts similarity index 62% rename from scopes/forks/angular-env-v12/config/jest.config.ts rename to angular/examples/my-angular-env/config/jest.config.ts index cecbbb3c..59aa1238 100644 --- a/scopes/forks/angular-env-v12/config/jest.config.ts +++ b/angular/examples/my-angular-env/config/jest.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -import { jestConfig } from '@teambit/angular-v12'; +import { jestConfig } from '@bitdev/angular.angular-env'; export default { ...jestConfig, diff --git a/scopes/forks/angular-env-v13/config/prettier.config.ts b/angular/examples/my-angular-env/config/prettier.config.ts similarity index 61% rename from scopes/forks/angular-env-v13/config/prettier.config.ts rename to angular/examples/my-angular-env/config/prettier.config.ts index ca7924c7..81493b26 100644 --- a/scopes/forks/angular-env-v13/config/prettier.config.ts +++ b/angular/examples/my-angular-env/config/prettier.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@teambit/angular-base'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env'); module.exports = { ...prettierConfig, diff --git a/scopes/forks/angular-env-v12/config/tsconfig.json b/angular/examples/my-angular-env/config/tsconfig.json similarity index 62% rename from scopes/forks/angular-env-v12/config/tsconfig.json rename to angular/examples/my-angular-env/config/tsconfig.json index 1c59cbbe..e32c1f2e 100644 --- a/scopes/forks/angular-env-v12/config/tsconfig.json +++ b/angular/examples/my-angular-env/config/tsconfig.json @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/typescript/typescript-config */ { - "extends": "@teambit/angular-base/config/tsconfig.json", + "extends": "@bitdev/angular.envs.base-env/config/tsconfig.json", "include": ["**/*", "**/*.json"] } diff --git a/scopes/forks/angular-env-default/env.jsonc b/angular/examples/my-angular-env/env.jsonc similarity index 100% rename from scopes/forks/angular-env-default/env.jsonc rename to angular/examples/my-angular-env/env.jsonc diff --git a/scopes/forks/angular-env-default/index.ts b/angular/examples/my-angular-env/index.ts similarity index 100% rename from scopes/forks/angular-env-default/index.ts rename to angular/examples/my-angular-env/index.ts diff --git a/scopes/forks/angular-env-default/my-angular-env.bit-env.ts b/angular/examples/my-angular-env/my-angular-env.bit-env.ts similarity index 86% rename from scopes/forks/angular-env-default/my-angular-env.bit-env.ts rename to angular/examples/my-angular-env/my-angular-env.bit-env.ts index 2853afad..b8ae516f 100644 --- a/scopes/forks/angular-env-default/my-angular-env.bit-env.ts +++ b/angular/examples/my-angular-env/my-angular-env.bit-env.ts @@ -1,7 +1,15 @@ -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; -import { AngularStarter } from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; -import { AngularEnv } from '@teambit/angular'; +import { AngularEnv } from '@bitdev/angular.angular-env'; +import { + AngularPreview, + BundlerProvider, + DevServerProvider +} from '@bitdev/angular.dev-services.preview.preview'; +import { AngularStarter } from '@bitdev/angular.templates.starters'; +import { + NgAppTemplate, + NgEnvTemplate, + NgModuleTemplate +} from '@bitdev/angular.templates.generators'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; import { JestTask, JestTester } from '@teambit/defender.jest-tester'; @@ -16,7 +24,7 @@ import hostDependencies from './preview/host-dependencies'; export class MyAngularEnv extends AngularEnv { // Name of the environment, used for friendly mentions across bit - name = 'my-angular-env'; + name = 'my-my-angular-env'; getTesterConfig() { return { @@ -38,7 +46,7 @@ export class MyAngularEnv extends AngularEnv { getLinterConfig() { return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), eslint: ESLintLib, configPath: require.resolve('./config/eslintrc'), // resolve all plugins from the angular environment. @@ -95,7 +103,7 @@ export class MyAngularEnv extends AngularEnv { * Pipelines are optimized for performance and consistency, making sure every component is * independently built and tested. * This is a set of processes to be performed before a component is snapped, during its build phase - * @see https://bit.dev/docs/angular-env-default-default/build-pipelines + * @see https://bit.dev/docs/my-angular-env/build-pipelines */ override build() { return super.build().replace([ @@ -106,7 +114,7 @@ export class MyAngularEnv extends AngularEnv { /** * Defines the component generators (templates) available with the command `bit templates`. - * @see https://bit.dev/docs/angular-env-default-default/component-generators + * @see https://bit.dev/docs/my-angular-env/component-generators */ override generators(): EnvHandler { const envName = this.constructor.name; @@ -119,7 +127,7 @@ export class MyAngularEnv extends AngularEnv { /** * Defines the Angular workspace starters available with the command `bit new`. - * @see https://bit.dev/docs/angular-env-default-default/workspace-starters + * @see https://bit.dev/docs/my-angular-env/workspace-starters */ override starters(): EnvHandler { return StarterList.from([ diff --git a/scopes/forks/angular-env-default/my-angular-env.docs.mdx b/angular/examples/my-angular-env/my-angular-env.docs.mdx similarity index 70% rename from scopes/forks/angular-env-default/my-angular-env.docs.mdx rename to angular/examples/my-angular-env/my-angular-env.docs.mdx index d4e00b02..11a07a90 100644 --- a/scopes/forks/angular-env-default/my-angular-env.docs.mdx +++ b/angular/examples/my-angular-env/my-angular-env.docs.mdx @@ -12,7 +12,7 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; icon: 'https://static.bit.dev/brands/logo-angular.svg', background: '#0d47a1' }} - envId='teambit.angular/angular' + envId='bitdev.angular/my-angular-env' docsLink='https://bit.dev/docs/angular-introduction' isExtension tools={{ @@ -20,19 +20,19 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; { name: 'Jest', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/angular-v16/~code/jest/jest.config.ts', + 'https://bit.cloud/bitdev/angular/envs/angular-v16/~code/jest/jest.config.ts', ], }, { name: 'ESLint', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/eslintrc.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/eslintrc.js', ], }, { name: 'Prettier', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/prettier.config.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/prettier.config.js', ], }, ], @@ -46,13 +46,13 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; { name: 'ESLint', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/eslintrc.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/eslintrc.js', ], }, { name: 'Jest', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/angular-v16/~code/jest/jest.config.ts', + 'https://bit.cloud/bitdev/angular/envs/angular-v16/~code/jest/jest.config.ts', ], }, ], @@ -61,8 +61,8 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; name: 'Component Preview', toolLink: 'https://bit.cloud/teambit/angular/dev-services/preview/mounter', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/preview/mounter.ts', - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/preview/host-dependencies.ts', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/preview/mounter.ts', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/preview/host-dependencies.ts', ], }, { diff --git a/scopes/forks/angular-env-v12/preview/host-dependencies.ts b/angular/examples/my-angular-env/preview/host-dependencies.ts similarity index 62% rename from scopes/forks/angular-env-v12/preview/host-dependencies.ts rename to angular/examples/my-angular-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/scopes/forks/angular-env-v12/preview/host-dependencies.ts +++ b/angular/examples/my-angular-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/examples/my-angular-env/preview/mounter.ts b/angular/examples/my-angular-env/preview/mounter.ts new file mode 100644 index 00000000..89494dfe --- /dev/null +++ b/angular/examples/my-angular-env/preview/mounter.ts @@ -0,0 +1,27 @@ +/* eslint-disable import/no-unresolved */ +import { createMounter } from '@bitdev/angular.dev-services.preview.mounter'; +import { Component, ViewEncapsulation } from '@angular/core'; + +/** + * Provide your component compositions (preview) with the context they need to run. + * for example, a router, a theme, a data provider, etc. + * components added here as providers should be listed as host-dependencies in your host-dependencies.ts file. + * @see https://bit.dev/docs/my-angular-env/components-preview#compositions-providers + */ +@Component({ + selector: 'bit-wrapper', + standalone: true, + imports: [], + encapsulation: ViewEncapsulation.None, + template: ` + + `, +}) export class WrapperComponent {} + + +/** + * the entry for the app (preview runtime) that renders your component previews. + * use the default template or create your own. + * @see https://bit.dev/docs/my-angular-env/components-preview#compositions-mounter + */ +export default createMounter(WrapperComponent); diff --git a/scopes/forks/angular-env-v12/component.json b/angular/examples/my-angular-v12-env/component.json similarity index 67% rename from scopes/forks/angular-env-v12/component.json rename to angular/examples/my-angular-v12-env/component.json index 79e4b673..c6e19cfb 100644 --- a/scopes/forks/angular-env-v12/component.json +++ b/angular/examples/my-angular-v12-env/component.json @@ -1,13 +1,14 @@ { "componentId": { - "name": "forks/angular-env-v12" + "name": "examples/my-angular-v12-env", + "scope": "bitdev.angular" }, "propagate": true, "extensions": { "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { - "@teambit/angular-eslint-config": ">= 2.0.1", + "@bitdev/angular.dev-services.linter.eslint": ">= 1.0.0", "@types/jest": "~27.0.1", "jest": "~27.0.4", "jest-preset-angular": "~10.0.1" diff --git a/scopes/forks/angular-env-v13/config/eslintrc.js b/angular/examples/my-angular-v12-env/config/eslintrc.js similarity index 56% rename from scopes/forks/angular-env-v13/config/eslintrc.js rename to angular/examples/my-angular-v12-env/config/eslintrc.js index 1a96ec4b..68b9519b 100644 --- a/scopes/forks/angular-env-v13/config/eslintrc.js +++ b/angular/examples/my-angular-v12-env/config/eslintrc.js @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/eslint/eslint-config */ module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], rules: {}, }; diff --git a/scopes/forks/angular-env-default/config/jest.config.ts b/angular/examples/my-angular-v12-env/config/jest.config.ts similarity index 59% rename from scopes/forks/angular-env-default/config/jest.config.ts rename to angular/examples/my-angular-v12-env/config/jest.config.ts index 2a4755d6..ffc766e5 100644 --- a/scopes/forks/angular-env-default/config/jest.config.ts +++ b/angular/examples/my-angular-v12-env/config/jest.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -import { jestConfig } from '@teambit/angular'; +import { jestConfig } from '@bitdev/angular.envs.angular-v12-env'; export default { ...jestConfig, diff --git a/scopes/forks/angular-env-v12/config/prettier.config.ts b/angular/examples/my-angular-v12-env/config/prettier.config.ts similarity index 61% rename from scopes/forks/angular-env-v12/config/prettier.config.ts rename to angular/examples/my-angular-v12-env/config/prettier.config.ts index ca7924c7..81493b26 100644 --- a/scopes/forks/angular-env-v12/config/prettier.config.ts +++ b/angular/examples/my-angular-v12-env/config/prettier.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@teambit/angular-base'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env'); module.exports = { ...prettierConfig, diff --git a/scopes/forks/angular-env-v13/config/tsconfig.json b/angular/examples/my-angular-v12-env/config/tsconfig.json similarity index 62% rename from scopes/forks/angular-env-v13/config/tsconfig.json rename to angular/examples/my-angular-v12-env/config/tsconfig.json index 1c59cbbe..e32c1f2e 100644 --- a/scopes/forks/angular-env-v13/config/tsconfig.json +++ b/angular/examples/my-angular-v12-env/config/tsconfig.json @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/typescript/typescript-config */ { - "extends": "@teambit/angular-base/config/tsconfig.json", + "extends": "@bitdev/angular.envs.base-env/config/tsconfig.json", "include": ["**/*", "**/*.json"] } diff --git a/scopes/forks/angular-env-v12/env.jsonc b/angular/examples/my-angular-v12-env/env.jsonc similarity index 100% rename from scopes/forks/angular-env-v12/env.jsonc rename to angular/examples/my-angular-v12-env/env.jsonc diff --git a/angular/examples/my-angular-v12-env/index.ts b/angular/examples/my-angular-v12-env/index.ts new file mode 100644 index 00000000..22d064b3 --- /dev/null +++ b/angular/examples/my-angular-v12-env/index.ts @@ -0,0 +1 @@ +export { MyAngularV12Env, MyAngularV12Env as default } from './my-angular-v12-env.bit-env'; diff --git a/scopes/forks/angular-env-v14/my-angular-env.bit-env.ts b/angular/examples/my-angular-v12-env/my-angular-v12-env.bit-env.ts similarity index 87% rename from scopes/forks/angular-env-v14/my-angular-env.bit-env.ts rename to angular/examples/my-angular-v12-env/my-angular-v12-env.bit-env.ts index 34d3a2a4..ece0461d 100644 --- a/scopes/forks/angular-env-v14/my-angular-env.bit-env.ts +++ b/angular/examples/my-angular-v12-env/my-angular-v12-env.bit-env.ts @@ -1,7 +1,15 @@ -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; -import { AngularStarter } from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; -import { AngularV14Env } from '@teambit/angular-v14'; +import { + AngularPreview, + BundlerProvider, + DevServerProvider +} from '@bitdev/angular.dev-services.preview.preview'; +import { AngularV12Env } from '@bitdev/angular.envs.angular-v12-env'; +import { AngularStarter } from '@bitdev/angular.templates.starters'; +import { + NgAppTemplate, + NgEnvTemplate, + NgModuleTemplate +} from '@bitdev/angular.templates.generators'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; import { JestTask, JestTester } from '@teambit/defender.jest-tester'; @@ -14,9 +22,9 @@ import { Tester } from '@teambit/tester'; import { ESLint as ESLintLib } from 'eslint'; import hostDependencies from './preview/host-dependencies'; -export class MyAngularEnv extends AngularV14Env { +export class MyAngularV12Env extends AngularV12Env { // Name of the environment, used for friendly mentions across bit - name = 'my-angular-env'; + name = 'my-angular-v12-env'; getTesterConfig() { return { @@ -38,7 +46,7 @@ export class MyAngularEnv extends AngularV14Env { getLinterConfig() { return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), eslint: ESLintLib, configPath: require.resolve('./config/eslintrc'), // resolve all plugins from the angular environment. @@ -128,4 +136,4 @@ export class MyAngularEnv extends AngularV14Env { } } -export default new MyAngularEnv(); +export default new MyAngularV12Env(); diff --git a/scopes/forks/angular-env-v13/my-angular-env.docs.mdx b/angular/examples/my-angular-v12-env/my-angular-v12-env.docs.mdx similarity index 55% rename from scopes/forks/angular-env-v13/my-angular-env.docs.mdx rename to angular/examples/my-angular-v12-env/my-angular-v12-env.docs.mdx index 209d17be..de1cccc3 100644 --- a/scopes/forks/angular-env-v13/my-angular-env.docs.mdx +++ b/angular/examples/my-angular-v12-env/my-angular-v12-env.docs.mdx @@ -8,11 +8,11 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; = 2.0.1", + "@bitdev/angular.dev-services.linter.eslint": ">= 1.0.0", "@types/jest": "^27.0.3", "jest": "^27.4.4", "jest-preset-angular": "~11.0.1" diff --git a/scopes/forks/angular-env-v14/config/eslintrc.js b/angular/examples/my-angular-v13-env/config/eslintrc.js similarity index 56% rename from scopes/forks/angular-env-v14/config/eslintrc.js rename to angular/examples/my-angular-v13-env/config/eslintrc.js index 1a96ec4b..68b9519b 100644 --- a/scopes/forks/angular-env-v14/config/eslintrc.js +++ b/angular/examples/my-angular-v13-env/config/eslintrc.js @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/eslint/eslint-config */ module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], rules: {}, }; diff --git a/scopes/forks/angular-env-v13/config/jest.config.ts b/angular/examples/my-angular-v13-env/config/jest.config.ts similarity index 59% rename from scopes/forks/angular-env-v13/config/jest.config.ts rename to angular/examples/my-angular-v13-env/config/jest.config.ts index 99a8b8e0..7bd86529 100644 --- a/scopes/forks/angular-env-v13/config/jest.config.ts +++ b/angular/examples/my-angular-v13-env/config/jest.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -import { jestConfig } from '@teambit/angular-v13'; +import { jestConfig } from '@bitdev/angular.envs.angular-v13-env'; export default { ...jestConfig, diff --git a/scopes/forks/angular-env-default/config/prettier.config.ts b/angular/examples/my-angular-v13-env/config/prettier.config.ts similarity index 61% rename from scopes/forks/angular-env-default/config/prettier.config.ts rename to angular/examples/my-angular-v13-env/config/prettier.config.ts index ca7924c7..81493b26 100644 --- a/scopes/forks/angular-env-default/config/prettier.config.ts +++ b/angular/examples/my-angular-v13-env/config/prettier.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@teambit/angular-base'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env'); module.exports = { ...prettierConfig, diff --git a/scopes/forks/angular-env-v14/config/tsconfig.json b/angular/examples/my-angular-v13-env/config/tsconfig.json similarity index 62% rename from scopes/forks/angular-env-v14/config/tsconfig.json rename to angular/examples/my-angular-v13-env/config/tsconfig.json index 1c59cbbe..e32c1f2e 100644 --- a/scopes/forks/angular-env-v14/config/tsconfig.json +++ b/angular/examples/my-angular-v13-env/config/tsconfig.json @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/typescript/typescript-config */ { - "extends": "@teambit/angular-base/config/tsconfig.json", + "extends": "@bitdev/angular.envs.base-env/config/tsconfig.json", "include": ["**/*", "**/*.json"] } diff --git a/scopes/forks/angular-env-v13/env.jsonc b/angular/examples/my-angular-v13-env/env.jsonc similarity index 100% rename from scopes/forks/angular-env-v13/env.jsonc rename to angular/examples/my-angular-v13-env/env.jsonc diff --git a/angular/examples/my-angular-v13-env/index.ts b/angular/examples/my-angular-v13-env/index.ts new file mode 100644 index 00000000..46cbb66d --- /dev/null +++ b/angular/examples/my-angular-v13-env/index.ts @@ -0,0 +1 @@ +export { MyAngularV13Env, MyAngularV13Env as default } from './my-angular-v13-env.bit-env'; diff --git a/scopes/forks/angular-env-v15/my-angular-env.bit-env.ts b/angular/examples/my-angular-v13-env/my-angular-v13-env.bit-env.ts similarity index 87% rename from scopes/forks/angular-env-v15/my-angular-env.bit-env.ts rename to angular/examples/my-angular-v13-env/my-angular-v13-env.bit-env.ts index 8551b15a..077df967 100644 --- a/scopes/forks/angular-env-v15/my-angular-env.bit-env.ts +++ b/angular/examples/my-angular-v13-env/my-angular-v13-env.bit-env.ts @@ -1,7 +1,15 @@ -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; -import { AngularStarter } from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; -import { AngularV15Env } from '@teambit/angular-v15'; +import { + AngularPreview, + BundlerProvider, + DevServerProvider +} from '@bitdev/angular.dev-services.preview.preview'; +import { AngularV13Env } from '@bitdev/angular.envs.angular-v13-env'; +import { AngularStarter } from '@bitdev/angular.templates.starters'; +import { + NgAppTemplate, + NgEnvTemplate, + NgModuleTemplate +} from '@bitdev/angular.templates.generators'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; import { JestTask, JestTester } from '@teambit/defender.jest-tester'; @@ -14,9 +22,9 @@ import { Tester } from '@teambit/tester'; import { ESLint as ESLintLib } from 'eslint'; import hostDependencies from './preview/host-dependencies'; -export class MyAngularEnv extends AngularV15Env { +export class MyAngularV13Env extends AngularV13Env { // Name of the environment, used for friendly mentions across bit - name = 'my-angular-env'; + name = 'my-angular-v13-env'; getTesterConfig() { return { @@ -38,7 +46,7 @@ export class MyAngularEnv extends AngularV15Env { getLinterConfig() { return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), eslint: ESLintLib, configPath: require.resolve('./config/eslintrc'), // resolve all plugins from the angular environment. @@ -128,4 +136,4 @@ export class MyAngularEnv extends AngularV15Env { } } -export default new MyAngularEnv(); +export default new MyAngularV13Env(); diff --git a/scopes/forks/angular-env-v12/my-angular-env.docs.mdx b/angular/examples/my-angular-v13-env/my-angular-v13-env.docs.mdx similarity index 55% rename from scopes/forks/angular-env-v12/my-angular-env.docs.mdx rename to angular/examples/my-angular-v13-env/my-angular-v13-env.docs.mdx index 9505f2f6..9204ff5e 100644 --- a/scopes/forks/angular-env-v12/my-angular-env.docs.mdx +++ b/angular/examples/my-angular-v13-env/my-angular-v13-env.docs.mdx @@ -8,11 +8,11 @@ import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; = 1.0.0", "@types/jest": "^28.0.0", "jest": "^28.0.0", "jest-preset-angular": "~12.1.0" diff --git a/scopes/forks/angular-env-v12/config/eslintrc.js b/angular/examples/my-angular-v14-env/config/eslintrc.js similarity index 56% rename from scopes/forks/angular-env-v12/config/eslintrc.js rename to angular/examples/my-angular-v14-env/config/eslintrc.js index 1a96ec4b..68b9519b 100644 --- a/scopes/forks/angular-env-v12/config/eslintrc.js +++ b/angular/examples/my-angular-v14-env/config/eslintrc.js @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/eslint/eslint-config */ module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], rules: {}, }; diff --git a/scopes/forks/angular-env-v14/config/jest.config.ts b/angular/examples/my-angular-v14-env/config/jest.config.ts similarity index 59% rename from scopes/forks/angular-env-v14/config/jest.config.ts rename to angular/examples/my-angular-v14-env/config/jest.config.ts index 8016f7ed..4894be09 100644 --- a/scopes/forks/angular-env-v14/config/jest.config.ts +++ b/angular/examples/my-angular-v14-env/config/jest.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/jest/jest-config */ -import { jestConfig } from '@teambit/angular-v14'; +import { jestConfig } from '@bitdev/angular.envs.angular-v14-env'; export default { ...jestConfig, diff --git a/scopes/forks/angular-env-v14/config/prettier.config.ts b/angular/examples/my-angular-v14-env/config/prettier.config.ts similarity index 61% rename from scopes/forks/angular-env-v14/config/prettier.config.ts rename to angular/examples/my-angular-v14-env/config/prettier.config.ts index ca7924c7..81493b26 100644 --- a/scopes/forks/angular-env-v14/config/prettier.config.ts +++ b/angular/examples/my-angular-v14-env/config/prettier.config.ts @@ -1,7 +1,7 @@ /** * @see https://bit.dev/reference/prettier/prettier-config */ -const { prettierConfig } = require('@teambit/angular-base'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env'); module.exports = { ...prettierConfig, diff --git a/scopes/forks/angular-env-default/config/tsconfig.json b/angular/examples/my-angular-v14-env/config/tsconfig.json similarity index 62% rename from scopes/forks/angular-env-default/config/tsconfig.json rename to angular/examples/my-angular-v14-env/config/tsconfig.json index 1c59cbbe..e32c1f2e 100644 --- a/scopes/forks/angular-env-default/config/tsconfig.json +++ b/angular/examples/my-angular-v14-env/config/tsconfig.json @@ -2,6 +2,6 @@ * @see https://bit.dev/reference/typescript/typescript-config */ { - "extends": "@teambit/angular-base/config/tsconfig.json", + "extends": "@bitdev/angular.envs.base-env/config/tsconfig.json", "include": ["**/*", "**/*.json"] } diff --git a/scopes/forks/angular-env-v14/env.jsonc b/angular/examples/my-angular-v14-env/env.jsonc similarity index 100% rename from scopes/forks/angular-env-v14/env.jsonc rename to angular/examples/my-angular-v14-env/env.jsonc diff --git a/angular/examples/my-angular-v14-env/index.ts b/angular/examples/my-angular-v14-env/index.ts new file mode 100644 index 00000000..e63cab08 --- /dev/null +++ b/angular/examples/my-angular-v14-env/index.ts @@ -0,0 +1 @@ +export { MyAngularV14Env, MyAngularV14Env as default } from './my-angular-v14-env.bit-env'; diff --git a/scopes/forks/angular-env-v13/my-angular-env.bit-env.ts b/angular/examples/my-angular-v14-env/my-angular-v14-env.bit-env.ts similarity index 87% rename from scopes/forks/angular-env-v13/my-angular-env.bit-env.ts rename to angular/examples/my-angular-v14-env/my-angular-v14-env.bit-env.ts index aafe1333..c1fdd699 100644 --- a/scopes/forks/angular-env-v13/my-angular-env.bit-env.ts +++ b/angular/examples/my-angular-v14-env/my-angular-v14-env.bit-env.ts @@ -1,7 +1,15 @@ -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; -import { AngularStarter } from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; -import { AngularV13Env } from '@teambit/angular-v13'; +import { + AngularPreview, + BundlerProvider, + DevServerProvider +} from '@bitdev/angular.dev-services.preview.preview'; +import { AngularV14Env } from '@bitdev/angular.envs.angular-v14-env'; +import { AngularStarter } from '@bitdev/angular.templates.starters'; +import { + NgAppTemplate, + NgEnvTemplate, + NgModuleTemplate +} from '@bitdev/angular.templates.generators'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; import { JestTask, JestTester } from '@teambit/defender.jest-tester'; @@ -14,9 +22,9 @@ import { Tester } from '@teambit/tester'; import { ESLint as ESLintLib } from 'eslint'; import hostDependencies from './preview/host-dependencies'; -export class MyAngularEnv extends AngularV13Env { +export class MyAngularV14Env extends AngularV14Env { // Name of the environment, used for friendly mentions across bit - name = 'my-angular-env'; + name = 'my-angular-v14-env'; getTesterConfig() { return { @@ -38,7 +46,7 @@ export class MyAngularEnv extends AngularV13Env { getLinterConfig() { return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), eslint: ESLintLib, configPath: require.resolve('./config/eslintrc'), // resolve all plugins from the angular environment. @@ -128,4 +136,4 @@ export class MyAngularEnv extends AngularV13Env { } } -export default new MyAngularEnv(); +export default new MyAngularV14Env(); diff --git a/angular/examples/my-angular-v14-env/my-angular-v14-env.docs.mdx b/angular/examples/my-angular-v14-env/my-angular-v14-env.docs.mdx new file mode 100644 index 00000000..e882db64 --- /dev/null +++ b/angular/examples/my-angular-v14-env/my-angular-v14-env.docs.mdx @@ -0,0 +1,86 @@ +--- +description: A Bit development environment for Angular Components +labels: ['angular', 'environment', 'env', 'aspect', 'extension'] +--- + +import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; + + diff --git a/angular/examples/my-angular-v14-env/preview/host-dependencies.ts b/angular/examples/my-angular-v14-env/preview/host-dependencies.ts new file mode 100644 index 00000000..6f6a9bb7 --- /dev/null +++ b/angular/examples/my-angular-v14-env/preview/host-dependencies.ts @@ -0,0 +1,11 @@ +/** + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. + * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. + */ +export default [ + '@teambit/mdx.ui.mdx-scope-context', + '@mdx-js/react', + 'react', + 'react-dom', +]; diff --git a/scopes/forks/angular-env-v14/preview/mounter.ts b/angular/examples/my-angular-v14-env/preview/mounter.ts similarity index 92% rename from scopes/forks/angular-env-v14/preview/mounter.ts rename to angular/examples/my-angular-v14-env/preview/mounter.ts index 5ec70032..46e6d70b 100644 --- a/scopes/forks/angular-env-v14/preview/mounter.ts +++ b/angular/examples/my-angular-v14-env/preview/mounter.ts @@ -1,5 +1,5 @@ /* eslint-disable import/no-unresolved */ -import { createMounter } from '@teambit/angular-mounter'; +import { createMounter } from '@bitdev/angular.dev-services.preview.mounter'; import { Component, ViewEncapsulation } from '@angular/core'; /** diff --git a/scopes/forks/angular-env-v15/component.json b/angular/examples/my-angular-v15-env/component.json similarity index 70% rename from scopes/forks/angular-env-v15/component.json rename to angular/examples/my-angular-v15-env/component.json index 70c46fd6..5b58ab04 100644 --- a/scopes/forks/angular-env-v15/component.json +++ b/angular/examples/my-angular-v15-env/component.json @@ -1,6 +1,7 @@ { "componentId": { - "name": "forks/angular-env-v15" + "name": "examples/my-angular-v15-env", + "scope": "bitdev.angular" }, "propagate": true, "extensions": { @@ -8,7 +9,7 @@ "policy": { "dependencies": { "@jest/globals": "^29.3.1", - "@teambit/angular-eslint-config": ">= 2.0.1", + "@bitdev/angular.dev-services.linter.eslint": ">= 1.0.0", "@types/jest": "^29.2.4", "jest": "^29.3.1", "jest-preset-angular": "~12.2.3" diff --git a/angular/examples/my-angular-v15-env/config/eslintrc.js b/angular/examples/my-angular-v15-env/config/eslintrc.js new file mode 100644 index 00000000..68b9519b --- /dev/null +++ b/angular/examples/my-angular-v15-env/config/eslintrc.js @@ -0,0 +1,7 @@ +/** + * @see https://bit.dev/reference/eslint/eslint-config + */ +module.exports = { + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], + rules: {}, +}; diff --git a/angular/examples/my-angular-v15-env/config/jest.config.ts b/angular/examples/my-angular-v15-env/config/jest.config.ts new file mode 100644 index 00000000..70fbe294 --- /dev/null +++ b/angular/examples/my-angular-v15-env/config/jest.config.ts @@ -0,0 +1,8 @@ +/** + * @see https://bit.dev/reference/jest/jest-config + */ +import { jestConfig } from '@bitdev/angular.envs.angular-v15-env'; + +export default { + ...jestConfig, +}; diff --git a/angular/examples/my-angular-v15-env/config/prettier.config.ts b/angular/examples/my-angular-v15-env/config/prettier.config.ts new file mode 100644 index 00000000..81493b26 --- /dev/null +++ b/angular/examples/my-angular-v15-env/config/prettier.config.ts @@ -0,0 +1,8 @@ +/** + * @see https://bit.dev/reference/prettier/prettier-config + */ +const { prettierConfig } = require('@bitdev/angular.envs.base-env'); + +module.exports = { + ...prettierConfig, +}; diff --git a/angular/examples/my-angular-v15-env/config/tsconfig.json b/angular/examples/my-angular-v15-env/config/tsconfig.json new file mode 100644 index 00000000..e32c1f2e --- /dev/null +++ b/angular/examples/my-angular-v15-env/config/tsconfig.json @@ -0,0 +1,7 @@ +/** + * @see https://bit.dev/reference/typescript/typescript-config + */ +{ + "extends": "@bitdev/angular.envs.base-env/config/tsconfig.json", + "include": ["**/*", "**/*.json"] +} diff --git a/scopes/forks/angular-env-v15/env.jsonc b/angular/examples/my-angular-v15-env/env.jsonc similarity index 100% rename from scopes/forks/angular-env-v15/env.jsonc rename to angular/examples/my-angular-v15-env/env.jsonc diff --git a/angular/examples/my-angular-v15-env/index.ts b/angular/examples/my-angular-v15-env/index.ts new file mode 100644 index 00000000..ed9e4240 --- /dev/null +++ b/angular/examples/my-angular-v15-env/index.ts @@ -0,0 +1 @@ +export { MyAngularV15Env, MyAngularV15Env as default } from './my-angular-v15-env.bit-env'; 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 new file mode 100644 index 00000000..2b73f8af --- /dev/null +++ b/angular/examples/my-angular-v15-env/my-angular-v15-env.bit-env.ts @@ -0,0 +1,139 @@ +import { + AngularPreview, + BundlerProvider, + DevServerProvider +} from '@bitdev/angular.dev-services.preview.preview'; +import { AngularV15Env } from '@bitdev/angular.envs.angular-v15-env'; +import { AngularStarter } from '@bitdev/angular.templates.starters'; +import { + NgAppTemplate, + NgEnvTemplate, + NgModuleTemplate +} from '@bitdev/angular.templates.generators'; +import { BundlerContext, DevServerContext } from '@teambit/bundler'; +import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; +import { JestTask, JestTester } from '@teambit/defender.jest-tester'; +import { PrettierFormatter } from '@teambit/defender.prettier-formatter'; +import { EnvHandler } from '@teambit/envs'; +import { StarterList, TemplateList } from '@teambit/generator'; +import { Linter } from '@teambit/linter'; +import { Preview } from '@teambit/preview'; +import { Tester } from '@teambit/tester'; +import { ESLint as ESLintLib } from 'eslint'; +import hostDependencies from './preview/host-dependencies'; + +export class MyAngularV15Env extends AngularV15Env { + // Name of the environment, used for friendly mentions across bit + name = 'my-angular-v15-env'; + + getTesterConfig() { + return { + jest: require.resolve('jest'), + config: require.resolve('./config/jest.config') + }; + } + + /** + * Returns a tester to use during development + * Required for `bit start` & `bit test` + */ + override tester(): EnvHandler { + /** + * @see https://bit.dev/reference/jest/using-jest + * */ + return JestTester.from(this.getTesterConfig()); + } + + getLinterConfig() { + return { + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), + eslint: ESLintLib, + configPath: require.resolve('./config/eslintrc'), + // resolve all plugins from the angular environment. + pluginsPath: __dirname, + extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] + }; + } + + /** + * The linter to use during development. + * Config files would be used to validate coding standards in components. + * bit will write the minimum required files in any workspace to optimize + * for dev experience. + */ + override linter(): EnvHandler { + return ESLintLinter.from(this.getLinterConfig()); + } + + /** + * The formatter to use during development + * (source files are not formatted as part of the components' build) + * */ + override formatter() { + /** + * @see https://bit.dev/reference/prettier/using-prettier + * */ + return PrettierFormatter.from({ + configPath: require.resolve('./config/prettier.config') + }); + } + + /** + * Generates the component previews during development and build + */ + override preview(): EnvHandler { + const ngEnvOptions = this.getNgEnvOptions(); + /** + * To customize the dev server or bundler behavior, you can change webpack transformers, angular + * options and webpack options in the getDevServer and getBundler methods. + */ + const devServerProvider: DevServerProvider = (devServerContext: DevServerContext) => this.getDevServer(devServerContext, ngEnvOptions); + const bundlerProvider: BundlerProvider = (bundlerContext: BundlerContext) => this.getBundler(bundlerContext, ngEnvOptions); + return AngularPreview.from({ + devServerProvider, + bundlerProvider, + ngEnvOptions, + hostDependencies, + mounterPath: require.resolve('./preview/mounter'), + }); + } + + /** + * Defines the build pipeline for a component. + * Pipelines are optimized for performance and consistency, making sure every component is + * independently built and tested. + * This is a set of processes to be performed before a component is snapped, during its build phase + * @see https://bit.dev/docs/angular-env/build-pipelines + */ + override build() { + return super.build().replace([ + EslintTask.from(this.getLinterConfig()), + JestTask.from(this.getTesterConfig()), + ]); + } + + /** + * Defines the component generators (templates) available with the command `bit templates`. + * @see https://bit.dev/docs/angular-env/component-generators + */ + override generators(): EnvHandler { + const envName = this.constructor.name; + return TemplateList.from([ + NgModuleTemplate.from({envName, angularVersion: this.angularVersion}), + NgEnvTemplate.from({envName, angularVersion: this.angularVersion}), + NgAppTemplate.from({envName, angularVersion: this.angularVersion}) + ]); + } + + /** + * Defines the Angular workspace starters available with the command `bit new`. + * @see https://bit.dev/docs/angular-env/workspace-starters + */ + override starters(): EnvHandler { + return StarterList.from([ + AngularStarter.from({envName: this.constructor.name, angularVersion: this.angularVersion}) + ]); + } +} + +export default new MyAngularV15Env(); diff --git a/angular/examples/my-angular-v15-env/my-angular-v15-env.docs.mdx b/angular/examples/my-angular-v15-env/my-angular-v15-env.docs.mdx new file mode 100644 index 00000000..233df226 --- /dev/null +++ b/angular/examples/my-angular-v15-env/my-angular-v15-env.docs.mdx @@ -0,0 +1,86 @@ +--- +description: A Bit development environment for Angular Components +labels: ['angular', 'environment', 'env', 'aspect', 'extension'] +--- + +import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; + + diff --git a/angular/examples/my-angular-v15-env/preview/host-dependencies.ts b/angular/examples/my-angular-v15-env/preview/host-dependencies.ts new file mode 100644 index 00000000..6f6a9bb7 --- /dev/null +++ b/angular/examples/my-angular-v15-env/preview/host-dependencies.ts @@ -0,0 +1,11 @@ +/** + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. + * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. + */ +export default [ + '@teambit/mdx.ui.mdx-scope-context', + '@mdx-js/react', + 'react', + 'react-dom', +]; diff --git a/scopes/versions/common/angular-base/preview/mounter.ts b/angular/examples/my-angular-v15-env/preview/mounter.ts similarity index 92% rename from scopes/versions/common/angular-base/preview/mounter.ts rename to angular/examples/my-angular-v15-env/preview/mounter.ts index 5ec70032..46e6d70b 100644 --- a/scopes/versions/common/angular-base/preview/mounter.ts +++ b/angular/examples/my-angular-v15-env/preview/mounter.ts @@ -1,5 +1,5 @@ /* eslint-disable import/no-unresolved */ -import { createMounter } from '@teambit/angular-mounter'; +import { createMounter } from '@bitdev/angular.dev-services.preview.mounter'; import { Component, ViewEncapsulation } from '@angular/core'; /** diff --git a/angular/examples/my-angular-v16-env/component.json b/angular/examples/my-angular-v16-env/component.json new file mode 100644 index 00000000..da877220 --- /dev/null +++ b/angular/examples/my-angular-v16-env/component.json @@ -0,0 +1,19 @@ +{ + "componentId": { + "name": "examples/my-angular-v16-env", + "scope": "bitdev.angular" + }, + "propagate": true, + "extensions": { + "teambit.dependencies/dependency-resolver": { + "policy": { + "dependencies": { + "@bitdev/angular.dev-services.linter.eslint": ">= 1.0.0", + "@types/jest": "^29.5.0", + "jest": "^29.5.0", + "jest-preset-angular": "~13.1.0" + } + } + } + } +} diff --git a/angular/examples/my-angular-v16-env/config/eslintrc.js b/angular/examples/my-angular-v16-env/config/eslintrc.js new file mode 100644 index 00000000..68b9519b --- /dev/null +++ b/angular/examples/my-angular-v16-env/config/eslintrc.js @@ -0,0 +1,7 @@ +/** + * @see https://bit.dev/reference/eslint/eslint-config + */ +module.exports = { + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], + rules: {}, +}; diff --git a/angular/examples/my-angular-v16-env/config/jest.config.ts b/angular/examples/my-angular-v16-env/config/jest.config.ts new file mode 100644 index 00000000..a2feec97 --- /dev/null +++ b/angular/examples/my-angular-v16-env/config/jest.config.ts @@ -0,0 +1,8 @@ +/** + * @see https://bit.dev/reference/jest/jest-config + */ +import { jestConfig } from '@bitdev/angular.envs.angular-v16-env'; + +export default { + ...jestConfig, +}; diff --git a/angular/examples/my-angular-v16-env/config/prettier.config.ts b/angular/examples/my-angular-v16-env/config/prettier.config.ts new file mode 100644 index 00000000..81493b26 --- /dev/null +++ b/angular/examples/my-angular-v16-env/config/prettier.config.ts @@ -0,0 +1,8 @@ +/** + * @see https://bit.dev/reference/prettier/prettier-config + */ +const { prettierConfig } = require('@bitdev/angular.envs.base-env'); + +module.exports = { + ...prettierConfig, +}; diff --git a/angular/examples/my-angular-v16-env/config/tsconfig.json b/angular/examples/my-angular-v16-env/config/tsconfig.json new file mode 100644 index 00000000..e32c1f2e --- /dev/null +++ b/angular/examples/my-angular-v16-env/config/tsconfig.json @@ -0,0 +1,7 @@ +/** + * @see https://bit.dev/reference/typescript/typescript-config + */ +{ + "extends": "@bitdev/angular.envs.base-env/config/tsconfig.json", + "include": ["**/*", "**/*.json"] +} diff --git a/scopes/forks/angular-env-v16/env.jsonc b/angular/examples/my-angular-v16-env/env.jsonc similarity index 100% rename from scopes/forks/angular-env-v16/env.jsonc rename to angular/examples/my-angular-v16-env/env.jsonc diff --git a/angular/examples/my-angular-v16-env/index.ts b/angular/examples/my-angular-v16-env/index.ts new file mode 100644 index 00000000..8c2decef --- /dev/null +++ b/angular/examples/my-angular-v16-env/index.ts @@ -0,0 +1 @@ +export { MyAngularV16Env, MyAngularV16Env as default } from './my-angular-v16-env.bit-env'; diff --git a/scopes/forks/angular-env-v12/my-angular-env.bit-env.ts b/angular/examples/my-angular-v16-env/my-angular-v16-env.bit-env.ts similarity index 90% rename from scopes/forks/angular-env-v12/my-angular-env.bit-env.ts rename to angular/examples/my-angular-v16-env/my-angular-v16-env.bit-env.ts index cb1a6656..4e2602ac 100644 --- a/scopes/forks/angular-env-v12/my-angular-env.bit-env.ts +++ b/angular/examples/my-angular-v16-env/my-angular-v16-env.bit-env.ts @@ -1,7 +1,7 @@ -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; -import { AngularStarter } from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; -import { AngularV12Env } from '@teambit/angular-v12'; +import { AngularPreview, BundlerProvider, DevServerProvider } from '@bitdev/angular.dev-services.preview.preview'; +import { AngularStarter } from '@bitdev/angular.templates.starters'; +import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@bitdev/angular.templates.generators'; +import { AngularV16Env } from '@bitdev/angular.envs.angular-v16-env'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; import { JestTask, JestTester } from '@teambit/defender.jest-tester'; @@ -14,9 +14,9 @@ import { Tester } from '@teambit/tester'; import { ESLint as ESLintLib } from 'eslint'; import hostDependencies from './preview/host-dependencies'; -export class MyAngularEnv extends AngularV12Env { +export class MyAngularV16Env extends AngularV16Env { // Name of the environment, used for friendly mentions across bit - name = 'my-angular-env'; + name = 'my-angular-v16-env'; getTesterConfig() { return { @@ -38,7 +38,7 @@ export class MyAngularEnv extends AngularV12Env { getLinterConfig() { return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), eslint: ESLintLib, configPath: require.resolve('./config/eslintrc'), // resolve all plugins from the angular environment. @@ -128,4 +128,4 @@ export class MyAngularEnv extends AngularV12Env { } } -export default new MyAngularEnv(); +export default new MyAngularV16Env(); diff --git a/angular/examples/my-angular-v16-env/my-angular-v16-env.docs.mdx b/angular/examples/my-angular-v16-env/my-angular-v16-env.docs.mdx new file mode 100644 index 00000000..58b36a0a --- /dev/null +++ b/angular/examples/my-angular-v16-env/my-angular-v16-env.docs.mdx @@ -0,0 +1,86 @@ +--- +description: A Bit development environment for Angular Components +labels: ['angular', 'environment', 'env', 'aspect', 'extension'] +--- + +import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; + + diff --git a/angular/examples/my-angular-v16-env/preview/host-dependencies.ts b/angular/examples/my-angular-v16-env/preview/host-dependencies.ts new file mode 100644 index 00000000..6f6a9bb7 --- /dev/null +++ b/angular/examples/my-angular-v16-env/preview/host-dependencies.ts @@ -0,0 +1,11 @@ +/** + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. + * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. + */ +export default [ + '@teambit/mdx.ui.mdx-scope-context', + '@mdx-js/react', + 'react', + 'react-dom', +]; diff --git a/scopes/forks/angular-env-v15/preview/mounter.ts b/angular/examples/my-angular-v16-env/preview/mounter.ts similarity index 92% rename from scopes/forks/angular-env-v15/preview/mounter.ts rename to angular/examples/my-angular-v16-env/preview/mounter.ts index 5ec70032..46e6d70b 100644 --- a/scopes/forks/angular-env-v15/preview/mounter.ts +++ b/angular/examples/my-angular-v16-env/preview/mounter.ts @@ -1,5 +1,5 @@ /* eslint-disable import/no-unresolved */ -import { createMounter } from '@teambit/angular-mounter'; +import { createMounter } from '@bitdev/angular.dev-services.preview.mounter'; import { Component, ViewEncapsulation } from '@angular/core'; /** diff --git a/angular/examples/tsconfig.json b/angular/examples/tsconfig.json new file mode 100644 index 00000000..687db92f --- /dev/null +++ b/angular/examples/tsconfig.json @@ -0,0 +1,5 @@ +// bit-generated-typescript-config + +{ + "extends": "./../../node_modules/.cache/tsconfig.bit.f3b87b1c18fb9e87952d48c4888ed71964a4999d.json" +} \ No newline at end of file diff --git a/angular/readme/index.ts b/angular/readme/index.ts new file mode 100644 index 00000000..736e7d08 --- /dev/null +++ b/angular/readme/index.ts @@ -0,0 +1 @@ +export { default as readme, default } from './readme.mdx'; diff --git a/angular/readme/readme.composition.tsx b/angular/readme/readme.composition.tsx new file mode 100644 index 00000000..80bbc842 --- /dev/null +++ b/angular/readme/readme.composition.tsx @@ -0,0 +1,4 @@ +import React from 'react'; +import Readme from './index'; + +export const PreviewMDX = () => diff --git a/angular/readme/readme.docs.mdx b/angular/readme/readme.docs.mdx new file mode 100644 index 00000000..f9fc4429 --- /dev/null +++ b/angular/readme/readme.docs.mdx @@ -0,0 +1,4 @@ +--- +description: 'An MDX component.' +labels: ['content', 'mdx'] +--- diff --git a/angular/readme/readme.mdx b/angular/readme/readme.mdx new file mode 100644 index 00000000..c1b12969 --- /dev/null +++ b/angular/readme/readme.mdx @@ -0,0 +1,51 @@ +# Bit Angular + +This scope contains the different components used to support the Angular framework. +You can get more information about Bit & Angular in [the Bit Angular documentation](https://bit.dev/docs/angular-introduction). + + +## Getting started +Run the following command to create a new workspace that contains a custom Angular env component: +``` +bit new angular my-workspace --aspect bitdev.angular/angular-env +``` + +You can list all available templates with the following command: +``` +bit templates +``` + +Generate a component using the ng-module template with the bit create command: +``` +bit create ng-module ui/my-button +``` + +Run the following commands to create and set up an application using the ng-app template: +``` +bit create ng-app apps/my-angular-app +bit use apps/my-angular-app +``` + + +## Structure +- `app-types`: adds support for Angular applications +- `dev-services`: the different tools used by the Angular envs such as the compilers, linter, preview, etc... +- `docs`: the components used by the [the Bit Angular documentation](https://bit.dev/docs/angular-introduction) +- `envs`: the Angular environments for each major version of the framework that we support +- `examples`: the components used by the templates +- `templates`: the templates for the starters and generators +- `angular-env`: the default Angular environment. It uses the latest version of the framework + + +## Features +The following dev services are supported by default: +- Jest +- ESLint +- Prettier +- Webpack dev server & bundler +- Ng-packagr for libraries +- Angular elements + + +## License +MIT diff --git a/scopes/generators/angular-templates/index.ts b/angular/templates/generators/index.ts similarity index 100% rename from scopes/generators/angular-templates/index.ts rename to angular/templates/generators/index.ts diff --git a/scopes/generators/angular-templates/ng-app/index.ts b/angular/templates/generators/ng-app/index.ts similarity index 83% rename from scopes/generators/angular-templates/ng-app/index.ts rename to angular/templates/generators/ng-app/index.ts index 7b9d670e..92412991 100644 --- a/scopes/generators/angular-templates/ng-app/index.ts +++ b/angular/templates/generators/ng-app/index.ts @@ -1,4 +1,4 @@ -import { AngularComponentTemplateOptions } from '@teambit/angular-common'; +import { AngularComponentTemplateOptions } from '@bitdev/angular.dev-services.common'; import { ComponentContext, ComponentTemplate } from '@teambit/generator'; import { indexFile } from './template-files'; import { docsFile } from './template-files/docs'; @@ -31,17 +31,17 @@ export class NgAppTemplate implements ComponentTemplate { ngAppFile(context), tsconfigFile(), indexHtmlFile(context), - mainNgAppFile(context), - polyfillFile(context), - stylesFile(context), - appComponentHtmlFile(context), - appComponentScssFile(context), + mainNgAppFile(), + polyfillFile(), + stylesFile(), + appComponentHtmlFile(), + appComponentScssFile(), appComponentSpecFile(context), appComponentFile(context), - appModuleFile(context), - gitKeepFile(context), - environmentProdFile(context), - environmentFile(context), + appModuleFile(), + gitKeepFile(), + environmentProdFile(), + environmentFile(), ]; } diff --git a/scopes/generators/angular-templates/ng-app/template-files/docs.ts b/angular/templates/generators/ng-app/template-files/docs.ts similarity index 100% rename from scopes/generators/angular-templates/ng-app/template-files/docs.ts rename to angular/templates/generators/ng-app/template-files/docs.ts diff --git a/scopes/generators/angular-templates/ng-app/template-files/index.ts b/angular/templates/generators/ng-app/template-files/index.ts similarity index 100% rename from scopes/generators/angular-templates/ng-app/template-files/index.ts rename to angular/templates/generators/ng-app/template-files/index.ts diff --git a/scopes/generators/angular-templates/ng-app/template-files/ng-app.ts b/angular/templates/generators/ng-app/template-files/ng-app.ts similarity index 84% rename from scopes/generators/angular-templates/ng-app/template-files/ng-app.ts rename to angular/templates/generators/ng-app/template-files/ng-app.ts index 2f12a2e0..c2290e1e 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/ng-app.ts +++ b/angular/templates/generators/ng-app/template-files/ng-app.ts @@ -4,8 +4,8 @@ export const ngAppFile = (context: ComponentContext): ComponentFile => { const { name, namePascalCase: Name } = context; return { relativePath: `${name}.ng-app.ts`, - content: `import { AngularAppOptions } from '@teambit/angular-apps'; -import { BrowserOptions, DevServerOptions } from '@teambit/angular-common'; + content: `import { AngularAppOptions } from '@bitdev/angular.app-types.angular-app-type'; +import { BrowserOptions, DevServerOptions } from '@bitdev/angular.dev-services.common'; const angularOptions: BrowserOptions & DevServerOptions = { main: './src/main.ts', diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-html.ts b/angular/templates/generators/ng-app/template-files/src/app/app.component-html.ts similarity index 99% rename from scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-html.ts rename to angular/templates/generators/ng-app/template-files/src/app/app.component-html.ts index e62ebcdd..886e47fb 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-html.ts +++ b/angular/templates/generators/ng-app/template-files/src/app/app.component-html.ts @@ -1,6 +1,6 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; +import { ComponentFile } from '@teambit/generator'; -export const appComponentHtmlFile = (context: ComponentContext): ComponentFile => { +export const appComponentHtmlFile = (): ComponentFile => { return { relativePath: `src/app/app.component.html`, content: ` diff --git a/angular/templates/generators/ng-app/template-files/src/app/app.component-scss.ts b/angular/templates/generators/ng-app/template-files/src/app/app.component-scss.ts new file mode 100644 index 00000000..546258a3 --- /dev/null +++ b/angular/templates/generators/ng-app/template-files/src/app/app.component-scss.ts @@ -0,0 +1,8 @@ +import { ComponentFile } from '@teambit/generator'; + +export const appComponentScssFile = (): ComponentFile => { + return { + relativePath: `src/app/app.component.scss`, + content: ``, + }; +}; diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-spec.ts b/angular/templates/generators/ng-app/template-files/src/app/app.component-spec.ts similarity index 100% rename from scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-spec.ts rename to angular/templates/generators/ng-app/template-files/src/app/app.component-spec.ts diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.component.ts b/angular/templates/generators/ng-app/template-files/src/app/app.component.ts similarity index 100% rename from scopes/generators/angular-templates/ng-app/template-files/src/app/app.component.ts rename to angular/templates/generators/ng-app/template-files/src/app/app.component.ts diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.module.ts b/angular/templates/generators/ng-app/template-files/src/app/app.module.ts similarity index 72% rename from scopes/generators/angular-templates/ng-app/template-files/src/app/app.module.ts rename to angular/templates/generators/ng-app/template-files/src/app/app.module.ts index 855f35a8..1f4e9b05 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.module.ts +++ b/angular/templates/generators/ng-app/template-files/src/app/app.module.ts @@ -1,6 +1,6 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; +import { ComponentFile } from '@teambit/generator'; -export const appModuleFile = (context: ComponentContext): ComponentFile => { +export const appModuleFile = (): ComponentFile => { return { relativePath: `src/app/app.module.ts`, content: `import { NgModule } from '@angular/core'; diff --git a/angular/templates/generators/ng-app/template-files/src/assets/gitkeep.ts b/angular/templates/generators/ng-app/template-files/src/assets/gitkeep.ts new file mode 100644 index 00000000..11d0f695 --- /dev/null +++ b/angular/templates/generators/ng-app/template-files/src/assets/gitkeep.ts @@ -0,0 +1,8 @@ +import { ComponentFile } from '@teambit/generator'; + +export const gitKeepFile = (): ComponentFile => { + return { + relativePath: `src/assets/.gitkeep`, + content: ``, + }; +}; diff --git a/angular/templates/generators/ng-app/template-files/src/environments/environment.prod.ts b/angular/templates/generators/ng-app/template-files/src/environments/environment.prod.ts new file mode 100644 index 00000000..babb7cb8 --- /dev/null +++ b/angular/templates/generators/ng-app/template-files/src/environments/environment.prod.ts @@ -0,0 +1,11 @@ +import { ComponentFile } from '@teambit/generator'; + +export const environmentProdFile = (): ComponentFile => { + return { + relativePath: `src/environments/environment.prod.ts`, + content: `export const environment = { + production: true +}; +`, + }; +}; diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/environments/environment.ts b/angular/templates/generators/ng-app/template-files/src/environments/environment.ts similarity index 83% rename from scopes/generators/angular-templates/ng-app/template-files/src/environments/environment.ts rename to angular/templates/generators/ng-app/template-files/src/environments/environment.ts index 85084639..14bf6fb2 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/src/environments/environment.ts +++ b/angular/templates/generators/ng-app/template-files/src/environments/environment.ts @@ -1,6 +1,6 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; +import { ComponentFile } from '@teambit/generator'; -export const environmentFile = (context: ComponentContext): ComponentFile => { +export const environmentFile = (): ComponentFile => { return { relativePath: `src/environments/environment.ts`, content: `// This file can be replaced during build by using the \`fileReplacements\` array. diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/index-html.ts b/angular/templates/generators/ng-app/template-files/src/index-html.ts similarity index 100% rename from scopes/generators/angular-templates/ng-app/template-files/src/index-html.ts rename to angular/templates/generators/ng-app/template-files/src/index-html.ts diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/main.ts b/angular/templates/generators/ng-app/template-files/src/main.ts similarity index 75% rename from scopes/generators/angular-templates/ng-app/template-files/src/main.ts rename to angular/templates/generators/ng-app/template-files/src/main.ts index 4bff2b85..d09e3435 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/src/main.ts +++ b/angular/templates/generators/ng-app/template-files/src/main.ts @@ -1,6 +1,6 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; +import { ComponentFile } from '@teambit/generator'; -export const mainNgAppFile = (context: ComponentContext): ComponentFile => { +export const mainNgAppFile = (): ComponentFile => { return { relativePath: `src/main.ts`, content: `import { enableProdMode } from '@angular/core'; diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/polyfills.ts b/angular/templates/generators/ng-app/template-files/src/polyfills.ts similarity index 95% rename from scopes/generators/angular-templates/ng-app/template-files/src/polyfills.ts rename to angular/templates/generators/ng-app/template-files/src/polyfills.ts index 19969544..9b44826b 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/src/polyfills.ts +++ b/angular/templates/generators/ng-app/template-files/src/polyfills.ts @@ -1,6 +1,6 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; +import { ComponentFile } from '@teambit/generator'; -export const polyfillFile = (context: ComponentContext): ComponentFile => { +export const polyfillFile = (): ComponentFile => { return { relativePath: `src/polyfills.ts`, content: `/** diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/styles.ts b/angular/templates/generators/ng-app/template-files/src/styles.ts similarity index 51% rename from scopes/generators/angular-templates/ng-app/template-files/src/styles.ts rename to angular/templates/generators/ng-app/template-files/src/styles.ts index 409277a2..7119a19a 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/src/styles.ts +++ b/angular/templates/generators/ng-app/template-files/src/styles.ts @@ -1,6 +1,6 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; +import { ComponentFile } from '@teambit/generator'; -export const stylesFile = (context: ComponentContext): ComponentFile => { +export const stylesFile = (): ComponentFile => { return { relativePath: `src/styles.scss`, content: `/* You can add global styles to this file, and also import other style files */ diff --git a/scopes/generators/angular-templates/ng-app/template-files/tsconfig.app.ts b/angular/templates/generators/ng-app/template-files/tsconfig.app.ts similarity index 97% rename from scopes/generators/angular-templates/ng-app/template-files/tsconfig.app.ts rename to angular/templates/generators/ng-app/template-files/tsconfig.app.ts index ca26e6d0..f0f552ed 100644 --- a/scopes/generators/angular-templates/ng-app/template-files/tsconfig.app.ts +++ b/angular/templates/generators/ng-app/template-files/tsconfig.app.ts @@ -34,7 +34,7 @@ export const tsconfigFile = (): ComponentFile => { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, - "strictTemplates": true, + "strictGenerators": true, "enableIvy": true }, "files": [ diff --git a/scopes/generators/angular-templates/ng-env/files/config/eslintrc.ts b/angular/templates/generators/ng-env/files/config/eslintrc.ts similarity index 73% rename from scopes/generators/angular-templates/ng-env/files/config/eslintrc.ts rename to angular/templates/generators/ng-env/files/config/eslintrc.ts index 04b5b4f2..5b9d1a9c 100644 --- a/scopes/generators/angular-templates/ng-env/files/config/eslintrc.ts +++ b/angular/templates/generators/ng-env/files/config/eslintrc.ts @@ -5,7 +5,7 @@ export const eslintConfigFile = () => { * @see https://bit.dev/reference/eslint/eslint-config */ module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], + extends: [require.resolve('@bitdev/angular.dev-services.linter.eslint')], rules: {}, }; `, diff --git a/scopes/generators/angular-templates/ng-env/files/config/jest.config.ts b/angular/templates/generators/ng-env/files/config/jest.config.ts similarity index 100% rename from scopes/generators/angular-templates/ng-env/files/config/jest.config.ts rename to angular/templates/generators/ng-env/files/config/jest.config.ts diff --git a/scopes/generators/angular-templates/ng-env/files/config/prettier.config.ts b/angular/templates/generators/ng-env/files/config/prettier.config.ts similarity index 77% rename from scopes/generators/angular-templates/ng-env/files/config/prettier.config.ts rename to angular/templates/generators/ng-env/files/config/prettier.config.ts index adc277ec..9f8ef111 100644 --- a/scopes/generators/angular-templates/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('@teambit/angular-base'); +const { prettierConfig } = require('@bitdev/angular.envs.base-env'); module.exports = { ...prettierConfig, diff --git a/scopes/generators/angular-templates/ng-env/files/config/tsconfig.json.ts b/angular/templates/generators/ng-env/files/config/tsconfig.json.ts similarity index 77% rename from scopes/generators/angular-templates/ng-env/files/config/tsconfig.json.ts rename to angular/templates/generators/ng-env/files/config/tsconfig.json.ts index 433a4df4..9cd99ad5 100644 --- a/scopes/generators/angular-templates/ng-env/files/config/tsconfig.json.ts +++ b/angular/templates/generators/ng-env/files/config/tsconfig.json.ts @@ -5,7 +5,7 @@ export const tsConfigFile = () => { * @see https://bit.dev/reference/typescript/typescript-config */ { - "extends": "@teambit/angular-base/config/tsconfig.json", + "extends": "@bitdev/angular.envs.base-env/config/tsconfig.json", "include": ["**/*", "**/*.json"] } `, diff --git a/scopes/generators/angular-templates/ng-env/files/doc.ts b/angular/templates/generators/ng-env/files/doc.ts similarity index 52% rename from scopes/generators/angular-templates/ng-env/files/doc.ts rename to angular/templates/generators/ng-env/files/doc.ts index b0f0edfa..48ac99c0 100644 --- a/scopes/generators/angular-templates/ng-env/files/doc.ts +++ b/angular/templates/generators/ng-env/files/doc.ts @@ -1,6 +1,4 @@ -import { ComponentContext } from '@teambit/generator'; - -export function docFile({ }: ComponentContext, angularVersion: number, envId: string) { +export function docFile(angularVersion: number, envId: string) { // language=Markdown return `--- description: A Bit development environment for Angular Components @@ -24,56 +22,56 @@ tools={{ { name: 'Jest', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/angular-v${angularVersion}/~code/jest/jest.config.ts', + 'https://bit.cloud/bitdev/angular/envs/angular-v${angularVersion}-env/~code/jest/jest.config.ts', ], }, { name: 'ESLint', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/eslintrc.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/eslintrc.js', ], }, { name: 'Prettier', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/prettier.config.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/prettier.config.js', ], }, ], buildPipeline: [ { name: 'Ng-Packagr', - toolLink: 'https://bit.cloud/teambit/angular/dev-services/compiler/ng-packagr', + toolLink: 'https://bit.cloud/bitdev/angular/dev-services/compiler/ng-packagr', configFiles: [ ], }, { name: 'ESLint', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/config/eslintrc.js', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/config/eslintrc.js', ], }, { name: 'Jest', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/angular-v${angularVersion}/~code/jest/jest.config.ts', + 'https://bit.cloud/bitdev/angular/envs/angular-v${angularVersion}/~code/jest/jest.config.ts', ], }, ], previewsAndDocs: [ { name: 'Component Preview', - toolLink: 'https://bit.cloud/teambit/angular/dev-services/preview/mounter', + toolLink: 'https://bit.cloud/bitdev/angular/dev-services/preview/mounter', configFiles: [ - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/preview/mounter.ts', - 'https://bit.cloud/teambit/angular/versions/common/angular-base/~code/preview/host-dependencies.ts', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/preview/mounter.ts', + 'https://bit.cloud/bitdev/angular/envs/base-env/~code/preview/host-dependencies.ts', ], }, { name: 'Component Docs', - toolLink: 'https://bit.cloud/teambit/angular/dev-services/preview/preview', + toolLink: 'https://bit.cloud/bitdev/angular/dev-services/preview/preview', configFiles: [ - 'https://bit.cloud/teambit/angular/dev-services/preview/preview/~code/docs.ts', + 'https://bit.cloud/bitdev/angular/dev-services/preview/preview/~code/docs.ts', ], }, { diff --git a/scopes/generators/angular-templates/ng-env/files/env-jsonc.ts b/angular/templates/generators/ng-env/files/env-jsonc.ts similarity index 69% rename from scopes/generators/angular-templates/ng-env/files/env-jsonc.ts rename to angular/templates/generators/ng-env/files/env-jsonc.ts index 6e13627b..c4935d2a 100644 --- a/scopes/generators/angular-templates/ng-env/files/env-jsonc.ts +++ b/angular/templates/generators/ng-env/files/env-jsonc.ts @@ -2,6 +2,6 @@ import { ComponentContext } from '@teambit/generator'; import { readFileSync } from 'fs-extra'; export const envJsoncFile = (context: ComponentContext, angularVersion: number) => { - const jsoncFile = require.resolve(`@teambit/angular-v${angularVersion}/env.jsonc`); + const jsoncFile = require.resolve(`@bitdev/angular.envs.angular-v${angularVersion}-env/env.jsonc`); return readFileSync(jsoncFile, 'utf-8'); }; diff --git a/scopes/generators/angular-templates/ng-env/files/env.ts b/angular/templates/generators/ng-env/files/env.ts similarity index 92% rename from scopes/generators/angular-templates/ng-env/files/env.ts rename to angular/templates/generators/ng-env/files/env.ts index 905db305..c517c438 100644 --- a/scopes/generators/angular-templates/ng-env/files/env.ts +++ b/angular/templates/generators/ng-env/files/env.ts @@ -7,15 +7,15 @@ import { EnvHandler } from '@teambit/envs'; import { Tester } from '@teambit/tester'; import { Preview } from '@teambit/preview'; import { Linter } from '@teambit/linter'; -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; +import { AngularPreview, BundlerProvider, DevServerProvider } from '@bitdev/angular.dev-services.preview.preview'; import { BundlerContext, DevServerContext } from '@teambit/bundler'; import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; import { JestTask, JestTester } from '@teambit/defender.jest-tester'; import { PrettierFormatter } from '@teambit/defender.prettier-formatter'; import { ESLint as ESLintLib } from 'eslint'; import { StarterList, TemplateList } from '@teambit/generator'; -import { AngularStarter, DesignSystemStarter } from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; +import { AngularStarter, DesignSystemStarter } from '@bitdev/angular.templates.starters'; +import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@bitdev/angular.generators.generators'; import hostDependencies from './preview/host-dependencies'; export class ${Name} extends ${envName} { @@ -42,7 +42,7 @@ export class ${Name} extends ${envName} { getLinterConfig() { return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), + tsconfig: require.resolve('@bitdev/angular.dev-services.linter.eslint/config/tsconfig.json'), eslint: ESLintLib, configPath: require.resolve('./config/eslintrc'), // resolve all plugins from the angular environment. @@ -109,7 +109,7 @@ export class ${Name} extends ${envName} { } /** - * Defines the component generators (templates) available with the command \`bit templates\`. + * Defines the component generators (generators) available with the command \`bit generators\`. * @see https://bit.dev/docs/angular-env/component-generators */ override generators(): EnvHandler { diff --git a/scopes/generators/angular-templates/ng-env/files/index.ts b/angular/templates/generators/ng-env/files/index.ts similarity index 100% rename from scopes/generators/angular-templates/ng-env/files/index.ts rename to angular/templates/generators/ng-env/files/index.ts diff --git a/scopes/generators/angular-templates/ng-env/files/preview/host-dependencies.ts b/angular/templates/generators/ng-env/files/preview/host-dependencies.ts similarity index 72% rename from scopes/generators/angular-templates/ng-env/files/preview/host-dependencies.ts rename to angular/templates/generators/ng-env/files/preview/host-dependencies.ts index eb75176f..bc1b1575 100644 --- a/scopes/generators/angular-templates/ng-env/files/preview/host-dependencies.ts +++ b/angular/templates/generators/ng-env/files/preview/host-dependencies.ts @@ -2,8 +2,9 @@ export const hostDependenciesFile = () => { return { relativePath: './preview/host-dependencies.ts', content: `/** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', diff --git a/scopes/generators/angular-templates/ng-env/files/preview/mounter.ts b/angular/templates/generators/ng-env/files/preview/mounter.ts similarity index 92% rename from scopes/generators/angular-templates/ng-env/files/preview/mounter.ts rename to angular/templates/generators/ng-env/files/preview/mounter.ts index de496ee0..bd735bba 100644 --- a/scopes/generators/angular-templates/ng-env/files/preview/mounter.ts +++ b/angular/templates/generators/ng-env/files/preview/mounter.ts @@ -2,7 +2,7 @@ export const mounterFile = () => { return { relativePath: './preview/mounter.ts', content: `/* eslint-disable import/no-unresolved */ -import { createMounter } from '@teambit/angular-mounter'; +import { createMounter } from '@bitdev/angular.dev-services.preview.mounter'; import { Component, ViewEncapsulation } from '@angular/core'; /** diff --git a/scopes/generators/angular-templates/ng-env/index.ts b/angular/templates/generators/ng-env/index.ts similarity index 79% rename from scopes/generators/angular-templates/ng-env/index.ts rename to angular/templates/generators/ng-env/index.ts index e3f73fa4..512a1d40 100644 --- a/scopes/generators/angular-templates/ng-env/index.ts +++ b/angular/templates/generators/ng-env/index.ts @@ -1,4 +1,4 @@ -import { AngularComponentTemplateOptions, getWorkspace } from '@teambit/angular-common'; +import { AngularComponentTemplateOptions, getWorkspace } from '@bitdev/angular.dev-services.common'; import { ComponentID } from '@teambit/component'; import { EnvContext } from '@teambit/envs'; import { ComponentContext, ComponentTemplate } from '@teambit/generator'; @@ -23,8 +23,9 @@ export class NgEnvTemplate implements ComponentTemplate { readonly description = 'create a customized Angular env with your configs and tools', readonly hidden = false, private pkg: PkgMain, - private workspace: Workspace | undefined, - ) {} + private workspace: Workspace | undefined + ) { + } async generateFiles(context: ComponentContext) { const aspectId: ComponentID = typeof context.aspectId === 'string' ? ComponentID.fromString(context.aspectId) : context.aspectId; @@ -33,41 +34,39 @@ export class NgEnvTemplate implements ComponentTemplate { if (this.workspace) { const envComponent = await this.workspace!.get(aspectId); envPkgName = this.pkg.getPackageName(envComponent); - } else { // mostly for ci / ripple - if(envId === 'teambit.angular/angular') { - envPkgName = '@teambit/angular'; - } else { - envPkgName = `@teambit/angular-v${this.angularVersion}`; - } + } else if (envId === 'bitdev.angular/angular-env') { // mostly for ci / ripple + envPkgName = '@bitdev/angular.angular-env'; + } else { + envPkgName = `@bitdev/angular.envs.angular-v${ this.angularVersion }-env`; } return [ { relativePath: 'index.ts', content: indexFile(context), - isMain: true, + isMain: true }, { relativePath: `env.jsonc`, - content: envJsoncFile(context, this.angularVersion), + content: envJsoncFile(context, this.angularVersion) }, { - relativePath: `${context.name}.docs.mdx`, - content: docFile(context, this.angularVersion, envId), + relativePath: `${ context.name }.docs.mdx`, + content: docFile(this.angularVersion, envId) }, { - relativePath: `${context.name}.bit-env.ts`, - content: envFile(context, this.envName, this.angularVersion, envPkgName), + relativePath: `${ context.name }.bit-env.ts`, + content: envFile(context, this.envName, this.angularVersion, envPkgName) }, eslintConfigFile(), jestConfigFile(this.angularVersion, envPkgName), prettierConfigFile(), tsConfigFile(), mounterFile(), - hostDependenciesFile(), + hostDependenciesFile() ]; } config() { return { 'teambit.envs/envs': { - env: 'teambit.envs/env', + env: 'teambit.envs/env' } }; } @@ -83,8 +82,8 @@ export class NgEnvTemplate implements ComponentTemplate { options.description, options.hidden, pkg, - workspace, + workspace ); - } + }; } } diff --git a/scopes/generators/angular-templates/ng-module/files/component-spec.ts b/angular/templates/generators/ng-module/files/component-spec.ts similarity index 100% rename from scopes/generators/angular-templates/ng-module/files/component-spec.ts rename to angular/templates/generators/ng-module/files/component-spec.ts diff --git a/scopes/generators/angular-templates/ng-module/files/component-styles.ts b/angular/templates/generators/ng-module/files/component-styles.ts similarity index 100% rename from scopes/generators/angular-templates/ng-module/files/component-styles.ts rename to angular/templates/generators/ng-module/files/component-styles.ts diff --git a/scopes/generators/angular-templates/ng-module/files/component.ts b/angular/templates/generators/ng-module/files/component.ts similarity index 100% rename from scopes/generators/angular-templates/ng-module/files/component.ts rename to angular/templates/generators/ng-module/files/component.ts diff --git a/scopes/generators/angular-templates/ng-module/files/composition.ts b/angular/templates/generators/ng-module/files/composition.ts similarity index 100% rename from scopes/generators/angular-templates/ng-module/files/composition.ts rename to angular/templates/generators/ng-module/files/composition.ts diff --git a/scopes/generators/angular-templates/ng-module/files/docs.ts b/angular/templates/generators/ng-module/files/docs.ts similarity index 93% rename from scopes/generators/angular-templates/ng-module/files/docs.ts rename to angular/templates/generators/ng-module/files/docs.ts index 4643a633..03ecfe0d 100644 --- a/scopes/generators/angular-templates/ng-module/files/docs.ts +++ b/angular/templates/generators/ng-module/files/docs.ts @@ -26,7 +26,7 @@ import { ${Name}Module } from './${name}.module'; export class AppModule {} \`\`\` -Use \`${Name}Component\` in your templates: +Use \`${Name}Component\` in your generators: \`\`\`html <${name}> diff --git a/scopes/generators/angular-templates/ng-module/files/module.ts b/angular/templates/generators/ng-module/files/module.ts similarity index 100% rename from scopes/generators/angular-templates/ng-module/files/module.ts rename to angular/templates/generators/ng-module/files/module.ts diff --git a/scopes/generators/angular-templates/ng-module/files/public-api.ts b/angular/templates/generators/ng-module/files/public-api.ts similarity index 100% rename from scopes/generators/angular-templates/ng-module/files/public-api.ts rename to angular/templates/generators/ng-module/files/public-api.ts diff --git a/scopes/generators/angular-templates/ng-module/index.ts b/angular/templates/generators/ng-module/index.ts similarity index 93% rename from scopes/generators/angular-templates/ng-module/index.ts rename to angular/templates/generators/ng-module/index.ts index dd4d27ca..37fda9ec 100644 --- a/scopes/generators/angular-templates/ng-module/index.ts +++ b/angular/templates/generators/ng-module/index.ts @@ -1,5 +1,5 @@ import { ComponentContext, ComponentTemplate } from '@teambit/generator'; -import { AngularComponentTemplateOptions } from '@teambit/angular-common'; +import { AngularComponentTemplateOptions } from '@bitdev/angular.dev-services.common'; import { componentFile } from './files/component'; import { componentSpecFile } from './files/component-spec'; import { componentStylesFile } from './files/component-styles'; diff --git a/scopes/generators/angular-starters/common/git-ignore.ts b/angular/templates/starters/common/git-ignore.ts similarity index 100% rename from scopes/generators/angular-starters/common/git-ignore.ts rename to angular/templates/starters/common/git-ignore.ts diff --git a/scopes/generators/angular-starters/common/launch-json.ts b/angular/templates/starters/common/launch-json.ts similarity index 100% rename from scopes/generators/angular-starters/common/launch-json.ts rename to angular/templates/starters/common/launch-json.ts diff --git a/scopes/generators/angular-starters/common/workspace-config.ts b/angular/templates/starters/common/workspace-config.ts similarity index 100% rename from scopes/generators/angular-starters/common/workspace-config.ts rename to angular/templates/starters/common/workspace-config.ts diff --git a/scopes/generators/angular-starters/constants.ts b/angular/templates/starters/constants.ts similarity index 100% rename from scopes/generators/angular-starters/constants.ts rename to angular/templates/starters/constants.ts diff --git a/scopes/generators/angular-starters/design-system/index.ts b/angular/templates/starters/design-system/index.ts similarity index 96% rename from scopes/generators/angular-starters/design-system/index.ts rename to angular/templates/starters/design-system/index.ts index cc833a81..e373c3e0 100644 --- a/scopes/generators/angular-starters/design-system/index.ts +++ b/angular/templates/starters/design-system/index.ts @@ -1,5 +1,5 @@ import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator'; -import { AngularComponentTemplateOptions } from '@teambit/angular-common'; +import { AngularComponentTemplateOptions } from '@bitdev/angular.dev-services.common'; import { EnvContext, EnvHandler } from '@teambit/envs'; import PkgAspect, { PkgMain } from '@teambit/pkg'; import { launchJson } from '../common/launch-json'; diff --git a/angular/templates/starters/index.ts b/angular/templates/starters/index.ts new file mode 100644 index 00000000..b2777c29 --- /dev/null +++ b/angular/templates/starters/index.ts @@ -0,0 +1,3 @@ +export { AngularStarter } from './ng-workspace'; +export { DesignSystemStarter } from './design-system'; +export { MaterialDesignSystemStarter } from './material-design-system'; diff --git a/scopes/generators/angular-starters/material-design-system/index.ts b/angular/templates/starters/material-design-system/index.ts similarity index 96% rename from scopes/generators/angular-starters/material-design-system/index.ts rename to angular/templates/starters/material-design-system/index.ts index 688c2305..3fa2d0a3 100644 --- a/scopes/generators/angular-starters/material-design-system/index.ts +++ b/angular/templates/starters/material-design-system/index.ts @@ -1,5 +1,5 @@ import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator'; -import { AngularComponentTemplateOptions } from '@teambit/angular-common'; +import { AngularComponentTemplateOptions } from '@bitdev/angular.dev-services.common'; import { EnvContext, EnvHandler } from '@teambit/envs'; import PkgAspect, { PkgMain } from '@teambit/pkg'; import { launchJson } from '../common/launch-json'; diff --git a/scopes/generators/angular-starters/ng-workspace/index.ts b/angular/templates/starters/ng-workspace/index.ts similarity index 83% rename from scopes/generators/angular-starters/ng-workspace/index.ts rename to angular/templates/starters/ng-workspace/index.ts index 7a9108d4..6416d7d5 100644 --- a/scopes/generators/angular-starters/ng-workspace/index.ts +++ b/angular/templates/starters/ng-workspace/index.ts @@ -1,4 +1,4 @@ -import { AngularComponentTemplateOptions } from '@teambit/angular-common'; +import { AngularComponentTemplateOptions } from '@bitdev/angular.dev-services.common'; import { EnvContext, EnvHandler } from '@teambit/envs'; import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator'; import { PkgAspect, PkgMain } from '@teambit/pkg'; @@ -32,15 +32,15 @@ export class AngularStarter implements WorkspaceTemplate { } fork(context?: WorkspaceContext) { - let forkName = `angular-env-v${this.angularVersion}`; + let forkName = `angular-v${this.angularVersion}-env`; if (context) { const envPkgName = this.pkg.getPackageName(context.aspectComponent!); - forkName = envPkgName === '@teambit/angular' ? 'angular-env-default' : `angular-env-v${this.angularVersion}`; + forkName = envPkgName === '@bitdev/angular.angular-env' ? 'my-angular-env' : `my-angular-v${this.angularVersion}-env`; } return [{ - id: `teambit.angular/forks/${forkName}`, + id: `bitdev.angular/examples/${forkName}`, targetName: FORKED_ENV_NAME }]; } diff --git a/examples/custom-env/custom-env.docs.mdx b/examples/custom-env/custom-env.docs.mdx deleted file mode 100644 index 3c468819..00000000 --- a/examples/custom-env/custom-env.docs.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -labels: ['extension', 'angular', 'env', 'environment'] -description: 'A customized extension for Angular environment.' ---- - -This is a customized extension for Angular, based on the [Angular Aspect](https://bit.dev/teambit/angular/angular-v12). - -Explain here the modified configurations and tools applied. diff --git a/examples/custom-env/custom-env.extension.ts b/examples/custom-env/custom-env.extension.ts deleted file mode 100644 index 748f3b54..00000000 --- a/examples/custom-env/custom-env.extension.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { EnvsMain, EnvsAspect } from '@teambit/envs' -import { AngularV12Aspect, AngularV12Main } from '@teambit/angular-v12'; - -export class CustomEnvExtension { - static dependencies: any = [EnvsAspect, AngularV12Aspect] - - static async provider([envs, angular]: [EnvsMain, AngularV12Main]) { - const CustomEnvEnv = angular.compose([ - /** - * Use any of the "angular.override..." transformers, for example: - * angular.overrideCompilerOptions({ - * fullTemplateTypeCheck: false - * }) - */ - angular.overrideAngularEnvOptions({useAngularElementsPreview: true}) - ]); - - envs.registerEnv(CustomEnvEnv) - - return new CustomEnvExtension(); - } -} diff --git a/examples/custom-env/index.ts b/examples/custom-env/index.ts deleted file mode 100644 index 57cea59e..00000000 --- a/examples/custom-env/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CustomEnvExtension, CustomEnvExtension as default } from './custom-env.extension'; diff --git a/examples/demo-lib-v11/src/bit-test.component.ts b/examples/demo-lib-v11/src/bit-test.component.ts deleted file mode 100644 index 69b5767f..00000000 --- a/examples/demo-lib-v11/src/bit-test.component.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component } from '@angular/core'; -import { BitTestService } from './bit-test.service'; - -@Component({ - selector: 'bit-test', - template: ` -

bit-test component works!

- {{ service.content }} - ` -}) -export class BitTestComponent { - constructor(public service: BitTestService) {} -} diff --git a/examples/demo-lib-v12/src/bit-test.component.ts b/examples/demo-lib-v12/src/bit-test.component.ts deleted file mode 100644 index 69b5767f..00000000 --- a/examples/demo-lib-v12/src/bit-test.component.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component } from '@angular/core'; -import { BitTestService } from './bit-test.service'; - -@Component({ - selector: 'bit-test', - template: ` -

bit-test component works!

- {{ service.content }} - ` -}) -export class BitTestComponent { - constructor(public service: BitTestService) {} -} diff --git a/examples/demo-lib-v14/src/compositions/cmp1.composition.ts b/examples/demo-lib-v14/src/compositions/cmp1.composition.ts deleted file mode 100644 index 9eccc4af..00000000 --- a/examples/demo-lib-v14/src/compositions/cmp1.composition.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'bit-composition', - template: ` -

- Composition component 1 -

- `, - styles: [ - ] -}) -export class StandaloneCompositionComponent { -} diff --git a/examples/demo-lib-v16/public-api.ts b/examples/demo-lib-v16/public-api.ts deleted file mode 100644 index b0c87230..00000000 --- a/examples/demo-lib-v16/public-api.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Entry point for this Angular library, do not move or rename this file. - */ -export * from './src/bit-test.component'; -export * from './src/bit-test2.component'; -export * from './src/bit-test.module'; diff --git a/examples/demo-lib-v16/src/bit-test.docs.md b/examples/demo-lib-v16/src/bit-test.docs.md deleted file mode 100644 index 1fcc392a..00000000 --- a/examples/demo-lib-v16/src/bit-test.docs.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -labels: ['angular', 'typescript', 'bit-test'] -description: 'A `bit-test` component.' ---- - -# Bit test documentation -Import `BitTestModule` : - -```typescript -import { BitTestModule } from './bit-test.module'; - -// add it to your module imports -@NgModule({ - // ... - imports: [ - BitTestModule - ] - // ... -}) -export class AppModule {} -``` - -Use `BitTestComponent` in your templates : - -```html - -``` diff --git a/examples/demo-lib-v16/src/bit-test.module.ts b/examples/demo-lib-v16/src/bit-test.module.ts deleted file mode 100644 index 722ee247..00000000 --- a/examples/demo-lib-v16/src/bit-test.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BitTestComponent } from './bit-test.component'; -import { BitTest2Component } from './bit-test2.component'; - -@NgModule({ - declarations: [ - BitTestComponent, - BitTest2Component - ], - exports: [ - BitTestComponent, - BitTest2Component - ] -}) -export class BitTestModule {} diff --git a/examples/demo-lib-v16/src/bit-test.service.ts b/examples/demo-lib-v16/src/bit-test.service.ts deleted file mode 100644 index e5ced380..00000000 --- a/examples/demo-lib-v16/src/bit-test.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ providedIn: 'any' }) -export class BitTestService { - get content() { - return 'Content from service'; - } -} diff --git a/examples/demo-lib-v16/src/bit-test.spec.ts b/examples/demo-lib-v16/src/bit-test.spec.ts deleted file mode 100644 index 4fc29a4e..00000000 --- a/examples/demo-lib-v16/src/bit-test.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { BitTestComponent } from './bit-test.component'; - -describe('BitTestComponent', () => { - let component: BitTestComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ BitTestComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(BitTestComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should have a service', () => { - expect(component.service).toBeDefined(); - expect(component.service.content).toEqual('Content from service'); - }) -}); diff --git a/examples/demo-lib-v16/src/bit-test2.component.ts b/examples/demo-lib-v16/src/bit-test2.component.ts deleted file mode 100644 index 629586b0..00000000 --- a/examples/demo-lib-v16/src/bit-test2.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'bit-test2', - template: ` -

- bit-test 2 works as well! -

- ` -}) -export class BitTest2Component {} diff --git a/examples/demo-lib-v16/src/compositions/bit-test.composition.ts b/examples/demo-lib-v16/src/compositions/bit-test.composition.ts deleted file mode 100644 index 5359c53f..00000000 --- a/examples/demo-lib-v16/src/compositions/bit-test.composition.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Component, NgModule } from '@angular/core'; -import { BitTestModule } from '../bit-test.module'; - -@Component({ - selector: 'composition-cmp', - template: `Composition: ` -}) -class CompositionComponent {} - -@NgModule({ - declarations: [CompositionComponent], - imports: [BitTestModule], - bootstrap: [CompositionComponent] -}) -export class CompositionModule { -} diff --git a/examples/demo-lib-v8/public-api.ts b/examples/demo-lib-v8/public-api.ts deleted file mode 100644 index b0c87230..00000000 --- a/examples/demo-lib-v8/public-api.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Entry point for this Angular library, do not move or rename this file. - */ -export * from './src/bit-test.component'; -export * from './src/bit-test2.component'; -export * from './src/bit-test.module'; diff --git a/examples/demo-lib-v8/src/bit-test.component.ts b/examples/demo-lib-v8/src/bit-test.component.ts deleted file mode 100644 index b206ca9c..00000000 --- a/examples/demo-lib-v8/src/bit-test.component.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component, Inject } from '@angular/core'; -import { BitTestService } from './bit-test.service'; - -@Component({ - selector: 'bit-test', - template: ` -

bit-test component works!

- {{ service.content }} - ` -}) -export class BitTestComponent { - constructor(@Inject(BitTestService) public service: BitTestService) {} -} diff --git a/examples/demo-lib-v8/src/bit-test.docs.md b/examples/demo-lib-v8/src/bit-test.docs.md deleted file mode 100644 index 1fcc392a..00000000 --- a/examples/demo-lib-v8/src/bit-test.docs.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -labels: ['angular', 'typescript', 'bit-test'] -description: 'A `bit-test` component.' ---- - -# Bit test documentation -Import `BitTestModule` : - -```typescript -import { BitTestModule } from './bit-test.module'; - -// add it to your module imports -@NgModule({ - // ... - imports: [ - BitTestModule - ] - // ... -}) -export class AppModule {} -``` - -Use `BitTestComponent` in your templates : - -```html - -``` diff --git a/examples/demo-lib-v8/src/bit-test.module.ts b/examples/demo-lib-v8/src/bit-test.module.ts deleted file mode 100644 index 8e673134..00000000 --- a/examples/demo-lib-v8/src/bit-test.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BitTestComponent } from './bit-test.component'; -import { BitTestService } from './bit-test.service'; -import { BitTest2Component } from './bit-test2.component'; - -@NgModule({ - declarations: [ - BitTestComponent, - BitTest2Component - ], - providers: [BitTestService], - exports: [ - BitTestComponent, - BitTest2Component - ] -}) -export class BitTestModule {} diff --git a/examples/demo-lib-v8/src/bit-test.service.ts b/examples/demo-lib-v8/src/bit-test.service.ts deleted file mode 100644 index 7bd6f5c5..00000000 --- a/examples/demo-lib-v8/src/bit-test.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable() -export class BitTestService { - get content() { - return 'Content from service'; - } -} diff --git a/examples/demo-lib-v8/src/bit-test.spec.ts b/examples/demo-lib-v8/src/bit-test.spec.ts deleted file mode 100644 index 03adc858..00000000 --- a/examples/demo-lib-v8/src/bit-test.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { BitTestComponent } from './bit-test.component'; -import { BitTestService } from './bit-test.service'; - -describe('BitTestComponent', () => { - let component: BitTestComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - providers: [ BitTestService ], - declarations: [ BitTestComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(BitTestComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should have a service', () => { - expect(component.service).toBeDefined(); - expect(component.service.content).toEqual('Content from service'); - }) -}); diff --git a/examples/demo-lib-v8/src/bit-test2.component.ts b/examples/demo-lib-v8/src/bit-test2.component.ts deleted file mode 100644 index 629586b0..00000000 --- a/examples/demo-lib-v8/src/bit-test2.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'bit-test2', - template: ` -

- bit-test 2 works as well! -

- ` -}) -export class BitTest2Component {} diff --git a/examples/demo-lib-v8/src/compositions/bit-test.composition.ts b/examples/demo-lib-v8/src/compositions/bit-test.composition.ts deleted file mode 100644 index ffdaea9c..00000000 --- a/examples/demo-lib-v8/src/compositions/bit-test.composition.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Component, NgModule } from '@angular/core'; -import { BitTestModule } from '../bit-test.module'; - -@Component({ - selector: 'composition-cmp', - template: `Composition: ` -}) -class CompositionComponent {} - -@NgModule({ - entryComponents: [CompositionComponent], - declarations: [CompositionComponent], - imports: [BitTestModule], - bootstrap: [CompositionComponent] -}) -export class CompositionModule { -} diff --git a/examples/demo-lib-v9/public-api.ts b/examples/demo-lib-v9/public-api.ts deleted file mode 100644 index b0c87230..00000000 --- a/examples/demo-lib-v9/public-api.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Entry point for this Angular library, do not move or rename this file. - */ -export * from './src/bit-test.component'; -export * from './src/bit-test2.component'; -export * from './src/bit-test.module'; diff --git a/examples/demo-lib-v9/src/bit-test.component.ts b/examples/demo-lib-v9/src/bit-test.component.ts deleted file mode 100644 index 69b5767f..00000000 --- a/examples/demo-lib-v9/src/bit-test.component.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component } from '@angular/core'; -import { BitTestService } from './bit-test.service'; - -@Component({ - selector: 'bit-test', - template: ` -

bit-test component works!

- {{ service.content }} - ` -}) -export class BitTestComponent { - constructor(public service: BitTestService) {} -} diff --git a/examples/demo-lib-v9/src/bit-test.docs.md b/examples/demo-lib-v9/src/bit-test.docs.md deleted file mode 100644 index 1fcc392a..00000000 --- a/examples/demo-lib-v9/src/bit-test.docs.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -labels: ['angular', 'typescript', 'bit-test'] -description: 'A `bit-test` component.' ---- - -# Bit test documentation -Import `BitTestModule` : - -```typescript -import { BitTestModule } from './bit-test.module'; - -// add it to your module imports -@NgModule({ - // ... - imports: [ - BitTestModule - ] - // ... -}) -export class AppModule {} -``` - -Use `BitTestComponent` in your templates : - -```html - -``` diff --git a/examples/demo-lib-v9/src/bit-test.module.ts b/examples/demo-lib-v9/src/bit-test.module.ts deleted file mode 100644 index 722ee247..00000000 --- a/examples/demo-lib-v9/src/bit-test.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BitTestComponent } from './bit-test.component'; -import { BitTest2Component } from './bit-test2.component'; - -@NgModule({ - declarations: [ - BitTestComponent, - BitTest2Component - ], - exports: [ - BitTestComponent, - BitTest2Component - ] -}) -export class BitTestModule {} diff --git a/examples/demo-lib-v9/src/bit-test.service.ts b/examples/demo-lib-v9/src/bit-test.service.ts deleted file mode 100644 index e5ced380..00000000 --- a/examples/demo-lib-v9/src/bit-test.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ providedIn: 'any' }) -export class BitTestService { - get content() { - return 'Content from service'; - } -} diff --git a/examples/demo-lib-v9/src/bit-test.spec.ts b/examples/demo-lib-v9/src/bit-test.spec.ts deleted file mode 100644 index 4fc29a4e..00000000 --- a/examples/demo-lib-v9/src/bit-test.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { BitTestComponent } from './bit-test.component'; - -describe('BitTestComponent', () => { - let component: BitTestComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ BitTestComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(BitTestComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should have a service', () => { - expect(component.service).toBeDefined(); - expect(component.service.content).toEqual('Content from service'); - }) -}); diff --git a/examples/demo-lib-v9/src/bit-test2.component.ts b/examples/demo-lib-v9/src/bit-test2.component.ts deleted file mode 100644 index 629586b0..00000000 --- a/examples/demo-lib-v9/src/bit-test2.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'bit-test2', - template: ` -

- bit-test 2 works as well! -

- ` -}) -export class BitTest2Component {} diff --git a/examples/demo-lib-v9/src/compositions/bit-test.composition.ts b/examples/demo-lib-v9/src/compositions/bit-test.composition.ts deleted file mode 100644 index 5359c53f..00000000 --- a/examples/demo-lib-v9/src/compositions/bit-test.composition.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Component, NgModule } from '@angular/core'; -import { BitTestModule } from '../bit-test.module'; - -@Component({ - selector: 'composition-cmp', - template: `Composition: ` -}) -class CompositionComponent {} - -@NgModule({ - declarations: [CompositionComponent], - imports: [BitTestModule], - bootstrap: [CompositionComponent] -}) -export class CompositionModule { -} diff --git a/examples/demo-lib-v9/src/compositions/cmp1.composition.ts b/examples/demo-lib-v9/src/compositions/cmp1.composition.ts deleted file mode 100644 index 9eccc4af..00000000 --- a/examples/demo-lib-v9/src/compositions/cmp1.composition.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'bit-composition', - template: ` -

- Composition component 1 -

- `, - styles: [ - ] -}) -export class StandaloneCompositionComponent { -} diff --git a/examples/demo-lib/public-api.ts b/examples/demo-lib/public-api.ts deleted file mode 100644 index b0c87230..00000000 --- a/examples/demo-lib/public-api.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Entry point for this Angular library, do not move or rename this file. - */ -export * from './src/bit-test.component'; -export * from './src/bit-test2.component'; -export * from './src/bit-test.module'; diff --git a/examples/demo-lib/src/bit-test.docs.md b/examples/demo-lib/src/bit-test.docs.md deleted file mode 100644 index 1fcc392a..00000000 --- a/examples/demo-lib/src/bit-test.docs.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -labels: ['angular', 'typescript', 'bit-test'] -description: 'A `bit-test` component.' ---- - -# Bit test documentation -Import `BitTestModule` : - -```typescript -import { BitTestModule } from './bit-test.module'; - -// add it to your module imports -@NgModule({ - // ... - imports: [ - BitTestModule - ] - // ... -}) -export class AppModule {} -``` - -Use `BitTestComponent` in your templates : - -```html - -``` diff --git a/examples/demo-lib/src/bit-test.module.ts b/examples/demo-lib/src/bit-test.module.ts deleted file mode 100644 index 722ee247..00000000 --- a/examples/demo-lib/src/bit-test.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BitTestComponent } from './bit-test.component'; -import { BitTest2Component } from './bit-test2.component'; - -@NgModule({ - declarations: [ - BitTestComponent, - BitTest2Component - ], - exports: [ - BitTestComponent, - BitTest2Component - ] -}) -export class BitTestModule {} diff --git a/examples/demo-lib/src/bit-test.service.ts b/examples/demo-lib/src/bit-test.service.ts deleted file mode 100644 index e5ced380..00000000 --- a/examples/demo-lib/src/bit-test.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ providedIn: 'any' }) -export class BitTestService { - get content() { - return 'Content from service'; - } -} diff --git a/examples/demo-lib/src/bit-test.spec.ts b/examples/demo-lib/src/bit-test.spec.ts deleted file mode 100644 index 4fc29a4e..00000000 --- a/examples/demo-lib/src/bit-test.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { BitTestComponent } from './bit-test.component'; - -describe('BitTestComponent', () => { - let component: BitTestComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ BitTestComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(BitTestComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should have a service', () => { - expect(component.service).toBeDefined(); - expect(component.service.content).toEqual('Content from service'); - }) -}); diff --git a/examples/demo-lib/src/bit-test2.component.ts b/examples/demo-lib/src/bit-test2.component.ts deleted file mode 100644 index 629586b0..00000000 --- a/examples/demo-lib/src/bit-test2.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'bit-test2', - template: ` -

- bit-test 2 works as well! -

- ` -}) -export class BitTest2Component {} diff --git a/examples/demo-lib/src/compositions/bit-test.composition.ts b/examples/demo-lib/src/compositions/bit-test.composition.ts deleted file mode 100644 index 5359c53f..00000000 --- a/examples/demo-lib/src/compositions/bit-test.composition.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Component, NgModule } from '@angular/core'; -import { BitTestModule } from '../bit-test.module'; - -@Component({ - selector: 'composition-cmp', - template: `Composition: ` -}) -class CompositionComponent {} - -@NgModule({ - declarations: [CompositionComponent], - imports: [BitTestModule], - bootstrap: [CompositionComponent] -}) -export class CompositionModule { -} diff --git a/examples/demo-lib/src/compositions/cmp1.composition.ts b/examples/demo-lib/src/compositions/cmp1.composition.ts deleted file mode 100644 index 9eccc4af..00000000 --- a/examples/demo-lib/src/compositions/cmp1.composition.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'bit-composition', - template: ` -

- Composition component 1 -

- `, - styles: [ - ] -}) -export class StandaloneCompositionComponent { -} diff --git a/integration/.eslintrc.json b/integration/.eslintrc.json new file mode 100644 index 00000000..97a7d5e5 --- /dev/null +++ b/integration/.eslintrc.json @@ -0,0 +1,6 @@ +// bit-generated-eslint-config +{ + "extends": [ + "./../node_modules/.cache/.eslintrc.bit.c6e5f65d29035ab6c25c07fb10bbd5e4ff3416ab.json" + ] +} \ No newline at end of file diff --git a/examples/demo-app/demo-app.docs.md b/integration/demo-app/demo-app.docs.md similarity index 100% rename from examples/demo-app/demo-app.docs.md rename to integration/demo-app/demo-app.docs.md diff --git a/examples/demo-app/demo-app.ng-app.ts b/integration/demo-app/demo-app.ng-app.ts similarity index 80% rename from examples/demo-app/demo-app.ng-app.ts rename to integration/demo-app/demo-app.ng-app.ts index 994e8ae7..715b4fd9 100644 --- a/examples/demo-app/demo-app.ng-app.ts +++ b/integration/demo-app/demo-app.ng-app.ts @@ -1,5 +1,5 @@ -import { AngularAppOptions } from '@teambit/angular-apps'; -import { BrowserOptions, DevServerOptions } from '@teambit/angular-common'; +import type { AngularAppOptions } from '@bitdev/angular.dev-services.apps'; +import type { BrowserOptions, DevServerOptions } from '@bitdev/angular.dev-services.common'; const angularOptions: BrowserOptions & DevServerOptions = { main: './src/main.ts', diff --git a/examples/demo-app/index.ts b/integration/demo-app/index.ts similarity index 100% rename from examples/demo-app/index.ts rename to integration/demo-app/index.ts diff --git a/examples/demo-app/src/app/app.component.html b/integration/demo-app/src/app/app.component.html similarity index 100% rename from examples/demo-app/src/app/app.component.html rename to integration/demo-app/src/app/app.component.html diff --git a/examples/demo-app/src/app/app.component.scss b/integration/demo-app/src/app/app.component.scss similarity index 100% rename from examples/demo-app/src/app/app.component.scss rename to integration/demo-app/src/app/app.component.scss diff --git a/examples/demo-app/src/app/app.component.spec.ts b/integration/demo-app/src/app/app.component.spec.ts similarity index 100% rename from examples/demo-app/src/app/app.component.spec.ts rename to integration/demo-app/src/app/app.component.spec.ts diff --git a/examples/demo-app/src/app/app.component.ts b/integration/demo-app/src/app/app.component.ts similarity index 100% rename from examples/demo-app/src/app/app.component.ts rename to integration/demo-app/src/app/app.component.ts diff --git a/examples/demo-app/src/app/app.module.ts b/integration/demo-app/src/app/app.module.ts similarity index 100% rename from examples/demo-app/src/app/app.module.ts rename to integration/demo-app/src/app/app.module.ts diff --git a/scopes/dev-services/preview/preview/preview-app/src/assets/.gitkeep b/integration/demo-app/src/assets/.gitkeep similarity index 100% rename from scopes/dev-services/preview/preview/preview-app/src/assets/.gitkeep rename to integration/demo-app/src/assets/.gitkeep diff --git a/examples/demo-app/src/assets/favicon.ico b/integration/demo-app/src/assets/favicon.ico similarity index 100% rename from examples/demo-app/src/assets/favicon.ico rename to integration/demo-app/src/assets/favicon.ico diff --git a/examples/demo-app/src/environments/environment.prod.ts b/integration/demo-app/src/environments/environment.prod.ts similarity index 100% rename from examples/demo-app/src/environments/environment.prod.ts rename to integration/demo-app/src/environments/environment.prod.ts diff --git a/examples/demo-app/src/environments/environment.ts b/integration/demo-app/src/environments/environment.ts similarity index 100% rename from examples/demo-app/src/environments/environment.ts rename to integration/demo-app/src/environments/environment.ts diff --git a/examples/demo-app/src/index.html b/integration/demo-app/src/index.html similarity index 100% rename from examples/demo-app/src/index.html rename to integration/demo-app/src/index.html diff --git a/examples/demo-app/src/main.ts b/integration/demo-app/src/main.ts similarity index 100% rename from examples/demo-app/src/main.ts rename to integration/demo-app/src/main.ts diff --git a/examples/demo-app/src/polyfills.ts b/integration/demo-app/src/polyfills.ts similarity index 100% rename from examples/demo-app/src/polyfills.ts rename to integration/demo-app/src/polyfills.ts diff --git a/examples/demo-app/src/styles.scss b/integration/demo-app/src/styles.scss similarity index 100% rename from examples/demo-app/src/styles.scss rename to integration/demo-app/src/styles.scss diff --git a/examples/demo-app/tsconfig.app.json b/integration/demo-app/tsconfig.app.json similarity index 100% rename from examples/demo-app/tsconfig.app.json rename to integration/demo-app/tsconfig.app.json diff --git a/examples/demo-lib-v10/public-api.ts b/integration/demo-lib-v12/public-api.ts similarity index 100% rename from examples/demo-lib-v10/public-api.ts rename to integration/demo-lib-v12/public-api.ts diff --git a/examples/demo-lib-v10/src/bit-test.component.ts b/integration/demo-lib-v12/src/bit-test.component.ts similarity index 100% rename from examples/demo-lib-v10/src/bit-test.component.ts rename to integration/demo-lib-v12/src/bit-test.component.ts diff --git a/examples/demo-lib-v10/src/bit-test.docs.md b/integration/demo-lib-v12/src/bit-test.docs.md similarity index 100% rename from examples/demo-lib-v10/src/bit-test.docs.md rename to integration/demo-lib-v12/src/bit-test.docs.md diff --git a/examples/demo-lib-v10/src/bit-test.module.ts b/integration/demo-lib-v12/src/bit-test.module.ts similarity index 100% rename from examples/demo-lib-v10/src/bit-test.module.ts rename to integration/demo-lib-v12/src/bit-test.module.ts diff --git a/examples/demo-lib-v10/src/bit-test.service.ts b/integration/demo-lib-v12/src/bit-test.service.ts similarity index 100% rename from examples/demo-lib-v10/src/bit-test.service.ts rename to integration/demo-lib-v12/src/bit-test.service.ts diff --git a/examples/demo-lib-v10/src/bit-test.spec.ts b/integration/demo-lib-v12/src/bit-test.spec.ts similarity index 100% rename from examples/demo-lib-v10/src/bit-test.spec.ts rename to integration/demo-lib-v12/src/bit-test.spec.ts diff --git a/examples/demo-lib-v10/src/bit-test2.component.ts b/integration/demo-lib-v12/src/bit-test2.component.ts similarity index 100% rename from examples/demo-lib-v10/src/bit-test2.component.ts rename to integration/demo-lib-v12/src/bit-test2.component.ts diff --git a/examples/demo-lib-v10/src/compositions/bit-test.composition.ts b/integration/demo-lib-v12/src/compositions/bit-test.composition.ts similarity index 100% rename from examples/demo-lib-v10/src/compositions/bit-test.composition.ts rename to integration/demo-lib-v12/src/compositions/bit-test.composition.ts diff --git a/examples/demo-lib-v10/src/compositions/cmp1.composition.ts b/integration/demo-lib-v12/src/compositions/cmp1.composition.ts similarity index 100% rename from examples/demo-lib-v10/src/compositions/cmp1.composition.ts rename to integration/demo-lib-v12/src/compositions/cmp1.composition.ts diff --git a/examples/demo-lib-v11/public-api.ts b/integration/demo-lib-v13/public-api.ts similarity index 100% rename from examples/demo-lib-v11/public-api.ts rename to integration/demo-lib-v13/public-api.ts diff --git a/examples/demo-lib-v13/src/bit-test.component.ts b/integration/demo-lib-v13/src/bit-test.component.ts similarity index 100% rename from examples/demo-lib-v13/src/bit-test.component.ts rename to integration/demo-lib-v13/src/bit-test.component.ts diff --git a/examples/demo-lib-v11/src/bit-test.docs.md b/integration/demo-lib-v13/src/bit-test.docs.md similarity index 100% rename from examples/demo-lib-v11/src/bit-test.docs.md rename to integration/demo-lib-v13/src/bit-test.docs.md diff --git a/examples/demo-lib-v11/src/bit-test.module.ts b/integration/demo-lib-v13/src/bit-test.module.ts similarity index 100% rename from examples/demo-lib-v11/src/bit-test.module.ts rename to integration/demo-lib-v13/src/bit-test.module.ts diff --git a/examples/demo-lib-v11/src/bit-test.service.ts b/integration/demo-lib-v13/src/bit-test.service.ts similarity index 100% rename from examples/demo-lib-v11/src/bit-test.service.ts rename to integration/demo-lib-v13/src/bit-test.service.ts diff --git a/examples/demo-lib-v11/src/bit-test.spec.ts b/integration/demo-lib-v13/src/bit-test.spec.ts similarity index 100% rename from examples/demo-lib-v11/src/bit-test.spec.ts rename to integration/demo-lib-v13/src/bit-test.spec.ts diff --git a/examples/demo-lib-v11/src/bit-test2.component.ts b/integration/demo-lib-v13/src/bit-test2.component.ts similarity index 100% rename from examples/demo-lib-v11/src/bit-test2.component.ts rename to integration/demo-lib-v13/src/bit-test2.component.ts diff --git a/examples/demo-lib-v11/src/compositions/bit-test.composition.ts b/integration/demo-lib-v13/src/compositions/bit-test.composition.ts similarity index 100% rename from examples/demo-lib-v11/src/compositions/bit-test.composition.ts rename to integration/demo-lib-v13/src/compositions/bit-test.composition.ts diff --git a/examples/demo-lib-v11/src/compositions/cmp1.composition.ts b/integration/demo-lib-v13/src/compositions/cmp1.composition.ts similarity index 100% rename from examples/demo-lib-v11/src/compositions/cmp1.composition.ts rename to integration/demo-lib-v13/src/compositions/cmp1.composition.ts diff --git a/examples/demo-lib-v12/public-api.ts b/integration/demo-lib-v14/public-api.ts similarity index 100% rename from examples/demo-lib-v12/public-api.ts rename to integration/demo-lib-v14/public-api.ts diff --git a/examples/demo-lib-v14/src/bit-test.component.ts b/integration/demo-lib-v14/src/bit-test.component.ts similarity index 100% rename from examples/demo-lib-v14/src/bit-test.component.ts rename to integration/demo-lib-v14/src/bit-test.component.ts diff --git a/examples/demo-lib-v12/src/bit-test.docs.md b/integration/demo-lib-v14/src/bit-test.docs.md similarity index 100% rename from examples/demo-lib-v12/src/bit-test.docs.md rename to integration/demo-lib-v14/src/bit-test.docs.md diff --git a/examples/demo-lib-v12/src/bit-test.module.ts b/integration/demo-lib-v14/src/bit-test.module.ts similarity index 100% rename from examples/demo-lib-v12/src/bit-test.module.ts rename to integration/demo-lib-v14/src/bit-test.module.ts diff --git a/examples/demo-lib-v12/src/bit-test.service.ts b/integration/demo-lib-v14/src/bit-test.service.ts similarity index 100% rename from examples/demo-lib-v12/src/bit-test.service.ts rename to integration/demo-lib-v14/src/bit-test.service.ts diff --git a/examples/demo-lib-v12/src/bit-test.spec.ts b/integration/demo-lib-v14/src/bit-test.spec.ts similarity index 100% rename from examples/demo-lib-v12/src/bit-test.spec.ts rename to integration/demo-lib-v14/src/bit-test.spec.ts diff --git a/examples/demo-lib-v12/src/bit-test2.component.ts b/integration/demo-lib-v14/src/bit-test2.component.ts similarity index 100% rename from examples/demo-lib-v12/src/bit-test2.component.ts rename to integration/demo-lib-v14/src/bit-test2.component.ts diff --git a/examples/demo-lib-v12/src/compositions/bit-test.composition.ts b/integration/demo-lib-v14/src/compositions/bit-test.composition.ts similarity index 100% rename from examples/demo-lib-v12/src/compositions/bit-test.composition.ts rename to integration/demo-lib-v14/src/compositions/bit-test.composition.ts diff --git a/examples/demo-lib-v12/src/compositions/cmp1.composition.ts b/integration/demo-lib-v14/src/compositions/cmp1.composition.ts similarity index 100% rename from examples/demo-lib-v12/src/compositions/cmp1.composition.ts rename to integration/demo-lib-v14/src/compositions/cmp1.composition.ts diff --git a/examples/demo-lib-v13/public-api.ts b/integration/demo-lib-v15/public-api.ts similarity index 100% rename from examples/demo-lib-v13/public-api.ts rename to integration/demo-lib-v15/public-api.ts diff --git a/examples/demo-lib-v15/src/bit-test.component.ts b/integration/demo-lib-v15/src/bit-test.component.ts similarity index 100% rename from examples/demo-lib-v15/src/bit-test.component.ts rename to integration/demo-lib-v15/src/bit-test.component.ts diff --git a/examples/demo-lib-v13/src/bit-test.docs.md b/integration/demo-lib-v15/src/bit-test.docs.md similarity index 100% rename from examples/demo-lib-v13/src/bit-test.docs.md rename to integration/demo-lib-v15/src/bit-test.docs.md diff --git a/examples/demo-lib-v13/src/bit-test.module.ts b/integration/demo-lib-v15/src/bit-test.module.ts similarity index 100% rename from examples/demo-lib-v13/src/bit-test.module.ts rename to integration/demo-lib-v15/src/bit-test.module.ts diff --git a/examples/demo-lib-v13/src/bit-test.service.ts b/integration/demo-lib-v15/src/bit-test.service.ts similarity index 100% rename from examples/demo-lib-v13/src/bit-test.service.ts rename to integration/demo-lib-v15/src/bit-test.service.ts diff --git a/examples/demo-lib-v13/src/bit-test.spec.ts b/integration/demo-lib-v15/src/bit-test.spec.ts similarity index 100% rename from examples/demo-lib-v13/src/bit-test.spec.ts rename to integration/demo-lib-v15/src/bit-test.spec.ts diff --git a/examples/demo-lib-v13/src/bit-test2.component.ts b/integration/demo-lib-v15/src/bit-test2.component.ts similarity index 100% rename from examples/demo-lib-v13/src/bit-test2.component.ts rename to integration/demo-lib-v15/src/bit-test2.component.ts diff --git a/examples/demo-lib-v13/src/compositions/bit-test.composition.ts b/integration/demo-lib-v15/src/compositions/bit-test.composition.ts similarity index 100% rename from examples/demo-lib-v13/src/compositions/bit-test.composition.ts rename to integration/demo-lib-v15/src/compositions/bit-test.composition.ts diff --git a/examples/demo-lib-v15/src/compositions/cmp1.composition.ts b/integration/demo-lib-v15/src/compositions/cmp1.composition.ts similarity index 100% rename from examples/demo-lib-v15/src/compositions/cmp1.composition.ts rename to integration/demo-lib-v15/src/compositions/cmp1.composition.ts diff --git a/examples/demo-lib-v14/public-api.ts b/integration/demo-lib-v16/public-api.ts similarity index 100% rename from examples/demo-lib-v14/public-api.ts rename to integration/demo-lib-v16/public-api.ts diff --git a/examples/demo-lib-v16/src/bit-test.component.ts b/integration/demo-lib-v16/src/bit-test.component.ts similarity index 100% rename from examples/demo-lib-v16/src/bit-test.component.ts rename to integration/demo-lib-v16/src/bit-test.component.ts diff --git a/examples/demo-lib-v14/src/bit-test.docs.md b/integration/demo-lib-v16/src/bit-test.docs.md similarity index 100% rename from examples/demo-lib-v14/src/bit-test.docs.md rename to integration/demo-lib-v16/src/bit-test.docs.md diff --git a/examples/demo-lib-v14/src/bit-test.module.ts b/integration/demo-lib-v16/src/bit-test.module.ts similarity index 100% rename from examples/demo-lib-v14/src/bit-test.module.ts rename to integration/demo-lib-v16/src/bit-test.module.ts diff --git a/examples/demo-lib-v14/src/bit-test.service.ts b/integration/demo-lib-v16/src/bit-test.service.ts similarity index 100% rename from examples/demo-lib-v14/src/bit-test.service.ts rename to integration/demo-lib-v16/src/bit-test.service.ts diff --git a/examples/demo-lib-v14/src/bit-test.spec.ts b/integration/demo-lib-v16/src/bit-test.spec.ts similarity index 100% rename from examples/demo-lib-v14/src/bit-test.spec.ts rename to integration/demo-lib-v16/src/bit-test.spec.ts diff --git a/examples/demo-lib-v14/src/bit-test2.component.ts b/integration/demo-lib-v16/src/bit-test2.component.ts similarity index 100% rename from examples/demo-lib-v14/src/bit-test2.component.ts rename to integration/demo-lib-v16/src/bit-test2.component.ts diff --git a/examples/demo-lib-v14/src/compositions/bit-test.composition.ts b/integration/demo-lib-v16/src/compositions/bit-test.composition.ts similarity index 100% rename from examples/demo-lib-v14/src/compositions/bit-test.composition.ts rename to integration/demo-lib-v16/src/compositions/bit-test.composition.ts diff --git a/examples/demo-lib-v16/src/compositions/cmp1.composition.ts b/integration/demo-lib-v16/src/compositions/cmp1.composition.ts similarity index 100% rename from examples/demo-lib-v16/src/compositions/cmp1.composition.ts rename to integration/demo-lib-v16/src/compositions/cmp1.composition.ts diff --git a/examples/demo-lib-v15/public-api.ts b/integration/demo-lib/public-api.ts similarity index 100% rename from examples/demo-lib-v15/public-api.ts rename to integration/demo-lib/public-api.ts diff --git a/examples/demo-lib/src/bit-test.component.ts b/integration/demo-lib/src/bit-test.component.ts similarity index 100% rename from examples/demo-lib/src/bit-test.component.ts rename to integration/demo-lib/src/bit-test.component.ts diff --git a/examples/demo-lib-v15/src/bit-test.docs.md b/integration/demo-lib/src/bit-test.docs.md similarity index 100% rename from examples/demo-lib-v15/src/bit-test.docs.md rename to integration/demo-lib/src/bit-test.docs.md diff --git a/examples/demo-lib-v15/src/bit-test.module.ts b/integration/demo-lib/src/bit-test.module.ts similarity index 100% rename from examples/demo-lib-v15/src/bit-test.module.ts rename to integration/demo-lib/src/bit-test.module.ts diff --git a/examples/demo-lib-v15/src/bit-test.service.ts b/integration/demo-lib/src/bit-test.service.ts similarity index 100% rename from examples/demo-lib-v15/src/bit-test.service.ts rename to integration/demo-lib/src/bit-test.service.ts diff --git a/examples/demo-lib-v15/src/bit-test.spec.ts b/integration/demo-lib/src/bit-test.spec.ts similarity index 100% rename from examples/demo-lib-v15/src/bit-test.spec.ts rename to integration/demo-lib/src/bit-test.spec.ts diff --git a/examples/demo-lib-v15/src/bit-test2.component.ts b/integration/demo-lib/src/bit-test2.component.ts similarity index 100% rename from examples/demo-lib-v15/src/bit-test2.component.ts rename to integration/demo-lib/src/bit-test2.component.ts diff --git a/examples/demo-lib-v15/src/compositions/bit-test.composition.ts b/integration/demo-lib/src/compositions/bit-test.composition.ts similarity index 100% rename from examples/demo-lib-v15/src/compositions/bit-test.composition.ts rename to integration/demo-lib/src/compositions/bit-test.composition.ts diff --git a/examples/demo-lib-v13/src/compositions/cmp1.composition.ts b/integration/demo-lib/src/compositions/cmp1.composition.ts similarity index 100% rename from examples/demo-lib-v13/src/compositions/cmp1.composition.ts rename to integration/demo-lib/src/compositions/cmp1.composition.ts diff --git a/integration/tsconfig.json b/integration/tsconfig.json new file mode 100644 index 00000000..aac077cb --- /dev/null +++ b/integration/tsconfig.json @@ -0,0 +1,5 @@ +// bit-generated-typescript-config + +{ + "extends": "./../node_modules/.cache/tsconfig.bit.97419b053b01c53685848de90d78fc38da395744.json" +} \ No newline at end of file diff --git a/package.json b/package.json index db9dbeb7..d818f569 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "

Bit Angular

", "directories": { - "example": "examples" + "example": "integration" }, "dependencies": {}, "devDependencies": {}, diff --git a/scopes/angular/index.ts b/scopes/angular/index.ts deleted file mode 100644 index 9e0c3620..00000000 --- a/scopes/angular/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { AngularEnv } from './angular.bit-env'; -export { jestConfig } from '@teambit/angular-v16'; diff --git a/scopes/dev-services/compiler/ngcc/component.json b/scopes/dev-services/compiler/ngcc/component.json deleted file mode 100644 index 69b4932f..00000000 --- a/scopes/dev-services/compiler/ngcc/component.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "componentId": { - "name": "dev-services/compiler/ngcc", - "scope": "teambit.angular" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/ngcc", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@angular/compiler-cli": "-" - }, - "peerDependencies": { - "@angular/compiler-cli": ">= 8.0.0" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" - } - } - } - } -} diff --git a/scopes/dev-services/preview/preview/mounter.ts b/scopes/dev-services/preview/preview/mounter.ts deleted file mode 100644 index a681ee30..00000000 --- a/scopes/dev-services/preview/preview/mounter.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable import/no-unresolved */ -import { createMounter } from '@teambit/angular-mounter'; - -export default createMounter(); diff --git a/scopes/forks/angular-env-default/component.json b/scopes/forks/angular-env-default/component.json deleted file mode 100644 index 695ca399..00000000 --- a/scopes/forks/angular-env-default/component.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "componentId": { - "name": "forks/angular-env-default", - "scope": "teambit.angular" - }, - "propagate": true, - "extensions": { - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@teambit/angular-eslint-config": ">= 2.0.1", - "@types/jest": "^29.5.0", - "jest": "^29.5.0", - "jest-preset-angular": "~13.1.0" - } - } - }, - "teambit.component/renaming": { - "renamedFrom": { - "scope": "teambit.angular", - "name": "forks/angular-env", - "version": "0.1.1" - } - } - } -} diff --git a/scopes/forks/angular-env-default/preview/mounter.ts b/scopes/forks/angular-env-default/preview/mounter.ts deleted file mode 100644 index 7a974b6b..00000000 --- a/scopes/forks/angular-env-default/preview/mounter.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* eslint-disable import/no-unresolved */ -import { createMounter } from '@teambit/angular-mounter'; -import { Component, ViewEncapsulation } from '@angular/core'; - -/** - * Provide your component compositions (preview) with the context they need to run. - * for example, a router, a theme, a data provider, etc. - * components added here as providers should be listed as host-dependencies in your host-dependencies.ts file. - * @see https://bit.dev/docs/angular-env-default-default/components-preview#compositions-providers - */ -@Component({ - selector: 'bit-wrapper', - standalone: true, - imports: [], - encapsulation: ViewEncapsulation.None, - template: ` - - `, -}) export class WrapperComponent {} - - -/** - * the entry for the app (preview runtime) that renders your component previews. - * use the default template or create your own. - * @see https://bit.dev/docs/angular-env-default-default/components-preview#compositions-mounter - */ -export default createMounter(WrapperComponent); diff --git a/scopes/forks/angular-env-v12/index.ts b/scopes/forks/angular-env-v12/index.ts deleted file mode 100644 index 6f975888..00000000 --- a/scopes/forks/angular-env-v12/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { MyAngularEnv, MyAngularEnv as default } from './my-angular-env.bit-env'; diff --git a/scopes/forks/angular-env-v13/index.ts b/scopes/forks/angular-env-v13/index.ts deleted file mode 100644 index 6f975888..00000000 --- a/scopes/forks/angular-env-v13/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { MyAngularEnv, MyAngularEnv as default } from './my-angular-env.bit-env'; diff --git a/scopes/forks/angular-env-v14/index.ts b/scopes/forks/angular-env-v14/index.ts deleted file mode 100644 index 6f975888..00000000 --- a/scopes/forks/angular-env-v14/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { MyAngularEnv, MyAngularEnv as default } from './my-angular-env.bit-env'; diff --git a/scopes/forks/angular-env-v14/my-angular-env.docs.mdx b/scopes/forks/angular-env-v14/my-angular-env.docs.mdx deleted file mode 100644 index 13f57ff1..00000000 --- a/scopes/forks/angular-env-v14/my-angular-env.docs.mdx +++ /dev/null @@ -1,86 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; - - diff --git a/scopes/forks/angular-env-v15/config/eslintrc.js b/scopes/forks/angular-env-v15/config/eslintrc.js deleted file mode 100644 index 1a96ec4b..00000000 --- a/scopes/forks/angular-env-v15/config/eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @see https://bit.dev/reference/eslint/eslint-config - */ -module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], - rules: {}, -}; diff --git a/scopes/forks/angular-env-v15/config/jest.config.ts b/scopes/forks/angular-env-v15/config/jest.config.ts deleted file mode 100644 index 26603856..00000000 --- a/scopes/forks/angular-env-v15/config/jest.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @see https://bit.dev/reference/jest/jest-config - */ -import { jestConfig } from '@teambit/angular-v15'; - -export default { - ...jestConfig, -}; \ No newline at end of file diff --git a/scopes/forks/angular-env-v15/config/prettier.config.ts b/scopes/forks/angular-env-v15/config/prettier.config.ts deleted file mode 100644 index ca7924c7..00000000 --- a/scopes/forks/angular-env-v15/config/prettier.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @see https://bit.dev/reference/prettier/prettier-config - */ -const { prettierConfig } = require('@teambit/angular-base'); - -module.exports = { - ...prettierConfig, -}; diff --git a/scopes/forks/angular-env-v15/config/tsconfig.json b/scopes/forks/angular-env-v15/config/tsconfig.json deleted file mode 100644 index 1c59cbbe..00000000 --- a/scopes/forks/angular-env-v15/config/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @see https://bit.dev/reference/typescript/typescript-config - */ -{ - "extends": "@teambit/angular-base/config/tsconfig.json", - "include": ["**/*", "**/*.json"] -} diff --git a/scopes/forks/angular-env-v15/index.ts b/scopes/forks/angular-env-v15/index.ts deleted file mode 100644 index 6f975888..00000000 --- a/scopes/forks/angular-env-v15/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { MyAngularEnv, MyAngularEnv as default } from './my-angular-env.bit-env'; diff --git a/scopes/forks/angular-env-v15/my-angular-env.docs.mdx b/scopes/forks/angular-env-v15/my-angular-env.docs.mdx deleted file mode 100644 index ddd6d28a..00000000 --- a/scopes/forks/angular-env-v15/my-angular-env.docs.mdx +++ /dev/null @@ -1,86 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; - - diff --git a/scopes/forks/angular-env-v15/preview/host-dependencies.ts b/scopes/forks/angular-env-v15/preview/host-dependencies.ts deleted file mode 100644 index 1e705939..00000000 --- a/scopes/forks/angular-env-v15/preview/host-dependencies.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. - * most of your peer dependencies should be listed here to avoid duplications in the preview. - */ -export default [ - '@teambit/mdx.ui.mdx-scope-context', - '@mdx-js/react', - 'react', - 'react-dom', -]; \ No newline at end of file diff --git a/scopes/forks/angular-env-v16/config/eslintrc.js b/scopes/forks/angular-env-v16/config/eslintrc.js deleted file mode 100644 index 1a96ec4b..00000000 --- a/scopes/forks/angular-env-v16/config/eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @see https://bit.dev/reference/eslint/eslint-config - */ -module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], - rules: {}, -}; diff --git a/scopes/forks/angular-env-v16/config/jest.config.ts b/scopes/forks/angular-env-v16/config/jest.config.ts deleted file mode 100644 index 4e9fcc3a..00000000 --- a/scopes/forks/angular-env-v16/config/jest.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @see https://bit.dev/reference/jest/jest-config - */ -import { jestConfig } from '@teambit/angular-v16'; - -export default { - ...jestConfig, -}; diff --git a/scopes/forks/angular-env-v16/config/prettier.config.ts b/scopes/forks/angular-env-v16/config/prettier.config.ts deleted file mode 100644 index ca7924c7..00000000 --- a/scopes/forks/angular-env-v16/config/prettier.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @see https://bit.dev/reference/prettier/prettier-config - */ -const { prettierConfig } = require('@teambit/angular-base'); - -module.exports = { - ...prettierConfig, -}; diff --git a/scopes/forks/angular-env-v16/config/tsconfig.json b/scopes/forks/angular-env-v16/config/tsconfig.json deleted file mode 100644 index 1c59cbbe..00000000 --- a/scopes/forks/angular-env-v16/config/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @see https://bit.dev/reference/typescript/typescript-config - */ -{ - "extends": "@teambit/angular-base/config/tsconfig.json", - "include": ["**/*", "**/*.json"] -} diff --git a/scopes/forks/angular-env-v16/index.ts b/scopes/forks/angular-env-v16/index.ts deleted file mode 100644 index 6f975888..00000000 --- a/scopes/forks/angular-env-v16/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { MyAngularEnv, MyAngularEnv as default } from './my-angular-env.bit-env'; diff --git a/scopes/forks/angular-env-v16/my-angular-env.bit-env.ts b/scopes/forks/angular-env-v16/my-angular-env.bit-env.ts deleted file mode 100644 index 465e9adf..00000000 --- a/scopes/forks/angular-env-v16/my-angular-env.bit-env.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { AngularPreview, BundlerProvider, DevServerProvider } from '@teambit/angular-preview'; -import { AngularStarter } from '@teambit/angular-starters'; -import { NgAppTemplate, NgEnvTemplate, NgModuleTemplate } from '@teambit/angular-templates'; -import { AngularV16Env } from '@teambit/angular-v16'; -import { BundlerContext, DevServerContext } from '@teambit/bundler'; -import { ESLintLinter, EslintTask } from '@teambit/defender.eslint-linter'; -import { JestTask, JestTester } from '@teambit/defender.jest-tester'; -import { PrettierFormatter } from '@teambit/defender.prettier-formatter'; -import { EnvHandler } from '@teambit/envs'; -import { StarterList, TemplateList } from '@teambit/generator'; -import { Linter } from '@teambit/linter'; -import { Preview } from '@teambit/preview'; -import { Tester } from '@teambit/tester'; -import { ESLint as ESLintLib } from 'eslint'; -import hostDependencies from './preview/host-dependencies'; - -export class MyAngularEnv extends AngularV16Env { - // Name of the environment, used for friendly mentions across bit - name = 'my-angular-env'; - - getTesterConfig() { - return { - jest: require.resolve('jest'), - config: require.resolve('./config/jest.config') - }; - } - - /** - * Returns a tester to use during development - * Required for `bit start` & `bit test` - */ - override tester(): EnvHandler { - /** - * @see https://bit.dev/reference/jest/using-jest - * */ - return JestTester.from(this.getTesterConfig()); - } - - getLinterConfig() { - return { - tsconfig: require.resolve('@teambit/angular-eslint-config/config/tsconfig.json'), - eslint: ESLintLib, - configPath: require.resolve('./config/eslintrc'), - // resolve all plugins from the angular environment. - pluginsPath: __dirname, - extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] - }; - } - - /** - * The linter to use during development. - * Config files would be used to validate coding standards in components. - * bit will write the minimum required files in any workspace to optimize - * for dev experience. - */ - override linter(): EnvHandler { - return ESLintLinter.from(this.getLinterConfig()); - } - - /** - * The formatter to use during development - * (source files are not formatted as part of the components' build) - * */ - override formatter() { - /** - * @see https://bit.dev/reference/prettier/using-prettier - * */ - return PrettierFormatter.from({ - configPath: require.resolve('./config/prettier.config') - }); - } - - /** - * Generates the component previews during development and build - */ - override preview(): EnvHandler { - const ngEnvOptions = this.getNgEnvOptions(); - /** - * To customize the dev server or bundler behavior, you can change webpack transformers, angular - * options and webpack options in the getDevServer and getBundler methods. - */ - const devServerProvider: DevServerProvider = (devServerContext: DevServerContext) => this.getDevServer(devServerContext, ngEnvOptions); - const bundlerProvider: BundlerProvider = (bundlerContext: BundlerContext) => this.getBundler(bundlerContext, ngEnvOptions); - return AngularPreview.from({ - devServerProvider, - bundlerProvider, - ngEnvOptions, - hostDependencies, - mounterPath: require.resolve('./preview/mounter'), - }); - } - - /** - * Defines the build pipeline for a component. - * Pipelines are optimized for performance and consistency, making sure every component is - * independently built and tested. - * This is a set of processes to be performed before a component is snapped, during its build phase - * @see https://bit.dev/docs/angular-env/build-pipelines - */ - override build() { - return super.build().replace([ - EslintTask.from(this.getLinterConfig()), - JestTask.from(this.getTesterConfig()), - ]); - } - - /** - * Defines the component generators (templates) available with the command `bit templates`. - * @see https://bit.dev/docs/angular-env/component-generators - */ - override generators(): EnvHandler { - const envName = this.constructor.name; - return TemplateList.from([ - NgModuleTemplate.from({envName, angularVersion: this.angularVersion}), - NgEnvTemplate.from({envName, angularVersion: this.angularVersion}), - NgAppTemplate.from({envName, angularVersion: this.angularVersion}) - ]); - } - - /** - * Defines the Angular workspace starters available with the command `bit new`. - * @see https://bit.dev/docs/angular-env/workspace-starters - */ - override starters(): EnvHandler { - return StarterList.from([ - AngularStarter.from({envName: this.constructor.name, angularVersion: this.angularVersion}) - ]); - } -} - -export default new MyAngularEnv(); diff --git a/scopes/forks/angular-env-v16/my-angular-env.docs.mdx b/scopes/forks/angular-env-v16/my-angular-env.docs.mdx deleted file mode 100644 index eb0a4a75..00000000 --- a/scopes/forks/angular-env-v16/my-angular-env.docs.mdx +++ /dev/null @@ -1,86 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; - - diff --git a/scopes/forks/angular-env-v16/preview/host-dependencies.ts b/scopes/forks/angular-env-v16/preview/host-dependencies.ts deleted file mode 100644 index 1e705939..00000000 --- a/scopes/forks/angular-env-v16/preview/host-dependencies.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. - * most of your peer dependencies should be listed here to avoid duplications in the preview. - */ -export default [ - '@teambit/mdx.ui.mdx-scope-context', - '@mdx-js/react', - 'react', - 'react-dom', -]; \ No newline at end of file diff --git a/scopes/generators/angular-starters/component.json b/scopes/generators/angular-starters/component.json deleted file mode 100644 index 383b5f22..00000000 --- a/scopes/generators/angular-starters/component.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "componentId": { - "name": "generators/angular-starters", - "scope": "teambit.angular" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-starters", - "private": false, - "engines": { - "node": ">=14.20.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "devDependencies": { - "@babel/runtime": "7.22.15" - } - } - } - } -} diff --git a/scopes/generators/angular-starters/index.ts b/scopes/generators/angular-starters/index.ts deleted file mode 100644 index 7ded0330..00000000 --- a/scopes/generators/angular-starters/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AngularStarter } from './ng-workspace'; - -export { AngularStarter, /** @deprecated */ AngularStarter as NgWorkspaceTemplate } from './ng-workspace'; -export { DesignSystemStarter } from './design-system'; -export { MaterialDesignSystemStarter } from './material-design-system'; diff --git a/scopes/generators/angular-templates/component.json b/scopes/generators/angular-templates/component.json deleted file mode 100644 index bb6c03a3..00000000 --- a/scopes/generators/angular-templates/component.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "componentId": { - "name": "generators/angular-templates", - "scope": "teambit.angular" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-templates", - "private": false, - "engines": { - "node": ">=14.20.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "devDependencies": { - "@babel/runtime": "7.22.15" - } - } - } - } -} diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-scss.ts b/scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-scss.ts deleted file mode 100644 index cacb35bd..00000000 --- a/scopes/generators/angular-templates/ng-app/template-files/src/app/app.component-scss.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; - -export const appComponentScssFile = (context: ComponentContext): ComponentFile => { - return { - relativePath: `src/app/app.component.scss`, - content: ``, - }; -}; diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/assets/gitkeep.ts b/scopes/generators/angular-templates/ng-app/template-files/src/assets/gitkeep.ts deleted file mode 100644 index b382fd18..00000000 --- a/scopes/generators/angular-templates/ng-app/template-files/src/assets/gitkeep.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; - -export const gitKeepFile = (context: ComponentContext): ComponentFile => { - return { - relativePath: `src/assets/.gitkeep`, - content: ``, - }; -}; diff --git a/scopes/generators/angular-templates/ng-app/template-files/src/environments/environment.prod.ts b/scopes/generators/angular-templates/ng-app/template-files/src/environments/environment.prod.ts deleted file mode 100644 index 4f527630..00000000 --- a/scopes/generators/angular-templates/ng-app/template-files/src/environments/environment.prod.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ComponentContext, ComponentFile } from '@teambit/generator'; - -export const environmentProdFile = (context: ComponentContext): ComponentFile => { - return { - relativePath: `src/environments/environment.prod.ts`, - content: `export const environment = { - production: true -}; -`, - }; -}; diff --git a/scopes/versions/angular-v10/angular-v10.aspect.ts b/scopes/versions/angular-v10/angular-v10.aspect.ts deleted file mode 100644 index eab3c50b..00000000 --- a/scopes/versions/angular-v10/angular-v10.aspect.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Aspect } from '@teambit/harmony'; - -export const AngularV10Aspect = Aspect.create({ - id: 'teambit.angular/versions/angular-v10', -}); diff --git a/scopes/versions/angular-v10/angular-v10.docs.md b/scopes/versions/angular-v10/angular-v10.docs.md deleted file mode 100644 index f2785f25..00000000 --- a/scopes/versions/angular-v10/angular-v10.docs.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -Adds Angular v10 support to your Bit workspace. - -**This is a legacy version of the Angular env. It is recommended to use the latest version of the Angular env instead.** - -# Angular Overview -`teambit.angular/versions/angular-v10` is a pre-built [Env](https://bit.dev/docs/envs/envs-overview) for building components and apps with Angular. -It enables you to quickly set up a dev environment that follows best practices for Angular component development. - -## Using the Angular env -### In a new workspace -To use the Angular Env, the easiest way is to create a new pre-configured workspace with the workspace generator: -```bash -bit new ng-workspace -a teambit.angular/versions/angular-v10 -``` - -Change directory to the newly created workspace -```bash -cd -``` - -Create a bit component: -```bash -bit create ng-module ui/my-button -``` - -Install dependencies: -```bash -bit install -``` - -Start the dev server -```bash -bit start -``` - -Open-up your browser on localhost:3000, or any other available port, and display your workspace with your components. - -### In an existing Bit workspace -First you need to make sure that you're using yarn (in your workspace.jsonc, search for `packageManager` and replace `pnpm` by `yarn` if needed), -then add the Angular env to your workspace.jsonc with the following command: - -```bash -bit use teambit.angular/versions/angular-v10 -``` - -You can now create a new component that uses the Angular env: -```bash -bit create ng-module --env teambit.angular/versions/angular-v10 -``` - -And finally you need to install the dependencies: -```bash -bit install -``` - -## Creating Components -The Angular env provides a set of component templates that can be used to speed up and standardize your component development: - -To list all available templates, use the following command: -```bash -bit templates -``` - -- `ng-module` a generic Angular module. -- `ng-env` boilerplate for a customized environment configuration. -- `ng-app` an Angular application. - -Use any of these templates with the `bit create` command: -```bash -bit create --env teambit.angular/versions/angular-v10 -``` - -## Angular versions -The Angular env (teambit.angular/angular) uses the latest stable version of Angular and its dependencies. -Whenever a new major version of Angular is released, a new major version of the Angular env is created. - -If you want to use a specific version of Angular, you can use one those env versions instead of `teambit.angular/angular`: -- [v8: `teambit.angular/versions/angular-v8`](https://bit.cloud/teambit/angular/versions/angular-v8) -- [v9: `teambit.angular/versions/angular-v9`](https://bit.cloud/teambit/angular/versions/angular-v9) -- [v10: `teambit.angular/versions/angular-v10`](https://bit.cloud/teambit/angular/versions/angular-v10) -- [v11: `teambit.angular/versions/angular-v11`](https://bit.cloud/teambit/angular/versions/angular-v11) -- [v12: `teambit.angular/versions/angular-v12`](https://bit.cloud/teambit/angular/versions/angular-v12) -- [v13: `teambit.angular/versions/angular-v13`](https://bit.cloud/teambit/angular/versions/angular-v13) -- [v14: `teambit.angular/versions/angular-v14`](https://bit.cloud/teambit/angular/versions/angular-v14) -- [v15: `teambit.angular/versions/angular-v15`](https://bit.cloud/teambit/angular/versions/angular-v15) - -You can quickly switch between these versions with the `bit env set` command. For example to use v14 instead of the default, you would use the following command: -```bash -bit env replace teambit.angular/angular teambit.angular/angular-v15 -``` - -## Angular applications -You can use the Angular env to create an Angular application with the following command: -```bash -bit create ng-app --env teambit.angular/versions/angular-v10 -``` - -To run your application in dev mode, use the following command: -```bash -bit run -``` - -### Configure your application -Your app component can be configured with different options for serve, build and deployment. -Open the configuration file named `.ng-app.ts` that is located in your app folder. - -You can change the default configuration by editing the different options, such as app name, port, source folder, serve, build, deploy options, etc. -See the [apps documentation](https://bit.dev/docs/apps/apps-overview) for more information. diff --git a/scopes/versions/angular-v10/angular-v10.env.ts b/scopes/versions/angular-v10/angular-v10.env.ts deleted file mode 100644 index 21d23f0c..00000000 --- a/scopes/versions/angular-v10/angular-v10.env.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { AngularBaseEnv, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationMain } from '@teambit/application'; -import { AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelMain } from '@teambit/babel'; -import { CompilerMain } from '@teambit/compiler'; -import { CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvDescriptor } from '@teambit/envs'; -import { ESLintMain } from '@teambit/eslint'; -import { GeneratorMain } from '@teambit/generator'; -import { IsolatorMain } from '@teambit/isolator'; -import { JestMain } from '@teambit/jest'; -import { LoggerMain } from '@teambit/logger'; -import { PkgMain } from '@teambit/pkg'; -import { ReactMain } from '@teambit/react'; -import { TesterMain } from '@teambit/tester'; -import { WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import { AngularV10Aspect } from './angular-v10.aspect'; -import { AngularV10Webpack } from './angular-v10.webpack'; - -/** - * a component environment built for [Angular](https://angular.io). - */ -export class AngularV10Env extends AngularBaseEnv { - name = 'Angular-v10'; - angularWebpack: AngularV10Webpack; - ngPackagr = require.resolve('ng-packagr'); - elements = null; - readDefaultTsConfig = require.resolve('ng-packagr/lib/ts/tsconfig'); - jestConfigPath = require.resolve('./jest/jest.config'); - jestModulePath = require.resolve('jest'); - - constructor( - jestAspect: JestMain, - compiler: CompilerMain, - tester: TesterMain, - eslint: ESLintMain, - generator: GeneratorMain, - isolator: IsolatorMain, - private webpackMain: WebpackMain, - protected workspace: Workspace | undefined, - private pkg: PkgMain, - application: ApplicationMain, - aspectLoader: AspectLoaderMain, - dependencyResolver: DependencyResolverMain, - private react: ReactMain, - loggerMain: LoggerMain, - compositions: CompositionsMain, - babel: BabelMain, - options: AngularEnvOptions, - ) { - super(jestAspect, compiler, tester, eslint, isolator, workspace, generator, application, aspectLoader, dependencyResolver, loggerMain, compositions, babel, options); - this.angularWebpack = new AngularV10Webpack(this.workspace, this.webpackMain, this.pkg, application, this.getNgEnvOptions()); - } - - /** - * Returns the Environment descriptor - * Required for any task - */ - async __getDescriptor(): Promise { - return { - type: 'angular-v10', - }; - } - - /** - * Required for `bit start` - */ - getDevEnvId(id?: string) { - if (typeof id !== 'string') return AngularV10Aspect.id; - return id || AngularV10Aspect.id; - } - - /** - * Returns the list of dependencies - * Required for any task - */ - async getDependencies() { - return { - dependencies: { - '@angular/common': '-', - '@angular/core': '-', - 'tslib': '^2.0.0', - 'rxjs': '-', - 'zone.js': '-', - }, - devDependencies: { - '@angular/compiler': '~10.2.5', - '@angular/compiler-cli': '~10.2.5', - '@types/jest': '~27.0.2', - '@types/node': '^12.11.1', - 'jest': '~27.0.4', - 'jest-preset-angular': '~10.0.1', - 'typescript': '-', - }, - peerDependencies: { - '@angular/common': '~10.2.5', - '@angular/core': '~10.2.5', - '@angular/platform-browser': '~10.2.5', - '@angular/platform-browser-dynamic': '~10.2.5', - 'rxjs': '^6.6.3', - 'zone.js': '~0.10.3', - 'typescript': '~4.0.2', - }, - }; - } -} diff --git a/scopes/versions/angular-v10/angular-v10.main.runtime.ts b/scopes/versions/angular-v10/angular-v10.main.runtime.ts deleted file mode 100644 index 6b5dfdb8..00000000 --- a/scopes/versions/angular-v10/angular-v10.main.runtime.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { AngularBaseMain, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationAspect, ApplicationMain } from '@teambit/application'; -import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelAspect, BabelMain } from '@teambit/babel'; -import { MainRuntime } from '@teambit/cli'; -import { CompilerAspect, CompilerMain } from '@teambit/compiler'; -import { CompositionsAspect, CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvsAspect, EnvsMain } from '@teambit/envs'; -import { ESLintAspect, ESLintMain } from '@teambit/eslint'; -import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; -import { IsolatorAspect, IsolatorMain } from '@teambit/isolator'; -import { JestAspect, JestMain } from '@teambit/jest'; -import { LoggerAspect, LoggerMain } from '@teambit/logger'; -import { PkgAspect, PkgMain } from '@teambit/pkg'; -import { ReactAspect, ReactMain } from '@teambit/react'; -import { TesterAspect, TesterMain } from '@teambit/tester'; -import { WebpackAspect, WebpackMain } from '@teambit/webpack'; -import { Workspace, WorkspaceAspect } from '@teambit/workspace'; -import { AngularV10Aspect } from './angular-v10.aspect'; -import { AngularV10Env } from './angular-v10.env'; - -export class AngularV10Main extends AngularBaseMain { - static slots = []; - static runtime: any = MainRuntime; - static dependencies: any = [ - JestAspect, - CompilerAspect, - TesterAspect, - ESLintAspect, - GeneratorAspect, - WebpackAspect, - WorkspaceAspect, - EnvsAspect, - IsolatorAspect, - PkgAspect, - ApplicationAspect, - AspectLoaderAspect, - DependencyResolverAspect, - ReactAspect, - LoggerAspect, - CompositionsAspect, - BabelAspect, - ]; - - static async provider([ - jestAspect, - compiler, - tester, - eslint, - generator, - webpack, - workspace, - envs, - isolator, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - ]: [ - JestMain, - CompilerMain, - TesterMain, - ESLintMain, - GeneratorMain, - WebpackMain, - Workspace | undefined, - EnvsMain, - IsolatorMain, - PkgMain, - ApplicationMain, - AspectLoaderMain, - DependencyResolverMain, - ReactMain, - LoggerMain, - CompositionsMain, - BabelMain, - ], options: AngularEnvOptions): Promise { - const angularV10Env = new AngularV10Env( - jestAspect, - compiler, - tester, - eslint, - generator, - isolator, - webpack, - workspace, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - options, - ); - return new AngularV10Main(envs, angularV10Env); - } -} - -AngularV10Aspect.addRuntime(AngularV10Main); diff --git a/scopes/versions/angular-v10/angular-v10.webpack.ts b/scopes/versions/angular-v10/angular-v10.webpack.ts deleted file mode 100644 index e571de6e..00000000 --- a/scopes/versions/angular-v10/angular-v10.webpack.ts +++ /dev/null @@ -1,241 +0,0 @@ -import { BuilderContext } from '@angular-devkit/architect'; -import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; -import { - getBrowserConfig, - getCommonConfig, - getStatsConfig, - getStylesConfig, - getAotConfig, - getNonAotConfig -} from '@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs'; -import { - WebpackConfigOptions -} from '@angular-devkit/build-angular/src/angular-cli-files/models/build-options'; -import { - OutputHashing, - Schema as BrowserBuilderSchema -} from '@angular-devkit/build-angular/src/browser/schema'; -import { buildServerConfig } from '@angular-devkit/build-angular/src/dev-server'; -import { normalizeBrowserSchema } from '@angular-devkit/build-angular/src/utils'; -import { generateEntryPoints } from '@angular-devkit/build-angular/src/angular-cli-files/utilities/package-chunk-sort'; -import { - BrowserWebpackConfigOptions, - generateWebpackConfig, - getIndexOutputFile -} from '@angular-devkit/build-angular/src/utils/webpack-browser-config'; -import { IndexHtmlWebpackPlugin } from '@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin'; -import { getSystemPath, logging, normalize, tags } from '@angular-devkit/core'; -import { NodeJsSyncHost } from '@angular-devkit/core/node'; -import { - AngularBaseWebpack, - AngularEnvOptions, - WebpackConfig, - WebpackSetup -} from '@teambit/angular-base'; -import { BundlerContext, DevServerContext } from '@teambit/bundler'; -import { Logger } from '@teambit/logger'; -import { WebpackConfigWithDevServer, WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import { PkgMain } from '@teambit/pkg'; -import path, { join } from 'path'; -import webpack from 'webpack'; -import WsDevServer, { addDevServerEntrypoints } from 'webpack-dev-server'; -import { AngularV10Aspect } from './angular-v10.aspect'; -import { webpack4BuildConfigFactory } from './webpack/webpack4.build.config'; -import { webpack4ServeConfigFactory } from './webpack/webpack4.serve.config'; -import { ApplicationMain } from '@teambit/application'; - -function getCompilerConfig(wco: WebpackConfigOptions): WebpackConfig { - if (wco.buildOptions.main || wco.buildOptions.polyfills) { - return wco.buildOptions.aot ? getAotConfig(wco) : getNonAotConfig(wco); - } - - return {}; -} - -export class AngularV10Webpack extends AngularBaseWebpack { - enableIvy = true; - webpackDevServer = WsDevServer; - webpackServeConfigFactory = webpack4ServeConfigFactory; - webpackBuildConfigFactory = webpack4BuildConfigFactory; - webpack: typeof webpack; - - constructor(workspace: Workspace | undefined, webpackMain: WebpackMain, pkg: PkgMain, application: ApplicationMain, ngEnvOptions: AngularEnvOptions) { - super(workspace, webpackMain, pkg, application, AngularV10Aspect as any, ngEnvOptions); - // resolving to the webpack used by angular devkit to avoid multiple instances of webpack - // otherwise, if we use a different version, it would break - const buildAngular = require.resolve('@angular-devkit/build-angular'); - const webpackPath = require.resolve('webpack', { paths: [buildAngular] }); - this.webpack = require(webpackPath); - } - - /** - * Migrate options from webpack-dev-server 3 to 4 - */ - private migrateConfiguration(webpackConfig: WebpackConfig): WebpackConfigWithDevServer | WebpackConfig { - /** - * Removed contentBase in favor of the static option - */ - // @ts-ignore - delete webpackConfig.devServer.contentBase; - - return webpackConfig; - } - - async getWebpackConfig( - context: DevServerContext | BundlerContext, - entryFiles: string[], - tsconfigPath: string, - workspaceRoot: string, - logger: Logger, - setup: WebpackSetup, - webpackOptions: Partial = {}, - angularOptions: Partial = {}, - sourceRoot = 'src', - ): Promise { - // Options from angular.json - const browserOptions: BrowserBuilderOptions = { - ...angularOptions, - baseHref: path.posix.join('/', context.rootPath!, context.publicPath!), - preserveSymlinks: false, - outputPath: 'public', // doesn't matter because it will be deleted from the config - index: angularOptions.index ?? join(sourceRoot, `index.html`), - main: angularOptions.main ?? join(sourceRoot, `main.ts`), - polyfills: angularOptions.polyfills ?? join(sourceRoot, `polyfills.ts`), - tsConfig: angularOptions.tsConfig ?? tsconfigPath, - assets: [...new Set([path.posix.join(sourceRoot, `favicon.ico`), path.posix.join(sourceRoot, `assets`), ...(angularOptions.assets ?? [])])], // using set to remove duplicates - styles: [...new Set([path.posix.join(sourceRoot, `styles.scss`), ...(angularOptions.styles ?? [])])], // using set to remove duplicates - scripts: angularOptions.scripts, - vendorChunk: angularOptions.vendorChunk ?? true, - namedChunks: angularOptions.namedChunks ?? true, - optimization: angularOptions.optimization ?? setup === WebpackSetup.Build, - buildOptimizer: angularOptions.buildOptimizer ?? setup === WebpackSetup.Build, - aot: angularOptions.aot ?? true, - deleteOutputPath: angularOptions.deleteOutputPath ?? true, - sourceMap: angularOptions.sourceMap ?? true, - outputHashing: angularOptions.outputHashing ?? (setup === WebpackSetup.Build ? OutputHashing.All : OutputHashing.None), - watch: setup === WebpackSetup.Serve, - allowedCommonJsDependencies: ['dompurify', '@teambit/harmony', 'graphql', '@teambit/documenter.ng.content.copy-box', ...(angularOptions.allowedCommonJsDependencies || [])], - }; - - const normalizedWorkspaceRoot = normalize(workspaceRoot); - const projectRoot = normalize(''); - const normalizedSourceRoot = normalize(sourceRoot); - - const host = new NodeJsSyncHost(); - const normalizedOptions = normalizeBrowserSchema(host, normalizedWorkspaceRoot, projectRoot, normalizedSourceRoot, { - ...browserOptions, - ...(webpackOptions as Partial), - }); - - const loggerApi = { - createChild: () => logger as any, - ...logger, - log: logger.console, - } as any as logging.LoggerApi; - - const webpackConfig: any = await generateWebpackConfig( - {builder: { - builderName: 'browser' - }} as BuilderContext, - getSystemPath(normalizedWorkspaceRoot), - getSystemPath(projectRoot), - getSystemPath(normalizedSourceRoot), - normalizedOptions, - (wco: BrowserWebpackConfigOptions) => [ - getCommonConfig(wco), - getBrowserConfig(wco), - getStylesConfig(wco), - getStatsConfig(wco), - getCompilerConfig(wco), - ], - loggerApi - ); - - if(setup === WebpackSetup.Serve) { - webpackConfig.devServer = buildServerConfig( - normalizedWorkspaceRoot, - webpackOptions as DevServerBuilderOptions, - browserOptions, - loggerApi - ); - } - - // Add bit generated files to the list of entries - webpackConfig.entry.main.unshift(...entryFiles); - - // @ts-ignore - if (webpackOptions.liveReload && !webpackOptions.hmr) { - // This is needed because we cannot use the inline option directly in the config - // because of the SuppressExtractedTextChunksWebpackPlugin - // Consider not using SuppressExtractedTextChunksWebpackPlugin when liveReload is enable. - // tslint:disable-next-line: no-any - addDevServerEntrypoints(webpackConfig as any, { - ...(webpackConfig as any).devServer, - inline: true, - }); - - // Remove live-reload code from all entrypoints but not main. - // Otherwise this will break SuppressExtractedTextChunksWebpackPlugin because - // 'addDevServerEntrypoints' adds additional entry-points to all entries. - if ( - webpackConfig.entry && - typeof webpackConfig.entry === 'object' && - !Array.isArray(webpackConfig.entry) && - webpackConfig.entry.main - ) { - for (const [key, value] of Object.entries(webpackConfig.entry)) { - if (key === 'main' || !Array.isArray(value)) { - // eslint-disable-next-line no-continue - continue; - } - - const webpackClientScriptIndex = value.findIndex((x) => x.includes('webpack-dev-server/client/index.js')); - if (webpackClientScriptIndex >= 0) { - // Remove the webpack-dev-server/client script from array. - value.splice(webpackClientScriptIndex, 1); - } - } - } - } - - // @ts-ignore - if (webpackOptions.hmr) { - logger.warn(tags.stripIndents`NOTICE: Hot Module Replacement (HMR) is enabled for the dev server. - See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`); - } - - const { scripts = [], styles = [] } = browserOptions; - const entrypoints = generateEntryPoints({ scripts, styles }); - if (!webpackConfig.plugins) { - webpackConfig.plugins = []; - } - webpackConfig.plugins.push( - new IndexHtmlWebpackPlugin({ - input: path.resolve(workspaceRoot, browserOptions.index as string), - output: getIndexOutputFile(browserOptions), - baseHref: browserOptions.baseHref || '/', - entrypoints, - moduleEntrypoints: [], - noModuleEntrypoints: ['polyfills-es5'], - deployUrl: browserOptions.deployUrl, - sri: browserOptions.subresourceIntegrity, - crossOrigin: browserOptions.crossOrigin, - lang: 'en-US', // TODO(ocombe) support locale - }) - ); - - // don't use the output path from angular - delete webpackConfig?.output?.path; - delete webpackConfig?.resolve?.modules; - webpackConfig.stats = 'errors-only'; - webpackConfig.context = workspaceRoot; - - if (setup === WebpackSetup.Serve) { - return this.migrateConfiguration(webpackConfig); - } - - - return webpackConfig; - } -} diff --git a/scopes/versions/angular-v10/component.json b/scopes/versions/angular-v10/component.json deleted file mode 100644 index 6c29d54e..00000000 --- a/scopes/versions/angular-v10/component.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "componentId": { - "name": "versions/angular-v10" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-v10", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@angular-devkit/architect": "~0.1002.3", - "@angular-devkit/build-angular": "~0.1002.3", - "@angular-devkit/build-optimizer": "~0.1002.3", - "@angular-devkit/build-webpack": "~0.1002.3", - "@angular-devkit/core": "~10.2.3", - "@angular-devkit/schematics": "~10.2.3", - "@angular-eslint/eslint-plugin": "^1.2.0", - "@angular-eslint/eslint-plugin-template": "^1.2.0", - "@angular-eslint/template-parser": "^1.2.0", - "@angular/animations": "~10.2.5", - "@angular/common": "~10.2.5", - "@angular/compiler": "~10.2.5", - "@angular/compiler-cli": "~10.2.5", - "@angular/core": "~10.2.5", - "@angular/elements": "~10.2.5", - "@angular/forms": "~10.2.5", - "@angular/platform-browser": "~10.2.5", - "@angular/platform-browser-dynamic": "~10.2.5", - "@angular/router": "~10.2.5", - "@ngtools/webpack": "~10.2.3", - "@types/remark-prism": "~1.3.0", - "@types/webpack-dev-server": "~3.11.2", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", - "eslint": "7.26.0", - "eslint-plugin-import": "^2.23.4", - "eslint-plugin-jsdoc": "^35.5.1", - "eslint-plugin-prefer-arrow": "^1.2.3", - "html-loader": "~1.3.2", - "jest": "~27.0.4", - "jest-preset-angular": "~10.0.1", - "ng-packagr": "~10.1.2", - "remark": "~13.0.0", - "remark-frontmatter": "~3.0.0", - "remark-html": "13.0.1", - "remark-loader": "~2.0.0", - "remark-prism": "~1.3.6", - "rxjs": "^6.6.3", - "ts-node": "~8.3.0", - "tslib": "^2.0.0", - "typescript": "~4.0.2", - "webpack": "~4.44.2", - "webpack-dev-middleware": "~3.7.2", - "webpack-dev-server": "~3.11.2", - "zone.js": "~0.10.3" - } - } - } - } -} diff --git a/scopes/versions/angular-v10/index.ts b/scopes/versions/angular-v10/index.ts deleted file mode 100644 index 1a48fcda..00000000 --- a/scopes/versions/angular-v10/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { AngularV10Main } from './angular-v10.main.runtime'; -export { AngularV10Env } from './angular-v10.env'; -export { AngularV10Aspect, AngularV10Aspect as default } from './angular-v10.aspect'; diff --git a/scopes/versions/angular-v10/jest/jest.config.js b/scopes/versions/angular-v10/jest/jest.config.js deleted file mode 100644 index 519f8631..00000000 --- a/scopes/versions/angular-v10/jest/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - preset: 'jest-preset-angular', - reporters: ['default'], - setupFilesAfterEnv: [require.resolve('./setup-jest.js')], - transformIgnorePatterns: ['node_modules/(?!(jest-test))'], - testPathIgnorePatterns: ['/.*/e2e/'], - globals: { - 'ts-jest': { - tsconfig: require.resolve('./tsconfig.spec.json'), - }, - }, - moduleNameMapper: { - // map angular modules to the root node_modules to avoid duplicated modules - "(@angular\/animations.*)$": "/node_modules/$1", - "(@angular\/common.*)$": "/node_modules/$1", - "(@angular\/compiler.*)$": "/node_modules/$1", - "(@angular\/compiler-cli.*)$": "/node_modules/$1", - "(@angular\/core.*)$": "/node_modules/$1", - "(@angular\/forms.*)$": "/node_modules/$1", - "(@angular\/platform-browser.*)$": "/node_modules/$1", - "(@angular\/platform-browser-dynamic.*)$": "/node_modules/$1", - "(@angular\/router.*)$": "/node_modules/$1", - } -}; diff --git a/scopes/versions/angular-v10/webpack/webpack4.build.config.ts b/scopes/versions/angular-v10/webpack/webpack4.build.config.ts deleted file mode 100644 index b8aaa8b5..00000000 --- a/scopes/versions/angular-v10/webpack/webpack4.build.config.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { AngularEnvOptions, BitDedupeModuleResolvePlugin, WebpackConfig } from '@teambit/angular-base'; -import { sep } from 'path'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -// TODO(ocombe): this is webpack 5 build config, not webpack 4 -export function webpack4BuildConfigFactory( - entryFiles: string[], - outputPath: string, - nodeModulesPaths: string[], - workspaceDir: string, - tempFolder: string, - plugins: any[] = [], - ngEnvOptions: AngularEnvOptions, -): WebpackConfig { - const config = { - mode: 'production', - // Stop compilation early in production - bail: true, - // These are the "entry points" to our application. - // This means they will be the "root" imports that are included in JS bundle. - entry: entryFiles, - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // The build folder. - path: `${outputPath}${sep}public`, - - // publicPath: ``, - - // @ts-ignore - futureEmitAssets: true, - - filename: 'static/js/[name].[contenthash:8].js', - - // There are also additional JS chunk files if you use code splitting. - chunkFilename: 'static/js/[name].[contenthash:8].chunk.js', - - // webpack uses `publicPath` to determine where the app is being served from. - // It requires a trailing slash, or the file assets will get an incorrect path. - // We inferred the "public path" (such as / or /my-project) from homepage. - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - path: require.resolve('path-browserify'), - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - ...plugins - ] - }; - - return config as WebpackConfig; -} diff --git a/scopes/versions/angular-v10/webpack/webpack4.serve.config.ts b/scopes/versions/angular-v10/webpack/webpack4.serve.config.ts deleted file mode 100644 index 8a583f29..00000000 --- a/scopes/versions/angular-v10/webpack/webpack4.serve.config.ts +++ /dev/null @@ -1,183 +0,0 @@ -import { AngularEnvOptions, BitDedupeModuleResolvePlugin } from '@teambit/angular-base'; -import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; -import { PubsubMain } from '@teambit/pubsub'; -import { fallbacksAliases, WebpackBitReporterPlugin } from '@teambit/webpack'; -import path from 'path'; -import errorOverlayMiddleware from 'react-dev-utils/errorOverlayMiddleware'; -import evalSourceMapMiddleware from 'react-dev-utils/evalSourceMapMiddleware'; -import getPublicUrlOrPath from 'react-dev-utils/getPublicUrlOrPath'; -import noopServiceWorkerMiddleware from 'react-dev-utils/noopServiceWorkerMiddleware'; -import redirectServedPath from 'react-dev-utils/redirectServedPathMiddleware'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -const sockHost = process.env.WDS_SOCKET_HOST; -const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node' -const sockPort = process.env.WDS_SOCKET_PORT; - -const publicUrlOrPath = getPublicUrlOrPath(process.env.NODE_ENV === 'development', '/', '/public'); - -export function webpack4ServeConfigFactory( - devServerID: string, - workspaceDir: string, - entryFiles: string[], - publicRoot: string, - publicPath: string, - pubsub: PubsubMain, - nodeModulesPaths: string[], - tempFolder: string, - plugins: any[] = [], - // eslint-disable-next-line @typescript-eslint/no-unused-vars - isApp = false, - ngEnvOptions: AngularEnvOptions, -): any { - const resolveWorkspacePath = (relativePath: string) => path.resolve(workspaceDir, relativePath); - - // Host - const host = process.env.HOST || 'localhost'; - - // Required for babel-preset-react-app - process.env.NODE_ENV = 'development'; - - const publicDirectory = path.posix.join(publicRoot, publicPath); - - return { - // Environment mode - mode: 'development', - - devtool: 'inline-source-map', - - // Entry point of app - entry: entryFiles.map((filePath) => resolveWorkspacePath(filePath)), - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // Development filename output - filename: 'static/js/[name].bundle.js', - - pathinfo: true, - - path: resolveWorkspacePath(publicDirectory), - - // publicPath: `/${publicRoot}/`, - - // @ts-ignore - futureEmitAssets: true, - - chunkFilename: 'static/js/[name].chunk.js', - - // point sourcemap entries to original disk locations (format as URL on windows) - devtoolModuleFilenameTemplate: (info: any) => pathNormalizeToLinux(path.resolve(info.absoluteResourcePath)), - - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - devServer: { - quiet: true, - stats: 'errors-only', - - // Serve index.html as the base - contentBase: resolveWorkspacePath(publicDirectory), - - // By default files from `contentBase` will not trigger a page reload. - watchContentBase: false, - - contentBasePublicPath: publicDirectory, - - // Enable compression - compress: true, - - // Use 'ws' instead of - // 'sockjs-node' on server since we're using native - // websockets in `webpackHotDevClient`. - transportMode: 'ws', - - injectClient: false, - - overlay: false, - // Enable hot reloading - hot: false, - - host, - - historyApiFallback: { - disableDotRule: true, - index: resolveWorkspacePath(publicDirectory), - }, - - sockHost, - sockPath, - sockPort, - - before(app: any, server: any) { - // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware` - // middlewares before `redirectServedPath` otherwise will not have any effect - // This lets us fetch source contents from webpack for the error overlay - app.use(evalSourceMapMiddleware(server)); - // This lets us open files from the runtime error overlay. - app.use(errorOverlayMiddleware()); - }, - - after(app: any) { - // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match - app.use(redirectServedPath(publicUrlOrPath)); - - // This service worker file is effectively a 'no-op' that will reset any - // previous service worker registered for the same host:port combination. - // We do this in development to avoid hitting the production cache if - // it used the same host and port. - // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432 - app.use(noopServiceWorkerMiddleware(publicUrlOrPath)); - }, - - // Public path is root of content base - publicPath: path.join('/', publicRoot), - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - ...fallbacksAliases, - path: require.resolve('path-browserify') - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - new WebpackBitReporterPlugin({ - options: { pubsub, devServerID }, - }), - ...plugins - ], - }; -} diff --git a/scopes/versions/angular-v11/angular-v11.aspect.ts b/scopes/versions/angular-v11/angular-v11.aspect.ts deleted file mode 100644 index c18a5ca7..00000000 --- a/scopes/versions/angular-v11/angular-v11.aspect.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Aspect } from '@teambit/harmony'; - -export const AngularV11Aspect = Aspect.create({ - id: 'teambit.angular/versions/angular-v11', -}); diff --git a/scopes/versions/angular-v11/angular-v11.docs.md b/scopes/versions/angular-v11/angular-v11.docs.md deleted file mode 100644 index e2b76f6a..00000000 --- a/scopes/versions/angular-v11/angular-v11.docs.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -Adds Angular v11 support to your Bit workspace. - -**This is a legacy version of the Angular env. It is recommended to use the latest version of the Angular env instead.** - -# Angular Overview -`teambit.angular/versions/angular-v11` is a pre-built [Env](https://bit.dev/docs/envs/envs-overview) for building components and apps with Angular. -It enables you to quickly set up a dev environment that follows best practices for Angular component development. - -## Using the Angular env -### In a new workspace -To use the Angular Env, the easiest way is to create a new pre-configured workspace with the workspace generator: -```bash -bit new ng-workspace -a teambit.angular/versions/angular-v11 -``` - -Change directory to the newly created workspace -```bash -cd -``` - -Create a bit component: -```bash -bit create ng-module ui/my-button -``` - -Install dependencies: -```bash -bit install -``` - -Start the dev server -```bash -bit start -``` - -Open-up your browser on localhost:3000, or any other available port, and display your workspace with your components. - -### In an existing Bit workspace -First you need to make sure that you're using yarn (in your workspace.jsonc, search for `packageManager` and replace `pnpm` by `yarn` if needed), -then add the Angular env to your workspace.jsonc with the following command: - -```bash -bit use teambit.angular/versions/angular-v11 -``` - -You can now create a new component that uses the Angular env: -```bash -bit create ng-module --env teambit.angular/versions/angular-v11 -``` - -And finally you need to install the dependencies: -```bash -bit install -``` - -## Creating Components -The Angular env provides a set of component templates that can be used to speed up and standardize your component development: - -To list all available templates, use the following command: -```bash -bit templates -``` - -- `ng-module` a generic Angular module. -- `ng-env` boilerplate for a customized environment configuration. -- `ng-app` an Angular application. - -Use any of these templates with the `bit create` command: -```bash -bit create --env teambit.angular/versions/angular-v11 -``` - -## Angular versions -The Angular env (teambit.angular/angular) uses the latest stable version of Angular and its dependencies. -Whenever a new major version of Angular is released, a new major version of the Angular env is created. - -If you want to use a specific version of Angular, you can use one those env versions instead of `teambit.angular/angular`: -- [v8: `teambit.angular/versions/angular-v8`](https://bit.cloud/teambit/angular/versions/angular-v8) -- [v9: `teambit.angular/versions/angular-v9`](https://bit.cloud/teambit/angular/versions/angular-v9) -- [v10: `teambit.angular/versions/angular-v10`](https://bit.cloud/teambit/angular/versions/angular-v10) -- [v11: `teambit.angular/versions/angular-v11`](https://bit.cloud/teambit/angular/versions/angular-v11) -- [v12: `teambit.angular/versions/angular-v12`](https://bit.cloud/teambit/angular/versions/angular-v12) -- [v13: `teambit.angular/versions/angular-v13`](https://bit.cloud/teambit/angular/versions/angular-v13) -- [v14: `teambit.angular/versions/angular-v14`](https://bit.cloud/teambit/angular/versions/angular-v14) -- [v15: `teambit.angular/versions/angular-v15`](https://bit.cloud/teambit/angular/versions/angular-v15) - -You can quickly switch between these versions with the `bit env set` command. For example to use v14 instead of the default, you would use the following command: -```bash -bit env replace teambit.angular/angular teambit.angular/angular-v15 -``` - -## Angular applications -You can use the Angular env to create an Angular application with the following command: -```bash -bit create ng-app --env teambit.angular/versions/angular-v11 -``` - -To run your application in dev mode, use the following command: -```bash -bit run -``` - -### Configure your application -Your app component can be configured with different options for serve, build and deployment. -Open the configuration file named `.ng-app.ts` that is located in your app folder. - -You can change the default configuration by editing the different options, such as app name, port, source folder, serve, build, deploy options, etc. -See the [apps documentation](https://bit.dev/docs/apps/apps-overview) for more information. diff --git a/scopes/versions/angular-v11/angular-v11.env.ts b/scopes/versions/angular-v11/angular-v11.env.ts deleted file mode 100644 index 958a2e4f..00000000 --- a/scopes/versions/angular-v11/angular-v11.env.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { AngularBaseEnv, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationMain } from '@teambit/application'; -import { AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelMain } from '@teambit/babel'; -import { CompilerMain } from '@teambit/compiler'; -import { CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvDescriptor } from '@teambit/envs'; -import { ESLintMain } from '@teambit/eslint'; -import { GeneratorMain } from '@teambit/generator'; -import { IsolatorMain } from '@teambit/isolator'; -import { JestMain } from '@teambit/jest'; -import { LoggerMain } from '@teambit/logger'; -import { PkgMain } from '@teambit/pkg'; -import { ReactMain } from '@teambit/react'; -import { TesterMain } from '@teambit/tester'; -import { WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import { AngularV11Aspect } from './angular-v11.aspect'; -import { AngularV11Webpack } from './angular-v11.webpack'; - -/** - * a component environment built for [Angular](https://angular.io). - */ -export class AngularV11Env extends AngularBaseEnv { - name = 'Angular-v11'; - angularWebpack: AngularV11Webpack; - ngPackagr = require.resolve('ng-packagr'); - elements = null; - readDefaultTsConfig = require.resolve('ng-packagr/lib/ts/tsconfig'); - jestConfigPath = require.resolve('./jest/jest.config'); - jestModulePath = require.resolve('jest'); - - constructor( - jestAspect: JestMain, - compiler: CompilerMain, - tester: TesterMain, - eslint: ESLintMain, - generator: GeneratorMain, - isolator: IsolatorMain, - private webpackMain: WebpackMain, - protected workspace: Workspace | undefined, - private pkg: PkgMain, - application: ApplicationMain, - aspectLoader: AspectLoaderMain, - dependencyResolver: DependencyResolverMain, - private react: ReactMain, - loggerMain: LoggerMain, - compositions: CompositionsMain, - babel: BabelMain, - options: AngularEnvOptions, - ) { - super(jestAspect, compiler, tester, eslint, isolator, workspace, generator, application, aspectLoader, dependencyResolver, loggerMain, compositions, babel, options); - this.angularWebpack = new AngularV11Webpack(this.workspace, this.webpackMain, this.pkg, application, this.getNgEnvOptions()); - } - - /** - * Returns the Environment descriptor - * Required for any task - */ - async __getDescriptor(): Promise { - return { - type: 'angular-v11', - }; - } - - /** - * Required for `bit start` - */ - getDevEnvId(id?: string) { - if (typeof id !== 'string') return AngularV11Aspect.id; - return id || AngularV11Aspect.id; - } - - /** - * Returns the list of dependencies - * Required for any task - */ - async getDependencies() { - return { - dependencies: { - '@angular/common': '-', - '@angular/core': '-', - 'tslib': '^2.0.0', - 'rxjs': '-', - 'zone.js': '-', - }, - devDependencies: { - '@angular/compiler': '~11.2.14', - '@angular/compiler-cli': '~11.2.14', - '@types/jest': '~27.0.2', - '@types/node': '^12.11.1', - 'jest': '~27.0.4', - 'jest-preset-angular': '~10.0.1', - 'typescript': '-', - }, - peerDependencies: { - '@angular/common': '~11.2.14', - '@angular/core': '~11.2.14', - '@angular/platform-browser': '~11.2.14', - '@angular/platform-browser-dynamic': '~11.2.14', - 'rxjs': '^6.6.3', - 'zone.js': '~0.11.4', - 'typescript': '~4.1.5', - }, - }; - } -} diff --git a/scopes/versions/angular-v11/angular-v11.main.runtime.ts b/scopes/versions/angular-v11/angular-v11.main.runtime.ts deleted file mode 100644 index b259ebc7..00000000 --- a/scopes/versions/angular-v11/angular-v11.main.runtime.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { AngularBaseMain, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationAspect, ApplicationMain } from '@teambit/application'; -import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelAspect, BabelMain } from '@teambit/babel'; -import { MainRuntime } from '@teambit/cli'; -import { CompilerAspect, CompilerMain } from '@teambit/compiler'; -import { CompositionsAspect, CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvsAspect, EnvsMain } from '@teambit/envs'; -import { ESLintAspect, ESLintMain } from '@teambit/eslint'; -import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; -import { IsolatorAspect, IsolatorMain } from '@teambit/isolator'; -import { JestAspect, JestMain } from '@teambit/jest'; -import { LoggerAspect, LoggerMain } from '@teambit/logger'; -import { PkgAspect, PkgMain } from '@teambit/pkg'; -import { ReactAspect, ReactMain } from '@teambit/react'; -import { TesterAspect, TesterMain } from '@teambit/tester'; -import { WebpackAspect, WebpackMain } from '@teambit/webpack'; -import { Workspace, WorkspaceAspect } from '@teambit/workspace'; -import { AngularV11Aspect } from './angular-v11.aspect'; -import { AngularV11Env } from './angular-v11.env'; - -export class AngularV11Main extends AngularBaseMain { - static slots = []; - static runtime: any = MainRuntime; - static dependencies: any = [ - JestAspect, - CompilerAspect, - TesterAspect, - ESLintAspect, - GeneratorAspect, - WebpackAspect, - WorkspaceAspect, - EnvsAspect, - IsolatorAspect, - PkgAspect, - ApplicationAspect, - AspectLoaderAspect, - DependencyResolverAspect, - ReactAspect, - LoggerAspect, - CompositionsAspect, - BabelAspect, - ]; - - static async provider([ - jestAspect, - compiler, - tester, - eslint, - generator, - webpack, - workspace, - envs, - isolator, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - ]: [ - JestMain, - CompilerMain, - TesterMain, - ESLintMain, - GeneratorMain, - WebpackMain, - Workspace | undefined, - EnvsMain, - IsolatorMain, - PkgMain, - ApplicationMain, - AspectLoaderMain, - DependencyResolverMain, - ReactMain, - LoggerMain, - CompositionsMain, - BabelMain, - ], options: AngularEnvOptions): Promise { - const angularV11Env = new AngularV11Env( - jestAspect, - compiler, - tester, - eslint, - generator, - isolator, - webpack, - workspace, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - options, - ); - return new AngularV11Main(envs, angularV11Env); - } -} - -AngularV11Aspect.addRuntime(AngularV11Main); diff --git a/scopes/versions/angular-v11/angular-v11.webpack.ts b/scopes/versions/angular-v11/angular-v11.webpack.ts deleted file mode 100644 index f2460b56..00000000 --- a/scopes/versions/angular-v11/angular-v11.webpack.ts +++ /dev/null @@ -1,225 +0,0 @@ -import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; -import { getCompilerConfig } from '@angular-devkit/build-angular/src/browser'; -import { - OutputHashing, - Schema as BrowserBuilderSchema -} from '@angular-devkit/build-angular/src/browser/schema'; -import { - BuildBrowserFeatures, - normalizeBrowserSchema, - normalizeOptimization -} from '@angular-devkit/build-angular/src/utils'; -import { generateEntryPoints } from '@angular-devkit/build-angular/src/utils/package-chunk-sort'; -import { - BrowserWebpackConfigOptions, - generateWebpackConfig, - getIndexOutputFile -} from '@angular-devkit/build-angular/src/utils/webpack-browser-config'; -import { - getBrowserConfig, - getCommonConfig, - getDevServerConfig, - getStatsConfig, - getStylesConfig -} from '@angular-devkit/build-angular/src/webpack/configs'; -import { - IndexHtmlWebpackPlugin -} from '@angular-devkit/build-angular/src/webpack/plugins/index-html-webpack-plugin'; -import { getSystemPath, logging, normalize, tags } from '@angular-devkit/core'; -import { - AngularBaseWebpack, - AngularEnvOptions, - WebpackConfig, - WebpackSetup -} from '@teambit/angular-base'; -import { ApplicationMain } from '@teambit/application'; -import { BundlerContext, DevServerContext } from '@teambit/bundler'; -import { Logger } from '@teambit/logger'; -import { PkgMain } from '@teambit/pkg'; -import { WebpackConfigWithDevServer, WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import path, { join } from 'path'; -import webpack from 'webpack'; -import WsDevServer, { addDevServerEntrypoints } from 'webpack-dev-server'; -import { AngularV11Aspect } from './angular-v11.aspect'; -import { webpack4BuildConfigFactory } from './webpack/webpack4.build.config'; -import { webpack4ServeConfigFactory } from './webpack/webpack4.serve.config'; - -export class AngularV11Webpack extends AngularBaseWebpack { - enableIvy = true; - webpackDevServer = WsDevServer; - webpackServeConfigFactory = webpack4ServeConfigFactory; - webpackBuildConfigFactory = webpack4BuildConfigFactory; - webpack: typeof webpack; - - constructor(workspace: Workspace | undefined, webpackMain: WebpackMain, pkg: PkgMain, application: ApplicationMain, ngEnvOptions: AngularEnvOptions) { - super(workspace, webpackMain, pkg, application, AngularV11Aspect as any, ngEnvOptions); - // resolving to the webpack used by angular devkit to avoid multiple instances of webpack - // otherwise, if we use a different version, it would break - const buildAngular = require.resolve('@angular-devkit/build-angular'); - const webpackPath = require.resolve('webpack', { paths: [buildAngular] }); - this.webpack = require(webpackPath); - } - - /** - * Migrate options from webpack-dev-server 3 to 4 - */ - private migrateConfiguration(webpackConfig: WebpackConfig): WebpackConfigWithDevServer | WebpackConfig { - /** - * Removed contentBase in favor of the static option - */ - // @ts-ignore - delete webpackConfig.devServer.contentBase; - - return webpackConfig; - } - - async getWebpackConfig( - context: DevServerContext | BundlerContext, - entryFiles: string[], - tsconfigPath: string, - workspaceRoot: string, - logger: Logger, - setup: WebpackSetup, - webpackOptions: Partial = {}, - angularOptions: Partial = {}, - sourceRoot = 'src', - ): Promise { - // Options from angular.json - const browserOptions: BrowserBuilderOptions = { - ...angularOptions, - baseHref: path.posix.join('/', context.rootPath!, context.publicPath!), - preserveSymlinks: false, - outputPath: 'public', // doesn't matter because it will be deleted from the config - index: angularOptions.index ?? join(sourceRoot, `index.html`), - main: angularOptions.main ?? join(sourceRoot, `main.ts`), - polyfills: angularOptions.polyfills ?? join(sourceRoot, `polyfills.ts`), - tsConfig: angularOptions.tsConfig ?? tsconfigPath, - assets: [...new Set([path.posix.join(sourceRoot, `favicon.ico`), path.posix.join(sourceRoot, `assets`), ...(angularOptions.assets ?? [])])], // using set to remove duplicates - styles: [...new Set([path.posix.join(sourceRoot, `styles.scss`), ...(angularOptions.styles ?? [])])], // using set to remove duplicates - scripts: angularOptions.scripts, - vendorChunk: angularOptions.vendorChunk ?? true, - namedChunks: angularOptions.namedChunks ?? true, - optimization: angularOptions.optimization ?? setup === WebpackSetup.Build, - buildOptimizer: angularOptions.buildOptimizer ?? setup === WebpackSetup.Build, - aot: angularOptions.aot ?? true, - deleteOutputPath: angularOptions.deleteOutputPath ?? true, - sourceMap: angularOptions.sourceMap ?? true, - outputHashing: angularOptions.outputHashing ?? (setup === WebpackSetup.Build ? OutputHashing.All : OutputHashing.None), - watch: setup === WebpackSetup.Serve, - allowedCommonJsDependencies: ['dompurify', '@teambit/harmony', 'graphql', '@teambit/documenter.ng.content.copy-box', ...(angularOptions.allowedCommonJsDependencies || [])], - }; - - const normalizedWorkspaceRoot = normalize(workspaceRoot); - const projectRoot = normalize(''); - const normalizedSourceRoot = normalize(sourceRoot); - - const normalizedOptions = normalizeBrowserSchema(normalizedWorkspaceRoot, projectRoot, normalizedSourceRoot, { - ...browserOptions, - ...(webpackOptions as Partial), - }); - - const loggerApi = { - createChild: () => logger as any, - ...logger, - log: logger.console, - } as any as logging.LoggerApi; - - const webpackConfig: any = await generateWebpackConfig( - getSystemPath(normalizedWorkspaceRoot), - getSystemPath(projectRoot), - getSystemPath(normalizedSourceRoot), - normalizedOptions, - (wco: BrowserWebpackConfigOptions) => [ - setup === WebpackSetup.Serve ? getDevServerConfig(wco) : {}, - getCommonConfig(wco), - getBrowserConfig(wco), - getStylesConfig(wco), - getStatsConfig(wco), - getCompilerConfig(wco), - ], - loggerApi, - {} - ); - - // Add bit generated files to the list of entries - webpackConfig.entry.main.unshift(...entryFiles); - - // @ts-ignore - if (webpackOptions.liveReload && !webpackOptions.hmr) { - // This is needed because we cannot use the inline option directly in the config - // because of the SuppressExtractedTextChunksWebpackPlugin - // Consider not using SuppressExtractedTextChunksWebpackPlugin when liveReload is enable. - // tslint:disable-next-line: no-any - addDevServerEntrypoints(webpackConfig as any, { - ...(webpackConfig as any).devServer, - inline: true, - }); - - // Remove live-reload code from all entrypoints but not main. - // Otherwise this will break SuppressExtractedTextChunksWebpackPlugin because - // 'addDevServerEntrypoints' adds additional entry-points to all entries. - if ( - webpackConfig.entry && - typeof webpackConfig.entry === 'object' && - !Array.isArray(webpackConfig.entry) && - webpackConfig.entry.main - ) { - for (const [key, value] of Object.entries(webpackConfig.entry)) { - if (key === 'main' || !Array.isArray(value)) { - // eslint-disable-next-line no-continue - continue; - } - - const webpackClientScriptIndex = value.findIndex((x) => x.includes('webpack-dev-server/client/index.js')); - if (webpackClientScriptIndex >= 0) { - // Remove the webpack-dev-server/client script from array. - value.splice(webpackClientScriptIndex, 1); - } - } - } - } - - // @ts-ignore - if (webpackOptions.hmr) { - logger.warn(tags.stripIndents`NOTICE: Hot Module Replacement (HMR) is enabled for the dev server. - See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`); - } - - const { scripts = [], styles = [] } = browserOptions; - const buildBrowserFeatures = new BuildBrowserFeatures(workspaceRoot); - const entrypoints = generateEntryPoints({ scripts, styles }); - const normalizedIndex = normalize(browserOptions.index as string); - const normalizedOptimization = normalizeOptimization(browserOptions.optimization); - if (!webpackConfig.plugins) { - webpackConfig.plugins = []; - } - webpackConfig.plugins.push( - new IndexHtmlWebpackPlugin({ - indexPath: path.resolve(workspaceRoot, browserOptions.index as string), - outputPath: getIndexOutputFile(normalizedIndex), - baseHref: browserOptions.baseHref || '/', - entrypoints, - moduleEntrypoints: [], - noModuleEntrypoints: ['polyfills-es5'], - deployUrl: browserOptions.deployUrl, - sri: browserOptions.subresourceIntegrity, - optimization: normalizedOptimization, - WOFFSupportNeeded: !buildBrowserFeatures.isFeatureSupported('woff2'), - crossOrigin: browserOptions.crossOrigin, - lang: 'en-US', // TODO(ocombe) support locale - }) - ); - - // don't use the output path from angular - delete webpackConfig?.output?.path; - delete webpackConfig?.resolve?.modules; - webpackConfig.stats = 'errors-only'; - - if (setup === WebpackSetup.Serve) { - return this.migrateConfiguration(webpackConfig); - } - - return webpackConfig; - } -} diff --git a/scopes/versions/angular-v11/component.json b/scopes/versions/angular-v11/component.json deleted file mode 100644 index 9361f5ab..00000000 --- a/scopes/versions/angular-v11/component.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "componentId": { - "name": "versions/angular-v11" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-v11", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@angular-devkit/architect": "~0.1102.13", - "@angular-devkit/build-angular": "~0.1102.13", - "@angular-devkit/build-optimizer": "~0.1102.13", - "@angular-devkit/build-webpack": "~0.1102.13", - "@angular-devkit/core": "~11.2.13", - "@angular-devkit/schematics": "~11.2.13", - "@angular-eslint/eslint-plugin": "^4.3.0", - "@angular-eslint/eslint-plugin-template": "^4.3.0", - "@angular-eslint/template-parser": "^4.3.0", - "@angular/animations": "~11.2.13", - "@angular/common": "~11.2.14", - "@angular/compiler": "~11.2.14", - "@angular/compiler-cli": "~11.2.14", - "@angular/core": "~11.2.14", - "@angular/elements": "~11.2.14", - "@angular/forms": "~11.2.14", - "@angular/platform-browser": "~11.2.14", - "@angular/platform-browser-dynamic": "~11.2.14", - "@angular/router": "~11.2.14", - "@ngtools/webpack": "~11.2.13", - "@types/react-dev-utils": "~9.0.8", - "@types/remark-prism": "~1.3.0", - "@types/webpack-dev-server": "~3.11.2", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", - "eslint": "7.26.0", - "html-loader": "~1.3.2", - "jest": "~27.0.4", - "jest-preset-angular": "~10.0.1", - "ng-packagr": "~11.2.4", - "path-browserify": "1.0.1", - "remark": "~13.0.0", - "remark-frontmatter": "~3.0.0", - "remark-html": "13.0.1", - "remark-loader": "~2.0.0", - "remark-prism": "~1.3.6", - "rxjs": "^6.6.3", - "tslib": "^2.0.0", - "ts-node": "~8.3.0", - "typescript": "~4.1.5", - "webpack": "~4.44.2", - "webpack-dev-middleware": "~3.7.2", - "webpack-dev-server": "~3.11.2", - "zone.js": "~0.11.4" - } - } - } - } -} diff --git a/scopes/versions/angular-v11/index.ts b/scopes/versions/angular-v11/index.ts deleted file mode 100644 index efe6be28..00000000 --- a/scopes/versions/angular-v11/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { AngularV11Main } from './angular-v11.main.runtime'; -export { AngularV11Env } from './angular-v11.env'; -export { AngularV11Aspect, AngularV11Aspect as default } from './angular-v11.aspect'; diff --git a/scopes/versions/angular-v11/jest/jest.config.js b/scopes/versions/angular-v11/jest/jest.config.js deleted file mode 100644 index 519f8631..00000000 --- a/scopes/versions/angular-v11/jest/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - preset: 'jest-preset-angular', - reporters: ['default'], - setupFilesAfterEnv: [require.resolve('./setup-jest.js')], - transformIgnorePatterns: ['node_modules/(?!(jest-test))'], - testPathIgnorePatterns: ['/.*/e2e/'], - globals: { - 'ts-jest': { - tsconfig: require.resolve('./tsconfig.spec.json'), - }, - }, - moduleNameMapper: { - // map angular modules to the root node_modules to avoid duplicated modules - "(@angular\/animations.*)$": "/node_modules/$1", - "(@angular\/common.*)$": "/node_modules/$1", - "(@angular\/compiler.*)$": "/node_modules/$1", - "(@angular\/compiler-cli.*)$": "/node_modules/$1", - "(@angular\/core.*)$": "/node_modules/$1", - "(@angular\/forms.*)$": "/node_modules/$1", - "(@angular\/platform-browser.*)$": "/node_modules/$1", - "(@angular\/platform-browser-dynamic.*)$": "/node_modules/$1", - "(@angular\/router.*)$": "/node_modules/$1", - } -}; diff --git a/scopes/versions/angular-v11/jest/setup-jest.ts b/scopes/versions/angular-v11/jest/setup-jest.ts deleted file mode 100644 index 1100b3e8..00000000 --- a/scopes/versions/angular-v11/jest/setup-jest.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest-preset-angular/setup-jest'; diff --git a/scopes/versions/angular-v11/jest/tsconfig.spec.json b/scopes/versions/angular-v11/jest/tsconfig.spec.json deleted file mode 100644 index 078e0693..00000000 --- a/scopes/versions/angular-v11/jest/tsconfig.spec.json +++ /dev/null @@ -1,36 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc/spec", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "sourceMap": true, - "declaration": false, - "emitDecoratorMetadata": true, - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "importHelpers": true, - "allowJs": true, - "target": "es2015", - "module": "esnext", - "lib": [ - "es2018", - "dom" - ], - "types": ["jest", "node"] - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true, - "enableIvy": true - }, - "include": ["**/*.spec.+(js|ts)", "**/*.test.+(js|ts)", "**/*.d.ts"] -} diff --git a/scopes/versions/angular-v11/webpack/webpack4.build.config.ts b/scopes/versions/angular-v11/webpack/webpack4.build.config.ts deleted file mode 100644 index b8aaa8b5..00000000 --- a/scopes/versions/angular-v11/webpack/webpack4.build.config.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { AngularEnvOptions, BitDedupeModuleResolvePlugin, WebpackConfig } from '@teambit/angular-base'; -import { sep } from 'path'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -// TODO(ocombe): this is webpack 5 build config, not webpack 4 -export function webpack4BuildConfigFactory( - entryFiles: string[], - outputPath: string, - nodeModulesPaths: string[], - workspaceDir: string, - tempFolder: string, - plugins: any[] = [], - ngEnvOptions: AngularEnvOptions, -): WebpackConfig { - const config = { - mode: 'production', - // Stop compilation early in production - bail: true, - // These are the "entry points" to our application. - // This means they will be the "root" imports that are included in JS bundle. - entry: entryFiles, - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // The build folder. - path: `${outputPath}${sep}public`, - - // publicPath: ``, - - // @ts-ignore - futureEmitAssets: true, - - filename: 'static/js/[name].[contenthash:8].js', - - // There are also additional JS chunk files if you use code splitting. - chunkFilename: 'static/js/[name].[contenthash:8].chunk.js', - - // webpack uses `publicPath` to determine where the app is being served from. - // It requires a trailing slash, or the file assets will get an incorrect path. - // We inferred the "public path" (such as / or /my-project) from homepage. - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - path: require.resolve('path-browserify'), - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - ...plugins - ] - }; - - return config as WebpackConfig; -} diff --git a/scopes/versions/angular-v11/webpack/webpack4.serve.config.ts b/scopes/versions/angular-v11/webpack/webpack4.serve.config.ts deleted file mode 100644 index 34203184..00000000 --- a/scopes/versions/angular-v11/webpack/webpack4.serve.config.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { AngularEnvOptions, BitDedupeModuleResolvePlugin, StatsLoggerPlugin } from '@teambit/angular-base'; -import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; -import { PubsubMain } from '@teambit/pubsub'; -import { fallbacksAliases, WebpackBitReporterPlugin } from '@teambit/webpack'; -import path from 'path'; -import errorOverlayMiddleware from 'react-dev-utils/errorOverlayMiddleware'; -import evalSourceMapMiddleware from 'react-dev-utils/evalSourceMapMiddleware'; -import getPublicUrlOrPath from 'react-dev-utils/getPublicUrlOrPath'; -import noopServiceWorkerMiddleware from 'react-dev-utils/noopServiceWorkerMiddleware'; -import redirectServedPath from 'react-dev-utils/redirectServedPathMiddleware'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -const sockHost = process.env.WDS_SOCKET_HOST; -const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node' -const sockPort = process.env.WDS_SOCKET_PORT; - -const publicUrlOrPath = getPublicUrlOrPath(process.env.NODE_ENV === 'development', '/', '/public'); - -export function webpack4ServeConfigFactory( - devServerID: string, - workspaceDir: string, - entryFiles: string[], - publicRoot: string, - publicPath: string, - pubsub: PubsubMain, - nodeModulesPaths: string[], - tempFolder: string, - plugins: any[] = [], - isApp = false, - ngEnvOptions: AngularEnvOptions, -): any { - const resolveWorkspacePath = (relativePath: string) => path.resolve(workspaceDir, relativePath); - - // Host - const host = process.env.HOST || 'localhost'; - - // Required for babel-preset-react-app - process.env.NODE_ENV = 'development'; - - const publicDirectory = path.posix.join(publicRoot, publicPath); - - if(isApp) { - plugins.push(new StatsLoggerPlugin() as any) - } - - return { - // Environment mode - mode: 'development', - - devtool: 'inline-source-map', - - // Entry point of app - entry: entryFiles.map((filePath) => resolveWorkspacePath(filePath)), - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // Development filename output - filename: 'static/js/[name].bundle.js', - - pathinfo: true, - - path: resolveWorkspacePath(publicDirectory), - - // publicPath: `/${publicRoot}/`, - - // @ts-ignore - futureEmitAssets: true, - - chunkFilename: 'static/js/[name].chunk.js', - - // point sourcemap entries to original disk locations (format as URL on windows) - devtoolModuleFilenameTemplate: (info: any) => pathNormalizeToLinux(path.resolve(info.absoluteResourcePath)), - - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - devServer: { - quiet: true, - stats: 'errors-only', - - // Serve index.html as the base - contentBase: resolveWorkspacePath(publicDirectory), - - // By default files from `contentBase` will not trigger a page reload. - watchContentBase: false, - - contentBasePublicPath: publicDirectory, - - // Enable compression - compress: true, - - // Use 'ws' instead of - // 'sockjs-node' on server since we're using native - // websockets in `webpackHotDevClient`. - transportMode: 'ws', - - injectClient: false, - - overlay: false, - // Enable hot reloading - hot: false, - - host, - - historyApiFallback: { - disableDotRule: true, - index: resolveWorkspacePath(publicDirectory), - }, - - sockHost, - sockPath, - sockPort, - - before(app: any, server: any) { - // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware` - // middlewares before `redirectServedPath` otherwise will not have any effect - // This lets us fetch source contents from webpack for the error overlay - app.use(evalSourceMapMiddleware(server)); - // This lets us open files from the runtime error overlay. - app.use(errorOverlayMiddleware()); - }, - - after(app: any) { - // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match - app.use(redirectServedPath(publicUrlOrPath)); - - // This service worker file is effectively a 'no-op' that will reset any - // previous service worker registered for the same host:port combination. - // We do this in development to avoid hitting the production cache if - // it used the same host and port. - // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432 - app.use(noopServiceWorkerMiddleware(publicUrlOrPath)); - }, - - // Public path is root of content base - publicPath: path.join('/', publicRoot), - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - ...fallbacksAliases, - path: require.resolve('path-browserify') - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - new WebpackBitReporterPlugin({ - options: { pubsub, devServerID }, - }), - ...plugins - ], - }; -} diff --git a/scopes/versions/angular-v12/jest/setup-jest.ts b/scopes/versions/angular-v12/jest/setup-jest.ts deleted file mode 100644 index 1100b3e8..00000000 --- a/scopes/versions/angular-v12/jest/setup-jest.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest-preset-angular/setup-jest'; diff --git a/scopes/versions/angular-v12/jest/tsconfig.spec.json b/scopes/versions/angular-v12/jest/tsconfig.spec.json deleted file mode 100644 index 078e0693..00000000 --- a/scopes/versions/angular-v12/jest/tsconfig.spec.json +++ /dev/null @@ -1,36 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc/spec", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "sourceMap": true, - "declaration": false, - "emitDecoratorMetadata": true, - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "importHelpers": true, - "allowJs": true, - "target": "es2015", - "module": "esnext", - "lib": [ - "es2018", - "dom" - ], - "types": ["jest", "node"] - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true, - "enableIvy": true - }, - "include": ["**/*.spec.+(js|ts)", "**/*.test.+(js|ts)", "**/*.d.ts"] -} diff --git a/scopes/versions/angular-v14/angular-v14.docs.mdx b/scopes/versions/angular-v14/angular-v14.docs.mdx deleted file mode 100644 index 86a44c88..00000000 --- a/scopes/versions/angular-v14/angular-v14.docs.mdx +++ /dev/null @@ -1,85 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; - - diff --git a/scopes/versions/angular-v15/angular-v15.docs.mdx b/scopes/versions/angular-v15/angular-v15.docs.mdx deleted file mode 100644 index 2c2e63d2..00000000 --- a/scopes/versions/angular-v15/angular-v15.docs.mdx +++ /dev/null @@ -1,85 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; - - diff --git a/scopes/versions/angular-v16/angular-v16.docs.mdx b/scopes/versions/angular-v16/angular-v16.docs.mdx deleted file mode 100644 index 0aa5725d..00000000 --- a/scopes/versions/angular-v16/angular-v16.docs.mdx +++ /dev/null @@ -1,85 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -import { EnvOverview } from '@teambit/envs.docs.env-overview-template'; - - diff --git a/scopes/versions/angular-v16/index.ts b/scopes/versions/angular-v16/index.ts deleted file mode 100644 index b3db35a6..00000000 --- a/scopes/versions/angular-v16/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { AngularV16Env } from './angular-v16.bit-env'; -export { default as jestConfig } from './jest/jest.config'; diff --git a/scopes/versions/angular-v8/angular-v8.aspect.ts b/scopes/versions/angular-v8/angular-v8.aspect.ts deleted file mode 100644 index 777dc1bc..00000000 --- a/scopes/versions/angular-v8/angular-v8.aspect.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Aspect } from '@teambit/harmony'; - -export const AngularV8Aspect = Aspect.create({ - id: 'teambit.angular/versions/angular-v8', -}); diff --git a/scopes/versions/angular-v8/angular-v8.docs.md b/scopes/versions/angular-v8/angular-v8.docs.md deleted file mode 100644 index a82b52c1..00000000 --- a/scopes/versions/angular-v8/angular-v8.docs.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -Adds Angular v8 support to your Bit workspace. - -**This is a legacy version of the Angular env. It is recommended to use the latest version of the Angular env instead.** - -# Angular Overview -`teambit.angular/versions/angular-v8` is a pre-built [Env](https://bit.dev/docs/envs/envs-overview) for building components and apps with Angular. -It enables you to quickly set up a dev environment that follows best practices for Angular component development. - -## Using the Angular env -### In a new workspace -To use the Angular Env, the easiest way is to create a new pre-configured workspace with the workspace generator: -```bash -bit new ng-workspace -a teambit.angular/versions/angular-v8 -``` - -Change directory to the newly created workspace -```bash -cd -``` - -Create a bit component: -```bash -bit create ng-module ui/my-button -``` - -Install dependencies: -```bash -bit install -``` - -Start the dev server -```bash -bit start -``` - -Open-up your browser on localhost:3000, or any other available port, and display your workspace with your components. - -### In an existing Bit workspace -First you need to make sure that you're using yarn (in your workspace.jsonc, search for `packageManager` and replace `pnpm` by `yarn` if needed), -then add the Angular env to your workspace.jsonc with the following command: - -```bash -bit use teambit.angular/versions/angular-v8 -``` - -You can now create a new component that uses the Angular env: -```bash -bit create ng-module --env teambit.angular/versions/angular-v8 -``` - -And finally you need to install the dependencies: -```bash -bit install -``` - -## Creating Components -The Angular env provides a set of component templates that can be used to speed up and standardize your component development: - -To list all available templates, use the following command: -```bash -bit templates -``` - -- `ng-module` a generic Angular module. -- `ng-env` boilerplate for a customized environment configuration. -- `ng-app` an Angular application. - -Use any of these templates with the `bit create` command: -```bash -bit create --env teambit.angular/versions/angular-v8 -``` - -## Angular versions -The Angular env (teambit.angular/angular) uses the latest stable version of Angular and its dependencies. -Whenever a new major version of Angular is released, a new major version of the Angular env is created. - -If you want to use a specific version of Angular, you can use one those env versions instead of `teambit.angular/angular`: -- [v8: `teambit.angular/versions/angular-v8`](https://bit.cloud/teambit/angular/versions/angular-v8) -- [v9: `teambit.angular/versions/angular-v9`](https://bit.cloud/teambit/angular/versions/angular-v9) -- [v10: `teambit.angular/versions/angular-v10`](https://bit.cloud/teambit/angular/versions/angular-v10) -- [v11: `teambit.angular/versions/angular-v11`](https://bit.cloud/teambit/angular/versions/angular-v11) -- [v12: `teambit.angular/versions/angular-v12`](https://bit.cloud/teambit/angular/versions/angular-v12) -- [v13: `teambit.angular/versions/angular-v13`](https://bit.cloud/teambit/angular/versions/angular-v13) -- [v14: `teambit.angular/versions/angular-v14`](https://bit.cloud/teambit/angular/versions/angular-v14) -- [v15: `teambit.angular/versions/angular-v15`](https://bit.cloud/teambit/angular/versions/angular-v15) - -You can quickly switch between these versions with the `bit env set` command. For example to use v14 instead of the default, you would use the following command: -```bash -bit env replace teambit.angular/angular teambit.angular/angular-v15 -``` - -## Angular applications -You can use the Angular env to create an Angular application with the following command: -```bash -bit create ng-app --env teambit.angular/versions/angular-v8 -``` - -To run your application in dev mode, use the following command: -```bash -bit run -``` - -### Configure your application -Your app component can be configured with different options for serve, build and deployment. -Open the configuration file named `.ng-app.ts` that is located in your app folder. - -You can change the default configuration by editing the different options, such as app name, port, source folder, serve, build, deploy options, etc. -See the [apps documentation](https://bit.dev/docs/apps/apps-overview) for more information. diff --git a/scopes/versions/angular-v8/angular-v8.env.ts b/scopes/versions/angular-v8/angular-v8.env.ts deleted file mode 100644 index 86eb13c5..00000000 --- a/scopes/versions/angular-v8/angular-v8.env.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { AngularBaseEnv, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationMain } from '@teambit/application'; -import { AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelMain } from '@teambit/babel'; -import { CompilerMain } from '@teambit/compiler'; -import { CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvDescriptor } from '@teambit/envs'; -import { ESLintMain } from '@teambit/eslint'; -import { GeneratorMain } from '@teambit/generator'; -import { IsolatorMain } from '@teambit/isolator'; -import { JestMain } from '@teambit/jest'; -import { LoggerMain } from '@teambit/logger'; -import { PkgMain } from '@teambit/pkg'; -import { ReactMain } from '@teambit/react'; -import { TesterMain } from '@teambit/tester'; -import { WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import { AngularV8Aspect } from './angular-v8.aspect'; -import { AngularV8Webpack } from './angular-v8.webpack'; - -/** - * a component environment built for [Angular](https://angular.io). - */ -export class AngularV8Env extends AngularBaseEnv { - name = 'Angular-v8'; - angularWebpack: AngularV8Webpack; - ngPackagr = require.resolve('ng-packagr'); - elements = null; - readDefaultTsConfig = require.resolve('ng-packagr/lib/ts/tsconfig'); - jestConfigPath = require.resolve('./jest/jest.config'); - jestModulePath = require.resolve('jest'); - - constructor( - jestAspect: JestMain, - compiler: CompilerMain, - tester: TesterMain, - eslint: ESLintMain, - generator: GeneratorMain, - isolator: IsolatorMain, - private webpackMain: WebpackMain, - protected workspace: Workspace | undefined, - private pkg: PkgMain, - application: ApplicationMain, - aspectLoader: AspectLoaderMain, - dependencyResolver: DependencyResolverMain, - private react: ReactMain, - loggerMain: LoggerMain, - compositions: CompositionsMain, - babel: BabelMain, - options: AngularEnvOptions, - ) { - super(jestAspect, compiler, tester, eslint, isolator, workspace, generator, application, aspectLoader, dependencyResolver, loggerMain, compositions, babel, options); - this.angularWebpack = new AngularV8Webpack(this.workspace, this.webpackMain, this.pkg, application, this.getNgEnvOptions()); - } - - /** - * Returns the Environment descriptor - * Required for any task - */ - async __getDescriptor(): Promise { - return { - type: 'angular-v8', - }; - } - - /** - * Required for `bit start` - */ - getDevEnvId(id?: string) { - if (typeof id !== 'string') return AngularV8Aspect.id; - return id || AngularV8Aspect.id; - } - - /** - * Returns the list of dependencies - * Required for any task - */ - async getDependencies() { - return { - dependencies: { - '@angular/common': '-', - '@angular/core': '-', - 'tslib': '^1.10.0', - 'rxjs': '-', - 'zone.js': '-', - }, - devDependencies: { - '@angular/compiler': '~8.2.14', - '@angular/compiler-cli': '~8.2.14', - '@types/jest': '~25.1.0', - '@types/node': '^12.11.1', - 'jest': '^25.1.0', - 'jest-preset-angular': '~8.2.0', - 'ts-jest': '^25.5.1', - 'typescript': '-', - }, - peerDependencies: { - '@angular/common': '~8.2.14', - '@angular/core': '~8.2.14', - '@angular/platform-browser': '~8.2.14', - '@angular/platform-browser-dynamic': '~8.2.14', - 'rxjs': '~6.4.0', - 'zone.js': '~0.9.1', - 'typescript': '~3.5.3', - }, - }; - } -} diff --git a/scopes/versions/angular-v8/angular-v8.main.runtime.ts b/scopes/versions/angular-v8/angular-v8.main.runtime.ts deleted file mode 100644 index 49f34639..00000000 --- a/scopes/versions/angular-v8/angular-v8.main.runtime.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { AngularBaseMain, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationAspect, ApplicationMain } from '@teambit/application'; -import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelAspect, BabelMain } from '@teambit/babel'; -import { MainRuntime } from '@teambit/cli'; -import { CompilerAspect, CompilerMain } from '@teambit/compiler'; -import { CompositionsAspect, CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvsAspect, EnvsMain } from '@teambit/envs'; -import { ESLintAspect, ESLintMain } from '@teambit/eslint'; -import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; -import { IsolatorAspect, IsolatorMain } from '@teambit/isolator'; -import { JestAspect, JestMain } from '@teambit/jest'; -import { LoggerAspect, LoggerMain } from '@teambit/logger'; -import { PkgAspect, PkgMain } from '@teambit/pkg'; -import { ReactAspect, ReactMain } from '@teambit/react'; -import { TesterAspect, TesterMain } from '@teambit/tester'; -import { WebpackAspect, WebpackMain } from '@teambit/webpack'; -import { Workspace, WorkspaceAspect } from '@teambit/workspace'; -import { AngularV8Aspect } from './angular-v8.aspect'; -import { AngularV8Env } from './angular-v8.env'; - -export class AngularV8Main extends AngularBaseMain { - static slots = []; - static runtime: any = MainRuntime; - static dependencies: any = [ - JestAspect, - CompilerAspect, - TesterAspect, - ESLintAspect, - GeneratorAspect, - WebpackAspect, - WorkspaceAspect, - EnvsAspect, - IsolatorAspect, - PkgAspect, - ApplicationAspect, - AspectLoaderAspect, - DependencyResolverAspect, - ReactAspect, - LoggerAspect, - CompositionsAspect, - BabelAspect, - ]; - - static async provider([ - jestAspect, - compiler, - tester, - eslint, - generator, - webpack, - workspace, - envs, - isolator, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - ]: [ - JestMain, - CompilerMain, - TesterMain, - ESLintMain, - GeneratorMain, - WebpackMain, - Workspace | undefined, - EnvsMain, - IsolatorMain, - PkgMain, - ApplicationMain, - AspectLoaderMain, - DependencyResolverMain, - ReactMain, - LoggerMain, - CompositionsMain, - BabelMain, - ], options: AngularEnvOptions): Promise { - const angularV8Env = new AngularV8Env( - jestAspect, - compiler, - tester, - eslint, - generator, - isolator, - webpack, - workspace, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - options, - ); - return new AngularV8Main(envs, angularV8Env); - } -} - -AngularV8Aspect.addRuntime(AngularV8Main); diff --git a/scopes/versions/angular-v8/angular-v8.webpack.ts b/scopes/versions/angular-v8/angular-v8.webpack.ts deleted file mode 100644 index 3e86cb0f..00000000 --- a/scopes/versions/angular-v8/angular-v8.webpack.ts +++ /dev/null @@ -1,242 +0,0 @@ -import { BuilderContext } from '@angular-devkit/architect'; -import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; -import { - getBrowserConfig, - getCommonConfig, - getStatsConfig, - getStylesConfig, - getAotConfig, - getNonAotConfig -} from '@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs'; -import { - WebpackConfigOptions -} from '@angular-devkit/build-angular/src/angular-cli-files/models/build-options'; -import { - OutputHashing, - Schema as BrowserBuilderSchema -} from '@angular-devkit/build-angular/src/browser/schema'; -import { buildServerConfig } from '@angular-devkit/build-angular/src/dev-server'; -import { normalizeBrowserSchema, NormalizedBrowserBuilderSchema } from '@angular-devkit/build-angular/src/utils'; -import { generateEntryPoints } from '@angular-devkit/build-angular/src/angular-cli-files/utilities/package-chunk-sort'; -import { - generateWebpackConfig, - getIndexOutputFile -} from '@angular-devkit/build-angular/src/utils/webpack-browser-config'; -import { IndexHtmlWebpackPlugin } from '@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin'; -import { getSystemPath, logging, normalize, tags } from '@angular-devkit/core'; -import { NodeJsSyncHost } from '@angular-devkit/core/node'; -import { - AngularBaseWebpack, - AngularEnvOptions, - WebpackConfig, - WebpackSetup -} from '@teambit/angular-base'; -import { BundlerContext, DevServerContext } from '@teambit/bundler'; -import { Logger } from '@teambit/logger'; -import { WebpackConfigWithDevServer, WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import { PkgMain } from '@teambit/pkg'; -import path, { join } from 'path'; -import webpack from 'webpack'; -import WsDevServer, { addDevServerEntrypoints } from 'webpack-dev-server'; -import { AngularV8Aspect } from './angular-v8.aspect'; -import { webpack4BuildConfigFactory } from './webpack/webpack4.build.config'; -import { webpack4ServeConfigFactory } from './webpack/webpack4.serve.config'; -import { ApplicationMain } from '@teambit/application'; - -function getCompilerConfig(wco: WebpackConfigOptions): WebpackConfig { - if (wco.buildOptions.main || wco.buildOptions.polyfills) { - return wco.buildOptions.aot ? getAotConfig(wco) : getNonAotConfig(wco); - } - - return {}; -} - -type BrowserWebpackConfigOptions = WebpackConfigOptions; - -export class AngularV8Webpack extends AngularBaseWebpack { - enableIvy = false; - webpackDevServer = WsDevServer; - webpackServeConfigFactory = webpack4ServeConfigFactory; - webpackBuildConfigFactory = webpack4BuildConfigFactory; - webpack: typeof webpack; - - constructor(workspace: Workspace | undefined, webpackMain: WebpackMain, pkg: PkgMain, application: ApplicationMain, ngEnvOptions: AngularEnvOptions) { - super(workspace, webpackMain, pkg, application, AngularV8Aspect as any, ngEnvOptions); - // resolving to the webpack used by angular devkit to avoid multiple instances of webpack - // otherwise, if we use a different version, it would break - const buildAngular = require.resolve('@angular-devkit/build-angular'); - const webpackPath = require.resolve('webpack', { paths: [buildAngular] }); - this.webpack = require(webpackPath); - } - - /** - * Migrate options from webpack-dev-server 3 to 4 - */ - private migrateConfiguration(webpackConfig: WebpackConfig): WebpackConfigWithDevServer | WebpackConfig { - /** - * Removed contentBase in favor of the static option - */ - // @ts-ignore - delete webpackConfig.devServer.contentBase; - - return webpackConfig; - } - - async getWebpackConfig( - context: DevServerContext | BundlerContext, - entryFiles: string[], - tsconfigPath: string, - workspaceRoot: string, - logger: Logger, - setup: WebpackSetup, - webpackOptions: Partial = {}, - angularOptions: Partial = {}, - sourceRoot = 'src', - ): Promise { - // Options from angular.json - const browserOptions: BrowserBuilderOptions = { - ...angularOptions, - baseHref: path.posix.join('/', context.rootPath!, context.publicPath!), - preserveSymlinks: false, - outputPath: 'public', // doesn't matter because it will be deleted from the config - index: angularOptions.index ?? join(sourceRoot, `index.html`), - main: angularOptions.main ?? join(sourceRoot, `main.ts`), - polyfills: angularOptions.polyfills ?? join(sourceRoot, `polyfills.ts`), - tsConfig: angularOptions.tsConfig ?? tsconfigPath, - assets: [...new Set([path.posix.join(sourceRoot, `favicon.ico`), path.posix.join(sourceRoot, `assets`), ...(angularOptions.assets ?? [])])], // using set to remove duplicates - styles: [...new Set([path.posix.join(sourceRoot, `styles.scss`), ...(angularOptions.styles ?? [])])], // using set to remove duplicates - scripts: angularOptions.scripts, - vendorChunk: angularOptions.vendorChunk ?? true, - namedChunks: angularOptions.namedChunks ?? true, - optimization: angularOptions.optimization ?? setup === WebpackSetup.Build, - buildOptimizer: angularOptions.buildOptimizer ?? setup === WebpackSetup.Build, - aot: angularOptions.aot ?? setup === WebpackSetup.Build, - deleteOutputPath: angularOptions.deleteOutputPath ?? true, - sourceMap: angularOptions.sourceMap ?? true, - outputHashing: angularOptions.outputHashing ?? (setup === WebpackSetup.Build ? OutputHashing.All : OutputHashing.None), - watch: setup === WebpackSetup.Serve - }; - - const normalizedWorkspaceRoot = normalize(workspaceRoot); - const projectRoot = normalizedWorkspaceRoot; - const normalizedSourceRoot = normalize(sourceRoot); - - const host = new NodeJsSyncHost(); - const normalizedOptions = normalizeBrowserSchema(host, normalizedWorkspaceRoot, projectRoot, normalizedSourceRoot, { - ...browserOptions, - ...(webpackOptions as Partial), - }); - - const loggerApi = { - createChild: () => logger as any, - ...logger, - log: logger.console, - } as any as logging.LoggerApi; - - const webpackConfigArr: any[] = await generateWebpackConfig( - {builder: { - builderName: 'browser' - }} as BuilderContext, - getSystemPath(normalizedWorkspaceRoot), - getSystemPath(projectRoot), - getSystemPath(normalizedSourceRoot), - normalizedOptions, - (wco: BrowserWebpackConfigOptions) => [ - getCommonConfig(wco), - getBrowserConfig(wco), - getStylesConfig(wco), - getStatsConfig(wco), - getCompilerConfig(wco), - ], - loggerApi - ); - - const webpackConfig = webpackConfigArr[0]; - - if(setup === WebpackSetup.Serve) { - webpackConfig.devServer = buildServerConfig( - normalizedWorkspaceRoot, - webpackOptions as DevServerBuilderOptions, - browserOptions, - loggerApi - ); - } - - // Add bit generated files to the list of entries - webpackConfig.entry.main.unshift(...entryFiles); - - // @ts-ignore - if (webpackOptions.liveReload && !webpackOptions.hmr) { - // This is needed because we cannot use the inline option directly in the config - // because of the SuppressExtractedTextChunksWebpackPlugin - // Consider not using SuppressExtractedTextChunksWebpackPlugin when liveReload is enable. - // tslint:disable-next-line: no-any - addDevServerEntrypoints(webpackConfig as any, { - ...(webpackConfig as any).devServer, - inline: true, - }); - - // Remove live-reload code from all entrypoints but not main. - // Otherwise this will break SuppressExtractedTextChunksWebpackPlugin because - // 'addDevServerEntrypoints' adds additional entry-points to all entries. - if ( - webpackConfig.entry && - typeof webpackConfig.entry === 'object' && - !Array.isArray(webpackConfig.entry) && - webpackConfig.entry.main - ) { - for (const [key, value] of Object.entries(webpackConfig.entry)) { - if (key === 'main' || !Array.isArray(value)) { - // eslint-disable-next-line no-continue - continue; - } - - const webpackClientScriptIndex = value.findIndex((x) => x.includes('webpack-dev-server/client/index.js')); - if (webpackClientScriptIndex >= 0) { - // Remove the webpack-dev-server/client script from array. - value.splice(webpackClientScriptIndex, 1); - } - } - } - } - - // @ts-ignore - if (webpackOptions.hmr) { - logger.warn(tags.stripIndents`NOTICE: Hot Module Replacement (HMR) is enabled for the dev server. - See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`); - } - - const { scripts = [], styles = [] } = browserOptions; - const entrypoints = generateEntryPoints({ scripts, styles }); - if (!webpackConfig.plugins) { - webpackConfig.plugins = []; - } - webpackConfig.plugins.push( - new IndexHtmlWebpackPlugin({ - input: path.resolve(workspaceRoot, browserOptions.index as string), - output: getIndexOutputFile(browserOptions), - baseHref: browserOptions.baseHref || '/', - entrypoints, - moduleEntrypoints: [], - noModuleEntrypoints: ['polyfills-es5'], - deployUrl: browserOptions.deployUrl, - sri: browserOptions.subresourceIntegrity, - crossOrigin: browserOptions.crossOrigin, - }) - ); - - // don't use the output path from angular - delete webpackConfig?.output?.path; - delete webpackConfig?.resolve?.modules; - webpackConfig.stats = 'errors-only'; - // webpackConfig.context = workspaceRoot; - - if (setup === WebpackSetup.Serve) { - return this.migrateConfiguration(webpackConfig); - } - - - return webpackConfig; - } -} diff --git a/scopes/versions/angular-v8/component.json b/scopes/versions/angular-v8/component.json deleted file mode 100644 index 34b2838f..00000000 --- a/scopes/versions/angular-v8/component.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "componentId": { - "name": "versions/angular-v8" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-v8", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@angular-devkit/architect": "~0.803.29", - "@angular-devkit/build-angular": "~0.803.29", - "@angular-devkit/build-optimizer": "~0.803.29", - "@angular-devkit/build-webpack": "~0.803.29", - "@angular-devkit/core": "~8.3.29", - "@angular-devkit/schematics": "~8.3.29", - "@angular-eslint/eslint-plugin": "^1.2.0", - "@angular-eslint/eslint-plugin-template": "^1.2.0", - "@angular-eslint/template-parser": "^1.2.0", - "@angular/animations": "~8.2.14", - "@angular/common": "~8.2.14", - "@angular/compiler": "~8.2.14", - "@angular/compiler-cli": "~8.2.14", - "@angular/core": "~8.2.14", - "@angular/elements": "~8.2.14", - "@angular/forms": "~8.2.14", - "@angular/platform-browser": "~8.2.14", - "@angular/platform-browser-dynamic": "~8.2.14", - "@angular/router": "~8.2.14", - "@ngtools/webpack": "~8.3.29", - "@types/react-dev-utils": "~9.0.8", - "@types/remark-prism": "~1.3.0", - "@types/webpack-dev-server": "~3.11.2", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", - "eslint": "7.26.0", - "eslint-plugin-import": "^2.23.4", - "eslint-plugin-jsdoc": "^35.5.1", - "eslint-plugin-prefer-arrow": "^1.2.3", - "html-loader": "~1.3.2", - "jest": "^25.1.0", - "jest-preset-angular": "~8.2.0", - "ng-packagr": "~5.7.1", - "path-browserify": "1.0.1", - "react-dev-utils": "10.2.1", - "remark": "~13.0.0", - "remark-frontmatter": "~3.0.0", - "remark-html": "13.0.1", - "remark-loader": "~2.0.0", - "remark-prism": "~1.3.6", - "rxjs": "~6.4.0", - "tslib": "^1.10.0", - "ts-jest": "^25.5.1", - "ts-node": "~8.3.0", - "typescript": "~3.5.3", - "webpack": "~4.44.2", - "webpack-dev-middleware": "~3.7.2", - "webpack-dev-server": "~3.11.2", - "zone.js": "~0.9.1" - } - } - } - } -} diff --git a/scopes/versions/angular-v8/index.ts b/scopes/versions/angular-v8/index.ts deleted file mode 100644 index 8faf8d04..00000000 --- a/scopes/versions/angular-v8/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { AngularV8Main } from './angular-v8.main.runtime'; -export { AngularV8Env } from './angular-v8.env'; -export { AngularV8Aspect, AngularV8Aspect as default } from './angular-v8.aspect'; diff --git a/scopes/versions/angular-v8/jest/jest-global-mocks.ts b/scopes/versions/angular-v8/jest/jest-global-mocks.ts deleted file mode 100644 index ccbc91e9..00000000 --- a/scopes/versions/angular-v8/jest/jest-global-mocks.ts +++ /dev/null @@ -1,24 +0,0 @@ -Object.defineProperty(window, 'CSS', {value: null}); -Object.defineProperty(document, 'doctype', { - value: '' -}); -Object.defineProperty(window, 'getComputedStyle', { - value: () => { - return { - display: 'none', - appearance: ['-webkit-appearance'] - }; - } -}); -/** - * ISSUE: https://github.com/angular/material2/issues/7101 - * Workaround for JSDOM missing transform property - */ -Object.defineProperty(document.body.style, 'transform', { - value: () => { - return { - enumerable: true, - configurable: true, - }; - }, -}); diff --git a/scopes/versions/angular-v8/jest/jest.config.js b/scopes/versions/angular-v8/jest/jest.config.js deleted file mode 100644 index 4d15c07b..00000000 --- a/scopes/versions/angular-v8/jest/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - preset: 'jest-preset-angular', - reporters: ['default'], - setupFilesAfterEnv: [require.resolve('./setup-jest.js')], - transformIgnorePatterns: ['node_modules/(?!(jest-test))'], - testPathIgnorePatterns: ['/.*/e2e/'], - globals: { - 'ts-jest': { - tsConfig: require.resolve('./tsconfig.spec.json'), - }, - }, - moduleNameMapper: { - // map angular modules to the root node_modules to avoid duplicated modules - "(@angular\/animations.*)$": "/node_modules/$1", - "(@angular\/common.*)$": "/node_modules/$1", - "(@angular\/compiler.*)$": "/node_modules/$1", - "(@angular\/compiler-cli.*)$": "/node_modules/$1", - "(@angular\/core.*)$": "/node_modules/$1", - "(@angular\/forms.*)$": "/node_modules/$1", - "(@angular\/platform-browser.*)$": "/node_modules/$1", - "(@angular\/platform-browser-dynamic.*)$": "/node_modules/$1", - "(@angular\/router.*)$": "/node_modules/$1", - } -}; diff --git a/scopes/versions/angular-v8/jest/setup-jest.ts b/scopes/versions/angular-v8/jest/setup-jest.ts deleted file mode 100644 index 904329f5..00000000 --- a/scopes/versions/angular-v8/jest/setup-jest.ts +++ /dev/null @@ -1,2 +0,0 @@ -import 'jest-preset-angular'; -import './jest-global-mocks'; diff --git a/scopes/versions/angular-v8/jest/tsconfig.spec.json b/scopes/versions/angular-v8/jest/tsconfig.spec.json deleted file mode 100644 index aa790e4c..00000000 --- a/scopes/versions/angular-v8/jest/tsconfig.spec.json +++ /dev/null @@ -1,36 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc/spec", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "sourceMap": true, - "declaration": false, - "emitDecoratorMetadata": true, - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "importHelpers": true, - "allowJs": true, - "target": "es2015", - "module": "commonjs", - "lib": [ - "es2018", - "dom" - ], - "types": ["jest", "node"] - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true, - "enableIvy": false - }, - "include": ["**/*.spec.+(js|ts)", "**/*.test.+(js|ts)", "**/*.d.ts"] -} diff --git a/scopes/versions/angular-v8/webpack/webpack4.build.config.ts b/scopes/versions/angular-v8/webpack/webpack4.build.config.ts deleted file mode 100644 index 56ae7d3d..00000000 --- a/scopes/versions/angular-v8/webpack/webpack4.build.config.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - AngularEnvOptions, - BitDedupeModuleResolvePlugin, - WebpackConfig -} from '@teambit/angular-base'; -import { sep } from 'path'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -// TODO(ocombe): this is webpack 5 build config, not webpack 4 -export function webpack4BuildConfigFactory( - entryFiles: string[], - outputPath: string, - nodeModulesPaths: string[], - workspaceDir: string, - tempFolder: string, - plugins: any[] = [], - ngEnvOptions: AngularEnvOptions, -): WebpackConfig { - const config = { - mode: 'production', - // Stop compilation early in production - bail: true, - // These are the "entry points" to our application. - // This means they will be the "root" imports that are included in JS bundle. - entry: entryFiles, - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // The build folder. - path: `${outputPath}${sep}public`, - - // publicPath: ``, - - // @ts-ignore - futureEmitAssets: true, - - filename: 'static/js/[name].[contenthash:8].js', - - // There are also additional JS chunk files if you use code splitting. - chunkFilename: 'static/js/[name].[contenthash:8].chunk.js', - - // webpack uses `publicPath` to determine where the app is being served from. - // It requires a trailing slash, or the file assets will get an incorrect path. - // We inferred the "public path" (such as / or /my-project) from homepage. - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - path: require.resolve('path-browserify'), - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins:[ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - ...plugins - ] - }; - - return config as WebpackConfig; -} diff --git a/scopes/versions/angular-v8/webpack/webpack4.serve.config.ts b/scopes/versions/angular-v8/webpack/webpack4.serve.config.ts deleted file mode 100644 index 8a583f29..00000000 --- a/scopes/versions/angular-v8/webpack/webpack4.serve.config.ts +++ /dev/null @@ -1,183 +0,0 @@ -import { AngularEnvOptions, BitDedupeModuleResolvePlugin } from '@teambit/angular-base'; -import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; -import { PubsubMain } from '@teambit/pubsub'; -import { fallbacksAliases, WebpackBitReporterPlugin } from '@teambit/webpack'; -import path from 'path'; -import errorOverlayMiddleware from 'react-dev-utils/errorOverlayMiddleware'; -import evalSourceMapMiddleware from 'react-dev-utils/evalSourceMapMiddleware'; -import getPublicUrlOrPath from 'react-dev-utils/getPublicUrlOrPath'; -import noopServiceWorkerMiddleware from 'react-dev-utils/noopServiceWorkerMiddleware'; -import redirectServedPath from 'react-dev-utils/redirectServedPathMiddleware'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -const sockHost = process.env.WDS_SOCKET_HOST; -const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node' -const sockPort = process.env.WDS_SOCKET_PORT; - -const publicUrlOrPath = getPublicUrlOrPath(process.env.NODE_ENV === 'development', '/', '/public'); - -export function webpack4ServeConfigFactory( - devServerID: string, - workspaceDir: string, - entryFiles: string[], - publicRoot: string, - publicPath: string, - pubsub: PubsubMain, - nodeModulesPaths: string[], - tempFolder: string, - plugins: any[] = [], - // eslint-disable-next-line @typescript-eslint/no-unused-vars - isApp = false, - ngEnvOptions: AngularEnvOptions, -): any { - const resolveWorkspacePath = (relativePath: string) => path.resolve(workspaceDir, relativePath); - - // Host - const host = process.env.HOST || 'localhost'; - - // Required for babel-preset-react-app - process.env.NODE_ENV = 'development'; - - const publicDirectory = path.posix.join(publicRoot, publicPath); - - return { - // Environment mode - mode: 'development', - - devtool: 'inline-source-map', - - // Entry point of app - entry: entryFiles.map((filePath) => resolveWorkspacePath(filePath)), - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // Development filename output - filename: 'static/js/[name].bundle.js', - - pathinfo: true, - - path: resolveWorkspacePath(publicDirectory), - - // publicPath: `/${publicRoot}/`, - - // @ts-ignore - futureEmitAssets: true, - - chunkFilename: 'static/js/[name].chunk.js', - - // point sourcemap entries to original disk locations (format as URL on windows) - devtoolModuleFilenameTemplate: (info: any) => pathNormalizeToLinux(path.resolve(info.absoluteResourcePath)), - - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - devServer: { - quiet: true, - stats: 'errors-only', - - // Serve index.html as the base - contentBase: resolveWorkspacePath(publicDirectory), - - // By default files from `contentBase` will not trigger a page reload. - watchContentBase: false, - - contentBasePublicPath: publicDirectory, - - // Enable compression - compress: true, - - // Use 'ws' instead of - // 'sockjs-node' on server since we're using native - // websockets in `webpackHotDevClient`. - transportMode: 'ws', - - injectClient: false, - - overlay: false, - // Enable hot reloading - hot: false, - - host, - - historyApiFallback: { - disableDotRule: true, - index: resolveWorkspacePath(publicDirectory), - }, - - sockHost, - sockPath, - sockPort, - - before(app: any, server: any) { - // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware` - // middlewares before `redirectServedPath` otherwise will not have any effect - // This lets us fetch source contents from webpack for the error overlay - app.use(evalSourceMapMiddleware(server)); - // This lets us open files from the runtime error overlay. - app.use(errorOverlayMiddleware()); - }, - - after(app: any) { - // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match - app.use(redirectServedPath(publicUrlOrPath)); - - // This service worker file is effectively a 'no-op' that will reset any - // previous service worker registered for the same host:port combination. - // We do this in development to avoid hitting the production cache if - // it used the same host and port. - // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432 - app.use(noopServiceWorkerMiddleware(publicUrlOrPath)); - }, - - // Public path is root of content base - publicPath: path.join('/', publicRoot), - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - ...fallbacksAliases, - path: require.resolve('path-browserify') - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - new WebpackBitReporterPlugin({ - options: { pubsub, devServerID }, - }), - ...plugins - ], - }; -} diff --git a/scopes/versions/angular-v9/angular-v9.aspect.ts b/scopes/versions/angular-v9/angular-v9.aspect.ts deleted file mode 100644 index ab5a2b7b..00000000 --- a/scopes/versions/angular-v9/angular-v9.aspect.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Aspect } from '@teambit/harmony'; - -export const AngularV9Aspect = Aspect.create({ - id: 'teambit.angular/versions/angular-v9', -}); diff --git a/scopes/versions/angular-v9/angular-v9.docs.md b/scopes/versions/angular-v9/angular-v9.docs.md deleted file mode 100644 index a754d9ec..00000000 --- a/scopes/versions/angular-v9/angular-v9.docs.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -description: A Bit development environment for Angular Components -labels: ['angular', 'environment', 'env', 'aspect', 'extension'] ---- - -Adds Angular v9 support to your Bit workspace. - -**This is a legacy version of the Angular env. It is recommended to use the latest version of the Angular env instead.** - -# Angular Overview -`teambit.angular/versions/angular-v9` is a pre-built [Env](https://bit.dev/docs/envs/envs-overview) for building components and apps with Angular. -It enables you to quickly set up a dev environment that follows best practices for Angular component development. - -## Using the Angular env -### In a new workspace -To use the Angular Env, the easiest way is to create a new pre-configured workspace with the workspace generator: -```bash -bit new ng-workspace -a teambit.angular/versions/angular-v9 -``` - -Change directory to the newly created workspace -```bash -cd -``` - -Create a bit component: -```bash -bit create ng-module ui/my-button -``` - -Install dependencies: -```bash -bit install -``` - -Start the dev server -```bash -bit start -``` - -Open-up your browser on localhost:3000, or any other available port, and display your workspace with your components. - -### In an existing Bit workspace -First you need to make sure that you're using yarn (in your workspace.jsonc, search for `packageManager` and replace `pnpm` by `yarn` if needed), -then add the Angular env to your workspace.jsonc with the following command: - -```bash -bit use teambit.angular/versions/angular-v9 -``` - -You can now create a new component that uses the Angular env: -```bash -bit create ng-module --env teambit.angular/versions/angular-v9 -``` - -And finally you need to install the dependencies: -```bash -bit install -``` - -## Creating Components -The Angular env provides a set of component templates that can be used to speed up and standardize your component development: - -To list all available templates, use the following command: -```bash -bit templates -``` - -- `ng-module` a generic Angular module. -- `ng-env` boilerplate for a customized environment configuration. -- `ng-app` an Angular application. - -Use any of these templates with the `bit create` command: -```bash -bit create --env teambit.angular/versions/angular-v9 -``` - -## Angular versions -The Angular env (teambit.angular/angular) uses the latest stable version of Angular and its dependencies. -Whenever a new major version of Angular is released, a new major version of the Angular env is created. - -If you want to use a specific version of Angular, you can use one those env versions instead of `teambit.angular/angular`: -- [v8: `teambit.angular/versions/angular-v8`](https://bit.cloud/teambit/angular/versions/angular-v8) -- [v9: `teambit.angular/versions/angular-v9`](https://bit.cloud/teambit/angular/versions/angular-v9) -- [v10: `teambit.angular/versions/angular-v10`](https://bit.cloud/teambit/angular/versions/angular-v10) -- [v11: `teambit.angular/versions/angular-v11`](https://bit.cloud/teambit/angular/versions/angular-v11) -- [v12: `teambit.angular/versions/angular-v12`](https://bit.cloud/teambit/angular/versions/angular-v12) -- [v13: `teambit.angular/versions/angular-v13`](https://bit.cloud/teambit/angular/versions/angular-v13) -- [v14: `teambit.angular/versions/angular-v14`](https://bit.cloud/teambit/angular/versions/angular-v14) -- [v15: `teambit.angular/versions/angular-v15`](https://bit.cloud/teambit/angular/versions/angular-v15) - -You can quickly switch between these versions with the `bit env set` command. For example to use v14 instead of the default, you would use the following command: -```bash -bit env replace teambit.angular/angular teambit.angular/angular-v15 -``` - -## Angular applications -You can use the Angular env to create an Angular application with the following command: -```bash -bit create ng-app --env teambit.angular/versions/angular-v9 -``` - -To run your application in dev mode, use the following command: -```bash -bit run -``` - -### Configure your application -Your app component can be configured with different options for serve, build and deployment. -Open the configuration file named `.ng-app.ts` that is located in your app folder. - -You can change the default configuration by editing the different options, such as app name, port, source folder, serve, build, deploy options, etc. -See the [apps documentation](https://bit.dev/docs/apps/apps-overview) for more information. diff --git a/scopes/versions/angular-v9/angular-v9.env.ts b/scopes/versions/angular-v9/angular-v9.env.ts deleted file mode 100644 index 91fade5e..00000000 --- a/scopes/versions/angular-v9/angular-v9.env.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { AngularBaseEnv, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationMain } from '@teambit/application'; -import { AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelMain } from '@teambit/babel'; -import { CompilerMain } from '@teambit/compiler'; -import { CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvDescriptor } from '@teambit/envs'; -import { ESLintMain } from '@teambit/eslint'; -import { GeneratorMain } from '@teambit/generator'; -import { IsolatorMain } from '@teambit/isolator'; -import { JestMain } from '@teambit/jest'; -import { LoggerMain } from '@teambit/logger'; -import { PkgMain } from '@teambit/pkg'; -import { ReactMain } from '@teambit/react'; -import { TesterMain } from '@teambit/tester'; -import { WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import { AngularV9Aspect } from './angular-v9.aspect'; -import { AngularV9Webpack } from './angular-v9.webpack'; - -/** - * a component environment built for [Angular](https://angular.io). - */ -export class AngularV9Env extends AngularBaseEnv { - name = 'Angular-v9'; - angularWebpack: AngularV9Webpack; - ngPackagr = require.resolve('ng-packagr'); - elements = null; - readDefaultTsConfig = require.resolve('ng-packagr/lib/ts/tsconfig'); - jestConfigPath = require.resolve('./jest/jest.config'); - jestModulePath = require.resolve('jest'); - - constructor( - jestAspect: JestMain, - compiler: CompilerMain, - tester: TesterMain, - eslint: ESLintMain, - generator: GeneratorMain, - isolator: IsolatorMain, - private webpackMain: WebpackMain, - protected workspace: Workspace | undefined, - private pkg: PkgMain, - application: ApplicationMain, - aspectLoader: AspectLoaderMain, - dependencyResolver: DependencyResolverMain, - private react: ReactMain, - loggerMain: LoggerMain, - compositions: CompositionsMain, - babel: BabelMain, - options: AngularEnvOptions, - ) { - super(jestAspect, compiler, tester, eslint, isolator, workspace, generator, application, aspectLoader, dependencyResolver, loggerMain, compositions, babel, options); - this.angularWebpack = new AngularV9Webpack(this.workspace, this.webpackMain, this.pkg, application, this.getNgEnvOptions()); - } - - /** - * Returns the Environment descriptor - * Required for any task - */ - async __getDescriptor(): Promise { - return { - type: 'angular-v9', - }; - } - - /** - * Required for `bit start` - */ - getDevEnvId(id?: string) { - if (typeof id !== 'string') return AngularV9Aspect.id; - return id || AngularV9Aspect.id; - } - - /** - * Returns the list of dependencies - * Required for any task - */ - async getDependencies() { - return { - dependencies: { - '@angular/common': '-', - '@angular/core': '-', - 'tslib': '^1.10.0', - 'rxjs': '-', - 'zone.js': '-', - }, - devDependencies: { - '@angular/compiler': '~9.1.13', - '@angular/compiler-cli': '~9.1.13', - '@types/jest': '~27.0.3', - '@types/node': '^12.11.1', - 'jest': '~27.0.4', - 'jest-preset-angular': '~9.0.7', - 'typescript': '-', - }, - peerDependencies: { - '@angular/common': '~9.1.13', - '@angular/core': '~9.1.13', - '@angular/platform-browser': '~9.1.13', - '@angular/platform-browser-dynamic': '~9.1.13', - 'rxjs': '^6.6.3', - 'zone.js': '~0.10.3', - 'typescript': '~3.8.3', - }, - }; - } -} diff --git a/scopes/versions/angular-v9/angular-v9.main.runtime.ts b/scopes/versions/angular-v9/angular-v9.main.runtime.ts deleted file mode 100644 index b8886b37..00000000 --- a/scopes/versions/angular-v9/angular-v9.main.runtime.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { AngularBaseMain, AngularEnvOptions } from '@teambit/angular-base'; -import { ApplicationAspect, ApplicationMain } from '@teambit/application'; -import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; -import { BabelAspect, BabelMain } from '@teambit/babel'; -import { MainRuntime } from '@teambit/cli'; -import { CompilerAspect, CompilerMain } from '@teambit/compiler'; -import { CompositionsAspect, CompositionsMain } from '@teambit/compositions'; -import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; -import { EnvsAspect, EnvsMain } from '@teambit/envs'; -import { ESLintAspect, ESLintMain } from '@teambit/eslint'; -import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; -import { IsolatorAspect, IsolatorMain } from '@teambit/isolator'; -import { JestAspect, JestMain } from '@teambit/jest'; -import { LoggerAspect, LoggerMain } from '@teambit/logger'; -import { PkgAspect, PkgMain } from '@teambit/pkg'; -import { ReactAspect, ReactMain } from '@teambit/react'; -import { TesterAspect, TesterMain } from '@teambit/tester'; -import { WebpackAspect, WebpackMain } from '@teambit/webpack'; -import { Workspace, WorkspaceAspect } from '@teambit/workspace'; -import { AngularV9Aspect } from './angular-v9.aspect'; -import { AngularV9Env } from './angular-v9.env'; - -export class AngularV9Main extends AngularBaseMain { - static slots = []; - static runtime: any = MainRuntime; - static dependencies: any = [ - JestAspect, - CompilerAspect, - TesterAspect, - ESLintAspect, - GeneratorAspect, - WebpackAspect, - WorkspaceAspect, - EnvsAspect, - IsolatorAspect, - PkgAspect, - ApplicationAspect, - AspectLoaderAspect, - DependencyResolverAspect, - ReactAspect, - LoggerAspect, - CompositionsAspect, - BabelAspect, - ]; - - static async provider([ - jestAspect, - compiler, - tester, - eslint, - generator, - webpack, - workspace, - envs, - isolator, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - ]: [ - JestMain, - CompilerMain, - TesterMain, - ESLintMain, - GeneratorMain, - WebpackMain, - Workspace | undefined, - EnvsMain, - IsolatorMain, - PkgMain, - ApplicationMain, - AspectLoaderMain, - DependencyResolverMain, - ReactMain, - LoggerMain, - CompositionsMain, - BabelMain, - ], options: AngularEnvOptions): Promise { - const angularV9Env = new AngularV9Env( - jestAspect, - compiler, - tester, - eslint, - generator, - isolator, - webpack, - workspace, - pkg, - application, - aspectLoader, - dependencyResolver, - react, - loggerMain, - compositions, - babel, - options, - ); - return new AngularV9Main(envs, angularV9Env); - } -} - -AngularV9Aspect.addRuntime(AngularV9Main); diff --git a/scopes/versions/angular-v9/angular-v9.webpack.ts b/scopes/versions/angular-v9/angular-v9.webpack.ts deleted file mode 100644 index 103978b7..00000000 --- a/scopes/versions/angular-v9/angular-v9.webpack.ts +++ /dev/null @@ -1,240 +0,0 @@ -import { BuilderContext } from '@angular-devkit/architect'; -import type { BrowserBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular'; -import { - getBrowserConfig, - getCommonConfig, - getStatsConfig, - getStylesConfig, - getAotConfig, - getNonAotConfig -} from '@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs'; -import { - WebpackConfigOptions -} from '@angular-devkit/build-angular/src/angular-cli-files/models/build-options'; -import { - OutputHashing, - Schema as BrowserBuilderSchema -} from '@angular-devkit/build-angular/src/browser/schema'; -import { buildServerConfig } from '@angular-devkit/build-angular/src/dev-server'; -import { normalizeBrowserSchema } from '@angular-devkit/build-angular/src/utils'; -import { generateEntryPoints } from '@angular-devkit/build-angular/src/angular-cli-files/utilities/package-chunk-sort'; -import { - BrowserWebpackConfigOptions, - generateWebpackConfig, - getIndexOutputFile -} from '@angular-devkit/build-angular/src/utils/webpack-browser-config'; -import { IndexHtmlWebpackPlugin } from '@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin'; -import { getSystemPath, logging, normalize, tags } from '@angular-devkit/core'; -import { NodeJsSyncHost } from '@angular-devkit/core/node'; -import { - AngularBaseWebpack, - AngularEnvOptions, - WebpackConfig, - WebpackSetup -} from '@teambit/angular-base'; -import { BundlerContext, DevServerContext } from '@teambit/bundler'; -import { Logger } from '@teambit/logger'; -import { WebpackConfigWithDevServer, WebpackMain } from '@teambit/webpack'; -import { Workspace } from '@teambit/workspace'; -import { PkgMain } from '@teambit/pkg'; -import path, { join } from 'path'; -import webpack from 'webpack'; -import WsDevServer, { addDevServerEntrypoints } from 'webpack-dev-server'; -import { AngularV9Aspect } from './angular-v9.aspect'; -import { webpack4BuildConfigFactory } from './webpack/webpack4.build.config'; -import { webpack4ServeConfigFactory } from './webpack/webpack4.serve.config'; -import { ApplicationMain } from '@teambit/application'; - -function getCompilerConfig(wco: WebpackConfigOptions): WebpackConfig { - if (wco.buildOptions.main || wco.buildOptions.polyfills) { - return wco.buildOptions.aot ? getAotConfig(wco) : getNonAotConfig(wco); - } - - return {}; -} - -export class AngularV9Webpack extends AngularBaseWebpack { - enableIvy = true; - webpackDevServer = WsDevServer; - webpackServeConfigFactory = webpack4ServeConfigFactory; - webpackBuildConfigFactory = webpack4BuildConfigFactory; - webpack: typeof webpack; - - constructor(workspace: Workspace | undefined, webpackMain: WebpackMain, pkg: PkgMain, application: ApplicationMain, ngEnvOptions: AngularEnvOptions) { - super(workspace, webpackMain, pkg, application, AngularV9Aspect as any, ngEnvOptions); - // resolving to the webpack used by angular devkit to avoid multiple instances of webpack - // otherwise, if we use a different version, it would break - const buildAngular = require.resolve('@angular-devkit/build-angular'); - const webpackPath = require.resolve('webpack', { paths: [buildAngular] }); - this.webpack = require(webpackPath); - } - - /** - * Migrate options from webpack-dev-server 3 to 4 - */ - private migrateConfiguration(webpackConfig: WebpackConfig): WebpackConfigWithDevServer | WebpackConfig { - /** - * Removed contentBase in favor of the static option - */ - // @ts-ignore - delete webpackConfig.devServer.contentBase; - - return webpackConfig; - } - - async getWebpackConfig( - context: DevServerContext | BundlerContext, - entryFiles: string[], - tsconfigPath: string, - workspaceRoot: string, - logger: Logger, - setup: WebpackSetup, - webpackOptions: Partial = {}, - angularOptions: Partial = {}, - sourceRoot = 'src', - ): Promise { - // Options from angular.json - const browserOptions: BrowserBuilderOptions = { - ...angularOptions, - baseHref: path.posix.join('/', context.rootPath!, context.publicPath!), - preserveSymlinks: false, - outputPath: 'public', // doesn't matter because it will be deleted from the config - index: angularOptions.index ?? join(sourceRoot, `index.html`), - main: angularOptions.main ?? join(sourceRoot, `main.ts`), - polyfills: angularOptions.polyfills ?? join(sourceRoot, `polyfills.ts`), - tsConfig: angularOptions.tsConfig ?? tsconfigPath, - assets: [...new Set([path.posix.join(sourceRoot, `favicon.ico`), path.posix.join(sourceRoot, `assets`), ...(angularOptions.assets ?? [])])], // using set to remove duplicates - styles: [...new Set([path.posix.join(sourceRoot, `styles.scss`), ...(angularOptions.styles ?? [])])], // using set to remove duplicates - scripts: angularOptions.scripts, - vendorChunk: angularOptions.vendorChunk ?? true, - namedChunks: angularOptions.namedChunks ?? true, - optimization: angularOptions.optimization ?? setup === WebpackSetup.Build, - buildOptimizer: angularOptions.buildOptimizer ?? setup === WebpackSetup.Build, - aot: angularOptions.aot ?? true, - deleteOutputPath: angularOptions.deleteOutputPath ?? true, - sourceMap: angularOptions.sourceMap ?? true, - outputHashing: angularOptions.outputHashing ?? (setup === WebpackSetup.Build ? OutputHashing.All : OutputHashing.None), - watch: setup === WebpackSetup.Serve, - }; - - const normalizedWorkspaceRoot = normalize(workspaceRoot); - const projectRoot = normalize(''); - const normalizedSourceRoot = normalize(sourceRoot); - - const host = new NodeJsSyncHost(); - const normalizedOptions = normalizeBrowserSchema(host, normalizedWorkspaceRoot, projectRoot, normalizedSourceRoot, { - ...browserOptions, - ...(webpackOptions as Partial), - }); - - const loggerApi = { - createChild: () => logger as any, - ...logger, - log: logger.console, - } as any as logging.LoggerApi; - - const webpackConfig: any = await generateWebpackConfig( - {builder: { - builderName: 'browser' - }} as BuilderContext, - getSystemPath(normalizedWorkspaceRoot), - getSystemPath(projectRoot), - getSystemPath(normalizedSourceRoot), - normalizedOptions, - (wco: BrowserWebpackConfigOptions) => [ - getCommonConfig(wco), - getBrowserConfig(wco), - getStylesConfig(wco), - getStatsConfig(wco), - getCompilerConfig(wco), - ], - loggerApi - ); - - if(setup === WebpackSetup.Serve) { - webpackConfig.devServer = buildServerConfig( - normalizedWorkspaceRoot, - webpackOptions as DevServerBuilderOptions, - browserOptions, - loggerApi - ); - } - - // Add bit generated files to the list of entries - webpackConfig.entry.main.unshift(...entryFiles); - - // @ts-ignore - if (webpackOptions.liveReload && !webpackOptions.hmr) { - // This is needed because we cannot use the inline option directly in the config - // because of the SuppressExtractedTextChunksWebpackPlugin - // Consider not using SuppressExtractedTextChunksWebpackPlugin when liveReload is enable. - // tslint:disable-next-line: no-any - addDevServerEntrypoints(webpackConfig as any, { - ...(webpackConfig as any).devServer, - inline: true, - }); - - // Remove live-reload code from all entrypoints but not main. - // Otherwise this will break SuppressExtractedTextChunksWebpackPlugin because - // 'addDevServerEntrypoints' adds additional entry-points to all entries. - if ( - webpackConfig.entry && - typeof webpackConfig.entry === 'object' && - !Array.isArray(webpackConfig.entry) && - webpackConfig.entry.main - ) { - for (const [key, value] of Object.entries(webpackConfig.entry)) { - if (key === 'main' || !Array.isArray(value)) { - // eslint-disable-next-line no-continue - continue; - } - - const webpackClientScriptIndex = value.findIndex((x) => x.includes('webpack-dev-server/client/index.js')); - if (webpackClientScriptIndex >= 0) { - // Remove the webpack-dev-server/client script from array. - value.splice(webpackClientScriptIndex, 1); - } - } - } - } - - // @ts-ignore - if (webpackOptions.hmr) { - logger.warn(tags.stripIndents`NOTICE: Hot Module Replacement (HMR) is enabled for the dev server. - See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`); - } - - const { scripts = [], styles = [] } = browserOptions; - const entrypoints = generateEntryPoints({ scripts, styles }); - if (!webpackConfig.plugins) { - webpackConfig.plugins = []; - } - webpackConfig.plugins.push( - new IndexHtmlWebpackPlugin({ - input: path.resolve(workspaceRoot, browserOptions.index as string), - output: getIndexOutputFile(browserOptions), - baseHref: browserOptions.baseHref || '/', - entrypoints, - moduleEntrypoints: [], - noModuleEntrypoints: ['polyfills-es5'], - deployUrl: browserOptions.deployUrl, - sri: browserOptions.subresourceIntegrity, - crossOrigin: browserOptions.crossOrigin, - lang: 'en-US', // TODO(ocombe) support locale - }) - ); - - // don't use the output path from angular - delete webpackConfig?.output?.path; - delete webpackConfig?.resolve?.modules; - webpackConfig.stats = 'errors-only'; - webpackConfig.context = workspaceRoot; - - if (setup === WebpackSetup.Serve) { - return this.migrateConfiguration(webpackConfig); - } - - - return webpackConfig; - } -} diff --git a/scopes/versions/angular-v9/component.json b/scopes/versions/angular-v9/component.json deleted file mode 100644 index 9da38d81..00000000 --- a/scopes/versions/angular-v9/component.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "componentId": { - "name": "versions/angular-v9" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-v9", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@angular-devkit/architect": "~0.901.15", - "@angular-devkit/build-angular": "~0.901.15", - "@angular-devkit/build-optimizer": "~0.901.15", - "@angular-devkit/build-webpack": "~0.901.15", - "@angular-devkit/core": "~9.1.15", - "@angular-devkit/schematics": "~9.1.15", - "@angular-eslint/eslint-plugin": "^1.2.0", - "@angular-eslint/eslint-plugin-template": "^1.2.0", - "@angular-eslint/template-parser": "^1.2.0", - "@angular/animations": "~9.1.13", - "@angular/common": "~9.1.13", - "@angular/compiler": "~9.1.13", - "@angular/compiler-cli": "~9.1.13", - "@angular/core": "~9.1.13", - "@angular/elements": "~9.1.13", - "@angular/forms": "~9.1.13", - "@angular/platform-browser": "~9.1.13", - "@angular/platform-browser-dynamic": "~9.1.13", - "@angular/router": "~9.1.13", - "@ngtools/webpack": "~9.1.15", - "@types/jest": "~27.0.3", - "@types/react-dev-utils": "~9.0.8", - "@types/remark-prism": "~1.3.0", - "@types/webpack-dev-server": "~3.11.2", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", - "eslint": "7.26.0", - "eslint-plugin-import": "^2.23.4", - "eslint-plugin-jsdoc": "^35.5.1", - "eslint-plugin-prefer-arrow": "^1.2.3", - "html-loader": "~1.3.2", - "jest": "~27.0.4", - "jest-preset-angular": "~9.0.7", - "ng-packagr": "~9.1.5", - "path-browserify": "1.0.1", - "react-dev-utils": "10.2.1", - "remark": "~13.0.0", - "remark-frontmatter": "~3.0.0", - "remark-html": "13.0.1", - "remark-loader": "~2.0.0", - "remark-prism": "~1.3.6", - "rxjs": "^6.6.3", - "tslib": "^1.10.0", - "ts-node": "~8.3.0", - "typescript": "~3.8.3", - "webpack": "~4.44.2", - "webpack-dev-middleware": "~3.7.2", - "webpack-dev-server": "~3.11.2", - "zone.js": "~0.10.3" - } - } - } - } -} diff --git a/scopes/versions/angular-v9/index.ts b/scopes/versions/angular-v9/index.ts deleted file mode 100644 index 25f4401c..00000000 --- a/scopes/versions/angular-v9/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { AngularV9Main } from './angular-v9.main.runtime'; -export { AngularV9Env } from './angular-v9.env'; -export { AngularV9Aspect, AngularV9Aspect as default } from './angular-v9.aspect'; diff --git a/scopes/versions/angular-v9/jest/jest.config.js b/scopes/versions/angular-v9/jest/jest.config.js deleted file mode 100644 index 519f8631..00000000 --- a/scopes/versions/angular-v9/jest/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - preset: 'jest-preset-angular', - reporters: ['default'], - setupFilesAfterEnv: [require.resolve('./setup-jest.js')], - transformIgnorePatterns: ['node_modules/(?!(jest-test))'], - testPathIgnorePatterns: ['/.*/e2e/'], - globals: { - 'ts-jest': { - tsconfig: require.resolve('./tsconfig.spec.json'), - }, - }, - moduleNameMapper: { - // map angular modules to the root node_modules to avoid duplicated modules - "(@angular\/animations.*)$": "/node_modules/$1", - "(@angular\/common.*)$": "/node_modules/$1", - "(@angular\/compiler.*)$": "/node_modules/$1", - "(@angular\/compiler-cli.*)$": "/node_modules/$1", - "(@angular\/core.*)$": "/node_modules/$1", - "(@angular\/forms.*)$": "/node_modules/$1", - "(@angular\/platform-browser.*)$": "/node_modules/$1", - "(@angular\/platform-browser-dynamic.*)$": "/node_modules/$1", - "(@angular\/router.*)$": "/node_modules/$1", - } -}; diff --git a/scopes/versions/angular-v9/jest/setup-jest.ts b/scopes/versions/angular-v9/jest/setup-jest.ts deleted file mode 100644 index 1100b3e8..00000000 --- a/scopes/versions/angular-v9/jest/setup-jest.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest-preset-angular/setup-jest'; diff --git a/scopes/versions/angular-v9/jest/tsconfig.spec.json b/scopes/versions/angular-v9/jest/tsconfig.spec.json deleted file mode 100644 index 078e0693..00000000 --- a/scopes/versions/angular-v9/jest/tsconfig.spec.json +++ /dev/null @@ -1,36 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc/spec", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "sourceMap": true, - "declaration": false, - "emitDecoratorMetadata": true, - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "importHelpers": true, - "allowJs": true, - "target": "es2015", - "module": "esnext", - "lib": [ - "es2018", - "dom" - ], - "types": ["jest", "node"] - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true, - "enableIvy": true - }, - "include": ["**/*.spec.+(js|ts)", "**/*.test.+(js|ts)", "**/*.d.ts"] -} diff --git a/scopes/versions/angular-v9/webpack/webpack4.build.config.ts b/scopes/versions/angular-v9/webpack/webpack4.build.config.ts deleted file mode 100644 index 21bd0bd4..00000000 --- a/scopes/versions/angular-v9/webpack/webpack4.build.config.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - AngularEnvOptions, - BitDedupeModuleResolvePlugin, - WebpackConfig -} from '@teambit/angular-base'; -import { sep } from 'path'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -// TODO(ocombe): this is webpack 5 build config, not webpack 4 -export function webpack4BuildConfigFactory( - entryFiles: string[], - outputPath: string, - nodeModulesPaths: string[], - workspaceDir: string, - tempFolder: string, - plugins: any[] = [], - ngEnvOptions: AngularEnvOptions, -): WebpackConfig { - const config = { - mode: 'production', - // Stop compilation early in production - bail: true, - // These are the "entry points" to our application. - // This means they will be the "root" imports that are included in JS bundle. - entry: entryFiles, - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // The build folder. - path: `${outputPath}${sep}public`, - - // publicPath: ``, - - // @ts-ignore - futureEmitAssets: true, - - filename: 'static/js/[name].[contenthash:8].js', - - // There are also additional JS chunk files if you use code splitting. - chunkFilename: 'static/js/[name].[contenthash:8].chunk.js', - - // webpack uses `publicPath` to determine where the app is being served from. - // It requires a trailing slash, or the file assets will get an incorrect path. - // We inferred the "public path" (such as / or /my-project) from homepage. - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - path: require.resolve('path-browserify'), - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - ...plugins - ] - }; - - return config as WebpackConfig; -} diff --git a/scopes/versions/angular-v9/webpack/webpack4.serve.config.ts b/scopes/versions/angular-v9/webpack/webpack4.serve.config.ts deleted file mode 100644 index 8a583f29..00000000 --- a/scopes/versions/angular-v9/webpack/webpack4.serve.config.ts +++ /dev/null @@ -1,183 +0,0 @@ -import { AngularEnvOptions, BitDedupeModuleResolvePlugin } from '@teambit/angular-base'; -import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; -import { PubsubMain } from '@teambit/pubsub'; -import { fallbacksAliases, WebpackBitReporterPlugin } from '@teambit/webpack'; -import path from 'path'; -import errorOverlayMiddleware from 'react-dev-utils/errorOverlayMiddleware'; -import evalSourceMapMiddleware from 'react-dev-utils/evalSourceMapMiddleware'; -import getPublicUrlOrPath from 'react-dev-utils/getPublicUrlOrPath'; -import noopServiceWorkerMiddleware from 'react-dev-utils/noopServiceWorkerMiddleware'; -import redirectServedPath from 'react-dev-utils/redirectServedPathMiddleware'; -import RemarkFrontmatter from 'remark-frontmatter'; -import RemarkHTML from 'remark-html'; -import RemarkPrism from 'remark-prism'; - -const sockHost = process.env.WDS_SOCKET_HOST; -const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node' -const sockPort = process.env.WDS_SOCKET_PORT; - -const publicUrlOrPath = getPublicUrlOrPath(process.env.NODE_ENV === 'development', '/', '/public'); - -export function webpack4ServeConfigFactory( - devServerID: string, - workspaceDir: string, - entryFiles: string[], - publicRoot: string, - publicPath: string, - pubsub: PubsubMain, - nodeModulesPaths: string[], - tempFolder: string, - plugins: any[] = [], - // eslint-disable-next-line @typescript-eslint/no-unused-vars - isApp = false, - ngEnvOptions: AngularEnvOptions, -): any { - const resolveWorkspacePath = (relativePath: string) => path.resolve(workspaceDir, relativePath); - - // Host - const host = process.env.HOST || 'localhost'; - - // Required for babel-preset-react-app - process.env.NODE_ENV = 'development'; - - const publicDirectory = path.posix.join(publicRoot, publicPath); - - return { - // Environment mode - mode: 'development', - - devtool: 'inline-source-map', - - // Entry point of app - entry: entryFiles.map((filePath) => resolveWorkspacePath(filePath)), - - node: { - // @ts-ignore - fs: 'empty', - }, - - output: { - // Development filename output - filename: 'static/js/[name].bundle.js', - - pathinfo: true, - - path: resolveWorkspacePath(publicDirectory), - - // publicPath: `/${publicRoot}/`, - - // @ts-ignore - futureEmitAssets: true, - - chunkFilename: 'static/js/[name].chunk.js', - - // point sourcemap entries to original disk locations (format as URL on windows) - devtoolModuleFilenameTemplate: (info: any) => pathNormalizeToLinux(path.resolve(info.absoluteResourcePath)), - - // this defaults to 'window', but by setting it to 'this' then - // module chunks which are built will work in web workers as well. - globalObject: 'this', - }, - - devServer: { - quiet: true, - stats: 'errors-only', - - // Serve index.html as the base - contentBase: resolveWorkspacePath(publicDirectory), - - // By default files from `contentBase` will not trigger a page reload. - watchContentBase: false, - - contentBasePublicPath: publicDirectory, - - // Enable compression - compress: true, - - // Use 'ws' instead of - // 'sockjs-node' on server since we're using native - // websockets in `webpackHotDevClient`. - transportMode: 'ws', - - injectClient: false, - - overlay: false, - // Enable hot reloading - hot: false, - - host, - - historyApiFallback: { - disableDotRule: true, - index: resolveWorkspacePath(publicDirectory), - }, - - sockHost, - sockPath, - sockPort, - - before(app: any, server: any) { - // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware` - // middlewares before `redirectServedPath` otherwise will not have any effect - // This lets us fetch source contents from webpack for the error overlay - app.use(evalSourceMapMiddleware(server)); - // This lets us open files from the runtime error overlay. - app.use(errorOverlayMiddleware()); - }, - - after(app: any) { - // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match - app.use(redirectServedPath(publicUrlOrPath)); - - // This service worker file is effectively a 'no-op' that will reset any - // previous service worker registered for the same host:port combination. - // We do this in development to avoid hitting the production cache if - // it used the same host and port. - // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432 - app.use(noopServiceWorkerMiddleware(publicUrlOrPath)); - }, - - // Public path is root of content base - publicPath: path.join('/', publicRoot), - }, - - resolve: { - extensions: ['.mjs', '.ts', '.tsx', '.js', '.mdx', '.md'], - alias: { - ...fallbacksAliases, - path: require.resolve('path-browserify') - }, - modules: nodeModulesPaths - }, - - module: { - rules: [ - { - test: /\.md$/, - use: [ - { - loader: 'html-loader', - }, - { - loader: 'remark-loader', - options: { - removeFrontMatter: false, - remarkOptions: { - plugins: [RemarkPrism, RemarkHTML, RemarkFrontmatter], - }, - }, - }, - ], - }, - ], - }, - - plugins: [ - new BitDedupeModuleResolvePlugin(nodeModulesPaths, workspaceDir, tempFolder, ngEnvOptions), - new WebpackBitReporterPlugin({ - options: { pubsub, devServerID }, - }), - ...plugins - ], - }; -} diff --git a/scopes/versions/common/angular-apps/component.json b/scopes/versions/common/angular-apps/component.json deleted file mode 100644 index 5e4840ce..00000000 --- a/scopes/versions/common/angular-apps/component.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "componentId": { - "scope": "teambit.angular", - "name": "versions/common/angular-apps" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-apps", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@angular-devkit/build-angular": "-", - "typescript": "-" - }, - "peerDependencies": { - "@angular-devkit/build-angular": ">= 0.0.1", - "typescript": ">= 3.5.3" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" - } - } - } - } -} diff --git a/scopes/versions/common/angular-base/angular-base.webpack.ts b/scopes/versions/common/angular-base/angular-base.webpack.ts deleted file mode 100644 index 1a992810..00000000 --- a/scopes/versions/common/angular-base/angular-base.webpack.ts +++ /dev/null @@ -1,306 +0,0 @@ -// import { componentIsApp } from '@teambit/angular-apps'; -// import { AngularEnvOptions, BrowserOptions, DevServerOptions } from '@teambit/angular-common'; -// import { WebpackConfig, WebpackPlugin, WebpackSetup } from '@teambit/angular-webpack'; -// import { AppBuildContext, AppContext, ApplicationMain } from '@teambit/application'; -// import { Bundler, BundlerContext, DevServer, DevServerContext, Target } from '@teambit/bundler'; -// import { Component, ComponentID } from '@teambit/component'; -// import { Aspect } from '@teambit/harmony'; -// import { CACHE_ROOT } from '@teambit/legacy/dist/constants'; -// import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; -// import { Logger } from '@teambit/logger'; -// import { PkgMain } from '@teambit/pkg'; -// import { PubsubMain } from '@teambit/pubsub'; -// import { -// runTransformersWithContext, -// WebpackBundler, -// WebpackConfigMutator, -// WebpackConfigTransformer, -// WebpackConfigWithDevServer, -// WebpackDevServer, -// WebpackMain -// } from '@teambit/webpack'; -// import { Workspace } from '@teambit/workspace'; -// import { existsSync, mkdirSync, writeFileSync } from 'fs-extra'; -// import objectHash from 'object-hash'; -// import { join, posix, resolve } from 'path'; -// import { readConfigFile, sys } from 'typescript'; -// import { Configuration, WebpackPluginInstance } from 'webpack'; -// import { -// StatsLoggerPlugin -// } from '../../../dev-services/compiler/webpack/webpack-plugins/stats-logger'; -// -// export type WebpackServeConfigFactory = ( -// devServerID: string, -// workspaceDir: string, -// entryFiles: string[], -// publicRoot: string, -// publicPath: string, -// pubsub: PubsubMain, -// nodeModulesPaths: string[], -// tempFolder: string, -// plugins: WebpackPlugin[], -// IsApp: boolean, -// ngEnvOptions: AngularEnvOptions -// ) => WebpackConfigWithDevServer; -// -// export type WebpackBuildConfigFactory = ( -// entryFiles: string[], -// outputPath: string, -// nodeModulesPaths: string[], -// workspaceDir: string, -// tempFolder: string, -// plugins: WebpackPlugin[], -// ngEnvOptions: AngularEnvOptions -// ) => Configuration; -// -// export abstract class AngularBaseWebpack { -// private timestamp = Date.now(); -// private writeHash = new Map(); -// private readonly tempFolder: string; -// webpackServeOptions: Partial = {}; -// webpackBuildOptions: Partial = {}; -// angularServeOptions: Partial = {}; -// angularBuildOptions: Partial = {}; -// sourceRoot = 'src'; -// -// constructor( -// private workspace: Workspace | undefined, -// private webpackMain: WebpackMain, -// private pkg: PkgMain, -// private application: ApplicationMain, -// angularAspect: Aspect, -// private ngEnvOptions: AngularEnvOptions -// ) { -// if (workspace) { -// this.tempFolder = workspace.getTempDir(angularAspect.id); -// } else { -// this.tempFolder = join(CACHE_ROOT, angularAspect.id); -// } -// } -// -// /** Abstract functions & properties specific to the adapter **/ -// abstract enableIvy: boolean; -// -// abstract getWebpackConfig( -// context: DevServerContext | BundlerContext, -// entryFiles: string[], -// tsConfigPath: string, -// rootPath: string, -// logger: Logger, -// setup: WebpackSetup, -// webpackOptions: Partial, -// angularOptions: any, -// sourceRoot?: string -// ): Promise; -// -// abstract webpack: any; -// abstract webpackDevServer: any; -// abstract webpackServeConfigFactory: WebpackServeConfigFactory; -// abstract webpackBuildConfigFactory: WebpackBuildConfigFactory; -// -// /** -// * Add the list of files to include into the typescript compilation as absolute paths -// */ -// private generateTsConfig(appPath: string, includePaths: string[], excludePaths: string[] = [], tsPaths: { [key: string]: string[] }): string { -// const tsconfigPath = join(appPath, 'tsconfig.app.json'); -// const tsconfigJSON = readConfigFile(tsconfigPath, sys.readFile); -// const pAppPath = pathNormalizeToLinux(appPath); -// -// tsconfigJSON.config.angularCompilerOptions.enableIvy = this.enableIvy; -// tsconfigJSON.config.files = [posix.join(pAppPath, 'src/main.ts'), posix.join(pAppPath, 'src/polyfills.ts')]; -// tsconfigJSON.config.include = [ -// posix.join(pAppPath, 'src/app/**/*.ts'), -// ...includePaths.map((path) => posix.join(path, '**/*.ts')) -// ]; -// tsconfigJSON.config.exclude = [ -// posix.join(pAppPath, '**/*.spec.ts'), -// ...excludePaths, -// ...includePaths.map((path) => posix.join(path, '**/*.spec.ts')) -// ]; -// tsconfigJSON.config.compilerOptions.paths = tsPaths; -// -// return JSON.stringify(tsconfigJSON.config, undefined, 2); -// } -// -// isBuildContext(context: DevServerContext | BundlerContext): context is BundlerContext { -// return (context as BundlerContext).capsuleNetwork !== undefined; -// } -// -// isAppContext(context: DevServerContext | AppContext): context is DevServerContext & AppContext { -// return (context as any).appName !== undefined; -// } -// -// isAppBuildContext(context: BundlerContext | AppBuildContext): context is BundlerContext & AppBuildContext { -// return (context as any).appName !== undefined; -// } -// -// /** -// * write a link to load custom modules dynamically. -// */ -// writeTsconfig(context: DevServerContext | BundlerContext, rootSpace: string): string { -// const tsPaths: { [key: string]: string[] } = {}; -// const includePaths = new Set(); -// const dirPath = join(this.tempFolder, context.id); -// if (!existsSync(dirPath)) { -// mkdirSync(dirPath, { recursive: true }); -// } -// -// // get the list of files for existing component compositions to include into the compilation -// context.components.forEach((component: Component) => { -// let outputPath: string; -// -// const isApp = componentIsApp(component, this.application); -// if (isApp) { -// return; -// } -// if (this.isBuildContext(context)) { -// const capsules = context.capsuleNetwork.graphCapsules; -// const capsule = capsules.getCapsule(component.id); -// if (!capsule) { -// throw new Error(`No capsule found for ${component.id} in network graph`); -// } -// outputPath = pathNormalizeToLinux(capsule.path); -// } else { -// outputPath = pathNormalizeToLinux(this.workspace?.componentDir(component.id, { -// ignoreScopeAndVersion: true, -// ignoreVersion: true -// }) || ''); -// } -// // map the package names to the workspace component paths for typescript in case a package references another local package -// tsPaths[`${this.pkg.getPackageName(component)}`] = [`${outputPath}/public-api.ts`]; -// tsPaths[`${this.pkg.getPackageName(component)}/*`] = [`${outputPath}/*`]; -// -// includePaths.add(outputPath); -// }); -// -// const content = this.generateTsConfig(rootSpace, Array.from(includePaths), [], tsPaths); -// const hash = objectHash(content); -// const targetPath = join(dirPath, `__tsconfig-${this.timestamp}.json`); -// -// // write only if link has changed (prevents triggering fs watches) -// if (this.writeHash.get(targetPath) !== hash) { -// writeFileSync(targetPath, content); -// this.writeHash.set(targetPath, hash); -// } -// -// return targetPath; -// } -// -// private getPreviewRootPath(): string { -// try { -// const rootPath = this.workspace?.componentDir(ComponentID.fromString('teambit.angular/versions/common/angular-base'), { -// ignoreScopeAndVersion: true, -// ignoreVersion: true -// }, { relative: false }) || ''; -// return join(rootPath, 'preview'); -// } catch (e) { -// return resolve(require.resolve('@teambit/angular-base'), '../../preview/'); -// } -// } -// -// async createDevServer(context: DevServerContext | (DevServerContext & AppContext), transformers: WebpackConfigTransformer[] = [], nodeModulesPaths: string[], angularServeOptions: Partial = {}, sourceRoot?: string): Promise { -// let appRootPath, tsconfigPath; -// const plugins: WebpackPluginInstance[] = []; -// let isApp = false; -// if (this.isAppContext(context)) { // When you use `bit run ` -// appRootPath = this.workspace?.componentDir(context.appComponent.id, { -// ignoreScopeAndVersion: true, -// ignoreVersion: true -// }) || ''; -// tsconfigPath = join(appRootPath, 'tsconfig.app.json'); -// isApp = true; -// } else { // When you use `bit start` -// appRootPath = this.getPreviewRootPath(); -// tsconfigPath = this.writeTsconfig(context, appRootPath); -// } -// -// const mergedAngularServeOptions = Object.assign({}, this.angularServeOptions, angularServeOptions); -// -// const defaultConfig: any = await this.getWebpackConfig( -// context, -// context.entry, -// tsconfigPath, -// appRootPath, -// this.webpackMain.logger, -// WebpackSetup.Serve, -// this.webpackServeOptions, -// mergedAngularServeOptions, -// sourceRoot ?? this.sourceRoot -// ); -// const defaultTransformer: WebpackConfigTransformer = (configMutator: WebpackConfigMutator) => -// configMutator.merge([defaultConfig]); -// -// const config = this.webpackServeConfigFactory( -// context.id, -// this.workspace?.path || '', -// context.entry, -// context.rootPath, -// context.publicPath, -// this.webpackMain.pubsub, -// nodeModulesPaths, -// this.tempFolder, -// plugins, -// isApp, -// this.ngEnvOptions -// ); -// const configMutator = new WebpackConfigMutator(config); -// -// const afterMutation = runTransformersWithContext( -// configMutator.clone(), -// [defaultTransformer, ...transformers], -// { mode: 'dev' } -// ); -// -// return new WebpackDevServer(afterMutation.raw as WebpackConfigWithDevServer, this.webpack as any, this.webpackDevServer as any); -// } -// -// private createPreviewConfig(context: BundlerContext | (BundlerContext & AppBuildContext), nodeModulesPaths: string[]): Configuration[] { -// let plugins: WebpackPluginInstance[] = []; -// if (this.isAppBuildContext(context)) { -// plugins = [new StatsLoggerPlugin()]; -// } -// return context.targets.map((target) => { -// return this.webpackBuildConfigFactory(target.entries as string[], target.outputPath, nodeModulesPaths, this.workspace?.path || '', this.tempFolder, plugins, this.ngEnvOptions); -// }); -// } -// -// async createBundler(context: BundlerContext | (BundlerContext & AppBuildContext), transformers: any[], nodeModulesPaths: string[], angularBuildOptions: Partial = {}, sourceRoot?: string): Promise { -// let appRootPath, tsconfigPath; -// if (this.isAppBuildContext(context)) { -// appRootPath = context.capsule.path;// this.workspace?.componentDir(context.appComponent.id, {ignoreScopeAndVersion: true, ignoreVersion: true}) || ''; -// tsconfigPath = join(appRootPath, 'tsconfig.app.json'); -// } else { -// appRootPath = this.getPreviewRootPath(); -// tsconfigPath = this.writeTsconfig(context, appRootPath); -// } -// -// const mergedAngularBuildOptions = Object.assign({}, this.angularBuildOptions, angularBuildOptions); -// -// const defaultConfig: any = await this.getWebpackConfig( -// context, -// context.targets.map((target: Target) => target.entries).flat() as string[], -// tsconfigPath, -// appRootPath, -// this.webpackMain.logger, -// WebpackSetup.Build, -// this.webpackBuildOptions as unknown as WebpackConfigWithDevServer, -// mergedAngularBuildOptions, -// sourceRoot ?? this.sourceRoot -// ); -// const defaultTransformer: WebpackConfigTransformer = (configMutator: WebpackConfigMutator) => -// configMutator.merge([defaultConfig]); -// -// const configs = this.createPreviewConfig(context, nodeModulesPaths); -// const mutatedConfigs = configs.map((config: any) => { -// const configMutator = new WebpackConfigMutator(config); -// const afterMutation = runTransformersWithContext( -// configMutator.clone(), -// [defaultTransformer, ...transformers], -// { mode: 'prod' } -// ); -// return afterMutation.raw; -// }); -// -// return new WebpackBundler(context.targets, mutatedConfigs, this.webpackMain.logger, this.webpack, context.metaData); -// } -// } diff --git a/scopes/versions/common/angular-base/config/eslintrc.js b/scopes/versions/common/angular-base/config/eslintrc.js deleted file mode 100644 index 7fd6446f..00000000 --- a/scopes/versions/common/angular-base/config/eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -// force bit to recognize this as dependency -require('@teambit/angular-eslint-config'); - -module.exports = { - extends: [require.resolve('@teambit/angular-eslint-config')], - rules: {} -}; diff --git a/scopes/versions/common/angular-base/preview/host-dependencies.ts b/scopes/versions/common/angular-base/preview/host-dependencies.ts deleted file mode 100644 index 1e705939..00000000 --- a/scopes/versions/common/angular-base/preview/host-dependencies.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. - * most of your peer dependencies should be listed here to avoid duplications in the preview. - */ -export default [ - '@teambit/mdx.ui.mdx-scope-context', - '@mdx-js/react', - 'react', - 'react-dom', -]; \ No newline at end of file diff --git a/scopes/versions/common/angular-common/component.json b/scopes/versions/common/angular-common/component.json deleted file mode 100644 index a1aeccb8..00000000 --- a/scopes/versions/common/angular-common/component.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "componentId": { - "name": "versions/common/angular-common", - "scope": "teambit.angular" - }, - "propagate": true, - "extensions": { - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/angular-common", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - }, - "teambit.dependencies/dependency-resolver": { - "policy": { - "dependencies": { - "@angular-devkit/build-angular": "-", - "typescript": "-" - }, - "peerDependencies": { - "@angular-devkit/build-angular": ">= 0.0.1", - "typescript": ">= 3.5.3" - }, - "devDependencies": { - "@babel/runtime": "7.22.15" - } - } - } - } -} diff --git a/tsconfig.json b/tsconfig.json index 7b821aaa..d6742fbd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,51 +1,10 @@ +// bit-generated-typescript-config { + "extends": "./node_modules/.cache/tsconfig.bit.d3d4e4a560ca9ced8c4fb46e8e65bb230e5e21ef.json", "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - "lib": ["ESNext", "dom"], /* Specify library files to be included in the compilation. */ - "allowJs": true, /* Allow javascript files to be compiled. */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - - /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - "preserveSymlinks": false, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Experimental Options */ - "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true, - /* Disallow inconsistently-cased references to the same file. */ - "jsx": "react-jsx" + "typeRoots": [ + "./node_modules/.cache/global-types", + "./node_modules/@types" + ] } -} +} \ No newline at end of file diff --git a/workspace.jsonc b/workspace.jsonc index 7dc514d7..7fed5ce1 100644 --- a/workspace.jsonc +++ b/workspace.jsonc @@ -22,8 +22,8 @@ /** * default scope for all components in workspace. **/ - "defaultScope": "teambit.angular", - "resolveEnvsFromRoots": false, + "defaultScope": "bitdev.angular", + "resolveEnvsFromRoots": false }, /** * main configuration for component dependency resolution. @@ -39,16 +39,16 @@ "@teambit/defender.eslint-linter": "1.0.8", "@teambit/defender.jest-tester": "1.0.5", "@teambit/defender.prettier-formatter": "1.0.2", - "@teambit/dependencies.modules.packages-excluder": "1.0.2", + "@teambit/dependencies.modules.packages-excluder": "1.0.4", "@teambit/envs.docs.env-overview-template": "0.0.2", "@teambit/graph.cleargraph": "^0.0.7", - "@teambit/react.ui.docs-app": "1.0.2", - "@teambit/toolbox.network.get-port": "1.0.0", - "@teambit/toolbox.performance.v8-cache": "0.0.27", + "@teambit/react.ui.docs-app": "1.0.6", + "@teambit/toolbox.network.get-port": "1.0.2", + "@teambit/toolbox.performance.v8-cache": "0.0.29", "@teambit/typescript.typescript-compiler": "2.0.7", - "@teambit/ui-foundation.ui.constants.z-indexes": "^0.0.500", - "@teambit/webpack.modules.generate-style-loaders": "1.0.0", - "@teambit/webpack.modules.style-regexps": "1.0.0", + "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.504", + "@teambit/webpack.modules.generate-style-loaders": "1.0.2", + "@teambit/webpack.modules.style-regexps": "1.0.2", "@teambit/webpack.webpack-bundler": "1.0.2", "@types/fs-extra": "~9.0.7", "@types/lodash": "4.14.165", @@ -77,57 +77,36 @@ }, "teambit.generator/generator": { "envs": [ -// "teambit.angular/angular", -// "teambit.angular/versions/angular-v16", -// "teambit.angular/versions/angular-v15", -// "teambit.angular/versions/angular-v14", -// "teambit.angular/versions/angular-v13", -// "teambit.angular/versions/angular-v12", - ], - // "aspects": [ - // "teambit.angular/versions/angular-v11", - // "teambit.angular/versions/angular-v10", - // "teambit.angular/versions/angular-v9", - // "teambit.angular/versions/angular-v8" - // ] + // "bitdev.angular/angular-env", + "bitdev.angular/envs/angular-v16-env" + // "bitdev.angular/envs/angular-v15-env", + // "bitdev.angular/envs/angular-v14-env", + // "bitdev.angular/envs/angular-v13-env", + // "bitdev.angular/envs/angular-v12-env", + ] }, - // Add angular templates to the list - "teambit.angular/angular": {}, - "teambit.angular/versions/angular-v16": {}, - "teambit.angular/versions/angular-v15": {}, - "teambit.angular/versions/angular-v14": {}, - "teambit.angular/versions/angular-v13": {}, - "teambit.angular/versions/angular-v12": {}, - // "teambit.angular/versions/angular-v11": {}, - // "teambit.angular/versions/angular-v10": {}, - // "teambit.angular/versions/angular-v9": {}, - // "teambit.angular/versions/angular-v8": {}, + // "bitdev.angular/envs/angular-v15-env": {}, + // "bitdev.angular/envs/angular-v14-env": {}, + // "bitdev.angular/envs/angular-v13-env": {}, + // "bitdev.angular/envs/angular-v12-env": {}, // Add angular apps (until this is no longer necessary) - "examples/demo-app": {}, +// "integration/demo-app": {}, /** * workspace variants allow you to set different subsets of configuration for components in your workspace. * this is extremely useful for upgrading, aligning and building components with a * new set of dependencies. **/ "teambit.workspace/variants": { - // Set the default variant configs to be used for all components (except examples). - "scopes": { - "defaultScope": "teambit.angular", - "teambit.pkg/pkg": { - "packageManagerPublishArgs": [ - "--access public" - ], - "packageJson": { - "name": "@teambit/{name}", - "private": false, - "engines": { - "node": ">=12.15.0" - } - } - } + // Set the default variant configs to be used for all components (except integration). + "angular": { + "defaultScope": "bitdev.angular" + }, + // Set the default variant configs to be used for integration + "integration": { + "defaultScope": "integration.examples" }, // Special rules for all aspect envs - "scopes/angular, scopes/versions/angular-v8, scopes/versions/angular-v9, scopes/versions/angular-v10, scopes/versions/angular-v11, scopes/versions/angular-v12, scopes/versions/angular-v13, scopes/versions/angular-v14, scopes/versions/angular-v15, scopes/versions/angular-v16, scopes/forks": { + "angular/envs, angular/examples": { "teambit.harmony/aspect": "-", // Set the env env for all core envs "teambit.envs/env": {}, @@ -136,48 +115,43 @@ } }, // All the other components use node env - "scopes/dev-services, scopes/generators, scopes/versions/common": { + "angular/devkit, angular/templates, angular/envs/base-env": { + "teambit.envs/env": "-", "teambit.envs/envs": { - "env": "teambit.harmony/node" + "env": "teambit.node/node" }, - "teambit.harmony/node": {} - }, - "examples/custom-env": { - "teambit.envs/env": {} + "teambit.node/node@1.0.16": {} }, - "examples/demo-app": { - "teambit.angular/angular": {} -// "teambit.angular/versions/angular-v16": {} - }, - "examples/demo-lib": { - "teambit.angular/angular": {} - }, - "examples/demo-lib-v16": { - "teambit.angular/versions/angular-v16": {} + "angular/readme": { + "teambit.mdx/mdx": {}, + "teambit.envs/envs": { + "env": "teambit.mdx/mdx" + } }, - "examples/demo-lib-v15": { - "teambit.angular/versions/angular-v15": {} + "integration/custom-env": { + "teambit.envs/env": {} }, - "examples/demo-lib-v14": { - "teambit.angular/versions/angular-v14": {} + "integration/demo-app": { + // "bitdev.angular/angular-env": {} + "bitdev.angular/envs/angular-v16-env": {} }, - "examples/demo-lib-v13": { - "teambit.angular/versions/angular-v13": {} + "integration/demo-lib": { + "bitdev.angular/angular-env": {} }, - "examples/demo-lib-v12": { - "teambit.angular/versions/angular-v12": {} + "integration/demo-lib-v16": { + "bitdev.angular/envs/angular-v16-env": {} }, - "examples/demo-lib-v11": { - "teambit.angular/versions/angular-v11": {} + "integration/demo-lib-v15": { + "bitdev.angular/envs/angular-v15-env": {} }, - "examples/demo-lib-v10": { - "teambit.angular/versions/angular-v10": {} + "integration/demo-lib-v14": { + "bitdev.angular/envs/angular-v14-env": {} }, - "examples/demo-lib-v9": { - "teambit.angular/versions/angular-v9": {} + "integration/demo-lib-v13": { + "bitdev.angular/envs/angular-v13-env": {} }, - "examples/demo-lib-v8": { - "teambit.angular/versions/angular-v8": {} + "integration/demo-lib-v12": { + "bitdev.angular/envs/angular-v12-env": {} } } }