-
Globally replace
engom
to your project name in kebab-case -
Globally replace
engom
to your project prefix, it should be a short lowercased abbreviation of your project name - Set up the environment
- Delete the
dashboard
feature - Fill the root README with relevant data and remove this section
-
Adjust
CODEOWNERS
of your application, make sure you have at least one code reviewer before starting a project 👨💻
And that's it, your're ready to go! 🥷😎
Please see the engines
section in package.json
Please see the package.json
to see different build configurations
By default,
development
environment is hidden from search engines
If you need to have specific behavior from search engines, you can add the following:
<project>
- name of the project (folder name in projects/
directory)
<environment>
- name of the environment (e.g: development
/production
/etc)
- Copy assets from
angular.json/projects/<project>/architect/build/assets
toangular.json/projects/<project>/architect/build/configurations/<environment>/assets
- Add
"projects/<project>/src/robots.txt"
to the newly-created array of assets - Create
projects/<project>/src/robots.txt
We stick to the default Angular-provided way to pass variables within the application, but, to keep the single source of truth and be able to pass bash/environment-provided variables, we also use @ngx-env/builder. See examples on how to use it in our code.
Development (most of the practices described in wiki)
We stick the our guidelines described in wiki
Again, wiki
By default, we use the following convention for properties:
--primary-color: #233faa;
--primary-dark-color: #283593;
--primary-light-color: #c5cae9;
--primary-contrast-color: white;
--primary-dark-contrast-color: white;
--primary-light-contrast-color: black;
/* Then you can use 'secondary', 'tertiary', 'error', 'warning', 'success' and so on */
Then you can use these variables in the project or to configure ui frameworks.
To generate this palette you can take every color(contrast, dark, light...) from designs or choose main and use generators for the purpose. Two most usable generators:
- Ionic color generator. Don't look that it's made by "ionic". This generator is really convenient and we relied on it when we made the existing scheme.
- Material design generator. Use it when you define a custom theme for angular material or you just want to have a more detailed palette.
If you use angular-material on your project, you need to define mat-theme as well. Open
material-custom-theme.scss
file to see an example how it should be done. Please, use css custom properties that you've already defined for the app, it makes it easier to refactor or add new functionality (like dark mode or dynamic theme).
To avoid using string literals in routes paths anywhere (modules, components, services, etc.)
we have utils to build constant route paths objects.
This approach allows you to create common paths for the entire project in common-route-paths.ts
file and separate paths for each app (web, mobile, etc.).
To describe the paths for an app, it is proposed to use two functions: provideAppNameRoutes()
and injectAppNameRoutes()
, where appName
- name of your app.
/** Create provider for a web route paths. */
export function provideWebAppRoutes(): Provider {
return {
provide: WEB_ROUTE_PATHS_TOKEN,
useValue: webRoutePaths,
};
}
/** Inject web app route paths to component. */
export function injectWebAppRoutes(): WebRoutePaths {
return inject(WEB_ROUTE_PATHS_TOKEN);
}
Please see Angular guideline and @ngx-env/builder in case it's bash/environment-provided
-
Create new application
npx ng g app <app_name> -p engom<first_letter_of_your_app_name>
-
Add env declaration into the [files] section of newly-created tsconfigs (
tsconfig.{app|spec}.json
). See example in the original tsconfig files -
Set up basic structure for this app
features
,shared
etc. (see wiki) -
Adjust testing configuration
-
Add the following code to newly generated
test.ts
defineGlobalsInjections({ providers: [{ provide: AppConfig, useClass: TestAppConfig }], });
-
Add
failSpecWithNoExpectations: true
tokarma.conf.js
-
Add the following code to newly generated
karma.conf.js
(reference)browsers: ['Chrome'], customLaunchers: { ChromeHeadlessCI: { base: 'ChromeHeadless', flags: ['--no-sandbox'] } },
Please be aware, that
defineGlobalsInjections()
must be called before the modules are loaded. In the default Angulartest.ts
this means beforecontext.keys().map(context);
(reference) -
-
(optional) Set up component libraries
- Add Angular Material for this app (guide)
- Ionic
npx ng add @ionic/angular --project <app_name>
(andnpx ionic init --multi-app
ifionic.config.json
is not present)
-
(optional) Provide interceptors (see examples in default project's
app.module.ts
) -
(optional) Set up environment
- Provide
AppConfigService
implementation, see example - Set up the
@ngx-env/builder
for this application by usingng add @ngx-env/builder --project <app_name>
.The order matters here, it's gotta be done only after Material is set up, otherwise Angular will scream at you since the builder is not the default one
- Provide