This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
# <%= classify(name) %>
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version <%= angularLatestVersion %>.
## Code scaffolding
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
```bash
ng generate component component-name
```
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
```bash
ng generate --help
```
## Building
To build the library, run:
```bash
ng build <%= name %>
```
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
### Publishing the Library
Once the project is built, you can publish your library by following these steps:
1. Navigate to the `dist` directory:
```bash
cd dist/<%= dasherize(name) %>
```
2. Run the `npm publish` command to publish your library to the npm registry:
```bash
npm publish
```
## Running unit tests
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
```bash
ng test
```
## Running end-to-end tests
For end-to-end (e2e) testing, run:
```bash
ng e2e
```
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
## Additional Resources
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

View File

@@ -0,0 +1,7 @@
{
"$schema": "<%= relativePathToWorkspaceRoot %>/node_modules/ng-packagr/ng-package.schema.json",
"dest": "<%= relativePathToWorkspaceRoot %>/<%= distRoot %>",
"lib": {
"entryFile": "src/<%= entryFile %>.ts"
}
}

View File

@@ -0,0 +1,12 @@
{
"name": "<%= dasherize(packageName) %>",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^<%= angularLatestVersion %>",
"@angular/core": "^<%= angularLatestVersion %>"
},
"dependencies": {
"tslib": "^<%= tsLibLatestVersion %>"
},
"sideEffects": false
}

View File

@@ -0,0 +1,6 @@
/*
* Public API Surface of <%= dasherize(name) %>
*/
export * from './lib/<%= dasherize(name) %>';<% if (!standalone) { %>
export * from './lib/<%= dasherize(name) %>-module';<% } %>

View File

@@ -0,0 +1,18 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "<%= relativePathToWorkspaceRoot %>/tsconfig.json",
"compilerOptions": {
"outDir": "<%= relativePathToWorkspaceRoot %>/out-tsc/lib",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"include": [
"src/**/*.ts"
],
"exclude": [
"**/*.spec.ts"
]
}

View File

@@ -0,0 +1,11 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

View File

@@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "<%= relativePathToWorkspaceRoot %>/tsconfig.json",
"compilerOptions": {
"outDir": "<%= relativePathToWorkspaceRoot %>/out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.d.ts",
"src/**/*<% if (standalone) { %>.spec<% } %>.ts"
]
}

10
node_modules/@schematics/angular/library/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,10 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Rule } from '@angular-devkit/schematics';
import { Schema as LibraryOptions } from './schema';
export default function (options: LibraryOptions): Rule;

167
node_modules/@schematics/angular/library/index.js generated vendored Executable file
View File

