@ng-cn/core 1.0.7 → 1.0.9
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/package.json +4 -4
- package/schematics/ng-add/index.js +33 -13
- package/schematics/ng-add/index.ts +33 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-cn/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Beautifully designed Angular components built with Tailwind CSS v4 - The official Angular port of shadcn/ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"shiki": "^3.20.0",
|
|
79
79
|
"tailwind-merge": "^3.4.0",
|
|
80
80
|
"tailwindcss": "^4.1.18",
|
|
81
|
-
"tslib": "^2.3.0"
|
|
81
|
+
"tslib": "^2.3.0",
|
|
82
|
+
"@angular-devkit/core": "^21.0.4",
|
|
83
|
+
"@angular-devkit/schematics": "^21.0.4"
|
|
82
84
|
},
|
|
83
85
|
"devDependencies": {
|
|
84
86
|
"@analogjs/vitest-angular": "^2.2.0",
|
|
85
|
-
"@angular-devkit/core": "^21.0.4",
|
|
86
|
-
"@angular-devkit/schematics": "^21.0.4",
|
|
87
87
|
"@angular/build": "^21.0.4",
|
|
88
88
|
"@angular/cli": "^21.0.4",
|
|
89
89
|
"@angular/compiler-cli": "^21.0.6",
|
|
@@ -702,31 +702,51 @@ function ngAdd(options) {
|
|
|
702
702
|
context.logger.info(' ✓ Path aliases already set');
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
//
|
|
705
|
+
// Copy selected components from @ng-cn/core
|
|
706
706
|
const componentsToInstall = parseComponentsOption(options.components);
|
|
707
707
|
if (componentsToInstall.length > 0) {
|
|
708
708
|
context.logger.info('');
|
|
709
709
|
if (options.components === 'all') {
|
|
710
|
-
context.logger.info(`🚀
|
|
710
|
+
context.logger.info(`🚀 Copying ALL ${componentsToInstall.length} components... (Magic Mode)`);
|
|
711
711
|
}
|
|
712
712
|
else {
|
|
713
713
|
context.logger.info('📦 Selected Components');
|
|
714
714
|
}
|
|
715
|
-
const
|
|
715
|
+
const sourceComponentsBase = 'node_modules/@ng-cn/core/src/app/lib/components/ui';
|
|
716
|
+
let componentsCopied = 0;
|
|
716
717
|
for (const component of componentsToInstall) {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
718
|
+
// Convert kebab-case to component folder name
|
|
719
|
+
const componentFolder = component.replace(/-/g, '-');
|
|
720
|
+
const sourceComponentPath = (0, core_1.join)((0, core_1.normalize)(sourceComponentsBase), (0, core_1.normalize)(componentFolder));
|
|
721
|
+
const targetComponentPath = (0, core_1.join)((0, core_1.normalize)(uiPath), (0, core_1.normalize)(componentFolder));
|
|
722
|
+
try {
|
|
723
|
+
// Try to copy the entire component folder
|
|
724
|
+
const sourceFiles = tree.getDir(sourceComponentPath);
|
|
725
|
+
if (sourceFiles && sourceFiles.subfiles.length > 0) {
|
|
726
|
+
for (const file of sourceFiles.subfiles) {
|
|
727
|
+
const sourceFile = sourceComponentPath + '/' + file;
|
|
728
|
+
const targetFile = targetComponentPath + '/' + file;
|
|
729
|
+
const content = tree.read(sourceFile);
|
|
730
|
+
if (content) {
|
|
731
|
+
if (tree.exists(targetFile)) {
|
|
732
|
+
tree.overwrite(targetFile, content);
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
tree.create(targetFile, content);
|
|
736
|
+
}
|
|
737
|
+
componentsCopied++;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
context.logger.info(` + ${component}`);
|
|
741
|
+
}
|
|
722
742
|
}
|
|
723
|
-
|
|
724
|
-
|
|
743
|
+
catch (e) {
|
|
744
|
+
// Component folder doesn't exist yet or not available, skip
|
|
745
|
+
context.logger.debug(` ⊘ ${component} not available in core package`);
|
|
725
746
|
}
|
|
726
747
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
748
|
+
if (componentsCopied > 0) {
|
|
749
|
+
context.logger.info(` ✓ ${componentsCopied} component files copied`);
|
|
730
750
|
}
|
|
731
751
|
}
|
|
732
752
|
// Success message with ASCII art banner
|
|
@@ -769,33 +769,52 @@ export function ngAdd(options: NgAddOptions): Rule {
|
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
771
|
|
|
772
|
-
//
|
|
772
|
+
// Copy selected components from @ng-cn/core
|
|
773
773
|
const componentsToInstall = parseComponentsOption(options.components);
|
|
774
774
|
if (componentsToInstall.length > 0) {
|
|
775
775
|
context.logger.info('');
|
|
776
776
|
if (options.components === 'all') {
|
|
777
|
-
context.logger.info(`🚀
|
|
777
|
+
context.logger.info(`🚀 Copying ALL ${componentsToInstall.length} components... (Magic Mode)`);
|
|
778
778
|
} else {
|
|
779
779
|
context.logger.info('📦 Selected Components');
|
|
780
780
|
}
|
|
781
781
|
|
|
782
|
-
const
|
|
782
|
+
const sourceComponentsBase = 'node_modules/@ng-cn/core/src/app/lib/components/ui';
|
|
783
|
+
let componentsCopied = 0;
|
|
783
784
|
|
|
784
785
|
for (const component of componentsToInstall) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
786
|
+
// Convert kebab-case to component folder name
|
|
787
|
+
const componentFolder = component.replace(/-/g, '-');
|
|
788
|
+
const sourceComponentPath = join(normalize(sourceComponentsBase), normalize(componentFolder)) as Path;
|
|
789
|
+
const targetComponentPath = join(normalize(uiPath), normalize(componentFolder)) as Path;
|
|
790
|
+
|
|
791
|
+
try {
|
|
792
|
+
// Try to copy the entire component folder
|
|
793
|
+
const sourceFiles = tree.getDir(sourceComponentPath);
|
|
794
|
+
if (sourceFiles && sourceFiles.subfiles.length > 0) {
|
|
795
|
+
for (const file of sourceFiles.subfiles) {
|
|
796
|
+
const sourceFile = sourceComponentPath + '/' + file;
|
|
797
|
+
const targetFile = targetComponentPath + '/' + file;
|
|
798
|
+
const content = tree.read(sourceFile as Path);
|
|
799
|
+
if (content) {
|
|
800
|
+
if (tree.exists(targetFile as Path)) {
|
|
801
|
+
tree.overwrite(targetFile as Path, content);
|
|
802
|
+
} else {
|
|
803
|
+
tree.create(targetFile as Path, content);
|
|
804
|
+
}
|
|
805
|
+
componentsCopied++;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
context.logger.info(` + ${component}`);
|
|
809
|
+
}
|
|
810
|
+
} catch (e) {
|
|
811
|
+
// Component folder doesn't exist yet or not available, skip
|
|
812
|
+
context.logger.debug(` ⊘ ${component} not available in core package`);
|
|
792
813
|
}
|
|
793
814
|
}
|
|
794
815
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
if (!options.skipInstall) {
|
|
798
|
-
context.addTask(new NodePackageInstallTask());
|
|
816
|
+
if (componentsCopied > 0) {
|
|
817
|
+
context.logger.info(` ✓ ${componentsCopied} component files copied`);
|
|
799
818
|
}
|
|
800
819
|
}
|
|
801
820
|
|