mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add script to generate npm publish script
This commit is contained in:
parent
07fe5b247b
commit
e94634544c
15
Gruntfile.js
15
Gruntfile.js
@ -562,7 +562,20 @@ module.exports = function(grunt) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
grunt.registerTask('generatePublishScript',
|
||||||
|
'Generates a script to publish build output to npm',
|
||||||
|
function () {
|
||||||
|
const done = this.async();
|
||||||
|
const generatePublishScript = require("./scripts/generate-publish-script.js");
|
||||||
|
generatePublishScript().then(function(output) {
|
||||||
|
grunt.log.writeln(output);
|
||||||
|
|
||||||
|
const filePath = path.join(grunt.config.get('paths.dist'),"modules","publish.sh");
|
||||||
|
grunt.file.write(filePath,output);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
grunt.registerTask('setDevEnv',
|
grunt.registerTask('setDevEnv',
|
||||||
'Sets NODE_ENV=development so non-minified assets are used',
|
'Sets NODE_ENV=development so non-minified assets are used',
|
||||||
function () {
|
function () {
|
||||||
@ -605,7 +618,7 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
grunt.registerTask('release',
|
grunt.registerTask('release',
|
||||||
'Create distribution zip file',
|
'Create distribution zip file',
|
||||||
['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules']);
|
['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules','generatePublishScript']);
|
||||||
|
|
||||||
grunt.registerTask('pack-modules',
|
grunt.registerTask('pack-modules',
|
||||||
'Create module pack files for release',
|
'Create module pack files for release',
|
||||||
|
38
scripts/generate-publish-script.js
Normal file
38
scripts/generate-publish-script.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
const fs = require("fs-extra");
|
||||||
|
const should = require("should");
|
||||||
|
|
||||||
|
function generateScript() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const packages = [
|
||||||
|
"node-red-util",
|
||||||
|
"node-red-runtime",
|
||||||
|
"node-red-registry",
|
||||||
|
"node-red-nodes",
|
||||||
|
"node-red-editor-client",
|
||||||
|
"node-red-editor-api",
|
||||||
|
"node-red"
|
||||||
|
];
|
||||||
|
const rootPackage = require(path.join(__dirname,"..","package.json"));
|
||||||
|
const version = rootPackage.version;
|
||||||
|
|
||||||
|
const tagArg = /-/.test(version) ? "--tag next" : ""
|
||||||
|
|
||||||
|
const lines = [];
|
||||||
|
|
||||||
|
packages.forEach(name => {
|
||||||
|
lines.push(`npm publish ${name}-${version}.tgz ${tagArg}\n`);
|
||||||
|
})
|
||||||
|
resolve(lines.join(""))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
generateScript().then(output => {
|
||||||
|
console.log(output);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
module.exports = generateScript;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user