Skip to content

Commit

Permalink
feat: Output ZIP files instead of XPI files
Browse files Browse the repository at this point in the history
  • Loading branch information
tofumatt committed Jun 29, 2016
1 parent 830065b commit 07ff822
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/cmd/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ function defaultPackageCreator(
filter: (...args) => fileFilter.wantFile(...args),
})
.then((buffer) => {
let extension = 'zip';
let packageName = safeFileName(
`${manifestData.name}-${manifestData.version}.xpi`);
`${manifestData.name}-${manifestData.version}.${extension}`);
let extensionPath = path.join(artifactsDir, packageName);
let stream = createWriteStream(extensionPath);
let promisedStream = streamToPromise(stream);
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions tests/test-cmd/test.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('build', () => {
})
.then((buildResult) => {
assert.match(buildResult.extensionPath,
/minimal_extension-1\.0\.xpi$/);
/minimal_extension-1\.0\.zip$/);
return buildResult.extensionPath;
})
.then((extensionPath) => zipFile.open(extensionPath))
Expand Down Expand Up @@ -62,12 +62,12 @@ describe('build', () => {
})
.then((buildResult) => {
assert.match(buildResult.extensionPath,
/the_extension-0\.0\.1\.xpi$/);
/the_extension-0\.0\.1\.zip$/);
return buildResult.extensionPath;
})
));

it('asks FileFilter what files to include in the XPI', () => {
it('asks FileFilter what files to include in the ZIP', () => {
let zipFile = new ZipFile();
let fileFilter = new FileFilter({
filesToIgnore: ['**/background-script.js'],
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('build', () => {
{manifestData: basicManifest, onSourceChange, fileFilter})
.then((buildResult) => {
// Make sure we still have a build result.
assert.match(buildResult.extensionPath, /\.xpi$/);
assert.match(buildResult.extensionPath, /\.zip$/);
return buildResult;
})
.then((buildResult) => {
Expand All @@ -122,7 +122,7 @@ describe('build', () => {
.then(() => args.onChange());
})
.then((buildResult) => {
assert.match(buildResult.extensionPath, /\.xpi$/);
assert.match(buildResult.extensionPath, /\.zip$/);
return fs.stat(buildResult.extensionPath);
})
.then((stat) => {
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('build', () => {
assert.equal(filter.wantFile('some.xpi'), true);
assert.equal(filter.wantFile('manifest.json'), false);
});

it('ignores node_modules by default', () => {
assert.equal(defaultFilter.wantFile('path/to/node_modules'), false);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cmd/test.sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('sign', () => {
// Do a sanity check that a built extension was passed to the
// signer.
assert.include(stubs.signAddon.firstCall.args[0].xpiPath,
'minimal_extension-1.0.xpi');
'minimal_extension-1.0.zip');
});
}
));
Expand Down
8 changes: 4 additions & 4 deletions tests/test-firefox/test.firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe('firefox', () => {
return withTempDir(
(tmpDir) => {
let data = {
extensionPath: fixturePath('minimal_extension-1.0.xpi'),
extensionPath: fixturePath('minimal_extension-1.0.zip'),
profile: undefined,
profileDir: path.join(tmpDir.path(), 'profile'),
};
Expand Down Expand Up @@ -411,19 +411,19 @@ describe('firefox', () => {

it('requires a directory path for proxy installs', () => setUp(
(data) => {
const xpiPath = fixturePath('minimal_extension-1.0.xpi');
const extensionPath = fixturePath('minimal_extension-1.0.zip');
return firefox.installExtension(
{
manifestData: basicManifest,
profile: data.profile,
extensionPath: xpiPath,
extensionPath: extensionPath,
asProxy: true,
})
.then(makeSureItFails())
.catch(onlyInstancesOf(WebExtError, (error) => {
assert.match(error.message,
/must be the extension source directory/);
assert.include(error.message, xpiPath);
assert.include(error.message, extensionPath);
}));
}
));
Expand Down

0 comments on commit 07ff822

Please sign in to comment.