Λογότυπο Electron Native Lib Extraction

Electron Native Lib Extraction

Κοινότητα
Innei
electron-native-lib-extraction

Χρησιμοποιήστε το όταν αποσπάτε μια ενσωμάτωση εγγενούς module Electron μέσα στην εφαρμογή (πρόσθετο N-API + scripts build + ρυθμίσεις packaging + CI έκδοσης) σε μια αυτόνομη βιβλιοθήκη npm που διανέμεται μαζί με τον πηγαίο κώδικα — ή όταν δημιουργείτε μια τέτοια βιβλιοθήκη από την αρχή. Καλύπτει τις παγίδες ABI και install script, τη σημασιολογία rebuild του node-gyp, το βάθος rpath στο macOS, τις εξαιρέσεις packaging του electron-builder, τις καλές πρακτικές για σύνθετα GitHub Actions και τη μεταφορά της ενσωμάτωσης πίσω στην εφαρμογή-πηγή για dogfooding.

Add to TypingMind

Επισκόπηση

ΕκδότηςInnei
ΑποθετήριοSKILL
Όνομα δεξιότηταςelectron-native-lib-extraction
Αστέρια
81
Διακλαδώσεις
2
Συνοδευτικά αρχεία
Μόνο οδηγίες
Σύνδεσμοι
  • Οδηγίες σε Markdown

    Ένα αρχείο SKILL.md που το μοντέλο φορτώνει όταν χρειάζεται, ώστε να καταναλώνει token μόνο όταν ένα αίτημα είναι πράγματι σχετικό.

  • Λειτουργεί με οποιοδήποτε LLM

    Οι δεξιότητες AI είναι απλό Markdown, όχι κώδικας για συγκεκριμένο πάροχο, επομένως αυτή η δεξιότητα λειτουργεί με GPT, Claude, Gemini, Grok ή ένα τοπικό μοντέλο.

  • Αυτοτελής

    Όλα όσα χρειάζεται το μοντέλο περιλαμβάνονται στις οδηγίες — χωρίς επιπλέον αρχεία για συγχρονισμό.

  • Ανοιχτού κώδικα

    Δημοσιεύτηκε στο GitHub από τον λογαριασμό Innei. Ελέγξτε τα αρχεία της δεξιότητας στο αποθετήριο πριν την εγκαταστήσετε.

Εγκατάσταση

Εγκαταστήστε τη δεξιότητα AI Electron Native Lib Extraction στο TypingMind για να τη χρησιμοποιείτε με οποιοδήποτε LLM ή προσθέστε τη σε άλλον πράκτορα AI που διαβάζει αρχεία SKILL.md.

1

Εγκατάσταση στο TypingMind

Το TypingMind εγκαθιστά μια δεξιότητα απευθείας από τον φάκελό της στο GitHub — διαβάζει το SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία σε πακέτο και αποθηκεύει το αποτέλεσμα τοπικά.

  1. Ανοίξτε την εφαρμογή και μεταβείτε στα Πρόσθετα → Δεξιότητες.
  2. Επιλέξτε «Εγκατάσταση από GitHub».
  3. Επικολλήστε το παρακάτω URL του φακέλου της δεξιότητας και επιβεβαιώστε.
    https://github.com/Innei/SKILL/tree/main/skills/infrastructure/electron-native-lib-extraction
  4. Ενεργοποιήστε τη δεξιότητα σε κάθε συνομιλία όπου θέλετε να είναι διαθέσιμη.
Πρόσθετα → Δεξιότητες → Προσθήκη δεξιότητας → Από URL του GitHub, έπειτα επικολλήστε το URL του φακέλου και πατήστε «Συνέχεια».
2

Εγκατάσταση σε άλλον πράκτορα AI

Κάθε πράκτορας AI που υποστηρίζει τη μορφή Agent Skills μπορεί να χρησιμοποιήσει αυτή τη δεξιότητα — αντιγράψτε τον φάκελο στον κατάλογο δεξιοτήτων του.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Innei/SKILL.git /tmp/SKILL
mkdir -p .claude/skills
cp -r /tmp/SKILL/skills/infrastructure/electron-native-lib-extraction .claude/skills/electron-native-lib-extraction
Επανεκκινήστε το Claude Code μετά την αντιγραφή, ώστε να εντοπίσει τη νέα δεξιότητα.

Χρησιμοποιήστε τη στο TypingMind

Ενεργοποιήστε τη δεξιότητα Electron Native Lib Extraction σε οποιαδήποτε συνομιλία στο TypingMind και το μοντέλο αναλαμβάνει τα υπόλοιπα. Το όνομα και η περιγραφή της περιλαμβάνονται στην προτροπή συστήματος και, μόλις προκύψει ένα σχετικό αίτημα, το μοντέλο φορτώνει μόνο του τις πλήρεις οδηγίες — δεν χρειάζεται ποτέ να την καλείτε χειροκίνητα και δεν καταναλώνει token μέχρι να χρησιμοποιηθεί πραγματικά.

Το μοντέλο φορτώνει αυτόματα τη δεξιότητα Electron Native Lib Extraction μόλις λάβει ένα σχετικό αίτημα.

Λειτουργεί με οποιοδήποτε μοντέλο AI

Οι δεξιότητες AI είναι οδηγίες σε απλό κείμενο Markdown και όχι κώδικας για συγκεκριμένο πάροχο, οπότε η δεξιότητα Electron Native Lib Extraction δεν περιορίζεται στο μοντέλο για το οποίο γράφτηκε. Εγκαταστήστε τη μία φορά στο TypingMind και χρησιμοποιήστε τη με GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ή ένα τοπικό μοντέλο που εκτελείτε εσείς — πάντα με τα δικά σας κλειδιά API.

  • Φόρτωση μόνο όταν χρειάζεται

    Η προτροπή συστήματος περιλαμβάνει μόνο το όνομα και την περιγραφή. Οι οδηγίες ανακτώνται με το πρώτο σχετικό αίτημα, οπότε μια δεξιότητα που δεν χρησιμοποιείται δεν έχει κόστος.

  • Αλλάξτε μοντέλο κατά τη διάρκεια της συνομιλίας

    Επειδή η δεξιότητα αποτελείται από οδηγίες και όχι από κώδικα, η αλλαγή μοντέλου δεν επηρεάζει τη λειτουργία της — το επόμενο μοντέλο διαβάζει το ίδιο αρχείο SKILL.md.

Οδηγίες δεξιότητας

Αυτό είναι το περιεχόμενο του αρχείου SKILL.md που φορτώνει το μοντέλο. Διαβάστε το πριν από την εγκατάσταση — μια δεξιότητα αποτελείται από οδηγίες που θα ακολουθήσει το μοντέλο σας.

electron-native-lib-extraction

An Electron app that grew a native module (N-API addon linking a system framework, e.g. Sparkle) accumulates four coupled layers: the addon source, the Electron-ABI build orchestration, the electron-builder packaging config, and the release CI. Extracting them into a reusable npm package is mostly mechanical — but most of the failure modes are invisible until a consumer installs the package or CI runs a real release. This skill encodes the extraction order and the traps. Reference implementation: https://github.com/Innei/electron-sparkle-updater (Sparkle.framework bridge + appcast release toolchain, extracted from the Kansoku desktop app).

When to use

  • In scope: source-distributed native npm packages for Electron (consumer compiles at build time), macOS framework linking, electron-builder integration fragments, composite GitHub Actions for release pipelines, migrating the source app onto the extracted library.
  • Out of scope: prebuilt binary distribution (prebuildify/node-gyp-build), Windows native bridges, ASAR internals beyond asarUnpack.

Inputs: the app's working native integration; a free npm name (npm view <name> → 404 = free); the consumer's Electron version (drives ABI flags).

Workflow

text
[1] Carve the package        addon + scripts verbatim, params for app values
[2] Neutralize npm install   no-op install script, real build = explicit CLI
[3] Runtime loader           null-degrading, path contract for dev/packaged
[4] Rebuild CLI              node-gyp resolved from OWN deps, never npx
[5] Packager fragments       asarUnpack narrow, vendor excluded, sign hook
[6] Release CI as an Action  env-routed inputs, EXIT-trap secrets
[7] Dogfood migration        app consumes the lib; packaged-layout assertion

[1] Carve

Copy the addon source and fetch scripts verbatim (keep their load-bearing comments — they move with the code). Everything app-specific (repo slug, feed URL, tag prefix, arch) becomes a parameter. Remove hardcoded ARCHS from binding.gyp; let node-gyp's --arch drive it. Parameterize in a separate, reviewable step after the verbatim copy.

[2] Neutralize npm install

npm auto-runs node-gyp rebuild for ANY package containing a binding.gyp, against the host Node ABI — the wrong target for Electron, and a build the consumer never asked for. Ship "install": "node -e \"\"" and put the real build behind an explicit CLI command. Do not set gypfile: true at the package root. Document why, prominently — the no-op looks like a bug.

[3] Runtime loader

The loader never throws: non-target-platform → null before any path work; load/shape failure → null + log. Two path contracts, both derived from the package's own import.meta.url:

  • dev: <packageRoot>/native/build/Release/<addon>.node
  • packaged: <resourcesPath>/app.asar.unpacked/node_modules/<pkg>/native/build/Release/<addon>.node

Provide an addonPath override as the escape hatch for exotic layouts. Import electron only lazily inside the one convenience wrapper, so the core stays loadable (and testable) in plain Node.

[4] Rebuild CLI

<pkg> rebuild --electron-version X --arch arm64|x64|universal:

  • node-gyp must be a runtime dependency, and the CLI must spawn its bin script resolved via createRequire(import.meta.url) from the package's own install — npx node-gyp silently network-fetches an unpinned version when the package sits in a consumer's node_modules.
  • node-gyp rebuild = clean → configure → build, and clean is rm -rf build/. Any intermediate stashed for a later step (universal lipo) must live OUTSIDE build/ or the second arch pass destroys it.
  • Electron ABI: --dist-url=https://electronjs.org/headers.
  • Auto-detect the consumer's Electron version from their node_modules when the flag is omitted.

[5] Packager fragments

Export a config-fragment function, not documentation alone. The traps:

  • electron-builder packs the ENTIRE production dependency. The vendored framework (fetched by your build) gets a useless second copy inside app.asar unless excluded: files: ["!**/node_modules/<pkg>/native/vendor/**"].
  • asarUnpack must be narrow: **/node_modules/<pkg>/native/build/Release/*.node, not native/build/** (which unpacks Makefiles and object files).
  • macOS rpath depth is layout-relative. An @loader_path/../../…/Frameworks entry copied from the app counts from the addon's OLD location; inside node_modules/<pkg>/native/build/Release the addon sits deeper — recount to Contents/Frameworks (8 ups for this layout) and verify with otool -l <addon>.node | grep -A2 LC_RPATH. Electron's own @executable_path/../Frameworks LC_RPATH can mask a dead entry — the framework loading is not proof your rpath is right.
  • Ship the afterPack ad-hoc signing hook as an export; consumers wrap it in a 3-line file (electron-builder takes a file path). Sign once before dmg and zip are packaged so both embed a valid CodeDirectory.
  • prepublishOnly: build — dist/ is gitignored; without the guard a clean checkout publishes a tarball with no JS and npm omits the dir silently.
  • require() of your ESM package from a consumer's .cjs hook needs Node ≥ 20.19 / ≥ 22.12 — set engines to match what your samples assume.

[6] Release CI as a composite Action

  • Composite inputs.*.default cannot reference other inputs — derive composed defaults inside the step body with ${VAR:-default}.
  • Never interpolate ${{ inputs.* }} inside run: bodies (script-injection surface). Route every input through the step's env: block, reference as "$VAR".
  • Secrets that touch disk (signing keys): RAM disk + trap cleanup EXIT with || true guards INSIDE the trap only — set -e skips inline cleanup when the signing tool fails mid-step.
  • An action step that runs npx <pkg> executes at the caller's workspace ROOT. In a pnpm workspace the bin only exists in the subpackage's node_modules/.bin, so npx silently falls back to a registry fetch of an unpinned version. Caller-side fix: add the package to ROOT devDependencies.
  • Pin external tool downloads by version + sha256, verified before extract.

[7] Dogfood migration

Switch the source app to the library and delete the local copy. The one assertion that cannot be skipped: run the app's REAL packaging and inspect the artifact — pnpm's symlinked node_modules is a layout the loader contract never saw in the lib's own repo:

  1. addon at app.asar.unpacked/node_modules/<pkg>/native/build/Release/
  2. framework at Contents/Frameworks/, a real directory
  3. codesign --verify --deep --strict passes
  4. npx asar list app.asar | grep vendor comes back empty

If 1 fails, the addonPath override is the fix — record the observed layout. Keep behavior parity explicit: tag prefixes, throttle values, notification text, and placeholder-injection anchors must survive the migration byte-for-byte (grep the old constants against the new wiring).

Common pitfalls

SymptomCauseFix
Install builds the addon against the wrong ABI, wastes minutesnpm auto-runs node-gyp for any package with binding.gypno-op install script; explicit rebuild CLI owns the real build
Consumer's rebuild fetches node-gyp from the registry, or fails offlinenode-gyp in devDependencies + npx node-gypmove to dependencies; spawn its bin via createRequire resolution
--arch universal always fails at lipointermediate stored under build/; second arch pass's clean removes itstash intermediates outside build/
Framework loads in the packaged app but the rpath entry is deadups-count copied from the app's shallower addon location; Electron's own LC_RPATH masks itrecount ups for the node_modules layout; verify with otool -l
Consumer's app.asar carries a full copy of the vendored frameworkelectron-builder packs the whole dependencyfiles exclusion for native/vendor/**
Published tarball has no dist/dist gitignored; npm omits missing dirs silentlyprepublishOnly build script
afterPack wrapper throws ERR_REQUIRE_ESM on some Node 20.xrequire(esm) unflagged only ≥ 20.19engines.node >= 20.19, noted beside the sample
Action step executes an unpinned registry version of your CLInpx at workspace root can't see the subpackage binpackage in caller's ROOT devDependencies
Signing key survives on the runner after a failed releaseset -e aborts before inline scrubtrap cleanup EXIT, || true only inside the trap
Old delta-base archives re-uploaded as the new release's assetsglobbing the archive dir after delta bases were fetched into itrecord own artifact names BEFORE fetching bases; publish only those
Version comparison treats every release as newer after migrationtag prefix not threaded into the generalized compareprefix is a required parameter; grep every call site
Appcast items 404 after a delta rebuildgenerator stamps ALL items with the current run's download URLre-point old enclosures to their own tags (URLs are not signed; safe)

Rules

  • Extraction is verbatim-first: byte-identical copies, then parameterize in a separate reviewable step.
  • The library never throws where the app can degrade — null contracts on every load path.
  • One source of truth per pinned value (framework version, placeholder string): shell script or exported constant, never both.
  • Real-artifact verification beats unit tests for packaging claims: otool, codesign, asar list, file-exists on the actual .app.

Verification

  • npm pack --dry-run from a CLEAN clone lists dist/, bin/, native sources, scripts — nothing more, nothing missing.
  • Rebuild CLI produces the addon end-to-end on the target Electron version; otool -l shows the recounted rpath entry.
  • Consumer-side packaging assertions 1–4 (step [7]) all pass on the real .app artifact.
  • Action YAML: no ${{ inputs.* }} inside any run: body; secret cleanup runs on the failure path.
  • Behavior-parity greps: old constants (URLs, prefixes, notification strings) resolve to identical values in the new wiring.

Συχνές ερωτήσεις

Τι κάνει η δεξιότητα AI Electron Native Lib Extraction;

Χρησιμοποιήστε το όταν αποσπάτε μια ενσωμάτωση εγγενούς module Electron μέσα στην εφαρμογή (πρόσθετο N-API + scripts build + ρυθμίσεις packaging + CI έκδοσης) σε μια αυτόνομη βιβλιοθήκη npm που διανέμεται μαζί με τον πηγαίο κώδικα — ή όταν δημιουργείτε μια τέτοια βιβλιοθήκη από την αρχή. Καλύπτει τις παγίδες ABI και install script, τη σημασιολογία rebuild του node-gyp, το βάθος rpath στο macOS, τις εξαιρέσεις packaging του electron-builder, τις καλές πρακτικές για σύνθετα GitHub Actions και τη μεταφορά της ενσωμάτωσης πίσω στην εφαρμογή-πηγή για dogfooding.

Γιατί να χρησιμοποιήσετε τη δεξιότητα Electron Native Lib Extraction στο TypingMind;

Επειδή την εγκαθιστάτε μία φορά και τη χρησιμοποιείτε με οποιοδήποτε μοντέλο. Η Electron Native Lib Extraction είναι απλό Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως η ίδια δεξιότητα λειτουργεί με GPT-5, Claude, Gemini, Grok ή ένα τοπικό μοντέλο — και μπορείτε να αλλάξετε μοντέλο κατά τη διάρκεια της συνομιλίας χωρίς να διακοπεί η λειτουργία της. Το TypingMind λειτουργεί με τα δικά σας κλειδιά API, οπότε πληρώνετε απευθείας τους παρόχους αντί για συνδρομή ανά θέση χρήστη, ενώ οι δεξιότητες και οι συνομιλίες σας παραμένουν στον δικό σας χώρο αποθήκευσης.

Πώς εγκαθιστώ τη δεξιότητα Electron Native Lib Extraction στο TypingMind;

Στο TypingMind, ανοίξτε Πρόσθετα → Δεξιότητες → Εγκατάσταση από το GitHub και επικολλήστε τη διεύθυνση https://github.com/Innei/SKILL/tree/main/skills/infrastructure/electron-native-lib-extraction. Το TypingMind διαβάζει το αρχείο SKILL.md και εγκαθιστά τη δεξιότητα, την οποία μπορείτε να ενεργοποιείτε ανά συνομιλία.

Ποια μοντέλα AI μπορούν να χρησιμοποιήσουν τη δεξιότητα Electron Native Lib Extraction;

Οποιοδήποτε μοντέλο συνδέετε στο TypingMind. Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως τα GPT, Claude, Gemini, Grok και τα τοπικά μοντέλα μπορούν όλα να φορτώσουν αυτή τη δεξιότητα όταν ένα αίτημα αντιστοιχεί σε αυτή.

Με πόσα μοντέλα AI μπορώ να χρησιμοποιήσω τη δεξιότητα Electron Native Lib Extraction;

Με όσα θέλετε. Στο TypingMind μπορείτε να χρησιμοποιήσετε τη δεξιότητα Electron Native Lib Extraction με οποιοδήποτε μοντέλο υποστηρίζει δεξιότητες, όπως τα GPT, Claude, Gemini, Grok, DeepSeek, Mistral και Llama, χρησιμοποιώντας τα δικά σας κλειδιά API.

Είναι δωρεάν η δεξιότητα AI Electron Native Lib Extraction;

Δημοσιεύεται στο GitHub από τον λογαριασμό Innei. Ελέγξτε το αποθετήριο για τους όρους αδειοδότησης. Πληρώνετε μόνο τον δικό σας πάροχο AI για τα token που χρησιμοποιείτε.

Τι είναι οι δεξιότητες AI;

Μια δεξιότητα AI είναι ένα επαναχρησιμοποιήσιμο πακέτο οδηγιών που διδάσκει σε ένα μοντέλο AI πώς να εκτελεί μια συγκεκριμένη εργασία. Ακολουθεί την ανοιχτή μορφή Agent Skills: ένα αρχείο SKILL.md με όνομα και περιγραφή, μαζί με τυχόν σενάρια κώδικα, πρότυπα ή αρχεία αναφοράς που μπορεί να χρειαστεί το μοντέλο. Το μοντέλο διαβάζει τις οδηγίες μόνο όταν το αίτημά σας αντιστοιχεί στη δεξιότητα, οπότε μια εγκατεστημένη δεξιότητα δεν κοστίζει τίποτα μέχρι να χρησιμοποιηθεί.

Σε τι διαφέρουν οι δεξιότητες AI από τα πρόσθετα ή τους συνδέσμους MCP;

Ένα πρόσθετο ή ένας σύνδεσμος MCP παρέχει στο μοντέλο νέα εργαλεία που μπορεί να καλέσει — κώδικα που εκτελείται κάπου και επιστρέφει ένα αποτέλεσμα. Μια δεξιότητα AI παρέχει αντί γι’ αυτό γνώσεις και διαδικασίες στο μοντέλο: πώς να προσεγγίσει μια εργασία, ποια βήματα να ακολουθήσει και ποια χαρακτηριστικά έχει ένα καλό αποτέλεσμα. Οι δεξιότητες είναι απλό Markdown, επομένως δεν χρειάζονται διακομιστή, κλειδί API ή περιβάλλον εκτέλεσης και λειτουργούν με οποιοδήποτε μοντέλο.

Προβολή όλων

Δημιουργήστε τώρα τον δικό σας χώρο εργασίας AI

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