New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(WiP) PR: Gracfully Deprecation of the Package in favor of npm - The Final Commit! #1202
Comments
NotesDocs update all guides need migration consider automation via @stealify/stealify PackageMaintainance Tools should get released in all x.x.x so backporting as old does not work anymore anyway. also deprecation of all it adds no benefits to keep that alive as it is a cli tool and the ssl version of older node does not even connect anymore to any cloudflare site so its save to do this.
Internal FunFactnpx got replaced by the same methods it internal now uses npm exec read more in the npm docs GeneratorsWhen running donejs add DoneJS will
General Translation // Note execSync auto uses process.cwd()
const { execSync: exec } = await import(''node:child_process)
const projectRoot = exec('npm prefix');
const projectModules = exec('npm root');
const globalModules = exec('npm root -g');
// TODO: Should always use local one import('yeoman')
const globalInstalledYo = `${globalModules}/yeoman`
// Utils
const installIfMissing = (specifier) => import(specifier).catch(()=>exec(`npm i -D ${specifier}`)) donejs/donejs/cli add var cmdInit = require('./cmd-init');
var runBinary = require('./run-binary');
var types = ['app', 'plugin', 'generator'];
// `donejs add app [folder]` => `donejs-cli init [folder]`
// `donejs add plugin [folder]` => `donejs-cli init [folder] --type=plugin`
// `donejs add generator [name]` => `donejs-cli init [folder] --type=generator`
// `donejs add <name> [params...]` => `donejs-cli add <name> [params...]`
module.exports = function(type, params, options) {
// handles commands with the following shape `donejs add <type> [folder]`
if (types.indexOf(type) !== -1) {
var folder = params[0];
if (type !== 'app') {
options.type = type;
}
return cmdInit(folder, options);
}
// handles commands with the following shape `donejs add <name> [params...]`
else {
var args = ['add', type].concat(params);
return runBinary(args, options, types);
}
}; ==== // donejs/cli
// `donejs add app [folder]` => `donejs-cli init [folder]`
// `donejs add plugin [folder]` => `donejs-cli init [folder] --type=plugin`
// `donejs add generator [name]` => `donejs-cli init [folder] --type=generator`
// `donejs add <name> [params...]` => `donejs-cli add <name> [params...]`
const add = {
var generators = require(path.join(root, 'node_modules', 'generator-donejs'));
if (generators[name]) {
debug('add called but running generate instead', name, params);
return generate(root, name, params);
}
debug('add', name, params);
return add(path.join(root, 'node_modules'), name, params);
// new
generate(projectModules, 'donejs-' +generatorName, (params && params.length) ? params : ['default'])
// donejs cli util
exports.add = function(root, name, params) {
var generatorName = 'donejs-' + name;
params = (params && params.length) ? params : ['default'];
debug('Adding', generatorName, params);
return generate(root, generatorName, params);
// New
generate(root, 'donejs-' + name, (params && params.length) ? params : ['default'])
};
// Run any of the Yeoman generators from the current generator-donejs
var generate = exports.generate = function(root, generator, args) {
var generatorName = generator.split('@')[0];
return Q.resolve(installIfMissing(root, generator)())
.then(function () {
var generators = require(path.join(root, generatorName));
var env = yeoman.createEnv();
Object.keys(generators).forEach(function(name) {
var fullName = path.join(root, generatorName, name);
debug('Registering generator', fullName);
env.register(require.resolve(fullName), name);
});
return Q.npost(env, 'run', args);
});
}; commandsThe following commands are available. To initialize a new DoneJS related project:
Within a DoneJS application or plugin:
the donejs-generator contains
|
//cli utils
// eq Promise.resolve(child_process.execSync)
runCommand = exports.runCommand = function(cmd, args) { TODOexports.runScript = function(name, args) {
debug('Running npm script', name, args);
return runCommand('npm', ['run', name].concat(args || []));
};
// Log error messages and exit application
exports.log = function(promise) {
return promise.then(function() {
process.exit(0);
}, function(error) {
console.error(error.stack || error.message || error);
process.exit(1);
});
};
exports.npmVersion = function(){
var child = spawn('npm', ['--version'], {
cwd: process.cwd()
});
var deferred = Q.defer();
var version = '';
var getVersion = function(d){
version = d.toString();
};
child.stdout.on('data', getVersion);
child.on('exit', function() {
var parts = version.trim().split(".");
deferred.resolve({
major: +parts[0],
minor: +parts[1],
patch: parts[1]
});
}); |
WiP PR transition to NPM 8 Gracefull Deprecation
Detailed Roadmap is supplyed in Expected Result. All Algos from this got adopted into the npm core package via its modules i am from the NodeJS Package Maintainance Group i would want to guide you trough the process of Deprecation if you allow me to do so.
I Was always a big fan of this project but the patterns did now improve and we got total new workflows but still all the functionality in here can be translated to npm now.
I Summon @justinbmeyer @matthewp @cherifGsoul to review and track this Issue and the PR that will Close it Thanks for all the wunderfull years this Project was a big influence for me.
But as NPM 8 now ships with lts its time to say good bye at last to this package.
How often can you reproduce it?
Description:
Steps to reproduce:
Expected results:
Actual results:
Environment:
The text was updated successfully, but these errors were encountered: