@ng-zen/cli 19.1.0 → 19.2.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +7 -2
- package/package.json +3 -88
- package/schematics/components/components-generator.js +3 -0
- package/schematics/components/components-generator.js.map +1 -0
- package/{src/schematics → schematics}/components/components-generator.ts +1 -1
- package/schematics/components/files/button/button.component.scss +43 -0
- package/{src/schematics → schematics}/components/files/button/button.stories.ts +1 -0
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.component.scss +1 -1
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.stories.ts +1 -0
- package/schematics/components/files/divider/divider.component.scss +52 -0
- package/schematics/components/files/divider/divider.component.spec.ts +22 -0
- package/schematics/components/files/divider/divider.component.ts +58 -0
- package/schematics/components/files/divider/divider.stories.ts +69 -0
- package/schematics/components/files/divider/index.ts +1 -0
- package/{src/schematics → schematics}/components/files/input/input.component.scss +1 -1
- package/{src/schematics → schematics}/components/files/input/input.stories.ts +1 -0
- package/{src/schematics → schematics}/components/files/switch/switch.component.scss +2 -2
- package/{src/schematics → schematics}/components/files/switch/switch.stories.ts +1 -0
- package/{src/schematics → schematics}/components/files/textarea/textarea.component.scss +1 -1
- package/{src/schematics → schematics}/components/files/textarea/textarea.stories.ts +1 -0
- package/schematics/components/index.js +11 -0
- package/schematics/components/index.js.map +1 -0
- package/{src/schematics → schematics}/components/schema.json +1 -1
- package/schematics/ng-add/index.js +12 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/index.ts +12 -0
- package/schematics/ng-add/ng-zen-generator.js +3 -0
- package/schematics/ng-add/ng-zen-generator.js.map +1 -0
- package/schematics/ng-add/ng-zen-generator.ts +3 -0
- package/types/generator-schema-base.interface.js +3 -0
- package/types/generator-schema-base.interface.js.map +1 -0
- package/types/index.js +5 -0
- package/types/index.js.map +1 -0
- package/types/schematics-folder.type.js +3 -0
- package/types/schematics-folder.type.js.map +1 -0
- package/utils/apply-file-template.util.js +23 -0
- package/utils/apply-file-template.util.js.map +1 -0
- package/{src/utils → utils}/apply-file-template.util.ts +1 -0
- package/utils/index.js +5 -0
- package/utils/index.js.map +1 -0
- package/utils/index.ts +1 -0
- package/.commitlintrc +0 -3
- package/.editorconfig +0 -17
- package/.github/dependabot.yml +0 -18
- package/.github/workflows/ci.yml +0 -112
- package/.github/workflows/deploy.yml +0 -33
- package/.github/workflows/release.yml +0 -65
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.nanostagedrc +0 -5
- package/.prettierignore +0 -3
- package/.prettierrc +0 -23
- package/.releaserc.json +0 -67
- package/.storybook/main.ts +0 -17
- package/.storybook/preview.ts +0 -13
- package/.storybook/stories/pages/1 README.mdx +0 -9
- package/.storybook/stories/pages/2 License.mdx +0 -9
- package/.storybook/stories/pages/3 CHANGELOG.mdx +0 -9
- package/.storybook/tsconfig.json +0 -10
- package/.storybook/typings.d.ts +0 -4
- package/.stylelintrc.json +0 -3
- package/CODE_OF_CONDUCT.md +0 -30
- package/CONTRIBUTING.md +0 -54
- package/DEVELOPMENT.md +0 -138
- package/angular.json +0 -66
- package/eslint.config.js +0 -40
- package/jest.config.ts +0 -20
- package/projects/schematic-builder/builders/builders.json +0 -9
- package/projects/schematic-builder/builders/index.js +0 -100
- package/projects/schematic-builder/builders/schema.json +0 -18
- package/projects/schematic-builder/package.json +0 -11
- package/src/schematics/components/files/button/button.component.scss +0 -42
- package/src/schematics/ng-add/index.ts +0 -14
- package/src/schematics/ng-add/ng-zen-generator.ts +0 -3
- package/src/utils/add-path-to-tsconfig.util.ts +0 -50
- package/src/utils/index.ts +0 -2
- package/tsconfig.json +0 -31
- package/tsconfig.lib.json +0 -11
- package/tsconfig.schematics.json +0 -30
- package/tsconfig.spec.json +0 -9
- package/{src/schematics → schematics}/collection.json +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.component.scss +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.component.spec.ts +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.component.ts +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.stories.ts +0 -0
- package/{src/schematics → schematics}/components/files/avatar/index.ts +0 -0
- package/{src/schematics → schematics}/components/files/button/button.component.spec.ts +0 -0
- package/{src/schematics → schematics}/components/files/button/button.component.ts +0 -0
- package/{src/schematics → schematics}/components/files/button/index.ts +0 -0
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.component.spec.ts +0 -0
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.component.ts +1 -1
- /package/{src/schematics → schematics}/components/files/checkbox/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/input/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/input/input.component.spec.ts +0 -0
- /package/{src/schematics → schematics}/components/files/input/input.component.ts +0 -0
- /package/{src/schematics → schematics}/components/files/switch/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/switch/switch.component.spec.ts +0 -0
- /package/{src/schematics → schematics}/components/files/switch/switch.component.ts +0 -0
- /package/{src/schematics → schematics}/components/files/textarea/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/textarea/textarea.component.spec.ts +0 -0
- /package/{src/schematics → schematics}/components/files/textarea/textarea.component.ts +0 -0
- /package/{src/schematics → schematics}/components/index.ts +0 -0
- /package/{src/schematics → schematics}/components/templates/README.md.template +0 -0
- /package/{src/schematics → schematics}/ng-add/schema.json +0 -0
- /package/{src/types → types}/generator-schema-base.interface.ts +0 -0
- /package/{src/types → types}/index.ts +0 -0
- /package/{src/types → types}/schematics-folder.type.ts +0 -0
package/DEVELOPMENT.md
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
# Local Development Setup
|
|
2
|
-
|
|
3
|
-
This guide details setting up a local development environment for **@ng-zen/cli**. It covers the necessary tools, the project's branching strategy, and the automated workflows in place.
|
|
4
|
-
|
|
5
|
-
**For a step-by-step guide specifically for external contributors submitting Pull Requests, please refer to `CONTRIBUTING.md`.**
|
|
6
|
-
|
|
7
|
-
**Key Technologies & Concepts:**
|
|
8
|
-
|
|
9
|
-
- **pnpm:** The required package manager (version in `package.json`). Use Corepack (`corepack enable`).
|
|
10
|
-
- **Storybook:** For UI component development and visualization.
|
|
11
|
-
- **Conventional Commits:** **Mandatory format** for commit messages (https://www.conventionalcommits.org/). Crucial for automation.
|
|
12
|
-
- **Automated Formatting/Linting:** `husky` + `nano-staged` apply formatting and basic fixes on commit.
|
|
13
|
-
- **Automated CI:** GitHub Actions (`ci.yml`) validate Pull Requests.
|
|
14
|
-
- **Automated Releases:** `semantic-release` manages releases based on commits.
|
|
15
|
-
- **Branching Strategy:** Detailed below.
|
|
16
|
-
|
|
17
|
-
## Table of Contents
|
|
18
|
-
|
|
19
|
-
- [Prerequisites & Setup](#prerequisites--setup)
|
|
20
|
-
- [Branching Strategy & Workflow](#branching-strategy--workflow)
|
|
21
|
-
- [Commit Messages (Crucial!)](#commit-messages-crucial)
|
|
22
|
-
- [Branch Synchronization (Maintainer Task)](#branch-synchronization-maintainer-task)
|
|
23
|
-
- [Working with Storybook](#working-with-storybook)
|
|
24
|
-
- [Running Tests and Linting](#running-tests-and-linting)
|
|
25
|
-
- [Building the Library](#building-the-library)
|
|
26
|
-
- [Optional: Local Testing with Verdaccio](#optional-local-testing-with-verdaccio)
|
|
27
|
-
|
|
28
|
-
## Prerequisites & Setup
|
|
29
|
-
|
|
30
|
-
1. Ensure **Node.js** is installed (use a version compatible with the project's Angular version; check CI workflows for reference).
|
|
31
|
-
2. Enable **Corepack**: `corepack enable`.
|
|
32
|
-
3. Clone the repository.
|
|
33
|
-
4. Install dependencies using **pnpm**: `pnpm install`.
|
|
34
|
-
|
|
35
|
-
## Branching Strategy & Workflow
|
|
36
|
-
|
|
37
|
-
This project employs a branching model designed for stability and automated releases:
|
|
38
|
-
|
|
39
|
-
- **`master`**: Contains only **stable, production-ready** code. Receives merges only from `next` during official releases or for critical hotfixes. Automated stable releases (`vX.Y.Z`) are triggered from here. **Direct work is forbidden.**
|
|
40
|
-
- **`next`**: The **pre-release / release candidate** branch. Code merged here from `develop` should be stable enough for final testing. Merges trigger automated pre-releases (`vX.Y.Z-next.N`) published to NPM under the `next` dist-tag.
|
|
41
|
-
- **`develop`**: The main **integration branch**. All feature branches are merged here first. This branch collects changes intended for the _next_ release cycle. **Target Pull Requests here.**
|
|
42
|
-
- **Feature/Fix Branches (`feature/*`, `fix/*`, etc.)**: Used for individual tasks. Always branch **off `develop`**.
|
|
43
|
-
|
|
44
|
-
**General Flow:** `Feature/Fix Branch` -> **`develop`** -> `next` -> `master`
|
|
45
|
-
|
|
46
|
-
## Commit Messages (Crucial!)
|
|
47
|
-
|
|
48
|
-
Strict adherence to the **Conventional Commits** specification (https://www.conventionalcommits.org/) is **required**.
|
|
49
|
-
|
|
50
|
-
- **Why?** Commit messages directly control automatic version bumping (`semantic-release`) and `CHANGELOG.md` generation.
|
|
51
|
-
- **Format:** `<type>(<scope>): <subject>` (e.g., `feat(button): add loading spinner`).
|
|
52
|
-
- **Key Types & Impact (on Stable Release):**
|
|
53
|
-
- `feat`: New feature -> `minor` version bump.
|
|
54
|
-
- `fix`: Bug fix -> `patch` version bump.
|
|
55
|
-
- `!` (e.g., `refactor(core)!:`) or `BREAKING CHANGE:` footer -> `major` version bump.
|
|
56
|
-
- Other types (`docs`, `chore`, `style`, `test`, `ci`, `build`, `refactor`, `perf`) document changes but don't trigger version bumps alone.
|
|
57
|
-
- **Validation:** `husky` + `commitlint` automatically check message format upon commit. Invalid messages will fail the commit.
|
|
58
|
-
|
|
59
|
-
_(See `CONTRIBUTING.md` for a concise summary focused on the commit action itself)._
|
|
60
|
-
|
|
61
|
-
## Branch Synchronization (Maintainer Task)
|
|
62
|
-
|
|
63
|
-
Maintain consistency across `master`, `next`, and `develop` by merging release commits and hotfixes. **Performed by maintainers.**
|
|
64
|
-
|
|
65
|
-
**General Update Step:** Fetch latest remote state:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
git fetch origin --prune
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 1. Sync `next` with `master` (After Stable Release or Hotfix)
|
|
72
|
-
|
|
73
|
-
This is the most comprehensive synchronization, ensuring all development branches are aligned with the latest production code.
|
|
74
|
-
|
|
75
|
-
- **Purpose:** Incorporate stable changes into the release candidate branch.
|
|
76
|
-
- **Flow:** `master` -> `next`.
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# Update local 'next', merge 'origin/master', push 'next'
|
|
80
|
-
git switch next && git pull origin next && git merge origin/master && git push origin next
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
_(Note: Merge conflicts might occur at either merge step and need manual resolution before continuing/pushing.)_
|
|
84
|
-
|
|
85
|
-
### 2. Sync `develop` with `next` (After Pre-release on next OR after syncing next with master)
|
|
86
|
-
|
|
87
|
-
- **Purpose:** Keep `develop` aligned with the latest pre-release state or the latest stable code propagated through next. Includes release commits (`chore(release): ...`).
|
|
88
|
-
- **Flow:** `next` -> `develop`.
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# Update local 'next', merge 'origin/master', push 'next'
|
|
92
|
-
git switch develop && git pull origin develop && git merge origin/next && git push origin develop
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
_(Note: Resolve conflicts before pushing.)_
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
Contributors should regularly update their local `develop` branch (`git switch develop && git pull origin develop`).
|
|
100
|
-
|
|
101
|
-
## Working with Storybook
|
|
102
|
-
|
|
103
|
-
Develop and visualize components using Storybook.
|
|
104
|
-
|
|
105
|
-
- **Start Storybook:**
|
|
106
|
-
```bash
|
|
107
|
-
pnpm run storybook
|
|
108
|
-
```
|
|
109
|
-
- **Build Static Storybook:**
|
|
110
|
-
```bash
|
|
111
|
-
pnpm run storybook:build
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Running Tests and Linting
|
|
115
|
-
|
|
116
|
-
`nano-staged` auto-formats/fixes on commit, but manual verification is recommended before creating a PR. The CI (`ci.yml`) runs these checks automatically on PRs.
|
|
117
|
-
|
|
118
|
-
- **Lint:** `pnpm run lint` (checks for errors not auto-fixed)
|
|
119
|
-
- **Test:** `pnpm run test` (runs unit tests)
|
|
120
|
-
|
|
121
|
-
## Building the Library
|
|
122
|
-
|
|
123
|
-
Build the distributable library files:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
pnpm run build
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Output artifacts are placed in the `dist/` directory
|
|
130
|
-
|
|
131
|
-
## Optional: Local Testing with Verdaccio
|
|
132
|
-
|
|
133
|
-
Test your local build in a separate project before submitting a PR to develop.
|
|
134
|
-
|
|
135
|
-
1. Install & Run Verdaccio: `npm install -g verdaccio` (or `pnpm add -g`), then `verdaccio`.\
|
|
136
|
-
2. Build Library: `pnpm run build`.
|
|
137
|
-
3. Publish Locally: `pnpm run publish:verdaccio`.
|
|
138
|
-
4. Install in Test Project: `ng add @ng-zen/cli --registry http://localhost:4873/` (or pnpm add ...).
|
package/angular.json
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
-
"version": 1,
|
|
4
|
-
"cli": {
|
|
5
|
-
"packageManager": "pnpm",
|
|
6
|
-
"schematicCollections": ["angular-eslint"]
|
|
7
|
-
},
|
|
8
|
-
"newProjectRoot": "projects",
|
|
9
|
-
"schematics": {
|
|
10
|
-
"@schematics/angular:component": {
|
|
11
|
-
"style": "scss",
|
|
12
|
-
"changeDetection": "OnPush"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"projects": {
|
|
16
|
-
"cli": {
|
|
17
|
-
"projectType": "library",
|
|
18
|
-
"root": "",
|
|
19
|
-
"sourceRoot": "src",
|
|
20
|
-
"prefix": "zen",
|
|
21
|
-
"architect": {
|
|
22
|
-
"build": {
|
|
23
|
-
"builder": "./projects/schematic-builder:build",
|
|
24
|
-
"options": {
|
|
25
|
-
"files": ["src/**", "README.md", "package.json", "LICENSE", "CHANGELOG.md"],
|
|
26
|
-
"tsConfig": "tsconfig.schematics.json"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"test": {
|
|
30
|
-
"builder": "@angular-builders/jest:run",
|
|
31
|
-
"options": {
|
|
32
|
-
"configPath": "./jest.config.ts",
|
|
33
|
-
"tsConfig": "tsconfig.spec.json"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"lint": {
|
|
37
|
-
"builder": "@angular-eslint/builder:lint",
|
|
38
|
-
"options": {
|
|
39
|
-
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"],
|
|
40
|
-
"eslintConfig": "eslint.config.js"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"storybook": {
|
|
44
|
-
"builder": "@storybook/angular:start-storybook",
|
|
45
|
-
"options": {
|
|
46
|
-
"configDir": ".storybook",
|
|
47
|
-
"browserTarget": "cli:build",
|
|
48
|
-
"compodoc": true,
|
|
49
|
-
"compodocArgs": ["-e", "json", "-d", "./documentation/"],
|
|
50
|
-
"port": 6006
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"build-storybook": {
|
|
54
|
-
"builder": "@storybook/angular:build-storybook",
|
|
55
|
-
"options": {
|
|
56
|
-
"configDir": ".storybook",
|
|
57
|
-
"browserTarget": "cli:build",
|
|
58
|
-
"compodoc": true,
|
|
59
|
-
"compodocArgs": ["-e", "json", "-d", "./documentation/"],
|
|
60
|
-
"outputDir": "dist/storybook"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
package/eslint.config.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const eslint = require('@eslint/js');
|
|
3
|
-
const tseslint = require('typescript-eslint');
|
|
4
|
-
const angular = require('angular-eslint');
|
|
5
|
-
|
|
6
|
-
module.exports = tseslint.config(
|
|
7
|
-
{
|
|
8
|
-
files: ['**/*.ts'],
|
|
9
|
-
extends: [
|
|
10
|
-
eslint.configs.recommended,
|
|
11
|
-
...tseslint.configs.recommended,
|
|
12
|
-
...tseslint.configs.stylistic,
|
|
13
|
-
...angular.configs.tsRecommended,
|
|
14
|
-
],
|
|
15
|
-
processor: angular.processInlineTemplates,
|
|
16
|
-
rules: {
|
|
17
|
-
'@angular-eslint/directive-selector': [
|
|
18
|
-
'error',
|
|
19
|
-
{
|
|
20
|
-
type: 'attribute',
|
|
21
|
-
prefix: 'zen',
|
|
22
|
-
style: 'camelCase',
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
'@angular-eslint/component-selector': [
|
|
26
|
-
'error',
|
|
27
|
-
{
|
|
28
|
-
type: 'element',
|
|
29
|
-
prefix: 'zen',
|
|
30
|
-
style: 'kebab-case',
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
files: ['**/*.html'],
|
|
37
|
-
extends: [...angular.configs.templateRecommended, ...angular.configs.templateAccessibility],
|
|
38
|
-
rules: {},
|
|
39
|
-
}
|
|
40
|
-
);
|
package/jest.config.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* For a detailed explanation regarding each configuration property, visit:
|
|
3
|
-
* https://jestjs.io/docs/configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { Config } from 'jest';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
clearMocks: true,
|
|
10
|
-
collectCoverage: true,
|
|
11
|
-
coverageDirectory: 'coverage',
|
|
12
|
-
coverageProvider: 'v8',
|
|
13
|
-
moduleNameMapper: {
|
|
14
|
-
'^@ng-zen/cli/(.*)': '<rootDir>/src/$1',
|
|
15
|
-
'^ng-zen/components/(.*)': '<rootDir>/src/schematics/components/files/$1',
|
|
16
|
-
'^ng-zen/directives/(.*)': '<rootDir>/src/schematics/directives/files/$1',
|
|
17
|
-
},
|
|
18
|
-
preset: 'jest-preset-angular',
|
|
19
|
-
testEnvironment: 'jsdom',
|
|
20
|
-
} satisfies Config;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { createBuilder } from '@angular-devkit/architect';
|
|
2
|
-
import { execa } from 'execa';
|
|
3
|
-
import cpy from 'cpy';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import fs from 'fs-extra';
|
|
6
|
-
|
|
7
|
-
const LOG = {
|
|
8
|
-
log: (logger, level, type, message) => {
|
|
9
|
-
const timestamp = new Date().toISOString();
|
|
10
|
-
const output = `[${timestamp}] [${type}] ${message}`;
|
|
11
|
-
|
|
12
|
-
// Use the appropriate logger method based on the log level
|
|
13
|
-
switch (level) {
|
|
14
|
-
case 'INFO':
|
|
15
|
-
logger.info(output);
|
|
16
|
-
break;
|
|
17
|
-
case 'ERROR':
|
|
18
|
-
logger.error(output);
|
|
19
|
-
break;
|
|
20
|
-
default:
|
|
21
|
-
logger.log(output);
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
info: (logger, type, message) => LOG.log(logger, 'INFO', type, message),
|
|
26
|
-
error: (logger, type, message) => LOG.log(logger, 'ERROR', type, message),
|
|
27
|
-
};
|
|
28
|
-
async function cleanOutputDirectory(outputDir, context) {
|
|
29
|
-
try {
|
|
30
|
-
if (await fs.pathExists(outputDir)) {
|
|
31
|
-
await fs.rm(outputDir, { recursive: true, force: true });
|
|
32
|
-
}
|
|
33
|
-
await fs.mkdir(outputDir, { recursive: true });
|
|
34
|
-
} catch (error) {
|
|
35
|
-
LOG.error(context.logger, 'ERROR', `Failed to clean output directory: ${error.message}`);
|
|
36
|
-
context.logger.error();
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function getOutputDir(tsConfigPath, workspaceRoot) {
|
|
42
|
-
const fullPath = path.resolve(workspaceRoot, tsConfigPath);
|
|
43
|
-
const configContent = await fs.readFile(fullPath, 'utf-8');
|
|
44
|
-
const config = JSON.parse(configContent);
|
|
45
|
-
|
|
46
|
-
const outDir = config.compilerOptions?.outDir || 'dist';
|
|
47
|
-
const tsConfigDir = path.dirname(fullPath);
|
|
48
|
-
|
|
49
|
-
return path.resolve(tsConfigDir, outDir);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function compileTypeScript(tsConfig, context) {
|
|
53
|
-
await execa('tsc', ['-p', tsConfig], {
|
|
54
|
-
stdio: 'inherit',
|
|
55
|
-
cwd: context.currentDirectory,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function copyProjectFiles(files, outputDir, context) {
|
|
60
|
-
await cpy(files, outputDir, {
|
|
61
|
-
parents: true,
|
|
62
|
-
cwd: context.currentDirectory,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function cleanPackageJson(outputDir) {
|
|
67
|
-
const distPackageJson = path.join(outputDir, 'package.json');
|
|
68
|
-
const pkg = await fs.readJson(distPackageJson);
|
|
69
|
-
delete pkg.scripts;
|
|
70
|
-
delete pkg.devDependencies;
|
|
71
|
-
await fs.writeJson(distPackageJson, pkg, { spaces: 2 });
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default createBuilder(async (options, context) => {
|
|
75
|
-
try {
|
|
76
|
-
const outputDir = await getOutputDir(options.tsConfig, context.workspaceRoot);
|
|
77
|
-
LOG.info(context.logger, 'BUILD', 'Starting build process...');
|
|
78
|
-
|
|
79
|
-
LOG.info(context.logger, 'CLEANING', `Cleaning old distribution files in ${outputDir}`);
|
|
80
|
-
await cleanOutputDirectory(outputDir, context);
|
|
81
|
-
LOG.info(context.logger, 'CLEANING', `Cleaning completed successfully.`);
|
|
82
|
-
|
|
83
|
-
LOG.info(context.logger, 'COMPILING', `Compiling TypeScript files using config: ${options.tsConfig}`);
|
|
84
|
-
await compileTypeScript(options.tsConfig, context);
|
|
85
|
-
LOG.info(context.logger, 'COMPILING', 'Compilation completed successfully.');
|
|
86
|
-
|
|
87
|
-
LOG.info(context.logger, 'COPYING', `Copying project files to: ${outputDir}`);
|
|
88
|
-
await copyProjectFiles(options.files, outputDir, context);
|
|
89
|
-
LOG.info(context.logger, 'COPYING', 'Copy completed successfully.');
|
|
90
|
-
|
|
91
|
-
LOG.info(context.logger, 'UPDATING', `Updating package.json file.`);
|
|
92
|
-
await cleanPackageJson(outputDir);
|
|
93
|
-
LOG.info(context.logger, 'UPDATING', 'Update completed successfully.');
|
|
94
|
-
|
|
95
|
-
return { success: true };
|
|
96
|
-
} catch (error) {
|
|
97
|
-
LOG.error(context.logger, 'ERROR', `Build failed: ${error.message}`);
|
|
98
|
-
return { success: false };
|
|
99
|
-
}
|
|
100
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"files": {
|
|
6
|
-
"type": "array",
|
|
7
|
-
"items": {
|
|
8
|
-
"type": "string"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"outputDir": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
|
-
"tsConfig": {
|
|
15
|
-
"type": "string"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
$bg-color-hover: #333;
|
|
2
|
-
$bg-color: #000;
|
|
3
|
-
$color: #fff;
|
|
4
|
-
$padding: 8px 24px;
|
|
5
|
-
$shadow-hover: 0 0 0 3px rgb(0 123 255 / 50%);
|
|
6
|
-
$shadow: 0 2px 4px rgb(0 0 0 / 10%);
|
|
7
|
-
$transition-duration: 0.4s;
|
|
8
|
-
|
|
9
|
-
:host {
|
|
10
|
-
display: inline-block;
|
|
11
|
-
font-size: 14px;
|
|
12
|
-
font-weight: bold;
|
|
13
|
-
text-align: center;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
border: none;
|
|
16
|
-
padding: $padding;
|
|
17
|
-
border-radius: 99999px;
|
|
18
|
-
transition: all $transition-duration ease;
|
|
19
|
-
background-color: $bg-color;
|
|
20
|
-
color: $color;
|
|
21
|
-
box-shadow: $shadow;
|
|
22
|
-
text-decoration: none;
|
|
23
|
-
outline: none;
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
position: relative;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* Hover state */
|
|
29
|
-
:host:hover {
|
|
30
|
-
background-color: $bg-color-hover;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/* Focus state */
|
|
34
|
-
:host:focus {
|
|
35
|
-
box-shadow: $shadow-hover;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* Disabled state */
|
|
39
|
-
:host[aria-disabled='true'] {
|
|
40
|
-
cursor: not-allowed;
|
|
41
|
-
opacity: 0.6;
|
|
42
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
import { addPathToTsconfigUtil } from '../../utils';
|
|
4
|
-
import { NgZenGeneratorSchema } from './ng-zen-generator';
|
|
5
|
-
|
|
6
|
-
export function ngAdd(options: NgZenGeneratorSchema): Rule {
|
|
7
|
-
return (tree: Tree, _context: SchematicContext) => {
|
|
8
|
-
_context.logger.info('Adding library to the project');
|
|
9
|
-
|
|
10
|
-
addPathToTsconfigUtil(tree, 'ng-zen/*', [`${options.path}/*`]);
|
|
11
|
-
|
|
12
|
-
return tree;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { SchematicsException, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
export function addPathToTsconfigUtil(tree: Tree, key: string, value: string[]): void {
|
|
4
|
-
const tsconfigPath = 'tsconfig.json';
|
|
5
|
-
|
|
6
|
-
// Check if tsconfig.json exists
|
|
7
|
-
if (!tree.exists(tsconfigPath)) {
|
|
8
|
-
throw new SchematicsException('tsconfig.json does not exist');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Read tsconfig.json content as string
|
|
12
|
-
const tsconfigBuffer = tree.read(tsconfigPath);
|
|
13
|
-
if (!tsconfigBuffer) {
|
|
14
|
-
throw new SchematicsException('Failed to read tsconfig.json');
|
|
15
|
-
}
|
|
16
|
-
let tsconfigContent = tsconfigBuffer.toString('utf-8');
|
|
17
|
-
|
|
18
|
-
// Extract and preserve the comment
|
|
19
|
-
const commentMatch = tsconfigContent.match(/\/\*[\s\S]*?\*\//);
|
|
20
|
-
const comment = commentMatch ? commentMatch[0] : '';
|
|
21
|
-
|
|
22
|
-
// Remove comment from content to parse JSON
|
|
23
|
-
tsconfigContent = tsconfigContent.replace(comment, '');
|
|
24
|
-
|
|
25
|
-
// Parse tsconfig.json content
|
|
26
|
-
let tsconfig;
|
|
27
|
-
try {
|
|
28
|
-
tsconfig = JSON.parse(tsconfigContent);
|
|
29
|
-
} catch (e) {
|
|
30
|
-
throw new SchematicsException('Failed to parse tsconfig.json' + e);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Modify compilerOptions.paths to add your new mapping
|
|
34
|
-
if (!tsconfig.compilerOptions) {
|
|
35
|
-
tsconfig.compilerOptions = {};
|
|
36
|
-
}
|
|
37
|
-
if (!tsconfig.compilerOptions.paths) {
|
|
38
|
-
tsconfig.compilerOptions.paths = {};
|
|
39
|
-
}
|
|
40
|
-
tsconfig.compilerOptions.paths[key] = value;
|
|
41
|
-
|
|
42
|
-
// Convert tsconfig back to JSON string
|
|
43
|
-
tsconfigContent = JSON.stringify(tsconfig, null, 2);
|
|
44
|
-
|
|
45
|
-
// Ensure the preserved comment is prepended to the JSON string
|
|
46
|
-
tsconfigContent = `${comment}\n${tsconfigContent}`;
|
|
47
|
-
|
|
48
|
-
// Write back to tsconfig.json
|
|
49
|
-
tree.overwrite(tsconfigPath, tsconfigContent);
|
|
50
|
-
}
|
package/src/utils/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"compileOnSave": false,
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "./dist/out-tsc",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"noImplicitOverride": true,
|
|
9
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
10
|
-
"noImplicitReturns": true,
|
|
11
|
-
"noFallthroughCasesInSwitch": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"moduleResolution": "bundler",
|
|
17
|
-
"importHelpers": true,
|
|
18
|
-
"target": "ES2022",
|
|
19
|
-
"module": "ES2022",
|
|
20
|
-
"paths": {
|
|
21
|
-
"ng-zen/components/*": ["./src/schematics/components/files/*"],
|
|
22
|
-
"ng-zen/directives/*": ["./src/schematics/directives/files/*"]
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"angularCompilerOptions": {
|
|
26
|
-
"enableI18nLegacyMessageIdFormat": false,
|
|
27
|
-
"strictInjectionParameters": true,
|
|
28
|
-
"strictInputAccessModifiers": true,
|
|
29
|
-
"strictTemplates": true
|
|
30
|
-
}
|
|
31
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "./tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"inlineSources": true
|
|
9
|
-
},
|
|
10
|
-
"exclude": ["**/*.spec.ts"]
|
|
11
|
-
}
|
package/tsconfig.schematics.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.lib.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist/@ng-zen/cli/",
|
|
5
|
-
"declarationMap": false,
|
|
6
|
-
"baseUrl": "tsconfig",
|
|
7
|
-
"lib": ["es2018"],
|
|
8
|
-
"declaration": false,
|
|
9
|
-
"module": "commonjs",
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"noEmitOnError": true,
|
|
12
|
-
"noFallthroughCasesInSwitch": true,
|
|
13
|
-
"noImplicitAny": true,
|
|
14
|
-
"noImplicitThis": true,
|
|
15
|
-
"noUnusedParameters": true,
|
|
16
|
-
"noUnusedLocals": true,
|
|
17
|
-
"rootDir": "src",
|
|
18
|
-
"skipDefaultLibCheck": true,
|
|
19
|
-
"skipLibCheck": true,
|
|
20
|
-
"sourceMap": true,
|
|
21
|
-
"strictNullChecks": true,
|
|
22
|
-
"target": "es2022",
|
|
23
|
-
"types": ["jest"]
|
|
24
|
-
},
|
|
25
|
-
"angularCompilerOptions": {
|
|
26
|
-
"compilationMode": "partial"
|
|
27
|
-
},
|
|
28
|
-
"include": ["./src/**/*"],
|
|
29
|
-
"exclude": ["./src/schematics/*/files/**/*"]
|
|
30
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "./tsconfig.schematics.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"lib": ["ES2022", "DOM"],
|
|
6
|
-
"types": ["jest", "node", "jsdom"]
|
|
7
|
-
},
|
|
8
|
-
"include": ["./src/**/*.spec.ts", "./src/**/*.d.ts"]
|
|
9
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
2
1
|
import { booleanAttribute, ChangeDetectionStrategy, Component, forwardRef, input, model } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* ZenCheckboxComponent is a reusable checkbox component designed to provide
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|