Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
# OSX
.DS_Store

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
.cache

# Build artifacts.
npm-debug.log
dist/tests.js*
artifacts/*
coverage/*
# The files to be included in the npm package are listed in the package.json file,
# in the `files` property (See https://docs.npmjs.com/files/package.json#files).
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"version": "3.2.0",
"description": "A command line tool to help build, run, and test web extensions",
"main": "dist/web-ext.js",
"files": [
"CODE_OF_CONDUCT.md",
"dist/*.js",
"src/**"
],
"engines": {
"node": ">=10.0.0",
"npm": ">=5.6.0"
Expand Down
10 changes: 0 additions & 10 deletions scripts/lib/config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
module.exports = {
clean: ['dist/*'],
copy: {
productionModeAssets: {
src: [
'package.json',
'package-lock.json',
'dist/**',
'bin/**',
],
},
},
watch: {
files: [
'package.json',
Expand Down
11 changes: 8 additions & 3 deletions scripts/test-functional
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ const path = require('path');
const shell = require('shelljs');
const tmp = require('tmp');

const config = require('./lib/config');
const pkg = require('../package.json');
const {mochaFunctional} = require('./lib/mocha');

shell.set('-e');

const packageFileName = `${pkg.name}-${pkg.version}.tgz`;
const testProductionMode = process.env.TEST_PRODUCTION_MODE === '1';
const testLegacyBundling = process.env.TEST_LEGACY_BUNDLING === '1';

Expand All @@ -23,6 +24,7 @@ shell.exec('npm run build', testProductionMode ? {
} : {});

if (testProductionMode) {
const srcDir = process.cwd();
const destDir = tmp.tmpNameSync();
const packageDir = tmp.tmpNameSync();
const npmInstallOptions = ['--production'];
Expand All @@ -42,9 +44,12 @@ if (testProductionMode) {
shell.echo('\nPreparing web-ext production mode environment...\n');
shell.rm('-rf', destDir, packageDir);
shell.mkdir('-p', destDir, packageDir);
shell.cp('-rf', config.copy.productionModeAssets.src, packageDir);
shell.pushd(packageDir);
shell.exec(`npm pack ${srcDir}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If srcDir contains a space, then this may fail unexpectedly.

shell.popd();
shell.pushd(destDir);
shell.exec(`npm install ${npmInstallOptions.join(' ')} ${packageDir}`);
const pkgPath = path.join(packageDir, packageFileName);
shell.exec(`npm install ${npmInstallOptions.join(' ')} ${pkgPath}`);
shell.popd();
shell.echo('\nProduction mode environment successfully created.\n');
}
Expand Down