Skip to content

Commit

Permalink
[semver-major] completely remove sl-blip
Browse files Browse the repository at this point in the history
  • Loading branch information
rmg committed Jan 30, 2017
1 parent a15fb82 commit c632475
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 244 deletions.
4 changes: 1 addition & 3 deletions README.md
Expand Up @@ -140,15 +140,13 @@ Usage: slt version <CMD> [ARGS]
Commands:
inc [PKG...] Increment version of specified packages
inc [VER...] Increment versions, printing new versions to stdout
set VER [PKG] Set version in PKG, also update sl-blip dep if present
set VER [PKG] Set version in PKG
help Display this usage
```

Currently the only practical `slt version` command is `set`, which operates
similar to `npm version` with the following major differences:
* does **not** commit any changes or create any tags
* updates `sl-blip` dependency URL if, and only if, sl-blip is already
listed in `optionalDependencies`.

#### slt info

Expand Down
3 changes: 0 additions & 3 deletions bin/slt-release.sh
Expand Up @@ -125,9 +125,6 @@ echo "Updating package version to $V"
slt version set "$V"

echo "Committing package and CHANGES for v$V"
if [ -e .sl-blip.js ]; then
git add .sl-blip.js
fi
TO_ADD="$(git ls-files bower.json) package.json CHANGES.md"
TO_REMOVE=""
if [ -e npm-shrinkwrap.json ]; then
Expand Down
30 changes: 0 additions & 30 deletions lib/blip.js

This file was deleted.

56 changes: 0 additions & 56 deletions lib/project.js
Expand Up @@ -11,10 +11,6 @@ var git = require('gift');
var normalizePackageData = require('normalize-package-data');
var path = require('path');

var BLIP_SCRIPT = 'node .sl-blip.js || exit 0';
var BLIP_SCRIPT_RX = /node \.sl-blip\.js/;
var BLIP_SRC_PATH = require.resolve('./blip.js');

module.exports = Project;

Project.prototype = {
Expand All @@ -27,8 +23,6 @@ Project.prototype = {
persist: Project$persist,
optionalDep: getterSetterFor('optionalDependencies'),
script: getterSetterFor('scripts'),
hasBlip: Project$hasBlip,
updateBlip: Project$updateBlip,
get: Project$get,
};

Expand Down Expand Up @@ -150,10 +144,6 @@ function Project$nameVer() {
}

function Project$persist() {
if (this.hasBlip()) {
this.updateBlip();
}

var newJSON = JSON.stringify(this.rawPkgJSON, null, 2) + '\n';
fs.writeFileSync(this.pkgJSONPath, newJSON);

Expand All @@ -164,52 +154,6 @@ function Project$persist() {
}
}

function Project$hasBlip() {
return this.optionalDep('sl-blip') ||
BLIP_SCRIPT_RX.test(this.script('preinstall')) ||
BLIP_SCRIPT_RX.test(this.script('install')) ||
BLIP_SCRIPT_RX.test(this.script('postinstall'));
}

function Project$updateBlip() {
// Always write out the file, replacing previous versions if set.
var blip = fs.readFileSync(BLIP_SRC_PATH, 'utf8');
var dstPath = path.resolve(this.rootPath, '.sl-blip.js');
blip = blip.split('\n').filter(function(l) {
return /^\/\/ /.test(l);
}).join('\n');
fs.writeFileSync(dstPath, blip);

// remove from optionalDependencies if present
this.optionalDep('sl-blip', false);

// it is still detected, but not in optionalDependencies, make sure it is
// using the latest form.
if (this.hasBlip()) {
if (BLIP_SCRIPT_RX.test(this.script('preinstall'))) {
return this.script('preinstall', BLIP_SCRIPT);
}
if (BLIP_SCRIPT_RX.test(this.script('postinstall'))) {
return this.script('postinstall', BLIP_SCRIPT);
}
if (BLIP_SCRIPT_RX.test(this.script('install'))) {
return this.script('install', BLIP_SCRIPT);
}
}

// find the first empty *install script and use it
if (!this.script('preinstall')) {
return this.script('preinstall', BLIP_SCRIPT);
}
if (!this.script('postinstall')) {
return this.script('postinstall', BLIP_SCRIPT);
}
if (!this.script('install')) {
return this.script('install', BLIP_SCRIPT);
}
throw new Error('unable to find suitable script for sl-blip');
}

function normalize(raw, warn, strict) {
var copy = JSON.parse(JSON.stringify(raw));
normalizePackageData(copy, warn, strict);
Expand Down
2 changes: 1 addition & 1 deletion lib/version.js
Expand Up @@ -25,7 +25,7 @@ function usage($0, p) {
p('Commands:');
p(' inc [PKG...] Increment version of specified packages');
p(' inc [VER...] Increment versions, printing new versions to stdout');
p(' set VER [PKG] Set version in PKG, also update sl-blip dep if present');
p(' set VER [PKG] Set version in PKG');
p(' help Display this usage');
p('');
}
Expand Down
151 changes: 0 additions & 151 deletions test/test-version-blip.js

This file was deleted.

0 comments on commit c632475

Please sign in to comment.