@learnpack/learnpack 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -8,49 +8,45 @@ Create, sell or download and take learning amazing learning packages
8
8
  [![License](https://img.shields.io/npm/l/learnpack.svg)](https://github.com/learnpack/learnpack-cli/blob/master/package.json)
9
9
 
10
10
  <!-- toc -->
11
-
12
- - [learnpack](#learnpack)
13
- - [Usage](#usage)
14
- - [Commands](#commands)
11
+ * [learnpack](#learnpack)
12
+ * [Usage](#usage)
13
+ * [Commands](#commands)
15
14
  <!-- tocstop -->
16
15
 
17
16
  # Usage
18
17
 
19
18
  <!-- usage -->
20
-
21
19
  ```sh-session
22
20
  $ npm install -g @learnpack/learnpack
23
21
  $ learnpack COMMAND
24
22
  running command...
25
23
  $ learnpack (-v|--version|version)
26
- @learnpack/learnpack/2.0.2 win32-x64 node-v16.14.0
24
+ @learnpack/learnpack/2.0.5 win32-x64 node-v16.14.0
27
25
  $ learnpack --help [COMMAND]
28
26
  USAGE
29
27
  $ learnpack COMMAND
30
28
  ...
31
29
  ```
32
-
33
30
  <!-- usagestop -->
34
31
 
35
32
  # Commands
36
33
 
37
34
  <!-- commands -->
38
-
39
- - [`learnpack audit`](#learnpack-audit)
40
- - [`learnpack clean`](#learnpack-clean)
41
- - [`learnpack download [PACKAGE]`](#learnpack-download-package)
42
- - [`learnpack help [COMMAND]`](#learnpack-help-command)
43
- - [`learnpack init`](#learnpack-init)
44
- - [`learnpack login [PACKAGE]`](#learnpack-login-package)
45
- - [`learnpack logout [PACKAGE]`](#learnpack-logout-package)
46
- - [`learnpack plugins`](#learnpack-plugins)
47
- - [`learnpack plugins:install PLUGIN...`](#learnpack-pluginsinstall-plugin)
48
- - [`learnpack plugins:link PLUGIN`](#learnpack-pluginslink-plugin)
49
- - [`learnpack plugins:uninstall PLUGIN...`](#learnpack-pluginsuninstall-plugin)
50
- - [`learnpack plugins:update`](#learnpack-pluginsupdate)
51
- - [`learnpack publish [PACKAGE]`](#learnpack-publish-package)
52
- - [`learnpack start`](#learnpack-start)
53
- - [`learnpack test [EXERCISESLUG]`](#learnpack-test-exerciseslug)
35
+ * [`learnpack audit`](#learnpack-audit)
36
+ * [`learnpack clean`](#learnpack-clean)
37
+ * [`learnpack download [PACKAGE]`](#learnpack-download-package)
38
+ * [`learnpack help [COMMAND]`](#learnpack-help-command)
39
+ * [`learnpack init`](#learnpack-init)
40
+ * [`learnpack login [PACKAGE]`](#learnpack-login-package)
41
+ * [`learnpack logout [PACKAGE]`](#learnpack-logout-package)
42
+ * [`learnpack plugins`](#learnpack-plugins)
43
+ * [`learnpack plugins:install PLUGIN...`](#learnpack-pluginsinstall-plugin)
44
+ * [`learnpack plugins:link PLUGIN`](#learnpack-pluginslink-plugin)
45
+ * [`learnpack plugins:uninstall PLUGIN...`](#learnpack-pluginsuninstall-plugin)
46
+ * [`learnpack plugins:update`](#learnpack-pluginsupdate)
47
+ * [`learnpack publish [PACKAGE]`](#learnpack-publish-package)
48
+ * [`learnpack start`](#learnpack-start)
49
+ * [`learnpack test [EXERCISESLUG]`](#learnpack-test-exerciseslug)
54
50
 
55
51
  ## `learnpack audit`
56
52
 
@@ -67,7 +63,7 @@ DESCRIPTION
67
63
  2. The command learnpack clean has been run. (Error)
68
64
  3. If a markdown or test file doesn't have any content. (Error)
69
65
  4. The links are accessing to valid servers. (Error)
70
- 5. The relative images are working (If they have the shortest path to the image or if the images exists in the
66
+ 5. The relative images are working (If they have the shortest path to the image or if the images exists in the
71
67
  assets). (Error)
72
68
  6. The external images are working (If they are pointing to a valid server). (Error)
73
69
  7. The exercises directory names are valid. (Error)
@@ -78,7 +74,7 @@ DESCRIPTION
78
74
  12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
79
75
  ```
80
76
 
81
- _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\audit.ts)_
77
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\audit.ts)_
82
78
 
83
79
  ## `learnpack clean`
84
80
 
@@ -93,7 +89,7 @@ DESCRIPTION
93
89
  Extra documentation goes here
94
90
  ```
95
91
 
96
- _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\clean.ts)_
92
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\clean.ts)_
97
93
 
98
94
  ## `learnpack download [PACKAGE]`
99
95
 
@@ -111,7 +107,7 @@ DESCRIPTION
111
107
  Extra documentation goes here
112
108
  ```
113
109
 
114
- _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\download.ts)_
110
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\download.ts)_
115
111
 
116
112
  ## `learnpack help [COMMAND]`
117
113
 
@@ -142,7 +138,7 @@ OPTIONS
142
138
  -h, --grading show CLI help
143
139
  ```
144
140
 
145
- _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\init.ts)_
141
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\init.ts)_
146
142
 
147
143
  ## `learnpack login [PACKAGE]`
148
144
 
@@ -160,7 +156,7 @@ DESCRIPTION
160
156
  Extra documentation goes here
161
157
  ```
162
158
 
163
- _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\login.ts)_
159
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\login.ts)_
164
160
 
165
161
  ## `learnpack logout [PACKAGE]`
166
162
 
@@ -178,7 +174,7 @@ DESCRIPTION
178
174
  Extra documentation goes here
179
175
  ```
180
176
 
181
- _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\logout.ts)_
177
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\logout.ts)_
182
178
 
183
179
  ## `learnpack plugins`
184
180
 
@@ -218,15 +214,15 @@ DESCRIPTION
218
214
 
219
215
  Installation of a user-installed plugin will override a core plugin.
220
216
 
221
- e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
222
- will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
217
+ e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
218
+ will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
223
219
  the CLI without the need to patch and update the whole CLI.
224
220
 
225
221
  ALIASES
226
222
  $ learnpack plugins:add
227
223
 
228
224
  EXAMPLES
229
- $ learnpack plugins:install myplugin
225
+ $ learnpack plugins:install myplugin
230
226
  $ learnpack plugins:install https://github.com/someuser/someplugin
231
227
  $ learnpack plugins:install someuser/someplugin
232
228
  ```
@@ -251,7 +247,7 @@ OPTIONS
251
247
  DESCRIPTION
252
248
  Installation of a linked plugin will override a user-installed or core plugin.
253
249
 
254
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
250
+ e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
255
251
  command will override the user-installed or core plugin implementation. This is useful for development work.
256
252
 
257
253
  EXAMPLE
@@ -313,7 +309,7 @@ DESCRIPTION
313
309
  Extra documentation goes here
314
310
  ```
315
311
 
316
- _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\publish.ts)_
312
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\publish.ts)_
317
313
 
318
314
  ## `learnpack start`
319
315
 
@@ -334,7 +330,7 @@ OPTIONS
334
330
  -w, --watch Watch for file changes
335
331
  ```
336
332
 
337
- _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\start.ts)_
333
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\start.ts)_
338
334
 
339
335
  ## `learnpack test [EXERCISESLUG]`
340
336
 
@@ -348,6 +344,5 @@ ARGUMENTS
348
344
  EXERCISESLUG The name of the exercise to test
349
345
  ```
350
346
 
351
- _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.2/src\commands\test.ts)_
352
-
347
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v2.0.5/src\commands\test.ts)_
353
348
  <!-- commandsstop -->
package/bin/run CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const fs = require('fs')
4
4
  const path = require('path')
@@ -0,0 +1 @@
1
+ {"version":"2.0.5","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[standalone, gitpod]","options":["standalone","gitpod"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@learnpack/learnpack",
3
3
  "description": "Create, sell or download and take learning amazing learning packages",
4
- "version": "2.0.2",
4
+ "version": "2.0.5",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "bin": {
7
7
  "learnpack": "bin/run"
@@ -90,7 +90,8 @@
90
90
  "oclif"
91
91
  ],
92
92
  "license": "UNLICENSED",
93
- "main": "src/index.js",
93
+ "main": "../bin/index.js",
94
+ "types": "../bin/index.d.ts",
94
95
  "oclif": {
95
96
  "commands": "./src/commands",
96
97
  "bin": "learnpack",
@@ -117,6 +118,7 @@
117
118
  },
118
119
  "scripts": {
119
120
  "postpack": "rm -f oclif.manifest.json && eslint . --ext .ts --config .eslintrc",
121
+ "prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
120
122
  "pre": "node ./test/precommit/index.ts",
121
123
  "test": "NODE_ENV=test nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
122
124
  "version": "oclif-dev readme && git add README.md",
@@ -1,29 +1,29 @@
1
- // import {flags} from '@oclif/command'
2
- import Console from "../utils/console";
3
- import SessionCommand from "../utils/SessionCommand";
4
-
5
- class CleanCommand extends SessionCommand {
6
- static description = `Clean the configuration object
7
- ...
8
- Extra documentation goes here
9
- `;
10
-
11
- static flags: any = {
12
- // name: flags.string({char: 'n', description: 'name to print'}),
13
- };
14
-
15
- async init() {
16
- const { flags } = this.parse(CleanCommand);
17
- await this.initSession(flags);
18
- }
19
-
20
- async run() {
21
- const { flags } = this.parse(CleanCommand);
22
-
23
- this.configManager?.clean();
24
-
25
- Console.success("Package cleaned successfully, ready to publish");
26
- }
27
- }
28
-
29
- export default CleanCommand;
1
+ // import {flags} from '@oclif/command'
2
+ import Console from "../utils/console";
3
+ import SessionCommand from "../utils/SessionCommand";
4
+
5
+ class CleanCommand extends SessionCommand {
6
+ static description = `Clean the configuration object
7
+ ...
8
+ Extra documentation goes here
9
+ `;
10
+
11
+ static flags: any = {
12
+ // name: flags.string({char: 'n', description: 'name to print'}),
13
+ };
14
+
15
+ async init() {
16
+ const { flags } = this.parse(CleanCommand);
17
+ await this.initSession(flags);
18
+ }
19
+
20
+ async run() {
21
+ const { flags } = this.parse(CleanCommand);
22
+
23
+ this.configManager?.clean();
24
+
25
+ Console.success("Package cleaned successfully, ready to publish");
26
+ }
27
+ }
28
+
29
+ export default CleanCommand;
@@ -1,62 +1,62 @@
1
- import { Command /* , flags */ } from "@oclif/command";
2
- // import fetch from 'node-fetch'
3
- import { clone } from "../managers/file";
4
- import Console from "../utils/console";
5
- import api from "../utils/api";
6
- import { askPackage } from "../ui/download";
7
- // const BaseCommand = require('../utils/BaseCommand');
8
-
9
- class DownloadCommand extends Command {
10
- static description = `Describe the command here
11
- ...
12
- Extra documentation goes here
13
- `;
14
-
15
- static flags: any = {
16
- // name: flags.string({char: 'n', description: 'name to print'}),
17
- };
18
-
19
- static args = [
20
- {
21
- name: "package", // name of arg to show in help and reference with args[name]
22
- required: false, // make the arg required with `required: true`
23
- description:
24
- "The unique string that identifies this package on learnpack", // help description
25
- hidden: false, // hide this arg from help
26
- },
27
- ];
28
- // async init() {
29
- // const {flags} = this.parse(DownloadCommand)
30
- // await this.initSession(flags)
31
- // }
32
-
33
- async run() {
34
- const { /* flags, */ args } = this.parse(DownloadCommand);
35
- // start watching for file changes
36
- let _package: string = args.package;
37
- if (!_package) {
38
- _package = (await askPackage()) as string;
39
- }
40
-
41
- if (!_package) {
42
- return null;
43
- }
44
-
45
- try {
46
- const packageInfo = await api.getAllPackages({ slug: _package });
47
- if (packageInfo.results.length === 0)
48
- Console.error(`Package ${_package} not found`);
49
- else
50
- clone(packageInfo.results[0].repository)
51
- .then(_result => {
52
- Console.success("Successfully downloaded");
53
- Console.info(
54
- `You can now CD into the folder like this: $ cd ${_package}`
55
- );
56
- })
57
- .catch(error => Console.error(error.message || error));
58
- } catch {}
59
- }
60
- }
61
-
62
- export default DownloadCommand;
1
+ import { Command /* , flags */ } from "@oclif/command";
2
+ // import fetch from 'node-fetch'
3
+ import { clone } from "../managers/file";
4
+ import Console from "../utils/console";
5
+ import api from "../utils/api";
6
+ import { askPackage } from "../ui/download";
7
+ // const BaseCommand = require('../utils/BaseCommand');
8
+
9
+ class DownloadCommand extends Command {
10
+ static description = `Describe the command here
11
+ ...
12
+ Extra documentation goes here
13
+ `;
14
+
15
+ static flags: any = {
16
+ // name: flags.string({char: 'n', description: 'name to print'}),
17
+ };
18
+
19
+ static args = [
20
+ {
21
+ name: "package", // name of arg to show in help and reference with args[name]
22
+ required: false, // make the arg required with `required: true`
23
+ description:
24
+ "The unique string that identifies this package on learnpack", // help description
25
+ hidden: false, // hide this arg from help
26
+ },
27
+ ];
28
+ // async init() {
29
+ // const {flags} = this.parse(DownloadCommand)
30
+ // await this.initSession(flags)
31
+ // }
32
+
33
+ async run() {
34
+ const { /* flags, */ args } = this.parse(DownloadCommand);
35
+ // start watching for file changes
36
+ let _package: string = args.package;
37
+ if (!_package) {
38
+ _package = (await askPackage()) as string;
39
+ }
40
+
41
+ if (!_package) {
42
+ return null;
43
+ }
44
+
45
+ try {
46
+ const packageInfo = await api.getAllPackages({ slug: _package });
47
+ if (packageInfo.results.length === 0)
48
+ Console.error(`Package ${_package} not found`);
49
+ else
50
+ clone(packageInfo.results[0].repository)
51
+ .then(_result => {
52
+ Console.success("Successfully downloaded");
53
+ Console.info(
54
+ `You can now CD into the folder like this: $ cd ${_package}`
55
+ );
56
+ })
57
+ .catch(error => Console.error(error.message || error));
58
+ } catch {}
59
+ }
60
+ }
61
+
62
+ export default DownloadCommand;