diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a64218a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish to npm + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev xvfb + + - name: Install Node dependencies + run: npm ci || npm install + + - name: Run unit tests + run: xvfb-run -a npm test + + - name: Publish to npm + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index a73a195..315f317 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Adrenaline.js is an ultra-lightweight, high-performance desktop application fram - **Zero Rust / Go Barrier:** Written 100% for Node.js & JavaScript developers. Use your favorite npm packages without learning a new language or toolchain. - **Drop-in Electron-like API:** Work with familiar APIs like `app`, `BrowserWindow`, and `ipcMain` out of the box with zero learning curve. - **Bidirectional IPC:** High-speed asynchronous inter-process communication between Node.js backend processes and webview frontends. -- **Built-in CLI & Scaffolder:** Instant project scaffolding and execution with `npx adrenaline init` and `adrenaline dev`. +- **Built-in CLI & Scaffolder:** Instant project scaffolding and execution with `npx adrenaline-js init` and `adrenaline dev`. --- @@ -25,7 +25,9 @@ Scaffold and launch a new project in seconds: ```bash # 1. Create a new Adrenaline.js project -npx adrenaline init my-app +npm install adrenaline-js +# or scaffold a new project: +npx adrenaline-js init my-app # 2. Navigate to your project folder cd my-app @@ -58,7 +60,7 @@ npx adrenaline dev ### Main Process (`main.js`) ```javascript -const { app, BrowserWindow, ipcMain } = require('adrenaline'); +const { app, BrowserWindow, ipcMain } = require('adrenaline-js'); const path = require('path'); app.whenReady().then(() => { diff --git a/package-lock.json b/package-lock.json index d3c79b9..30bd0cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "adrenaline", + "name": "adrenaline-js", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "adrenaline", + "name": "adrenaline-js", "version": "0.1.0", "hasInstallScript": true, "dependencies": { diff --git a/package.json b/package.json index 2986e1d..244db6d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "adrenaline", + "name": "adrenaline-js", "version": "0.1.0", "description": "Desktop app framework using Node.js and webview.h", "main": "index.js", diff --git a/templates/starter/main.js b/templates/starter/main.js index 5da9c97..b499c87 100644 --- a/templates/starter/main.js +++ b/templates/starter/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain } = require('adrenaline'); +const { app, BrowserWindow, ipcMain } = require('adrenaline-js'); const path = require('path'); const fs = require('fs'); diff --git a/templates/starter/package.json b/templates/starter/package.json index 9cdd355..50c0fc4 100644 --- a/templates/starter/package.json +++ b/templates/starter/package.json @@ -8,6 +8,6 @@ "dev": "adrenaline dev" }, "dependencies": { - "adrenaline": "^0.1.0" + "adrenaline-js": "^0.1.0" } } diff --git a/test/test_cli.js b/test/test_cli.js index 2a89d75..323df84 100644 --- a/test/test_cli.js +++ b/test/test_cli.js @@ -38,12 +38,12 @@ try { const scaffoldedPkg = JSON.parse(fs.readFileSync(path.join(testAppDir, 'package.json'), 'utf8')); assert.strictEqual(scaffoldedPkg.name, testAppName, 'Scaffolded package.json name should match project name'); - // Create node_modules/adrenaline inside testAppDir to point to root index.js so require('adrenaline') works directly + // Create node_modules/adrenaline-js inside testAppDir to point to root index.js so require('adrenaline-js') works directly const nodeModulesDir = path.join(testAppDir, 'node_modules'); - const adrenalinePackageDir = path.join(nodeModulesDir, 'adrenaline'); + const adrenalinePackageDir = path.join(nodeModulesDir, 'adrenaline-js'); fs.mkdirSync(adrenalinePackageDir, { recursive: true }); - // Copy/link root index.js, package.json, lib and build into testAppDir node_modules/adrenaline + // Copy/link root index.js, package.json, lib and build into testAppDir node_modules/adrenaline-js fs.copyFileSync(path.join(projectRoot, 'index.js'), path.join(adrenalinePackageDir, 'index.js')); fs.copyFileSync(path.join(projectRoot, 'package.json'), path.join(adrenalinePackageDir, 'package.json'));