Rename package-lock.json to package-lock.json - #8326
Closed
Sazwan1996 wants to merge 1 commit into
Closed
Conversation
# 📦 Complete Technical Documentation
## 📱 1. Android CI Workflow (GitHub Actions)
### **File: `.github/workflows/android-ci.yml`**
```yaml
name: Android CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Run tests
run: ./gradlew test
- name: Upload test results
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-results
path: app/build/reports/
lint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run lint
run: ./gradlew lint
- name: Upload lint results
uses: actions/upload-artifact@v3
if: always()
with:
name: lint-results
path: app/build/reports/lint/
```
### **Required Dependencies (`app/build.gradle`)**
```gradle
plugins {
id 'com.android.application'
id 'org.owasp.dependencycheck' version '8.4.0'
}
android {
compileSdk 34
// ... your configuration
}
dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.10.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
dependencyCheck {
suppressionFile = file("$project.rootDir/dependency-suppressions.xml")
analyzers { assemblyEnabled = false }
}
```
### **Dependency Suppression File (`dependency-suppressions.xml`)**
```xml
<?xml version="1.0" encoding="UTF-8"?>
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
<!-- Add known false positive suppressions here -->
</suppressions>
```
---
## 🖥️ 2. Deploy Nuxt.js to MS IIS
### **Comparison: SSG vs SSR**
| Feature | Static Site Generation (SSG) | Server-Side Rendering (SSR) |
|--------|-------------------------------|------------------------------|
| Use Case | Content-driven sites (blogs, marketing) | Dynamic web apps (user-specific content) |
| Nuxt Command | `npm run generate` | `npm run build` |
| Output Folder | `dist/` | `.output/` or `.nuxt/` |
| IIS Setup | Point to `dist` folder; no Node.js runtime needed | Requires **iisnode** and `web.config` |
| Pros | Simple, fast, scalable | Full dynamic functionality |
| Cons | Limited dynamic functionality | Complex configuration |
### **SSR Deployment with iisnode**
**Prerequisites:**
- Install [iisnode](https://github.com/Azure/iisnode)
- Install [URL Rewrite Module](https://www.iis.net/downloads/microsoft/url-rewrite)
**`nuxt.config.ts`**
```typescript
export default defineNuxtConfig({
ssr: true,
nitro: { preset: 'iis_node' }
})
```
**Build command:**
```bash
npx nuxi build --preset=iis_node
```
**`web.config` (place in project root)**
```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path=".output/server/index.mjs" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="Nuxt Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url=".output/server/index.mjs" />
</rule>
</rules>
</rewrite>
<iisnode
nodeProcessCommandLine=""C:\Program Files\nodejs\node.exe""
interceptor=""%programfiles%\iisnode\interceptor.js""
/>
</system.webServer>
</configuration>
```
**Important Note:** In `nuxt.config.js` (if using CommonJS) change `export default` to `module.exports`.
### **Static Site Deployment (SSG)**
```bash
npm run generate
# Deploy the generated `dist/` folder to IIS as a static website.
```
### **Troubleshooting**
- Enable detailed errors in `web.config`:
```xml
<system.webServer>
<iisnode loggingEnabled="true" devErrorsEnabled="true"/>
<httpErrors errorMode="Detailed" />
</system.webServer>
```
- Check iisnode logs at `C:\inetpub\logs\iisnode`
- Add MIME type for `.mjs` in IIS: `application/javascript`
---
## 🔔 3. Complete Guide to Managing Notifications
### **Notification Channels & Categories**
```javascript
const NOTIFICATION_CATEGORIES = {
SECURITY: { id: 'security', name: 'Security Alerts', channels: ['push', 'email', 'sms'], priority: 'high', userControllable: false },
TRANSACTIONAL: { id: 'transactional', name: 'Transactions', channels: ['push', 'in_app', 'email'], priority: 'medium', userControllable: true },
MARKETING: { id: 'marketing', name: 'Promotions', channels: ['push', 'email', 'in_app'], priority: 'low', userControllable: true },
SYSTEM: { id: 'system', name: 'System Updates', channels: ['email', 'in_app'], priority: 'medium', userControllable: false },
SOCIAL: { id: 'social', name: 'Social Interactions', channels: ['push', 'in_app', 'email'], priority: 'low', userControllable: true }
};
```
### **Permission Request (Soft Ask + Hard Ask)**
```javascript
class PermissionManager {
async requestNotificationPermission() {
if (!this.shouldAskForPermission()) return 'denied';
const result = await this.softAsk();
if (result === 'interested') return await this.hardAsk();
return result;
}
// ... full implementation
}
```
### **Notification Service (React Hooks)**
```jsx
// NotificationContext, useNotifications, NotificationStack, NotificationItem
// Full code provided in previous response
```
### **Backend Microservice (Node.js/Express)**
```javascript
// Express routes for sending notifications and managing preferences
router.post('/send', async (req, res) => { ... });
router.get('/preferences/:userId', ...);
router.put('/preferences/:userId', ...);
```
### **Database Schema (PostgreSQL)**
```sql
CREATE TABLE notifications (...);
CREATE TABLE notification_deliveries (...);
CREATE TABLE user_notification_preferences (...);
CREATE TABLE notification_templates (...);
```
### **Advanced Features**
- **Smart Delivery Engine**: Calculates optimal delivery times based on user engagement.
- **A/B Testing Framework**: Tests different notification variants.
- **Analytics**: Tracks deliveries, opens, clicks, conversions.
- **Performance Monitoring**: Measures delivery times and error rates.
- **Privacy & Compliance**: GDPR consent management, rate limiting.
---
## 🐳 4. Devcontainer.json – Complete Guide
### **What is a Dev Container?**
A configuration file (`.devcontainer/devcontainer.json`) that defines a containerized development environment, used by VS Code, GitHub Codespaces, and Gitpod.
### **Basic Structure**
```json
{
"name": "My Project",
"image": "node:18",
"features": {
"ghcr.io/devcontainers/features/git:1": {}
},
"extensions": ["dbaeumer.vscode-eslint"],
"settings": { "editor.formatOnSave": true },
"forwardPorts": [3000],
"postCreateCommand": "npm install",
"remoteUser": "node"
}
```
### **Key Properties**
| Property | Description |
|----------|-------------|
| `name` | Display name |
| `image` | Docker image to use |
| `build` | Build custom Dockerfile |
| `features` | Add tools (Docker-in-Docker, AWS CLI, etc.) |
| `extensions` | VS Code extensions |
| `settings` | VS Code settings |
| `forwardPorts` | Ports to forward |
| `postCreateCommand` | Run after container creation |
| `remoteUser` | User to run as |
### **Common Examples**
- **Node.js** – image `node:18`, extensions `eslint`, `prettier`
- **Python** – image `mcr.microsoft.com/devcontainers/python:3.10`, extensions `ms-python.python`
- **Java** – image `mcr.microsoft.com/devcontainers/java:17`, features for Maven/Gradle
- **Docker Compose** – use `dockerComposeFile` to include multiple services (app + database)
### **Best Practices**
- Commit `devcontainer.json` to repo.
- Use features instead of custom scripts.
- Pin image versions.
- Test with `Remote-Containers: Rebuild Container`.
---
## 🔄 5. Renaming `package-lock.json`
### **Why rename?**
- Regenerate lockfile (backup old one).
- Switch package managers (backup before Yarn/pnpm takes over).
- Temporarily disable lockfile (not recommended).
### **Commands**
**Linux/macOS/Git Bash**
```bash
mv package-lock.json package-lock.json.bak
```
**Windows Command Prompt**
```cmd
ren package-lock.json package-lock.json.bak
```
**Windows PowerShell**
```powershell
Rename-Item package-lock.json package-lock.json.bak
```
After renaming, run `npm install` to generate a new `package-lock.json`. Restore with `mv package-lock.json.bak package-lock.json` if needed.
**⚠️ Important:** Add backup file to `.gitignore` to avoid committing it. Inform your team about the change to prevent inconsistencies.
---
📌 *All documentation above has been compiled from the previous conversations. If you need further elaboration on any section, feel free to ask!*
|
Contributor
|
closing as spam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📦 Complete Technical Documentation
📱 1. Android CI Workflow (GitHub Actions)
File:
.github/workflows/android-ci.ymlRequired Dependencies (
app/build.gradle)Dependency Suppression File (
dependency-suppressions.xml)🖥️ 2. Deploy Nuxt.js to MS IIS
Comparison: SSG vs SSR
| Feature | Static Site Generation (SSG) | Server-Side Rendering (SSR) | |--------|-------------------------------|------------------------------| | Use Case | Content-driven sites (blogs, marketing) | Dynamic web apps (user-specific content) | | Nuxt Command |
npm run generate|npm run build| | Output Folder |dist/|.output/or.nuxt/| | IIS Setup | Point todistfolder; no Node.js runtime needed | Requires iisnode andweb.config| | Pros | Simple, fast, scalable | Full dynamic functionality | | Cons | Limited dynamic functionality | Complex configuration |SSR Deployment with iisnode
Prerequisites:
nuxt.config.tsBuild command:
web.config(place in project root)Important Note: In
nuxt.config.js(if using CommonJS) changeexport defaulttomodule.exports.Static Site Deployment (SSG)
npm run generate # Deploy the generated `dist/` folder to IIS as a static website.Troubleshooting
web.config:xml <system.webServer> <iisnode loggingEnabled="true" devErrorsEnabled="true"/> <httpErrors errorMode="Detailed" /> </system.webServer>C:\inetpub\logs\iisnode.mjsin IIS:application/javascript🔔 3. Complete Guide to Managing Notifications
Notification Channels & Categories
Permission Request (Soft Ask + Hard Ask)
Notification Service (React Hooks)
Backend Microservice (Node.js/Express)
Database Schema (PostgreSQL)
Advanced Features
🐳 4. Devcontainer.json – Complete Guide
What is a Dev Container?
A configuration file (
.devcontainer/devcontainer.json) that defines a containerized development environment, used by VS Code, GitHub Codespaces, and Gitpod.Basic Structure
{ "name": "My Project", "image": "node:18", "features": { "ghcr.io/devcontainers/features/git:1": {} }, "extensions": ["dbaeumer.vscode-eslint"], "settings": { "editor.formatOnSave": true }, "forwardPorts": [3000], "postCreateCommand": "npm install", "remoteUser": "node" }Key Properties
nameimagebuildfeaturessettingsforwardPortspostCreateCommandCommon Examples
node:18, extensionseslint,prettiermcr.microsoft.com/devcontainers/python:3.10, extensionsms-python.pythonmcr.microsoft.com/devcontainers/java:17, features for Maven/GradledockerComposeFileto include multiple services (app + database)Best Practices
devcontainer.jsonto repo.Remote-Containers: Rebuild Container.🔄 5. Renaming
package-lock.jsonWhy rename?
Commands
Linux/macOS/Git Bash
Windows Command Prompt
ren package-lock.json package-lock.json.bakWindows PowerShell
After renaming, run
npm installto generate a newpackage-lock.json. Restore withmv package-lock.json.bak package-lock.jsonif needed..gitignoreto avoid committing it. Inform your team about the change to prevent inconsistencies.📌 All documentation above has been compiled from the previous conversations. If you need further elaboration on any section, feel free to ask!
Closes #
Changelog
New
Changed
Removed
Rollout strategy
Testing & Reviewing