@@ -0,0 +1,167 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular-devkit/schematics");
const posix_1 = require("node:path/posix");
const dependency_1 = require("../utility/dependency");
const json_file_1 = require("../utility/json-file");
const latest_versions_1 = require("../utility/latest-versions");
const paths_1 = require("../utility/paths");
const workspace_1 = require("../utility/workspace");
const workspace_models_1 = require("../utility/workspace-models");
const LIBRARY_DEV_DEPENDENCIES = [
{ name: '@angular/compiler-cli', version: latest_versions_1.latestVersions.Angular },
{ name: '@angular/build', version: latest_versions_1.latestVersions.AngularBuild },
{ name: 'ng-packagr', version: latest_versions_1.latestVersions.NgPackagr },
{ name: 'typescript', version: latest_versions_1.latestVersions['typescript'] },
];
function updateTsConfig(packageName, ...paths) {
return (host) => {
if (!host.exists('tsconfig.json')) {
return host;
}
const file = new json_file_1.JSONFile(host, 'tsconfig.json');
const jsonPath = ['compilerOptions', 'paths', packageName];
const value = file.get(jsonPath);
file.modify(jsonPath, Array.isArray(value) ? [...value, ...paths] : paths);
};
}
function addTsProjectReference(...paths) {
return (host) => {
if (!host.exists('tsconfig.json')) {
return host;
}
const newReferences = paths.map((path) => ({ path }));
const file = new json_file_1.JSONFile(host, 'tsconfig.json');
const jsonPath = ['references'];
const value = file.get(jsonPath);
file.modify(jsonPath, Array.isArray(value) ? [...value, ...newReferences] : newReferences);
};
}
function addDependenciesToPackageJson(skipInstall) {
return (0, schematics_1.chain)([
...LIBRARY_DEV_DEPENDENCIES.map((dependency) => (0, dependency_1.addDependency)(dependency.name, dependency.version, {
type: dependency_1.DependencyType.Dev,
existing: dependency_1.ExistingBehavior.Skip,
install: skipInstall ? dependency_1.InstallBehavior.None : dependency_1.InstallBehavior.Auto,
})),
(0, dependency_1.addDependency)('tslib', latest_versions_1.latestVersions['tslib'], {
type: dependency_1.DependencyType.Default,
existing: dependency_1.ExistingBehavior.Skip,
install: skipInstall ? dependency_1.InstallBehavior.None : dependency_1.InstallBehavior.Auto,
}),
]);
}
function addLibToWorkspaceFile(options, projectRoot, projectName, hasZoneDependency) {
return (0, workspace_1.updateWorkspace)((workspace) => {
workspace.projects.add({
name: projectName,
root: projectRoot,
sourceRoot: `${projectRoot}/src`,
projectType: workspace_models_1.ProjectType.Library,
prefix: options.prefix,
targets: {
build: {
builder: workspace_models_1.Builders.BuildNgPackagr,
defaultConfiguration: 'production',
configurations: {
production: {
tsConfig: `${projectRoot}/tsconfig.lib.prod.json`,
},
development: {
tsConfig: `${projectRoot}/tsconfig.lib.json`,
},
},
},
test: {
builder: workspace_models_1.Builders.BuildKarma,
options: {
tsConfig: `${projectRoot}/tsconfig.spec.json`,
polyfills: hasZoneDependency ? ['zone.js', 'zone.js/testing'] : undefined,
},
},
},
});
});
}
function default_1(options) {
return async (host) => {
const prefix = options.prefix;
// If scoped project (i.e. "@foo/bar"), convert projectDir to "foo/bar".
const packageName = options.name;
if (/^@.*\/.*/.test(options.name)) {
const [, name] = options.name.split('/');
options.name = name;
}
const workspace = await (0, workspace_1.getWorkspace)(host);
const newProjectRoot = workspace.extensions.newProjectRoot || '';
let folderName = packageName.startsWith('@') ? packageName.slice(1) : packageName;
if (/[A-Z]/.test(folderName)) {
folderName = schematics_1.strings.dasherize(folderName);
}
const libDir = options.projectRoot !== undefined
? (0, posix_1.join)(options.projectRoot)
: (0, posix_1.join)(newProjectRoot, folderName);
const distRoot = `dist/${folderName}`;
const sourceDir = `${libDir}/src/lib`;
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
(0, schematics_1.applyTemplates)({
...schematics_1.strings,
...options,
packageName,
libDir,
distRoot,
relativePathToWorkspaceRoot: (0, paths_1.relativePathToWorkspaceRoot)(libDir),
prefix,
angularLatestVersion: latest_versions_1.latestVersions.Angular.replace(/~|\^/, ''),
tsLibLatestVersion: latest_versions_1.latestVersions['tslib'].replace(/~|\^/, ''),
folderName,
}),
(0, schematics_1.move)(libDir),
]);
const hasZoneDependency = (0, dependency_1.getDependency)(host, 'zone.js') !== null;
return (0, schematics_1.chain)([
(0, schematics_1.mergeWith)(templateSource),
addLibToWorkspaceFile(options, libDir, packageName, hasZoneDependency),
options.skipPackageJson ? (0, schematics_1.noop)() : addDependenciesToPackageJson(!!options.skipInstall),
options.skipTsConfig ? (0, schematics_1.noop)() : updateTsConfig(packageName, './' + distRoot),
options.skipTsConfig
? (0, schematics_1.noop)()
: addTsProjectReference('./' + (0, posix_1.join)(libDir, 'tsconfig.lib.json'), './' + (0, posix_1.join)(libDir, 'tsconfig.spec.json')),
options.standalone
? (0, schematics_1.noop)()
: (0, schematics_1.schematic)('module', {
name: options.name,
commonModule: false,
flat: true,
path: sourceDir,
project: packageName,
// Explicitly set the `typeSeparator` this also ensures that the generated files are valid even if the `module` schematic
// inherits its `typeSeparator` from the workspace.
typeSeparator: '-',
}),
(0, schematics_1.schematic)('component', {
name: options.name,
selector: `${prefix}-${options.name}`,
inlineStyle: true,
inlineTemplate: true,
flat: true,
path: sourceDir,
export: true,
standalone: options.standalone,
project: packageName,
// Explicitly set an empty `type` since it doesn't necessarily make sense in a library.
// This also ensures that the generated files are valid even if the `component` schematic
// inherits its `type` from the workspace.
type: '',
}),
]);
};
}

50
node_modules/@schematics/angular/library/schema.d.ts generated vendored Executable file
View File

@@ -0,0 +1,50 @@
/**
* Creates a new library project in your Angular workspace. Libraries are reusable
* collections of components, services, and other Angular artifacts that can be shared
* across multiple applications. This schematic simplifies the process of generating a new
* library with the necessary files and configurations.
*/
export type Schema = {
/**
* The path to the library's public API file, relative to the workspace root. This file
* defines what parts of the library are accessible to applications that import it.
*/
entryFile?: string;
/**
* The name for the new library. This name will be used for the project directory and
* various identifiers within the library's code.
*/
name: string;
/**
* A prefix to be added to the selectors of components generated within this library. For
* example, if the prefix is `my-lib` and you generate a component named `my-component`, the
* selector will be `my-lib-my-component`.
*/
prefix?: string;
/**
* The root directory for the new library, relative to the workspace root. If not specified,
* the library will be created in a subfolder within the `projects` directory, using the
* library's name.
*/
projectRoot?: string;
/**
* Skip the automatic installation of packages. You will need to manually install the
* dependencies later.
*/
skipInstall?: boolean;
/**
* Do not automatically add dependencies to the `package.json` file.
*/
skipPackageJson?: boolean;
/**
* Do not update the workspace `tsconfig.json` file to add a path mapping for the new
* library. The path mapping is needed to use the library in an application, but can be
* disabled here to simplify development.
*/
skipTsConfig?: boolean;
/**
* Create a library that utilizes the standalone API, eliminating the need for NgModules.
* This can simplify the structure of your library and its usage in applications.
*/
standalone?: boolean;
};

4
node_modules/@schematics/angular/library/schema.js generated vendored Executable file
View File

@@ -0,0 +1,4 @@
"use strict";
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
Object.defineProperty(exports, "__esModule", { value: true });

59
node_modules/@schematics/angular/library/schema.json generated vendored Executable file
View File

@@ -0,0 +1,59 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "SchematicsLibrary",
"title": "Library Options Schema",
"type": "object",
"description": "Creates a new library project in your Angular workspace. Libraries are reusable collections of components, services, and other Angular artifacts that can be shared across multiple applications. This schematic simplifies the process of generating a new library with the necessary files and configurations.",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "The name for the new library. This name will be used for the project directory and various identifiers within the library's code.",
"pattern": "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$",
"$default": {
"$source": "argv",
"index": 0
},
"x-prompt": "What name would you like to use for the library?"
},
"entryFile": {
"type": "string",
"format": "path",
"description": "The path to the library's public API file, relative to the workspace root. This file defines what parts of the library are accessible to applications that import it.",
"default": "public-api"
},
"prefix": {
"type": "string",
"format": "html-selector",
"description": "A prefix to be added to the selectors of components generated within this library. For example, if the prefix is `my-lib` and you generate a component named `my-component`, the selector will be `my-lib-my-component`.",
"default": "lib",
"alias": "p"
},
"skipPackageJson": {
"type": "boolean",
"default": false,
"description": "Do not automatically add dependencies to the `package.json` file."
},
"skipInstall": {
"description": "Skip the automatic installation of packages. You will need to manually install the dependencies later.",
"type": "boolean",
"default": false
},
"skipTsConfig": {
"type": "boolean",
"default": false,
"description": "Do not update the workspace `tsconfig.json` file to add a path mapping for the new library. The path mapping is needed to use the library in an application, but can be disabled here to simplify development."
},
"projectRoot": {
"type": "string",
"description": "The root directory for the new library, relative to the workspace root. If not specified, the library will be created in a subfolder within the `projects` directory, using the library's name."
},
"standalone": {
"description": "Create a library that utilizes the standalone API, eliminating the need for NgModules. This can simplify the structure of your library and its usage in applications.",
"type": "boolean",
"default": true,
"x-user-analytics": "ep.ng_standalone"
}
},
"required": ["name"]
}