blog-blueprint 0.0.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.
Files changed (68) hide show
  1. package/BlueprintTemplate/.editorconfig +17 -0
  2. package/BlueprintTemplate/.gitlab-ci.yml +34 -0
  3. package/BlueprintTemplate/DESIGN.txt +37 -0
  4. package/BlueprintTemplate/README.md +78 -0
  5. package/BlueprintTemplate/angular.json +101 -0
  6. package/BlueprintTemplate/gitignore +42 -0
  7. package/BlueprintTemplate/package.json +58 -0
  8. package/BlueprintTemplate/public/assets/lessons/aws/aws-overview.md +139 -0
  9. package/BlueprintTemplate/public/assets/lessons/core/aws-aurora-guide.md +181 -0
  10. package/BlueprintTemplate/public/assets/lessons/core/aws-dynamodb-guide.md +139 -0
  11. package/BlueprintTemplate/public/assets/lessons/core/aws-ec2-guide.md +152 -0
  12. package/BlueprintTemplate/public/assets/lessons/core/aws-eventbridge-guide.md +152 -0
  13. package/BlueprintTemplate/public/assets/lessons/core/aws-iam-guide.md +132 -0
  14. package/BlueprintTemplate/public/assets/lessons/core/aws-lambda-guide.md +129 -0
  15. package/BlueprintTemplate/public/assets/lessons/core/aws-rds-guide.md +193 -0
  16. package/BlueprintTemplate/public/assets/lessons/core/aws-s3-guide.md +158 -0
  17. package/BlueprintTemplate/public/assets/lessons/core/aws-sns-guide.md +163 -0
  18. package/BlueprintTemplate/public/assets/lessons/core/aws-sqs-guide.md +173 -0
  19. package/BlueprintTemplate/public/assets/lessons/core/aws-vpc-guide.md +145 -0
  20. package/BlueprintTemplate/public/assets/lessons/groups/aws-application-integration-overview.md +194 -0
  21. package/BlueprintTemplate/public/assets/lessons/groups/aws-compute-architecture-overview.md +187 -0
  22. package/BlueprintTemplate/public/assets/lessons/groups/aws-database-architecture.md +104 -0
  23. package/BlueprintTemplate/public/assets/lessons/groups/aws-networking-architecture.md +97 -0
  24. package/BlueprintTemplate/public/assets/lessons/groups/aws-security-architecture.md +88 -0
  25. package/BlueprintTemplate/public/assets/lessons/groups/aws-storage-architecture.md +116 -0
  26. package/BlueprintTemplate/public/assets/lessons/index.json +202 -0
  27. package/BlueprintTemplate/public/assets/lessons/theory/aws-caching-strategy.md +61 -0
  28. package/BlueprintTemplate/public/assets/lessons/theory/aws-disaster-recovery-strategies.md +117 -0
  29. package/BlueprintTemplate/public/assets/lessons/theory/aws-event-driven-architecture.md +77 -0
  30. package/BlueprintTemplate/public/assets/lessons/theory/aws-ha-ft-scalability.md +98 -0
  31. package/BlueprintTemplate/public/assets/lessons/theory/aws-hybrid-cloud.md +82 -0
  32. package/BlueprintTemplate/public/assets/lessons/theory/aws-microservices-vs-monolithic.md +77 -0
  33. package/BlueprintTemplate/public/assets/lessons/theory/aws-well-architected-framework.md +174 -0
  34. package/BlueprintTemplate/public/favicon.ico +0 -0
  35. package/BlueprintTemplate/public/robots.txt +23 -0
  36. package/BlueprintTemplate/public/sitemap.xml +11 -0
  37. package/BlueprintTemplate/src/app/app.config.server.ts +12 -0
  38. package/BlueprintTemplate/src/app/app.config.ts +16 -0
  39. package/BlueprintTemplate/src/app/app.html +36 -0
  40. package/BlueprintTemplate/src/app/app.routes.server.ts +8 -0
  41. package/BlueprintTemplate/src/app/app.routes.ts +11 -0
  42. package/BlueprintTemplate/src/app/app.scss +71 -0
  43. package/BlueprintTemplate/src/app/app.ts +50 -0
  44. package/BlueprintTemplate/src/app/core/models/lesson.model.ts +8 -0
  45. package/BlueprintTemplate/src/app/core/services/lesson.service.ts +46 -0
  46. package/BlueprintTemplate/src/app/core/services/seo.service.ts +68 -0
  47. package/BlueprintTemplate/src/app/features/about/about.html +14 -0
  48. package/BlueprintTemplate/src/app/features/about/about.scss +4 -0
  49. package/BlueprintTemplate/src/app/features/about/about.ts +23 -0
  50. package/BlueprintTemplate/src/app/features/lesson-detail/lesson-detail.html +4 -0
  51. package/BlueprintTemplate/src/app/features/lesson-detail/lesson-detail.scss +0 -0
  52. package/BlueprintTemplate/src/app/features/lesson-detail/lesson-detail.ts +55 -0
  53. package/BlueprintTemplate/src/app/features/lesson-list/lesson-list.html +13 -0
  54. package/BlueprintTemplate/src/app/features/lesson-list/lesson-list.scss +0 -0
  55. package/BlueprintTemplate/src/app/features/lesson-list/lesson-list.ts +59 -0
  56. package/BlueprintTemplate/src/app/shared/facades/event-abstract.facade.ts +18 -0
  57. package/BlueprintTemplate/src/app/shared/facades/pages.facade.ts +55 -0
  58. package/BlueprintTemplate/src/app/shared/utils/common.utils.ts +3 -0
  59. package/BlueprintTemplate/src/index.html +35 -0
  60. package/BlueprintTemplate/src/main.server.ts.bak +7 -0
  61. package/BlueprintTemplate/src/main.ts +6 -0
  62. package/BlueprintTemplate/src/server.ts.bak +68 -0
  63. package/BlueprintTemplate/src/styles.scss +36 -0
  64. package/BlueprintTemplate/tsconfig.app.json +17 -0
  65. package/BlueprintTemplate/tsconfig.json +34 -0
  66. package/README.md +22 -0
  67. package/create.js +92 -0
  68. package/package.json +21 -0
@@ -0,0 +1,68 @@
1
+ import {
2
+ AngularNodeAppEngine,
3
+ createNodeRequestHandler,
4
+ isMainModule,
5
+ writeResponseToNodeResponse,
6
+ } from '@angular/ssr/node';
7
+ import express from 'express';
8
+ import { join } from 'node:path';
9
+
10
+ const browserDistFolder = join(import.meta.dirname, '../browser');
11
+
12
+ const app = express();
13
+ const angularApp = new AngularNodeAppEngine();
14
+
15
+ /**
16
+ * Example Express Rest API endpoints can be defined here.
17
+ * Uncomment and define endpoints as necessary.
18
+ *
19
+ * Example:
20
+ * ```ts
21
+ * app.get('/api/{*splat}', (req, res) => {
22
+ * // Handle API request
23
+ * });
24
+ * ```
25
+ */
26
+
27
+ /**
28
+ * Serve static files from /browser
29
+ */
30
+ app.use(
31
+ express.static(browserDistFolder, {
32
+ maxAge: '1y',
33
+ index: false,
34
+ redirect: false,
35
+ }),
36
+ );
37
+
38
+ /**
39
+ * Handle all other requests by rendering the Angular application.
40
+ */
41
+ app.use((req, res, next) => {
42
+ angularApp
43
+ .handle(req)
44
+ .then((response) =>
45
+ response ? writeResponseToNodeResponse(response, res) : next(),
46
+ )
47
+ .catch(next);
48
+ });
49
+
50
+ /**
51
+ * Start the server if this module is the main entry point.
52
+ * The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
53
+ */
54
+ if (isMainModule(import.meta.url)) {
55
+ const port = process.env['PORT'] || 4000;
56
+ app.listen(port, (error) => {
57
+ if (error) {
58
+ throw error;
59
+ }
60
+
61
+ console.log(`Node Express server listening on http://localhost:${port}`);
62
+ });
63
+ }
64
+
65
+ /**
66
+ * Request handler used by the Angular CLI (for dev-server and during build) or Firebase Cloud Functions.
67
+ */
68
+ export const reqHandler = createNodeRequestHandler(app);
@@ -0,0 +1,36 @@
1
+ /* styles.css hoặc styles.scss */
2
+
3
+ /* Font chính cho toàn app */
4
+ body {
5
+ font-family: 'Inter', 'Roboto', sans-serif; /* Chọn font dễ đọc */
6
+ font-size: 16px; /* Cỡ chữ cơ bản */
7
+ line-height: 1.5; /* Khoảng cách dòng hợp lý */
8
+ color: #333; /* Màu chữ dễ nhìn */
9
+ background-color: #fff; /* Màu nền chuẩn */
10
+ margin: 0;
11
+ .page-content {
12
+ display: flex;
13
+ flex-direction: column;
14
+ padding: 20px 150px;
15
+ }
16
+ }
17
+
18
+ /* Typography cho các thẻ */
19
+ h1, h2, h3, h4, h5, h6 {
20
+ font-weight: 600; /* Đậm vừa phải */
21
+ line-height: 1.2; /* Khoảng cách dòng nhỏ hơn body */
22
+ margin-bottom: 0.5em;
23
+ }
24
+
25
+ p {
26
+ margin-bottom: 1em;
27
+ }
28
+
29
+ /* Links */
30
+ a {
31
+ color: #007bff;
32
+ text-decoration: none;
33
+ }
34
+ a:hover {
35
+ text-decoration: underline;
36
+ }
@@ -0,0 +1,17 @@
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
+ "outDir": "./out-tsc/app",
7
+ "types": [
8
+ "node"
9
+ ]
10
+ },
11
+ "include": [
12
+ "src/**/*.ts"
13
+ , "src/server.ts.bak", "src/main.server.ts.bak" ],
14
+ "exclude": [
15
+ "src/**/*.spec.ts"
16
+ ]
17
+ }
@@ -0,0 +1,34 @@
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
+ "strict": true,
7
+ "noImplicitOverride": true,
8
+ "noPropertyAccessFromIndexSignature": true,
9
+ "noImplicitReturns": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "skipLibCheck": true,
12
+ "isolatedModules": true,
13
+ "experimentalDecorators": true,
14
+ "importHelpers": true,
15
+ "target": "ES2022",
16
+ "module": "preserve"
17
+ },
18
+ "angularCompilerOptions": {
19
+ "enableI18nLegacyMessageIdFormat": false,
20
+ "strictInjectionParameters": true,
21
+ "strictInputAccessModifiers": true,
22
+ "typeCheckHostBindings": true,
23
+ "strictTemplates": true
24
+ },
25
+ "files": [],
26
+ "references": [
27
+ {
28
+ "path": "./tsconfig.app.json"
29
+ },
30
+ {
31
+ "path": "./tsconfig.spec.json"
32
+ }
33
+ ]
34
+ }
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ How to make a blueprint (Ex: python-blueprint)
2
+ 1. Change the name of the blueprint project in package.json file:
3
+ Ex: "name": "python-blueprint",
4
+ "bin": {
5
+ "blog-blueprint": "create.js"
6
+ },
7
+ 2. Copy the template into BlueprintTemplate. The template include:
8
+ - Basic files
9
+ - Add git
10
+ - Add gitignore file and change it from .gitignore=> gitignore file
11
+ 3. Add git to the blueprint, and change the root branch from master to main
12
+ - git branch -m master main
13
+ 4. Create new repo in git
14
+ - Add environment variables into the git repo: Project > Settings > CI/CD > Variables
15
+ + NPM_TOKEN: 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
16
+ + PACKAGE_NAME: python-blueprint
17
+ - push the blueprint to main branch
18
+ 5. Use the lib from npm:
19
+ - npm uninstall -g python-blueprint
20
+ - npm install -g python-blueprint
21
+ - npm list -g python-blueprint
22
+ - python-blueprint thmoney
package/create.js ADDED
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { execSync } = require('child_process'); // ✅ Fix: Import execSync
6
+
7
+ // Get the project name from command-line arguments
8
+ const projectName = process.argv[2];
9
+ if (!projectName) {
10
+ console.error("❌ Please specify the project name.");
11
+ process.exit(1);
12
+ }
13
+
14
+ const templatePath = path.join(__dirname, "BlueprintTemplate"); // Copy from BlueprintTemplate
15
+ const destinationPath = path.join(process.cwd(), projectName);
16
+
17
+ // Function to copy and rename files
18
+ function copyAndRenameFiles(src, dest, oldName, newName) {
19
+ if (fs.lstatSync(src).isDirectory()) {
20
+ fs.mkdirSync(dest, { recursive: true });
21
+ const entries = fs.readdirSync(src, { withFileTypes: true });
22
+
23
+ for (let entry of entries) {
24
+ let srcPath = path.join(src, entry.name);
25
+ let destPath = path.join(dest, entry.name.replace(new RegExp(oldName, 'g'), newName));
26
+ copyAndRenameFiles(srcPath, destPath, oldName, newName);
27
+ }
28
+ } else {
29
+ let content = fs.readFileSync(src, 'utf8');
30
+ content = content.replace(new RegExp(oldName, 'g'), newName); // Replace occurrences of Blueprint
31
+ fs.writeFileSync(dest, content, 'utf8');
32
+ }
33
+ }
34
+
35
+ // Ensure the destination folder doesn't already exist
36
+ if (fs.existsSync(destinationPath)) {
37
+ console.error(`❌ Project directory "${projectName}" already exists.`);
38
+ process.exit(1);
39
+ }
40
+
41
+ fs.mkdirSync(destinationPath, { recursive: true });
42
+
43
+ // Copy and rename all files
44
+ fs.readdirSync(templatePath).forEach(item => {
45
+ const srcPath = path.join(templatePath, item);
46
+ let destPath = path.join(destinationPath, item.replace(/Blueprint/g, projectName));
47
+
48
+ if (item === "gitignore") {
49
+ destPath = path.join(destinationPath, ".gitignore"); // Rename gitignore
50
+ }
51
+
52
+ console.log(`✅ Copying and renaming ${item}...`);
53
+ copyAndRenameFiles(srcPath, destPath, "Blueprint", projectName);
54
+ });
55
+
56
+ console.log(`🎉 Project "${projectName}" created successfully at ${destinationPath}`);
57
+ console.log(`📌 Open "${projectName}.sln" in Visual Studio to get started!`);
58
+
59
+ // Update package.json
60
+ const packageJsonPath = path.join(destinationPath, 'package.json');
61
+ if (fs.existsSync(packageJsonPath)) {
62
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
63
+ pkg.name = projectName;
64
+ pkg.bin = {
65
+ [projectName]: './create.js'
66
+ };
67
+ fs.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2), 'utf8');
68
+ console.log("📦 Updated package.json with project name.");
69
+ }
70
+
71
+ // Create an empty BlueprintTemplate folder
72
+ const internalBlueprintPath = path.join(destinationPath, 'BlueprintTemplate');
73
+ fs.mkdirSync(internalBlueprintPath, { recursive: true });
74
+ console.log(`📁 Created empty folder: ${internalBlueprintPath}`);
75
+
76
+ // Initialize Git and commit the first commit
77
+ try {
78
+ process.chdir(destinationPath); // Move into project directory
79
+
80
+ console.log("🚀 Initializing Git repository...");
81
+ execSync('git init', { stdio: 'inherit' });
82
+
83
+ console.log("📂 Adding all files...");
84
+ execSync('git add .', { stdio: 'inherit' });
85
+
86
+ console.log("✅ Creating first commit...");
87
+ execSync('git commit -m "Initial commit from blueprint"', { stdio: 'inherit' });
88
+
89
+ console.log("🎉 Git repository initialized successfully!");
90
+ } catch (error) {
91
+ console.error("❌ Failed to initialize Git:", error);
92
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "blog-blueprint",
3
+ "version": "0.0.2",
4
+ "description": "A custom project blueprint",
5
+ "main": "create.js",
6
+ "bin": {
7
+ "blog-blueprint": "create.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "keywords": [
13
+ "blueprint",
14
+ "starter-template"
15
+ ],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "files": [
19
+ "BlueprintTemplate/**"
20
+ ]
21
+ }