@dolphjs/cli 0.0.1-beta → 0.0.2-beta

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.
@@ -0,0 +1,76 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to make participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at <opensource-conduct@fb.com>. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ <https://www.contributor-covenant.org/faq>
@@ -0,0 +1,91 @@
1
+ # Contributing
2
+
3
+ Thank you for your interest in contributing to the DolphJs Docs!
4
+
5
+ ## Code of Conduct
6
+
7
+ DolphJs has adopted a code of conduct that we expect contributors to adhere to.
8
+ Please read the instructions in the [CODE_OF_CONDUCT](CODE_OF_CONDUCT) so
9
+ you can understand our ethics.
10
+
11
+ **Try to follow your own instructions.**
12
+
13
+ When writing step-by-step instructions (e.g. how to install something), try to forget everything you know about the topic, and actually follow the instructions you wrote, a single step at time. Often you will discover that there is implicit knowledge that you forgot to mention, or that there are missing or out-of-order steps in the instructions. Bonus points for getting _somebody else_ to follow the steps and watching what they struggle with. Often it would be something very simple that you have not anticipated.
14
+
15
+ ## Guidelines for Code Examples
16
+
17
+ ### Syntax
18
+
19
+ #### Prefer OOP to Functional Programming
20
+
21
+ DolphJS is strictly built with the OOP approach.
22
+
23
+ #### Use `const` where possible, otherwise `let`. Don't use `var`
24
+
25
+ #### Don't use ES5 features when equivalent ES6 features have no downsides
26
+
27
+ #### Don't forget to remove console.log's when finished with them
28
+
29
+ #### Ensure that your code is scalable and uses the best implementation e.g prefer code with 0(n) to 0(logn)
30
+
31
+ In particular, you should prefer arrow functions `const myFunction = () => ...` to named `functions` for top-level functions.
32
+
33
+ ### Style
34
+
35
+ - Use semicolons.
36
+ - No space between function names and parenthesis (`method() {}` not `method () {}`).
37
+ - When in doubt, use the default style favored by [Prettier](https://prettier.io/playground/).
38
+
39
+ ### Highlighting
40
+
41
+ Use `javascript` as the highlighting language in Markdown code blocks:
42
+
43
+ ````
44
+ ```javascript
45
+ // code
46
+ ```
47
+ ````
48
+
49
+ Sometimes you'll see blocks with numbers.
50
+ They tell the website to highlight specific lines.
51
+
52
+ You can highlight a single line:
53
+
54
+ ````
55
+ ```javascipt {2}
56
+ function hello() {
57
+ // this line will get highlighted
58
+ }
59
+ ```
60
+ ````
61
+
62
+ A range of lines:
63
+
64
+ ````
65
+ ```javascript {2-4}
66
+ function hello() {
67
+ // these lines
68
+ // will get
69
+ // highlighted
70
+ }
71
+ ```
72
+ ````
73
+
74
+ Or even multiple ranges:
75
+
76
+ ````
77
+ ```javascript {2-4,6}
78
+ function hello() {
79
+ // these lines
80
+ // will get
81
+ // highlighted
82
+ console.log('hello');
83
+ // also this one
84
+ console.log('there');
85
+ }
86
+ ```
87
+ ````
88
+
89
+ Be mindful that if you move some code in an example with highlighting, you also need to update the highlighting.
90
+
91
+ Don't be afraid to often use highlighting! It is very valuable when you need to focus the reader's attention on a particular detail that's easy to miss.
package/new-app.mjs CHANGED
@@ -149,9 +149,9 @@ program
149
149
  const spinner2 = ora("Installing dev dependencies...").start();
150
150
 
151
151
  if (selectedOption === jsFunc || selectedOption === jsOop) {
152
- exec(`${installCommand} ${devDependencies.join(" ")}`);
152
+ execSync(`${installCommand} ${devDependencies.join(" ")}`);
153
153
  } else if (selectedOption === tsFunc || selectedOption === tsOop) {
154
- exec(`${installCommand} ${tsDevDependencies.join(" ")}`);
154
+ execSync(`${installCommand} ${tsDevDependencies.join(" ")}`);
155
155
  }
156
156
 
157
157
  spinner2.succeed("Dev dependencies installed!");
@@ -303,11 +303,10 @@ program
303
303
  // show completion message
304
304
  console.log(
305
305
  chalk.green(
306
- `Done! Your app has been created. Navigate to your app by running "cd ${appName}" and then run ${chalk.bgGreen(
307
- runMsg
308
- )}`
306
+ `Done! Your app has been created. Navigate to your app by running "cd ${appName}" and then run ${runMsg}`
309
307
  )
310
308
  );
309
+ process.exit(1);
311
310
  } catch (error) {
312
311
  console.log(chalk.redBright("\nError creating your app", error));
313
312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphjs/cli",
3
- "version": "0.0.1beta",
3
+ "version": "0.0.2beta",
4
4
  "description": "DolphJs is an express.js library for making software development easier by taking care of all the unneccessary tasks developers have to worry about.",
5
5
  "main": "new-app.mjs",
6
6
  "bin": {
@@ -15,7 +15,7 @@ module.exports = defaultRoutes;
15
15
 
16
16
  const demoRoutes =
17
17
  "const { Router } = require('@dolphjs/core');\n\
18
- const { sendMsg } = require('@/controllers/demo.controller');\n\
18
+ const { sendMsg } = require('../controllers/demo.controller');\n\
19
19
  \
20
20
  const router = Router();\n\
21
21
  \
@@ -40,7 +40,7 @@ const controllerDemo = `const { httpStatus, catchAsync } = require('@dolphjs/cor
40
40
 
41
41
  const sendMsg = catchAsync(async (req, res) => {
42
42
  \tconst message =
43
- \t'Welcome to the API end-point for the Dolph app. If you have problems getting started, visit https://github.com/dolphjs/\tcore#README.MD';
43
+ \t'Welcome to the API end-point for the Dolph app. If you have problems getting started, visit https://github.com/dolphjs/core#README.MD';
44
44
  \tres.status(httpStatus.OK).json({ message });
45
45
  });
46
46
 
@@ -77,14 +77,14 @@ module.exports = {\n\
77
77
  };\
78
78
  ";
79
79
 
80
- const jsConfigFile = `{
81
- "compilerOptions": {
82
- "paths": {
83
- "@/*": ["./src/*"]
84
- }
85
- }
86
- }
87
- `;
80
+ // const jsConfigFile = `{
81
+ // "compilerOptions": {
82
+ // "paths": {
83
+ // "@/*": ["./src/*"]
84
+ // }
85
+ // }
86
+ // }
87
+ // `;
88
88
 
89
89
  export default function writeSubFileJsFunc() {
90
90
  writeFileSync("src/index.js", indexData);
@@ -92,5 +92,5 @@ export default function writeSubFileJsFunc() {
92
92
  writeFileSync("src/routes/demo.route.js", demoRoutes);
93
93
  writeFileSync("src/routes/index.js", indexRoute);
94
94
  writeFileSync("src/controllers/demo.controller.js", controllerDemo);
95
- writeFileSync("jsConfig.json", jsConfigFile);
95
+ // writeFileSync("jsConfig.json", jsConfigFile);
96
96
  }
@@ -2,7 +2,7 @@ import { writeFileSync } from "fs";
2
2
 
3
3
  const routeIndex =
4
4
  "const { Router } = require('@dolphjs/core');\n\
5
- const DemoController = require('@/controllers/demo.controller');\n\
5
+ const DemoController = require('../controllers/demo.controller');\n\
6
6
  \n\
7
7
  class DemoRouter {\n\
8
8
  \tpath = '/v1/api';\n\
@@ -76,19 +76,19 @@ module.exports = {\n\
76
76
  };\
77
77
  ";
78
78
 
79
- const jsConfigFile = `{
80
- "compilerOptions": {
81
- "paths": {
82
- "@/*": ["./src/*"]
83
- }
84
- }
85
- }
86
- `;
79
+ // const jsConfigFile = `{
80
+ // "compilerOptions": {
81
+ // "paths": {
82
+ // "@/*": ["./src/*"]
83
+ // }
84
+ // }
85
+ // }
86
+ // `;
87
87
 
88
88
  export default function writeSubFileJsOop() {
89
89
  writeFileSync("src/index.js", indexData);
90
90
  writeFileSync("src/config/index.js", configIndex);
91
91
  writeFileSync("src/routes/demo.route.js", routeIndex);
92
92
  writeFileSync("src/controllers/demo.controller.js", controllerDemo);
93
- writeFileSync("jsConfig.json", jsConfigFile);
93
+ // writeFileSync("jsConfig.json", jsConfigFile);
94
94
  }
@@ -31,7 +31,7 @@ const sendGreeting = catchAsync(async (req: Request, res: Response) => {
31
31
  \tres.status(httpStatus.OK).send({ message });
32
32
  });
33
33
 
34
- export default { sendGreeting };\
34
+ export { sendGreeting };\
35
35
  `;
36
36
 
37
37
  const demoRoute = `import { Router } from '@dolphjs/core'
@@ -27,7 +27,7 @@ import { AppRes, catchAsync, httpStatus } from '@dolphjs/core';
27
27
  class DemoAppController {
28
28
  \tpublic sendGreeting = catchAsync(async (req: Request, res: Response) => {
29
29
  \t const message =
30
- \t 'Welcome to the API end-point for the Dolph app. If you have problems getting started, visit https://github.com/dolphjs/\t core#README.MD';
30
+ \t 'Welcome to the API end-point for the Dolph app. If you have problems getting started, visit https://github.com/dolphjs/core#README.MD';
31
31
  \t res.status(httpStatus.OK).send({ message });
32
32
  \t});
33
33
  }