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.8.0/lodash.src.js" title="<a href=\"https://lodash.com/\">lodash</a> <span>v3.8.0</span>" hash="github"
node ../docdown/bin/docdown ./lodash.src.js ./doc/README.md toc="categories" url="https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js" title="<a href=\"https://lodash.com/\">lodash</a> <span>v3.8.0</span>" hash="default"
node ../lodash-cli/bin/lodash modularize modern exports=es -o ./
node ../lodash-cli/bin/lodash modularize modern exports=amd -o ./modern && node ../lodash-cli/bin/lodash modern 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 modern exports=node -o ./modern && node ../lodash-cli/bin/lodash modern 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 modern exports=node -o ./ && node ../lodash-cli/bin/lodash modern -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,
spawn = childProcess.spawn;
var reString = /(["'])(?:(?!\1)[^\n\\]|\\.)*?\1/g;
var git = spawn('git', ['log', 'npm-packages', '--pretty=format:"%s | %h"']);
git.stdout.on('data', function(data) {
var commands = _.map(data.toString().match(reString), function(value) {
var parts = _.map(_.trim(value, '"\'').split('|'), _.trim);
parts[0] = _.result(/\d+(?:\.\d+)*/.exec(parts[0]), 0, '');
return 'git tag -f -a -m ' + parts[0] + '-npm-packages "' + parts[0] + '-npm-packages" ' + parts[1];
});
_.eachRight(commands, function(command) {
console.log(command);
execSync(command);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment