Comments (8)
Hey @kingio,
I'm sorry to read you have some hard time making it work. Let's try to fix this together 🙂
I see you try to load the content of the ./build
directory. Is it the one which contains your extension manifest.json
file? Or is it the location you want to store the compiled extension to?
If you aim load()
at the directory which contains your extension, it should work.
generateUpdateXML
can be called only after load
happened so it has to be somewhere in the chain of promises. It is not the source of your problem I suppose.
If the source code of your extension is on GitHub and the pointers I just wrote did not help, feel free to share your repo so as we can have a look at it.
from crx.
Yes, manifest was inside build
directory.
I ended hardcoding the public key in your code to build the crx.
from crx.
archive
.glob(selfie.src, {
cwd: selfie.path,
matchBase: true,
ignore: ['node_modules/**', '*.pem', '.git', '*.crx']
})
.finalize();
maybe, ignoring the folder will resolve it. (node_modules/**)
from crx.
@kingio me too, same problem.
debugging with vscode, I found program abort at this line:
https://github.com/oncletom/crx/blob/master/src/crx.js#L96
load: function (path) {
var selfie = this;
return resolve(path || selfie.rootDirectory)
.then(function(metadata){
selfie.path = metadata.path;
selfie.src = metadata.src;
selfie.manifest = require(join(selfie.path, "manifest.json"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I tried this tiny script: ( ./dist/chrome/manifest.json
existed.)
const manifest = require(path.join('./dist/chrome/', 'manifest.json'))
this result:
module.js:538
throw err;
^
Error: Cannot find module 'dist\chrome\manifest.json'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
...
but const manifest = require('./dist/chrome/manifest.json')
works correctly (success to json read).
from crx.
I think this problem re-produce only at windows platform.
from crx.
path.join('./dist/chrome/', 'manifest.json')
on windows generates dist\chrome\manifest.json
.
->
const manifest = require('./dist/chrome/manifest.json')
successed,
<>
const manifest = require('dist\\chrome\\manifest.json')
failed.
this may be node.js require() bug on windows platform.
from crx.
This works on Windows10 Pro 64bit, node.js v8.9.1
function monkeyPatchedResolve (path) {
return new Promise(function (resolve, reject) {
return resolve({
path: path,
src: '**'
})
})
}
crx.load = (path) => {
var selfie = crx
return monkeyPatchedResolve(path || selfie.rootDirectory)
.then(function (metadata) {
selfie.path = metadata.path
selfie.src = metadata.src
selfie.manifest = require(selfie.path + '/manifest.json')
selfie.loaded = true
return selfie
})
}
crx.load('./dist/chrome') // WARNING : './' NEEDED !!
.then(() => {
return crx.loadContents()
})
.then((zipBuffer) => {
fs.writeFile(`build/my-ext.chrome.zip`)
return crx.pack(zipBuffer)
})
.then(crxBuffer => {
const updateXML = crx.generateUpdateXML()
fs.writeFile(`build/chrome-update.xml`, updateXML)
fs.writeFile(`build/my-ext.crx`, crxBuffer)
console.log('chrome packaging done.')
})
Good Luck !!
from crx.
Sorry for being late in the game.
I have setup a Windows build in the PR #76. But I struggle to reproduce the problem on any version of Node on Windows. Could it be related to the version of Windows too? We can build on Windows Server 2012 R2
or Windows Server 2016
.
Let me know, I'd be happy to see this one fixed.
from crx.
Related Issues (20)
- Do not write PEM inside extension's directory
- CRX3 inconsistent extension URL HOT 3
- Chrome 75.x: Package is invalid: 'CRX_REQUIRED_PROOF_MISSING' HOT 14
- Upgrade vulnerable lodash (again) HOT 1
- cli: crx command not found HOT 2
- how solveing to Callback must be a function ? HOT 3
- I have a problem. The generated file is incomplete HOT 2
- Why are the hash of crx files different using the same private key HOT 1
- use crx pack failed HOT 1
- Is there any plan to support rollup plugins ? HOT 1
- Reduce CRX size by setting zlib compression level HOT 1
- Some extensions need to include .crx files HOT 1
- Pack an extension without .pem key. HOT 1
- Calculate ID from path HOT 4
- Incorrect id calculation based on path HOT 10
- TypeScript HOT 4
- API for public PKCS PEM string HOT 7
- Lodash Security Vulnerability HOT 2
- Packed & signed .crx does not work in Chrome HOT 29
- Allow supplying our own `fs` HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crx.