Skip to content

Instantly share code, notes, and snippets.

@jdalton
Last active July 3, 2024 02:00
Show Gist options
  • Save jdalton/938ea49ab3919f1c046c to your computer and use it in GitHub Desktop.
Save jdalton/938ea49ab3919f1c046c to your computer and use it in GitHub Desktop.
node ../lodash-cli/bin/lodash modularize modern exports=amd -o ./ && node ../lodash-cli/bin/lodash modern exports=amd -d -o ./main.js
node ../lodash-cli/bin/lodash modularize compat exports=amd -o ./ && node ../lodash-cli/bin/lodash compat exports=amd -d -o ./main.js
node ../docdown/bin/docdown ./lodash.src.js ./doc/README.md toc="categories" url="https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js" title="<a href=\"https://lodash.com/\">lodash</a> <span>v3.10.1</span>" hash="github"
node ../docdown/bin/docdown ./lodash.src.js ./doc/README.md toc="categories" url="https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js" title="<a href=\"https://lodash.com/\">lodash</a> <span>v3.10.1</span>" hash="default"
node ../lodash-cli/bin/lodash modularize modern exports=es -o ./
node ../lodash-cli/bin/lodash modularize exports=amd -o ./modern && node ../lodash-cli/bin/lodash exports=amd -d -o ./modern/main.js
node ../lodash-cli/bin/lodash modularize compat exports=amd -o ./compat && node ../lodash-cli/bin/lodash compat exports=amd -d -o ./compat/main.js
node ../lodash-cli/bin/lodash modern -o ./lodash.js
node ../lodash-cli/bin/lodash compat -o ./lodash.js
node ../lodash-cli/bin/lodash modularize exports=node -o ./modern && node ../lodash-cli/bin/lodash exports=node -d -o ./modern/index.js
node ../lodash-cli/bin/lodash modularize compat exports=node -o ./compat && node ../lodash-cli/bin/lodash compat exports=node -d -o ./compat/index.js
node ../lodash-cli/bin/lodash modern modularize exports=npm -o ./
node ../lodash-cli/bin/lodash modularize exports=node -o ./ && node ../lodash-cli/bin/lodash -d -o ./index.js
node ../lodash-cli/bin/lodash modularize compat exports=node -o ./ && node ../lodash-cli/bin/lodash compat -d -o ./index.js
'use strict';
var util = require('./lib/util.js'),
fs = util.fs,
path = util.path;
var _ = require('lodash-compat'),
glob = require('glob'),
moment = require('moment'),
ncp = require('ncp').ncp;
var cwd = process.cwd();
var packages = _.transform(glob.sync(path.join(cwd, 'lodash.*')), function(result, pathname) {
var stat = fs.statSync(path.join(pathname, 'index.js'));
if (!moment(stat.mtime).isSame(stat.birthtime)) {
result[path.basename(pathname)] = require(path.join(pathname, 'package.json'));
}
}, {});
var grouped = _.groupBy(packages, 'version');
_.forOwn(grouped, function(packages, version) {
var pathname = path.join(cwd, version);
if (!fs.existsSync(pathname)) {
fs.mkdirpSync(pathname);
}
_.each(packages, function(pkg) {
var source = path.join(cwd, pkg.name),
destination = path.join(pathname, pkg.name);
ncp(source, destination, function (err) {
if (err) {
console.error(err);
return;
}
// console.log('copied ' + pkg.name + ' to ' + path.join(version, pkg.name));
});
});
});
'use strict';
var _ = require('lodash-compat'),
childProcess = require('child_process'),
execSync = childProcess.execSync,
semver = require('semver'),
spawn = childProcess.spawn;
var branch = 'npm-packages';
var reLine = /^.*$/gm;
var output = execSync('git log ' + branch + ' --pretty=format:"%s | %h"').toString();
var pairs = _.map(output.match(reLine), function(value) {
var pair = _.map(_.trim(value, '"\'').split('|'), _.trim);
pair[0] = _.result(/\d+(?:\.\d+)*/.exec(pair[0]), 0, '');
return pair;
});
pairs = _.filter(pairs, '0');
pairs.sort(function(a, b) {
return semver.gt(a[0], b[0]) ? 1 : (semver.lt(a[0], b[0]) ? -1 : 0);
});
pairs = pairs.map(function(pair) {
var tag = pair[0] + (branch == 'master' ? '' : '-' + branch);
return [
//'git checkout ' + parts[0] + '-npm-packages && git commit --amend --no-edit --date "`date`"'//,
'git tag -f -a -m ' + tag + ' "' + tag + '" ' + pair[1],
'git push -f origin ' + tag
];
});
_.each(pairs, function(pair, index) {
_.each(pair, function(command) {
_.delay(function() {
console.log(command)
execSync(command);
}, 1000 * index);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment