@procamp/cli 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/index.js +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/command/init.js +5 -0
- package/dist/command/init.js.map +1 -1
- package/dist/constants/plueprint-example.d.ts +1 -0
- package/dist/constants/plueprint-example.js +78 -0
- package/dist/constants/plueprint-example.js.map +1 -0
- package/package.json +1 -1
package/dist/bin/index.js
CHANGED
|
@@ -18,9 +18,9 @@ const login_1 = require("../command/login");
|
|
|
18
18
|
const new_1 = require("../command/new");
|
|
19
19
|
const pack_1 = require("../command/pack");
|
|
20
20
|
const publish_1 = require("../command/publish");
|
|
21
|
+
const set_1 = require("../command/set");
|
|
21
22
|
const validate_1 = require("../command/validate");
|
|
22
23
|
const output_1 = require("../utils/output");
|
|
23
|
-
const set_1 = require("../command/set");
|
|
24
24
|
const { version, name, description } = require('../../package.json');
|
|
25
25
|
exports.program = new commander_1.Command();
|
|
26
26
|
exports.program.name(name).version(version).description(description);
|
package/dist/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,yCAAoC;AACpC,kDAAqD;AACrD,0CAA6C;AAC7C,4CAAyC;AACzC,wCAA8C;AAC9C,0CAA4C;AAC5C,gDAAmD;AACnD,kDAA+C;AAC/C,4CAAwC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,yCAAoC;AACpC,kDAAqD;AACrD,0CAA6C;AAC7C,4CAAyC;AACzC,wCAA8C;AAC9C,0CAA4C;AAC5C,gDAAmD;AACnD,wCAA2E;AAC3E,kDAA+C;AAC/C,4CAAwC;AAExC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAA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,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC;IAEnD,OAAO,IAAA,cAAK,EAAC,kBAAkB,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEL,eAAO;KACJ,OAAO,CAAC,mBAAmB,CAAC;KAC5B,WAAW,CAAC,WAAW,CAAC;KACxB,MAAM,CAAC,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;IACrC,IAAI,GAAG,KAAK,UAAU;QAAE,OAAO,IAAA,iBAAW,EAAC,KAAK,CAAC,CAAC;SAC7C,IAAI,GAAG,KAAK,UAAU;QAAE,OAAO,IAAA,iBAAW,EAAC,KAAK,CAAC,CAAC;SAClD,IAAI,GAAG,KAAK,cAAc;QAAE,OAAO,IAAA,qBAAe,EAAC,KAAK,CAAC,CAAC;IAC/D,OAAO,IAAA,cAAK,EAAC,kBAAkB,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEL,eAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,aAAK,CAAC,CAAC;AACvE,eAAO,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE;IACpC,IAAA,cAAK,EAAC,qBAAqB,OAAO,WAAW,CAAC,CAAC;IAC/C,eAAO,CAAC,IAAI,EAAE,CAAC;IACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AACH,eAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["#! /usr/bin/env node\n\nimport { Command } from 'commander';\nimport { generateCourse } from '../command/generate';\nimport { initCourse } from '../command/init';\nimport { login } from '../command/login';\nimport { createCourse } from '../command/new';\nimport { zipCourse } from '../command/pack';\nimport { publishCourse } from '../command/publish';\nimport { setClientId, setClientSecret, setCourseId } from '../command/set';\nimport { validate } from '../command/validate';\nimport { error } from '../utils/output';\n\nconst { version, name, description } = require('../../package.json');\n\nexport const program = new Command();\nprogram.name(name).version(version).description(description);\n\nprogram\n .command('init')\n .description('Initialise project configuration ')\n .option(\n '-d, --directory <directory>',\n 'Directory to initialise project',\n process.cwd()\n )\n .action(initCourse);\n\nprogram\n .command('new <projectName>')\n .description('Generate course project')\n .action(createCourse);\n\nprogram\n .command('pack')\n .description('Compress files')\n .option('-d, --directory <directory>', 'Directory to compress', process.cwd())\n .action(zipCourse);\n\nprogram\n .command('publish')\n .description('Publish file to service')\n .option('-a, --access <type>', 'Set access type (public or private)')\n .action(async (options) => {\n await publishCourse(options.access);\n });\nprogram\n .command('validate')\n .description('Validate course folder structure')\n .action(validate);\n\n// Commande pour générer un chapitre\nprogram\n .command('generate <key> <value>')\n .alias('g')\n .description('Generating Course with blueprint.yml')\n .action((key: string, value: string) => {\n if (key === 'course') return generateCourse(value);\n\n return error('unknown command ');\n });\n\nprogram\n .command('set <key> <value>')\n .description('set value')\n .action((key: string, value: string) => {\n if (key === 'courseId') return setCourseId(value);\n else if (key === 'clientId') return setClientId(value);\n else if (key === 'clientSecret') return setClientSecret(value);\n return error('unknown command ');\n });\n\nprogram.command('login').description('Login to procamp').action(login);\nprogram.on('command:*', ([command]) => {\n error(`Erreur : unknown \"${command}\" command`);\n program.help();\n process.exit(1);\n});\nprogram.parse(process.argv);\n"]}
|
package/dist/command/init.js
CHANGED
|
@@ -39,6 +39,7 @@ exports.initCourse = void 0;
|
|
|
39
39
|
const fs = __importStar(require("fs-extra"));
|
|
40
40
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
|
+
const plueprint_example_1 = require("../constants/plueprint-example");
|
|
42
43
|
const getUserId_1 = require("../utils/getUserId");
|
|
43
44
|
const output_1 = require("../utils/output");
|
|
44
45
|
function initCourse(opt) {
|
|
@@ -90,6 +91,10 @@ function initCourse(opt) {
|
|
|
90
91
|
};
|
|
91
92
|
const filename = 'meta.json';
|
|
92
93
|
const filepath = path.join(directory, filename);
|
|
94
|
+
const blueprintFilePath = path.join(directory, 'blueprint.yaml');
|
|
95
|
+
if (!(yield fs.exists(blueprintFilePath))) {
|
|
96
|
+
yield fs.writeFile(blueprintFilePath, plueprint_example_1.BlueprintExampleContent);
|
|
97
|
+
}
|
|
93
98
|
try {
|
|
94
99
|
yield fs.writeFile(filepath, JSON.stringify(meta, null, 2));
|
|
95
100
|
console.log(`Le fichier ${filename} a été créé avec succès dans le répertoire ${directory} !`);
|
package/dist/command/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/command/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,wDAAgC;AAChC,2CAA6B;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/command/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,wDAAgC;AAChC,2CAA6B;AAC7B,sEAAyE;AAEzE,kDAA+C;AAC/C,4CAAwC;AAExC,SAAsB,UAAU,CAAC,GAAG;;QAClC,MAAM,SAAS,GAAW,GAAG,CAAC,SAAS,CAAC;QACxC,MAAM,SAAS,GAAG;YAChB;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,kCAAkC;gBAC3C,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;aAClC;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,UAAU;gBACnB,OAAO,EAAE,EAAE;aACZ;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,kCAAkC;gBAC3C,OAAO,EAAE,EAAE;aACZ;YACD;gBACE,IAAI,EAAE,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IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC5D,OAAO,CAAC,GAAG,CACT,cAAc,QAAQ,8CAA8C,SAAS,IAAI,CAClF,CAAC;SACH;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,GAAG,CAAC;SACX;IACH,CAAC;CAAA;AAjED,gCAiEC","sourcesContent":["import * as fs from 'fs-extra';\nimport inquirer from 'inquirer';\nimport * as path from 'path';\nimport { BlueprintExampleContent } from '../constants/plueprint-example';\nimport { courseInfo } from '../interfaces/course';\nimport { getUserId } from '../utils/getUserId';\nimport { error } from '../utils/output';\n\nexport async function initCourse(opt) {\n const directory: string = opt.directory;\n const questions = [\n {\n type: 'input',\n name: 'title',\n message: 'What is the title of the Folder?',\n default: path.basename(directory)\n },\n {\n type: 'input',\n name: 'author',\n message: 'Author ?',\n default: ''\n },\n {\n type: 'input',\n name: 'description',\n message: 'What is the course description ?',\n default: ''\n },\n {\n type: 'input',\n name: 'version',\n message: 'What is the course version ?',\n default: '1.0'\n },\n {\n type: 'input',\n name: 'courseId',\n message: 'What is the course id ?',\n default: ''\n }\n ];\n let configContent = getUserId();\n const answers = await inquirer.prompt(questions);\n\n if (!answers.courseId || answers.courseId.length === 0)\n return error('Course id must be not null');\n\n const meta: courseInfo = {\n title: answers.title,\n author: answers.author,\n description: answers.description,\n courseId: answers.courseId,\n version: answers.version,\n userId: configContent ? configContent.userId : ''\n };\n const filename = 'meta.json';\n const filepath = path.join(directory, filename);\n\n const blueprintFilePath = path.join(directory, 'blueprint.yaml');\n\n if (!(await fs.exists(blueprintFilePath))) {\n await fs.writeFile(blueprintFilePath, BlueprintExampleContent);\n }\n\n try {\n await fs.writeFile(filepath, JSON.stringify(meta, null, 2));\n console.log(\n `Le fichier ${filename} a été créé avec succès dans le répertoire ${directory} !`\n );\n } catch (err) {\n throw err;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BlueprintExampleContent: string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlueprintExampleContent = void 0;
|
|
4
|
+
exports.BlueprintExampleContent = `
|
|
5
|
+
course:
|
|
6
|
+
title: 'Example Course Title'
|
|
7
|
+
author: 'Instructor Name'
|
|
8
|
+
description: 'A brief description of the course content.'
|
|
9
|
+
version: '1.0'
|
|
10
|
+
courseId: 'nextjs-001'
|
|
11
|
+
|
|
12
|
+
chapters:
|
|
13
|
+
- title: 'Next.js'
|
|
14
|
+
lessons:
|
|
15
|
+
- title: 'Introduction to Next.js'
|
|
16
|
+
objectives:
|
|
17
|
+
- 'Understand what Next.js '
|
|
18
|
+
- 'Learn about the main features of Next.js'
|
|
19
|
+
|
|
20
|
+
- title: 'Benefits and use cases of Next.js'
|
|
21
|
+
objectives:
|
|
22
|
+
- 'Learn about the benefits of using Next.js'
|
|
23
|
+
- 'Explore various use cases for Next.js'
|
|
24
|
+
|
|
25
|
+
- title: 'Benefits1 and use cases of Next.js'
|
|
26
|
+
objectives:
|
|
27
|
+
- 'Learn about the benefits of using Next.js'
|
|
28
|
+
- 'Explore various use cases for Next.js'
|
|
29
|
+
|
|
30
|
+
- title: 'Setting up the development environment'
|
|
31
|
+
objectives:
|
|
32
|
+
- 'Set up the necessary tools for Next.js development'
|
|
33
|
+
- 'Learn about the recommended development environment'
|
|
34
|
+
assessments:
|
|
35
|
+
- title: 'Development Environment Check'
|
|
36
|
+
description: 'Describe the steps to set up the development environment for Next.js.'
|
|
37
|
+
language: 'JavaScript'
|
|
38
|
+
solution: true
|
|
39
|
+
|
|
40
|
+
- title: 'Environmen1t Setup'
|
|
41
|
+
description: 'Verify your development environment is correctly set up'
|
|
42
|
+
language: 'JavaScript'
|
|
43
|
+
solution: true
|
|
44
|
+
|
|
45
|
+
- title: 'Environment Setup'
|
|
46
|
+
description: 'Verify your development environment is correctly set up'
|
|
47
|
+
language: 'JavaScript'
|
|
48
|
+
solution: true
|
|
49
|
+
|
|
50
|
+
- title: 'Get Started with Next.js'
|
|
51
|
+
lessons:
|
|
52
|
+
- title: 'Introduction to Next.js'
|
|
53
|
+
objectives:
|
|
54
|
+
- 'Understand what Next.js '
|
|
55
|
+
- 'Learn about the main features of Next.js'
|
|
56
|
+
|
|
57
|
+
- title: 'Benefits and use cases of Next.js'
|
|
58
|
+
objectives:
|
|
59
|
+
- 'Learn about the benefits of using Next.js'
|
|
60
|
+
- 'Explore various use cases for Next.js'
|
|
61
|
+
|
|
62
|
+
- title: 'Setting up the development environment'
|
|
63
|
+
objectives:
|
|
64
|
+
- 'Set up the necessary tools for Next.js development'
|
|
65
|
+
- 'Learn about the recommended development environment'
|
|
66
|
+
assessments:
|
|
67
|
+
- title: 'Development Environment Check'
|
|
68
|
+
description: 'Describe the steps to set up the development environment for Next.js.'
|
|
69
|
+
language: 'JavaScript'
|
|
70
|
+
solution: true
|
|
71
|
+
|
|
72
|
+
- title: 'Environment Setup'
|
|
73
|
+
description: 'Verify your development environment is correctly set up'
|
|
74
|
+
language: 'JavaScript'
|
|
75
|
+
solution: true
|
|
76
|
+
|
|
77
|
+
`.trim();
|
|
78
|
+
//# sourceMappingURL=plueprint-example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plueprint-example.js","sourceRoot":"","sources":["../../src/constants/plueprint-example.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEtC,CAAC,IAAI,EAAE,CAAC","sourcesContent":["export const BlueprintExampleContent = `\ncourse:\n title: 'Example Course Title'\n author: 'Instructor Name'\n description: 'A brief description of the course content.'\n version: '1.0'\n courseId: 'nextjs-001'\n\nchapters:\n - title: 'Next.js'\n lessons:\n - title: 'Introduction to Next.js'\n objectives:\n - 'Understand what Next.js '\n - 'Learn about the main features of Next.js'\n\n - title: 'Benefits and use cases of Next.js'\n objectives:\n - 'Learn about the benefits of using Next.js'\n - 'Explore various use cases for Next.js'\n\n - title: 'Benefits1 and use cases of Next.js'\n objectives:\n - 'Learn about the benefits of using Next.js'\n - 'Explore various use cases for Next.js'\n\n - title: 'Setting up the development environment'\n objectives:\n - 'Set up the necessary tools for Next.js development'\n - 'Learn about the recommended development environment'\n assessments:\n - title: 'Development Environment Check'\n description: 'Describe the steps to set up the development environment for Next.js.'\n language: 'JavaScript'\n solution: true\n\n - title: 'Environmen1t Setup'\n description: 'Verify your development environment is correctly set up'\n language: 'JavaScript'\n solution: true\n\n - title: 'Environment Setup'\n description: 'Verify your development environment is correctly set up'\n language: 'JavaScript'\n solution: true\n\n - title: 'Get Started with Next.js'\n lessons:\n - title: 'Introduction to Next.js'\n objectives:\n - 'Understand what Next.js '\n - 'Learn about the main features of Next.js'\n\n - title: 'Benefits and use cases of Next.js'\n objectives:\n - 'Learn about the benefits of using Next.js'\n - 'Explore various use cases for Next.js'\n\n - title: 'Setting up the development environment'\n objectives:\n - 'Set up the necessary tools for Next.js development'\n - 'Learn about the recommended development environment'\n assessments:\n - title: 'Development Environment Check'\n description: 'Describe the steps to set up the development environment for Next.js.'\n language: 'JavaScript'\n solution: true\n\n - title: 'Environment Setup'\n description: 'Verify your development environment is correctly set up'\n language: 'JavaScript'\n solution: true\n\n`.trim();\n"]}
|