Browse Source

Fix auto publishing npm

pull/7101/head
jlukic 2 years ago
parent
commit
abfbbb95c4
2 changed files with 53 additions and 29 deletions
  1. 53
      package.json
  2. 29
      tasks/admin/register.js

53
package.json

@ -47,40 +47,41 @@
}, },
"dependencies": { "dependencies": {
"better-console": "*", "better-console": "*",
"del": "^3.0.0",
"extend": "^3.0.2",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^6.1.0",
"gulp-chmod": "^2.0.0",
"gulp-clean-css": "^3.10.0",
"gulp-clone": "^2.0.1",
"gulp-concat": "^2.6.1",
"gulp-concat-css": "^3.1.0",
"gulp-copy": "4.0.1",
"gulp-dedupe": "0.0.2",
"gulp-flatten": "^0.4.0",
"gulp-header": "^2.0.9",
"gulp-if": "^2.0.2",
"del": "*",
"extend": "*",
"gulp": "*",
"gulp-autoprefixer": "*",
"gulp-chmod": "*",
"gulp-clean-css": "*",
"gulp-clone": "*",
"gulp-concat": "*",
"gulp-concat-css": "*",
"gulp-copy": "*",
"gulp-dedupe": "*",
"gulp-flatten": "*",
"gulp-header": "*",
"gulp-if": "*",
"gulp-json-editor": "^2.5.4", "gulp-json-editor": "^2.5.4",
"gulp-less": "^4.0.1",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1",
"gulp-print": "^5.0.2",
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0",
"gulp-rtlcss": "^1.4.1",
"gulp-uglify": "^3.0.2",
"gulp-less": "*",
"gulp-notify": "*",
"gulp-plumber": "*",
"gulp-print": "*",
"gulp-rename": "*",
"gulp-replace": "*",
"gulp-rtlcss": "*",
"gulp-uglify": "*",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"map-stream": "^0.1.0",
"map-stream": "*",
"merge-stream": "^1.0.0", "merge-stream": "^1.0.0",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"prompt-sui": "^3.2.1", "prompt-sui": "^3.2.1",
"replace-ext": "^1.0.1",
"require-dot-file": "^0.4.0",
"replace-ext": "*",
"require-dot-file": "*",
"wrench-sui": "^0.0.3", "wrench-sui": "^0.0.3",
"yamljs": "^0.3.0"
"yamljs": "*"
}, },
"devDependencies": { "devDependencies": {
"@jsdevtools/npm-publish": "^1.4.3",
"@octokit/rest": "^19.0.4", "@octokit/rest": "^19.0.4",
"gulp-concat-filenames": "*", "gulp-concat-filenames": "*",
"gulp-debug": "^4.0.0", "gulp-debug": "^4.0.0",

29
tasks/admin/register.js

@ -12,6 +12,8 @@ let
// node dependencies // node dependencies
process = require('child_process'), process = require('child_process'),
npmPublish = require('@jsdevtools/npm-publish'),
// config // config
release = require('../config/admin/release'), release = require('../config/admin/release'),
@ -29,21 +31,42 @@ module.exports = function(callback) {
console.log('Registering repos with package managers'); console.log('Registering repos with package managers');
// Do Git commands synchronously per component, to avoid issues // Do Git commands synchronously per component, to avoid issues
stepRepo = function() {
stepRepo = async function() {
index = index + 1; index = index + 1;
if(index >= total) { if(index >= total) {
callback(); callback();
return; return;
} }
let let
fs = require('fs'),
config = fs.existsSync(__dirname + '/../config/admin/oauth.js')
? require('../config/admin/oauth')
: false,
repo = repos[index].toLowerCase(), repo = repos[index].toLowerCase(),
outputDirectory = release.outputRoot + repo + '/',
outputDirectory = `${release.outputRoot}${repo}/`,
exec = process.exec, exec = process.exec,
execSettings = {cwd: outputDirectory}, execSettings = {cwd: outputDirectory},
updateNPM = 'npm publish;meteor publish;'
updateNPM = 'meteor publish;'
; ;
/* Register with NPM */ /* Register with NPM */
console.info(`NPM Token "${config.npmToken}"`);
console.info(`NPM Publish "${repo}"`);
console.info(outputDirectory);
await npmPublish({
package: `${outputDirectory}/package.json`,
token: config.npmToken,
greaterVersionOnly: true,
debug: function(log) {
console.log(log);
}
});
/* Register with NPM */
console.info(`Meteor publish "${repo}"`);
console.info(outputDirectory);
exec(updateNPM, execSettings, function(err, stdout, stderr) { exec(updateNPM, execSettings, function(err, stdout, stderr) {
console.log(err, stdout, stderr); console.log(err, stdout, stderr);
stepRepo(); stepRepo();

Loading…
Cancel
Save