@jobber/generators 0.7.3-rc.40 → 0.8.0

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/CHANGELOG.md CHANGED
@@ -1,8 +1,19 @@
1
- # Changelog
1
+ # Change Log
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.8.0](https://github.com/GetJobber/atlantis/compare/@jobber/generators@0.7.2...@jobber/generators@0.8.0) (2023-08-11)
7
+
8
+
9
+ ### Features
10
+
11
+ * Upgrade to Node 18 [Feature Branch][JOB-62820] ([#1141](https://github.com/GetJobber/atlantis/issues/1141)) ([8b766cd](https://github.com/GetJobber/atlantis/commit/8b766cd1ebb215610ff3b0babe5d1f05540872b6)), closes [#1142](https://github.com/GetJobber/atlantis/issues/1142) [#1149](https://github.com/GetJobber/atlantis/issues/1149) [#1150](https://github.com/GetJobber/atlantis/issues/1150)
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.7.2](https://github.com/GetJobber/atlantis/compare/@jobber/generators@0.7.1...@jobber/generators@0.7.2) (2023-02-28)
7
18
 
8
19
  **Note:** Version bump only for package @jobber/generators
package/index.js CHANGED
@@ -23,6 +23,25 @@ module.exports = function (plop, config) {
23
23
  name: "name",
24
24
  message: "Component Name:",
25
25
  },
26
+ {
27
+ type: "list",
28
+ name: "type",
29
+ message: "Generate for:",
30
+ choices: [
31
+ {
32
+ name: "Web",
33
+ value: "web",
34
+ },
35
+ {
36
+ name: "React native",
37
+ value: "native",
38
+ },
39
+ {
40
+ name: "Both",
41
+ value: "both",
42
+ },
43
+ ],
44
+ },
26
45
  {
27
46
  type: "path",
28
47
  name: "path",
@@ -31,21 +50,70 @@ module.exports = function (plop, config) {
31
50
  directoryOnly: true,
32
51
  },
33
52
  ],
34
- actions: [
35
- /**
36
- * Gatsby is insisting on at least opening every file ending in `.mdx`.
37
- * This allows us to name the template file {{name}}.{{mdx}} and have
38
- * plop rename it to Component.mdx when it runs.
39
- *
40
- * https://plopjs.com/documentation/#addmany
41
- */
42
- answers => Object.assign(answers, { mdx: "mdx" }),
43
- {
44
- type: "addMany",
45
- destination: `{{path}}/{{name}}/`,
46
- base: "templates/component",
47
- templateFiles: `templates/component/${templateGlob}`,
48
- },
49
- ],
53
+ actions: answers => {
54
+ Object.assign(answers, { mdx: "mdx", tsx: "tsx" });
55
+ const actions = [];
56
+
57
+ if (answers.type === "web") {
58
+ actions.push(
59
+ {
60
+ type: "addMany",
61
+ destination: `{{path}}/{{name}}/`,
62
+ base: "templates/component",
63
+ templateFiles: `templates/component/${templateGlob}`,
64
+ },
65
+ {
66
+ type: "addMany",
67
+ destination: `docs/components/{{name}}/`,
68
+ base: "templates/docs",
69
+ templateFiles: `templates/docs/!(Mobile)*`,
70
+ },
71
+ );
72
+ } else if (answers.type === "native") {
73
+ actions.push(
74
+ {
75
+ type: "addMany",
76
+ destination: `packages/components-native/src/{{name}}/`,
77
+ base: "templates/component-native",
78
+ templateFiles: `templates/component-native/${templateGlob}`,
79
+ },
80
+ {
81
+ type: "addMany",
82
+ destination: `docs/components/{{name}}/`,
83
+ base: "templates/docs",
84
+ templateFiles: `templates/docs/!(Web)*`,
85
+ },
86
+ mobileReminder,
87
+ );
88
+ } else {
89
+ actions.push(
90
+ {
91
+ type: "addMany",
92
+ destination: `{{path}}/{{name}}/`,
93
+ base: "templates/component",
94
+ templateFiles: `templates/component/${templateGlob}`,
95
+ },
96
+ {
97
+ type: "addMany",
98
+ destination: `packages/components-native/src/{{name}}/`,
99
+ base: "templates/component-native",
100
+ templateFiles: `templates/component-native/${templateGlob}`,
101
+ },
102
+ {
103
+ type: "addMany",
104
+ destination: `docs/components/{{name}}/`,
105
+ base: "templates/docs",
106
+ templateFiles: `templates/docs/${templateGlob}`,
107
+ },
108
+ mobileReminder,
109
+ );
110
+ }
111
+
112
+ return actions;
113
+ },
50
114
  });
51
115
  };
116
+
117
+ function mobileReminder() {
118
+ return "🎉 Mobile Component created!. Remember to add the new component's export to packages/components-native/src/index.ts";
119
+ }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@jobber/generators",
3
- "version": "0.7.3-rc.40+3d350ab4",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "main": "index.js",
6
6
  "scripts": {},
7
7
  "dependencies": {
8
8
  "inquirer-path": "^1.0.0-beta5"
9
9
  },
10
- "gitHead": "3d350ab43df4707a91d0dd1b224e2596787cba4c"
10
+ "gitHead": "b94758cdc707512c2b57b9317fb2cfc961c77908"
11
11
  }
@@ -0,0 +1 @@
1
+ export { {{name}} } from "./{{name}}";
@@ -0,0 +1,7 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ export const styles = StyleSheet.create({
4
+ bold: {
5
+ fontWeight: "bold",
6
+ },
7
+ });
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { cleanup, render } from "@testing-library/react-native";
3
+
4
+ afterEach(cleanup);
5
+
6
+
7
+ it("renders a {{name}}", () => {
8
+ const { getByText } = render(< {{ name }} text = "Foo" />);
9
+ expect(getByText("Foo")).toBeTruthy();
10
+ });
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Text } from "react-native";
3
+ import { styles } from "./{{name}}.style";
4
+
5
+ interface {{name}}Props {
6
+ /**
7
+ * Text to display.
8
+ */
9
+ readonly text: string;
10
+ }
11
+
12
+ export function {{name}}({ text }: {{name}}Props) {
13
+ return <Text style={styles.bold}>{text}</Text>
14
+ }
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { ComponentMeta, ComponentStory } from "@storybook/react";
3
+ import { {{name}} } from "@jobber/components-native";
4
+
5
+ export default {
6
+ title: "Components/Category/{{name}}/Mobile",
7
+ component: {{name}},
8
+ parameters: {
9
+ viewMode: "story",
10
+ previewTabs: { code: { hidden: false } },
11
+ viewport: { defaultViewport: "mobile1" },
12
+ },
13
+ } as ComponentMeta<typeof {{name}}>;
14
+
15
+ const BasicTemplate: ComponentStory<typeof {{name}}> = args => (
16
+ <{{name}} {...args} />
17
+ );
18
+
19
+ export const Basic = BasicTemplate.bind({});
20
+ Basic.args = {};
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { ComponentMeta, ComponentStory } from "@storybook/react";
3
+ import { {{name}} } from "@jobber/components/{{name}}";
4
+
5
+ export default {
6
+ title: "Components/Category/{{name}}/Web",
7
+ component: {{name}},
8
+ parameters: {
9
+ viewMode: "story",
10
+ previewTabs: { code: { hidden: false } },
11
+ },
12
+ } as ComponentMeta<typeof {{name}}>;
13
+
14
+ const BasicTemplate: ComponentStory<typeof {{name}}> = args => (
15
+ <{{name}} {...args} />
16
+ );
17
+
18
+ export const Basic = BasicTemplate.bind({});
19
+ Basic.args = {};
@@ -1,65 +1,57 @@
1
- import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs";
2
- import { {{name}} } from ".";
1
+ import { Meta } from "@storybook/addon-docs";
3
2
  import { Figma } from "storybook-addon-designs/blocks";
4
3
 
5
-
6
4
  # {{ titleCase name }}
7
5
 
8
- <Meta title="Components/{{ name }}" component={ {{ name }} } />
6
+ <Meta title="Components/Category/{{ name }}/Docs" />
9
7
 
10
- ```ts
11
- import { {{ name }} } from "@jobber/components/{{ name }}";
12
- ```
8
+ ## Design & usage guidelines
13
9
 
14
- <Canvas>
15
- <Story name="{{ name }}" args={ { "text": "Bob"} }>
16
- {args => <{{ name }} {...args} />}
17
- </Story>
18
- </Canvas>
10
+ The {{name}} will... _Add a brief description of the design and usage of the component_
19
11
 
20
12
  <!--
21
- INTERFACE: This is for the proposal stage of the component
22
-
23
- Provide an example of what the component looks like in code. How would you use
24
- it from another React component? This should consist primarily of code blocks.
25
- This section can be deleted once the component is built, when the Playground
26
- will demonstrate this at a higher fidelity.
13
+ What is the design purpose of this component? How do its responsibilities
14
+ relate to other components? What should this component not be used for?
15
+ Try to describe this component not in terms of what it looks like or what
16
+ elements make it up, but what function it performs or how it enables a user
17
+ to perform tasks (e.g. “Buttons allow users to initiate, complete, and reverse
18
+ actions.” vs “Buttons are rectangular elements that have a green background and white text”).
27
19
  -->
28
20
 
29
- ## Props
30
-
31
- <ArgsTable of={ {{ name }} } story="{{ name }}" />
21
+ ## Content guidelines
32
22
 
33
23
  <!--
34
- It is not necessary to provide an example of each prop. Use usage examples to
35
- highlight key features of a component or particular considerations.
24
+ What type of content does this component present (documents, text, images, other components)?
25
+ What is the recommended, or expected, amount of content? What is the components’ behaviour when
26
+ the provided content diverges from what is expected (image aspect ratio, amount of text, video
27
+ vs audio, filesize)? Are there any important references to the [Product Vocabulary](https://atlantis.getjobber.com/guides/product-vocabulary)
28
+ that should be made regarding this component? What happens when content is unavailable or unreliable
29
+ (poor connection, empty states, flaky GPS data?)
30
+ -->
31
+
32
+ ## Related components
36
33
 
37
- See `Button.mdx` for a good example of this.
34
+ <!--
35
+ What are some related components in Atlantis?
38
36
  -->
39
37
 
40
- ## Usage guidelines
38
+ ## Related patterns
39
+
40
+ <!--
41
+ Is there a pattern related to this component?
42
+ -->
41
43
 
42
- The `<{{name}}>` will... _Add a brief description of the component_
44
+ ## Related resources
43
45
 
44
46
  <!--
45
- What is the design purpose of this component? How do its responsibilities
46
- relate to other components? What should this component not be used for? What
47
- are some related components in Atlantis? Try to describe this component not
48
- in terms of what it looks like or what elements make it up, but what function
49
- it performs or how it enables a user to perform tasks (e.g. “Buttons allow users
50
- to initiate, complete, and reverse actions.” vs “Buttons are rectangular elements
51
- that have a green background and white text”).
47
+ Is there any related resource (internal or external) to this component?
52
48
  -->
53
49
 
54
- ## Content guidelines
50
+ ## Platform considerations
55
51
 
56
52
  <!--
57
- What type of content does this component present (documents, text, images, other components)?
58
- What is the recommended, or expected, amount of content? What is the components’ behaviour when
59
- the provided content diverges from what is expected (image aspect ratio, amount of text, video
60
- vs audio, filesize)? Are there any important references to the [Product Vocabulary](https://atlantis.getjobber.com/guides/product-vocabulary)
61
- that should be made regarding this component? What happens when content is unavailable or unreliable
62
- (poor connection, empty states, flaky GPS data?)
53
+ Mostly for mobile components. Is there something that applies only for Android/iOS or
54
+ is browser-specific?
63
55
  -->
64
56
 
65
57
  ## Accessibility