Skip to content

Rename package-lock.json to package-lock.json - #8326

Closed
Sazwan1996 wants to merge 1 commit into
primer:mainfrom
Sazwan1996:patch-1
Closed

Rename package-lock.json to package-lock.json#8326
Sazwan1996 wants to merge 1 commit into
primer:mainfrom
Sazwan1996:patch-1

Conversation

@Sazwan1996

Copy link
Copy Markdown

📦 Complete Technical Documentation

📱 1. Android CI Workflow (GitHub Actions)

File: .github/workflows/android-ci.yml

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)

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 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:

nuxt.config.ts

export default defineNuxtConfig({
  ssr: true,
  nitro: { preset: 'iis_node' }
})

Build command:

npx nuxi build --preset=iis_node

web.config (place in project root)

<?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="&quot;C:\Program Files\nodejs\node.exe&quot;" 
      interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;" 
    />
  </system.webServer>
</configuration>

Important Note: In nuxt.config.js (if using CommonJS) change export default to module.exports.

Static Site Deployment (SSG)

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

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)

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)

// NotificationContext, useNotifications, NotificationStack, NotificationItem
// Full code provided in previous response

Backend Microservice (Node.js/Express)

// 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)

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

{
  "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.)
settings VS Code settings
forwardPorts Ports to forward
postCreateCommand Run after container creation

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

mv package-lock.json package-lock.json.bak

Windows Command Prompt

ren package-lock.json package-lock.json.bak

Windows 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!

Closes #

Changelog

New

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

# 📦 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="&quot;C:\Program Files\nodejs\node.exe&quot;" 
      interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;" 
    />
  </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!*
@Sazwan1996
Sazwan1996 requested a review from a team as a code owner August 21, 2026 02:57
@Sazwan1996
Sazwan1996 requested a review from liuliu-dev August 21, 2026 02:57
@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4492cfc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@liuliu-dev

Copy link
Copy Markdown
Contributor

closing as spam

@liuliu-dev liuliu-dev closed this Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants