@adobe-commerce/elsie 1.0.0-beta1 → 1.0.1-alpha04140951
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/bin/builders/generate/api/index.js +9 -0
- package/bin/builders/generate/api/templates/function.js +11 -2
- package/bin/builders/generate/api/templates/index.js +11 -2
- package/bin/builders/generate/api/templates/story.js +11 -2
- package/bin/builders/generate/api/templates/unit-test.js +11 -2
- package/bin/builders/generate/component/index.js +9 -0
- package/bin/builders/generate/component/templates/Component.js +22 -4
- package/bin/builders/generate/component/templates/css.js +11 -2
- package/bin/builders/generate/component/templates/index.js +11 -2
- package/bin/builders/generate/component/templates/stories.js +11 -2
- package/bin/builders/generate/component/templates/unit-test.js +11 -2
- package/bin/builders/generate/config/index.js +9 -0
- package/bin/builders/generate/config/templates/elsie.js +10 -1
- package/bin/builders/generate/container/index.js +9 -0
- package/bin/builders/generate/container/templates/Component.js +11 -2
- package/bin/builders/generate/container/templates/index.js +11 -2
- package/bin/builders/generate/container/templates/stories.js +11 -2
- package/bin/builders/generate/container/templates/unit-test.js +11 -2
- package/bin/builders/generate/index.js +9 -0
- package/package.json +1 -1
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
1
10
|
const path = require('path');
|
|
2
11
|
const fs = require('fs');
|
|
3
12
|
const writeFile = require('../../../lib/write-file');
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
const { stripIndent } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ basename }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${stripIndent`
|
|
5
14
|
export const ${basename} = () => {
|
|
6
15
|
return 'Howdy!';
|
|
7
16
|
}
|
|
8
|
-
|
|
17
|
+
`}\n`;
|
|
9
18
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ basename, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
export * from '${importPath}/${basename}';
|
|
6
|
-
|
|
15
|
+
`}\n`;
|
|
7
16
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ pathname, basename, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
import { Meta } from '@storybook/blocks';
|
|
6
15
|
|
|
7
16
|
<Meta title="API/${pathname}" />
|
|
@@ -19,5 +28,5 @@ module.exports = ({ pathname, basename, importPath = '.' }) => {
|
|
|
19
28
|
\`\`\`ts
|
|
20
29
|
${basename}();
|
|
21
30
|
\`\`\`
|
|
22
|
-
|
|
31
|
+
`}\n`;
|
|
23
32
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ name, basename, pathname, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
import { ${basename} } from '${importPath}';
|
|
6
15
|
|
|
7
16
|
describe('${name}/api/${pathname}', () => {
|
|
@@ -11,5 +20,5 @@ module.exports = ({ name, basename, pathname, importPath = '.' }) => {
|
|
|
11
20
|
expect(value).toEqual('Howdy!');
|
|
12
21
|
});
|
|
13
22
|
});
|
|
14
|
-
|
|
23
|
+
`}\n`;
|
|
15
24
|
};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
1
10
|
const path = require('path');
|
|
2
11
|
const fs = require('fs');
|
|
3
12
|
const writeFile = require('../../../lib/write-file');
|
|
@@ -5,7 +5,16 @@ module.exports = ({ basename, importPath = '.', skipCSS, cssPrefix }) => {
|
|
|
5
5
|
const _name = hyphenatedName(basename);
|
|
6
6
|
|
|
7
7
|
if (skipCSS)
|
|
8
|
-
return
|
|
8
|
+
return `/********************************************************************
|
|
9
|
+
* Copyright 2024 Adobe
|
|
10
|
+
* All Rights Reserved.
|
|
11
|
+
*
|
|
12
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
13
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
14
|
+
* accompanying it.
|
|
15
|
+
*******************************************************************/
|
|
16
|
+
|
|
17
|
+
${stripIndent`
|
|
9
18
|
import { FunctionComponent } from 'preact';
|
|
10
19
|
import { HTMLAttributes } from 'preact/compat';
|
|
11
20
|
|
|
@@ -18,9 +27,18 @@ module.exports = ({ basename, importPath = '.', skipCSS, cssPrefix }) => {
|
|
|
18
27
|
</div>
|
|
19
28
|
);
|
|
20
29
|
};
|
|
21
|
-
|
|
30
|
+
`}\n`;
|
|
22
31
|
|
|
23
|
-
return
|
|
32
|
+
return `/********************************************************************
|
|
33
|
+
* Copyright 2024 Adobe
|
|
34
|
+
* All Rights Reserved.
|
|
35
|
+
*
|
|
36
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
37
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
38
|
+
* accompanying it.
|
|
39
|
+
*******************************************************************/
|
|
40
|
+
|
|
41
|
+
${stripIndent`
|
|
24
42
|
import { FunctionComponent } from 'preact';
|
|
25
43
|
import { HTMLAttributes } from 'preact/compat';
|
|
26
44
|
import { classes } from '@adobe-commerce/elsie/lib';
|
|
@@ -39,5 +57,5 @@ module.exports = ({ basename, importPath = '.', skipCSS, cssPrefix }) => {
|
|
|
39
57
|
</div>
|
|
40
58
|
);
|
|
41
59
|
};
|
|
42
|
-
|
|
60
|
+
`}\n`;
|
|
43
61
|
};
|
|
@@ -4,7 +4,16 @@ const { hyphenatedName } = require('../../../../lib/string');
|
|
|
4
4
|
module.exports = ({ basename, cssPrefix }) => {
|
|
5
5
|
const _name = hyphenatedName(basename);
|
|
6
6
|
|
|
7
|
-
return
|
|
7
|
+
return `/********************************************************************
|
|
8
|
+
* Copyright 2024 Adobe
|
|
9
|
+
* All Rights Reserved.
|
|
10
|
+
*
|
|
11
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
12
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
13
|
+
* accompanying it.
|
|
14
|
+
*******************************************************************/
|
|
15
|
+
|
|
16
|
+
${source`
|
|
8
17
|
/* https://cssguidelin.es/#bem-like-naming */
|
|
9
18
|
|
|
10
19
|
/* .${cssPrefix}${_name} { } */
|
|
@@ -20,5 +29,5 @@ module.exports = ({ basename, cssPrefix }) => {
|
|
|
20
29
|
|
|
21
30
|
/* XXlarge (large laptops and desktops, 1920px and up) */
|
|
22
31
|
/* @media only screen and (min-width: 1920px) { } */
|
|
23
|
-
|
|
32
|
+
`}\n`;
|
|
24
33
|
};
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ basename, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
export * from '${importPath}/${basename}';
|
|
6
15
|
export { ${basename} as default } from '${importPath}/${basename}';
|
|
7
|
-
|
|
16
|
+
`}\n`;
|
|
8
17
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ name, pathname, basename, group, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
// https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
|
|
6
15
|
import type { Meta, StoryObj } from '@storybook/preact';
|
|
7
16
|
import { ${basename} as component, ${basename}Props } from '${importPath}';
|
|
@@ -42,5 +51,5 @@ module.exports = ({ name, pathname, basename, group, importPath = '.' }) => {
|
|
|
42
51
|
children: "👋 Hello from your new ${basename} story!",
|
|
43
52
|
},
|
|
44
53
|
};
|
|
45
|
-
|
|
54
|
+
`}\n`;
|
|
46
55
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ name, basename, pathname, group, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
/** https://preactjs.com/guide/v10/preact-testing-library/ */
|
|
6
15
|
|
|
7
16
|
import { render } from '@adobe-commerce/elsie/lib/tests';
|
|
@@ -15,5 +24,5 @@ module.exports = ({ name, basename, pathname, group, importPath = '.' }) => {
|
|
|
15
24
|
expect(!!container).toEqual(true);
|
|
16
25
|
});
|
|
17
26
|
});
|
|
18
|
-
|
|
27
|
+
`}\n`;
|
|
19
28
|
};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
1
10
|
const path = require('path');
|
|
2
11
|
const fs = require('fs/promises');
|
|
3
12
|
const m = require('../../../lib/log-message');
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ name, importPath }) =>
|
|
4
|
-
|
|
4
|
+
`/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
module.exports = {
|
|
6
15
|
name: '${name}',
|
|
7
16
|
api: {
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
1
10
|
const path = require('path');
|
|
2
11
|
const fs = require('fs');
|
|
3
12
|
const writeFile = require('../../../lib/write-file');
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { stripIndent } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ basename }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${stripIndent`
|
|
5
14
|
import { HTMLAttributes } from 'preact/compat';
|
|
6
15
|
import { Container } from '@adobe-commerce/elsie/lib';
|
|
7
16
|
|
|
@@ -14,5 +23,5 @@ module.exports = ({ basename }) => {
|
|
|
14
23
|
</div>
|
|
15
24
|
);
|
|
16
25
|
};
|
|
17
|
-
|
|
26
|
+
`}\n`;
|
|
18
27
|
};
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ basename, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
export * from '${importPath}/${basename}';
|
|
6
15
|
export { ${basename} as default } from '${importPath}/${basename}';
|
|
7
|
-
|
|
16
|
+
`}\n`;
|
|
8
17
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ pathname, basename, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
// https://storybook.js.org/docs/7.0/preact/writing-stories/introduction
|
|
6
15
|
import type { Meta, StoryObj } from '@storybook/preact';
|
|
7
16
|
import { ${basename} as component, ${basename}Props } from '${importPath}';
|
|
@@ -30,5 +39,5 @@ module.exports = ({ pathname, basename, importPath = '.' }) => {
|
|
|
30
39
|
children: "👋 Howdy, I'm Howdy!",
|
|
31
40
|
},
|
|
32
41
|
};
|
|
33
|
-
|
|
42
|
+
`}\n`;
|
|
34
43
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const { source } = require('common-tags');
|
|
2
2
|
|
|
3
3
|
module.exports = ({ name, basename, pathname, importPath = '.' }) => {
|
|
4
|
-
return
|
|
4
|
+
return `/********************************************************************
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
9
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
10
|
+
* accompanying it.
|
|
11
|
+
*******************************************************************/
|
|
12
|
+
|
|
13
|
+
${source`
|
|
5
14
|
/** https://preactjs.com/guide/v10/preact-testing-library/ */
|
|
6
15
|
|
|
7
16
|
import { render } from '@adobe-commerce/elsie/lib/tests';
|
|
@@ -15,5 +24,5 @@ module.exports = ({ name, basename, pathname, importPath = '.' }) => {
|
|
|
15
24
|
expect(!!container).toEqual(true);
|
|
16
25
|
});
|
|
17
26
|
});
|
|
18
|
-
|
|
27
|
+
`}\n`;
|
|
19
28
|
};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
1
10
|
const path = require('path');
|
|
2
11
|
const { toPascalCase, toCamelCase } = require('../../lib/string');
|
|
3
12
|
const m = require('../../lib/log-message');
|