mirror of
https://github.com/appium/appium.git
synced 2026-02-22 19:29:49 -06:00
chore: get rid of shrinkwrap and related functionality
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '12.x'
|
||||
- script: npm install
|
||||
displayName: NPM install
|
||||
- script: |
|
||||
git remote add triager https://triager:$GITHUB_TOKEN@github.com/appium/appium
|
||||
git checkout -b $MINOR_BRANCH_NAME
|
||||
git status
|
||||
node ./ci-jobs/scripts/set-package-json-version
|
||||
rm -rf package-lock.json
|
||||
npm shrinkwrap
|
||||
git add .
|
||||
git commit -n -m "Set version to $(MINOR_BRANCH_NAME).0-rc.0"
|
||||
git push -u triager $MINOR_BRANCH_NAME
|
||||
displayName: Create branch
|
||||
env:
|
||||
GITHUB_TOKEN: $(GITHUB_TOKEN)
|
||||
MINOR_BRANCH_NAME: $(MINOR_BRANCH_NAME)
|
||||
- script: |
|
||||
git tag $MINOR_BRANCH_NAME.0-rc.0
|
||||
git push --tags -u triager
|
||||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
|
||||
npm publish --tag $(node ./ci-jobs/scripts/parse-tag)
|
||||
env:
|
||||
NPM_TOKEN: $(NPM_TOKEN)
|
||||
displayName: Tag and Publish
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '12.x'
|
||||
- script: npm ci || npm install # "npm ci" if shrinkwrap is present
|
||||
- script: npm install
|
||||
displayName: Install NPM Dependencies
|
||||
- script: npm run build
|
||||
displayName: npm run build
|
||||
|
||||
@@ -5,7 +5,6 @@ const res = JSON.parse(childProcess.execSync('npm pack --dry-run --json --ignore
|
||||
|
||||
// List of files we are testing to make sure they are included in package
|
||||
const testFiles = [
|
||||
'npm-shrinkwrap.json', // Check that npm-shrinkwrap.json is being packed
|
||||
'LICENSE', // Check that license is included
|
||||
'build/lib/appium.js', // Sanity check that build files are being included by testing just one file
|
||||
];
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
const _ = require('lodash');
|
||||
const { asyncify } = require('asyncbox');
|
||||
const { fs, logger } = require('@appium/support');
|
||||
const path = require('path');
|
||||
|
||||
const log = new logger.getLogger('ShrinkwrapValidator');
|
||||
|
||||
async function main () {
|
||||
const shrinkwrapPath = path.resolve('npm-shrinkwrap.json');
|
||||
if (!(await fs.exists(shrinkwrapPath))) {
|
||||
log.info('No shrinkwrap found. Skipping shrinkwrap check');
|
||||
return;
|
||||
}
|
||||
const shrinkwrap = JSON.parse(await fs.readFile(shrinkwrapPath));
|
||||
const backupShrinkwrap = JSON.parse(await fs.readFile(path.resolve('npm-shrinkwrap-backup.json')));
|
||||
log.info('Checking that pruned shrinkwrap is a subset of primary shrinkwrap');
|
||||
if (!_.isMatch(backupShrinkwrap, shrinkwrap)) {
|
||||
log.errorAndThrow('Pruned shrinkwrap (shrinkwrap with dev dependencies removed) is not a subset of the original npm-shrinkwrap.json');
|
||||
}
|
||||
log.info('Shrinkwrap check passed');
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
asyncify(main);
|
||||
}
|
||||
@@ -14,28 +14,6 @@ const log = require('fancy-log');
|
||||
|
||||
gulp.task('copy-fixtures', () => gulp.src('./test/fixtures/*').pipe(gulp.dest('./build/test/fixtures/')));
|
||||
|
||||
// remove 'fsevents' from shrinkwrap, since it causes errors on non-Mac hosts
|
||||
// see https://github.com/npm/npm/issues/2679
|
||||
|
||||
gulp.task('fixShrinkwrap', function fixShrinkwrap (done) {
|
||||
let shrinkwrap;
|
||||
try {
|
||||
shrinkwrap = require('./npm-shrinkwrap.json');
|
||||
} catch (err) {
|
||||
log.error('Could not find shrinkwrap; skipping fixing shrinkwrap. ' +
|
||||
`(Original error: ${err.message})`);
|
||||
return done();
|
||||
}
|
||||
|
||||
if (!(shrinkwrap.dependencies || {}).fsevents) {
|
||||
return done();
|
||||
}
|
||||
|
||||
delete shrinkwrap.dependencies.fsevents;
|
||||
const shrinkwrapString = JSON.stringify(shrinkwrap, null, ' ') + '\n';
|
||||
fs.writeFile('./npm-shrinkwrap.json', shrinkwrapString, done);
|
||||
});
|
||||
|
||||
boilerplate({
|
||||
build: 'appium',
|
||||
files: [
|
||||
|
||||
@@ -32,20 +32,12 @@
|
||||
"bin",
|
||||
"lib",
|
||||
"build/lib",
|
||||
"npm-shrinkwrap.json",
|
||||
"postinstall.js"
|
||||
],
|
||||
"scripts": {
|
||||
"generate-docs": "gulp transpile && node ./build/commands-yml/parse.js",
|
||||
"postinstall": "node ./postinstall.js",
|
||||
"install-fake-driver": "node . driver install --source=local ../fake-driver",
|
||||
"prepublishOnly": "npm run shrinkwrap:prune && npm run shrinkwrap:fix",
|
||||
"postpublish": "npm run shrinkwrap:restore",
|
||||
"shrinkwrap:backup": "mv npm-shrinkwrap.json npm-shrinkwrap-backup.json",
|
||||
"shrinkwrap:check-pruned": "node check-pruned-shrinkwrap.js",
|
||||
"shrinkwrap:fix": "gulp fixShrinkwrap",
|
||||
"shrinkwrap:prune": "!(test -e npm-shrinkwrap.json) || (npm ci --production --ignore-scripts && npm run backup-shrinkwrap && npm shrinkwrap)",
|
||||
"shrinkwrap:restore": "(test -e npm-shrinkwrap.json) || (mv npm-shrinkwrap-backup.json npm-shrinkwrap.json)",
|
||||
"upload": "gulp github-upload",
|
||||
"zip": "zip -qr appium.zip .",
|
||||
"zip-and-upload": "npm run zip && npm run upload"
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// these are extra unit tests to ensure that appium is set up correctly for publishing
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
|
||||
const expect = chai.expect;
|
||||
|
||||
describe.skip('shrinkwrap checks', function () {
|
||||
it('shrinkwrap file should exist', function () {
|
||||
require('../../npm-shrinkwrap.json');
|
||||
});
|
||||
|
||||
it('shrinkwrap should not include fsevents', function () {
|
||||
// fsevents is an optional dep that only works on Mac.
|
||||
// if it's in shrinkwrap, non-Mac hosts won't be able to install appium
|
||||
let shrinkwrap = require('../../npm-shrinkwrap.json');
|
||||
expect(shrinkwrap.dependencies, 'no shrinkwrap file found. run `npm shrinkwrap`').to.exist;
|
||||
_.values(shrinkwrap.dependencies).length.should.be.above(10);
|
||||
let message = "'fsevents' entry found in shrinkwrap. It causes problems " +
|
||||
'on non-Mac systems. run `gulp fixShrinkwrap` and try again';
|
||||
expect(shrinkwrap.dependencies.fsevents, message).to.not.exist;
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user