зеркало из https://github.com/mozilla/web-ext.git
chore: npm release should only include production assets (#1794)
* chore: Excluded non-production assets from released npm package * test: Use npm-pack for running functional test on npm package installed as in production mode
This commit is contained in:
Родитель
e3aa788c09
Коммит
a0777ebbc3
14
.npmignore
14
.npmignore
|
@ -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).
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
module.exports = {
|
||||
clean: ['dist/*'],
|
||||
copy: {
|
||||
productionModeAssets: {
|
||||
src: [
|
||||
'package.json',
|
||||
'package-lock.json',
|
||||
'dist/**',
|
||||
'bin/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
files: [
|
||||
'package.json',
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
@ -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'];
|
||||
|
@ -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}`);
|
||||
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');
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче