Added a manifest create command
This commit is contained in:
Родитель
4cde9ab42f
Коммит
4789d4e427
|
@ -0,0 +1,22 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
topic: 'source',
|
||||
command: 'create',
|
||||
description: 'Create a manifest file for your open source project',
|
||||
help: 'help text for force:source:manifest:create',
|
||||
flags: [{
|
||||
name: 'path',
|
||||
char: 'p',
|
||||
description: 'Path for your source',
|
||||
required: true,
|
||||
hasValue: true
|
||||
}],
|
||||
run(context) {
|
||||
|
||||
console.log(context.flags.path);
|
||||
|
||||
}
|
||||
};
|
||||
}());
|
3
index.js
3
index.js
|
@ -1,4 +1,5 @@
|
|||
const oss = require('./commands/oss.js');
|
||||
const manifestCreate = require('./commands/create.js');
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
@ -13,6 +14,6 @@ const oss = require('./commands/oss.js');
|
|||
description: 'community commands from Trailhead'
|
||||
};
|
||||
|
||||
exports.commands = [oss];
|
||||
exports.commands = [oss, manifestCreate];
|
||||
|
||||
}());
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
|
||||
module.exports = {
|
||||
|
||||
// get the sfdx-oss-manifest.json file
|
||||
createManifest: (path, result) => {
|
||||
|
||||
const manifestPath = 'result.json';
|
||||
|
||||
result(manifestPath);
|
||||
}
|
||||
};
|
18
test/test.js
18
test/test.js
|
@ -1,5 +1,7 @@
|
|||
const assert = require('chai').assert;
|
||||
const files = require('../lib/files.js');
|
||||
const manifest = require('../lib/manifest.js');
|
||||
const path = require('path');
|
||||
const shell = require('shelljs');
|
||||
|
||||
(function () {
|
||||
|
@ -55,6 +57,22 @@ const shell = require('shelljs');
|
|||
});
|
||||
});
|
||||
|
||||
describe('creating manifest', () => {
|
||||
it('manifest create should return a string pointing to the new manifest file', (done) => {
|
||||
|
||||
manifest.createManifest(path, (manifestPath) => {
|
||||
|
||||
assert.isNotNull(manifestPath);
|
||||
|
||||
assert.equal(path.extname(manifestPath), '.json');
|
||||
|
||||
done();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
after(function() {
|
||||
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче