@abcnews/aunty 16.0.0 → 17.0.0-next.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.
Files changed (105) hide show
  1. package/README.md +10 -0
  2. package/dist/bin/aunty.js +3 -0
  3. package/dist/lib/constants.js +8 -0
  4. package/package.json +25 -82
  5. package/assets/done.mp3 +0 -0
  6. package/scripts/postinstall.js +0 -44
  7. package/src/api/index.js +0 -5
  8. package/src/bin/aunty.js +0 -27
  9. package/src/cli/build/constants.js +0 -46
  10. package/src/cli/build/index.js +0 -100
  11. package/src/cli/clean/constants.js +0 -10
  12. package/src/cli/clean/index.js +0 -40
  13. package/src/cli/constants.js +0 -114
  14. package/src/cli/deploy/constants.js +0 -40
  15. package/src/cli/deploy/index.js +0 -151
  16. package/src/cli/generate/constants.js +0 -39
  17. package/src/cli/generate/index.js +0 -72
  18. package/src/cli/index.js +0 -154
  19. package/src/cli/release/constants.js +0 -67
  20. package/src/cli/release/index.js +0 -162
  21. package/src/cli/serve/constants.js +0 -33
  22. package/src/cli/serve/index.js +0 -128
  23. package/src/cli/sign-cert/constants.js +0 -42
  24. package/src/cli/sign-cert/index.js +0 -50
  25. package/src/cli/test/constants.js +0 -15
  26. package/src/cli/test/index.js +0 -30
  27. package/src/config/babel.js +0 -75
  28. package/src/config/build.js +0 -39
  29. package/src/config/deploy.js +0 -143
  30. package/src/config/jest/index.js +0 -20
  31. package/src/config/jest/transformer-default.js +0 -27
  32. package/src/config/jest/transformer-svelte-preprocess.js +0 -8
  33. package/src/config/jest/transformer-svelte.js +0 -32
  34. package/src/config/project.js +0 -57
  35. package/src/config/serve.js +0 -144
  36. package/src/config/webpack.js +0 -325
  37. package/src/config/webpackDevServer.js +0 -46
  38. package/src/constants.js +0 -7
  39. package/src/generators/component/index.js +0 -172
  40. package/src/generators/component/templates/_non_sfc/styles.scss +0 -6
  41. package/src/generators/component/templates/basic/component-with-d3.test.ts +0 -7
  42. package/src/generators/component/templates/basic/component-with-d3.ts +0 -30
  43. package/src/generators/component/templates/basic/component.test.ts +0 -7
  44. package/src/generators/component/templates/basic/component.ts +0 -11
  45. package/src/generators/component/templates/preact/component-with-d3.test.tsx +0 -16
  46. package/src/generators/component/templates/preact/component-with-d3.tsx +0 -45
  47. package/src/generators/component/templates/preact/component.test.tsx +0 -18
  48. package/src/generators/component/templates/preact/component.tsx +0 -14
  49. package/src/generators/component/templates/react/component-with-d3.test.tsx +0 -13
  50. package/src/generators/component/templates/react/component-with-d3.tsx +0 -44
  51. package/src/generators/component/templates/react/component.test.tsx +0 -13
  52. package/src/generators/component/templates/react/component.tsx +0 -14
  53. package/src/generators/component/templates/svelte/component-with-d3.svelte +0 -46
  54. package/src/generators/component/templates/svelte/component-with-d3.test.ts +0 -10
  55. package/src/generators/component/templates/svelte/component.svelte +0 -17
  56. package/src/generators/component/templates/svelte/component.test.ts +0 -10
  57. package/src/generators/project/index.js +0 -244
  58. package/src/generators/project/templates/_common/.editorconfig +0 -12
  59. package/src/generators/project/templates/_common/.prettierrc +0 -6
  60. package/src/generators/project/templates/_common/LICENSE +0 -21
  61. package/src/generators/project/templates/_common/README.md +0 -3
  62. package/src/generators/project/templates/_common/_.gitignore +0 -12
  63. package/src/generators/project/templates/_common/package.json +0 -18
  64. package/src/generators/project/templates/_common/public/index.html +0 -21
  65. package/src/generators/project/templates/_common/src/components/Worm/worm.svg +0 -4
  66. package/src/generators/project/templates/_common/tsconfig.json +0 -4
  67. package/src/generators/project/templates/_non_sfc/src/components/App/styles.scss +0 -23
  68. package/src/generators/project/templates/_non_sfc/src/components/ErrorBox/styles.scss +0 -16
  69. package/src/generators/project/templates/_non_sfc/src/components/Worm/styles.scss +0 -4
  70. package/src/generators/project/templates/basic/src/components/App/index.test.ts +0 -9
  71. package/src/generators/project/templates/basic/src/components/App/index.ts +0 -22
  72. package/src/generators/project/templates/basic/src/components/ErrorBox/index.ts +0 -24
  73. package/src/generators/project/templates/basic/src/components/Worm/index.test.ts +0 -7
  74. package/src/generators/project/templates/basic/src/components/Worm/index.ts +0 -12
  75. package/src/generators/project/templates/basic/src/index.ts +0 -50
  76. package/src/generators/project/templates/preact/src/components/App/index.test.tsx +0 -21
  77. package/src/generators/project/templates/preact/src/components/App/index.tsx +0 -21
  78. package/src/generators/project/templates/preact/src/components/ErrorBox/index.tsx +0 -15
  79. package/src/generators/project/templates/preact/src/components/Worm/index.test.tsx +0 -14
  80. package/src/generators/project/templates/preact/src/components/Worm/index.tsx +0 -9
  81. package/src/generators/project/templates/preact/src/index.tsx +0 -42
  82. package/src/generators/project/templates/react/src/components/App/index.test.tsx +0 -14
  83. package/src/generators/project/templates/react/src/components/App/index.tsx +0 -21
  84. package/src/generators/project/templates/react/src/components/ErrorBox/index.tsx +0 -14
  85. package/src/generators/project/templates/react/src/components/Worm/index.test.tsx +0 -13
  86. package/src/generators/project/templates/react/src/components/Worm/index.tsx +0 -9
  87. package/src/generators/project/templates/react/src/index.tsx +0 -40
  88. package/src/generators/project/templates/svelte/src/components/App/App.svelte +0 -37
  89. package/src/generators/project/templates/svelte/src/components/App/App.test.ts +0 -18
  90. package/src/generators/project/templates/svelte/src/components/Worm/Worm.svelte +0 -12
  91. package/src/generators/project/templates/svelte/src/components/Worm/Worm.test.ts +0 -16
  92. package/src/generators/project/templates/svelte/src/index.ts +0 -26
  93. package/src/utils/async.js +0 -13
  94. package/src/utils/audio.js +0 -30
  95. package/src/utils/branding.js +0 -57
  96. package/src/utils/color.js +0 -12
  97. package/src/utils/ftp.js +0 -80
  98. package/src/utils/git.js +0 -127
  99. package/src/utils/logging.js +0 -74
  100. package/src/utils/npm.js +0 -59
  101. package/src/utils/remote.js +0 -81
  102. package/src/utils/structures.js +0 -33
  103. package/src/utils/text.js +0 -64
  104. package/ts/config.json +0 -22
  105. package/ts/custom.d.ts +0 -120
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title><%= projectName %></title>
7
- <!-- If you add `extractCSS:true` to your build config, add the <link> below -->
8
- <!-- <link rel="stylesheet" href="index.css" /> -->
9
- <script src="index.js"></script>
10
- <!-- If you add `addModernJS:true` to your build config, replace the <script> above with the ones below -->
11
- <!-- <script type="module" src="index_modern.js"></script> -->
12
- <!-- <script nomodule src="index.js"></script> -->
13
- </head>
14
- <body>
15
- <div data-mount id="<%= projectNameFlat %>X42YtextZtrue"></div><% if (isOdyssey) { %>
16
- <!-- Mock Odyssey's loaded event so the `whenOdysseyLoaded` promise resolves -->
17
- <script>
18
- window.dispatchEvent(new CustomEvent('odyssey:api'));
19
- </script><% } %>
20
- </body>
21
- </html>
@@ -1,4 +0,0 @@
1
- <svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300">
2
- <path fill="#<% if (isTS) { %>fff<% } else { %>000<% } %>" d="M57.733.28c15.15-.238 33.573 5.428 46 20.76 5.63 5.447 15.973 31.627 15.973 31.627l61.955 164.537c7.97 19.756 31.93 21.236 38.965 1.488L239.87 166.8l32.858 86.48c-15.973 29.157-31.435 36.304-49.765 42.966-21.346 6.68-46.932 4.477-65.245-6.9-6.086-3.947-22.06-14.318-32.86-40.516L59.616 66.494V232.53l24.417-70.16 31.325 87.586c-4.57 20.113-19.116 36.918-36.02 44.822-18.496 8.717-40.555 5.63-57.277-4.945C5.41 277.48.715 262.903 0 236.96L.22 57.366c1.9-29.91 21.017-46.193 37.794-53.486C45.67 1.16 48.944.418 57.734.28z"/>
3
- <path fill="#<% if (isTS) { %>fff<% } else { %>000<% } %>" d="M343.146 299.71c-15.15.267-33.572-5.427-46.02-20.733-5.628-5.445-15.954-31.625-15.954-31.625L219.22 82.814c-7.987-19.784-31.93-21.264-38.965-1.5L161.01 133.21l-32.86-86.48c15.955-29.132 31.453-36.306 49.765-42.985 21.364-6.68 46.95-4.45 65.245 6.926 6.104 3.95 22.06 14.32 32.86 40.52l65.243 182.31V67.49l-24.397 70.16-31.344-87.586c4.57-20.14 19.135-36.926 36.04-44.82 18.478-8.7 40.555-5.64 57.258 4.942 16.668 12.327 21.347 26.93 22.06 52.845l-.237 179.626c-1.864 29.908-21 46.2-37.795 53.484-7.603 2.712-10.893 3.442-19.702 3.57z"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "@abcnews/aunty/ts/config.json",
3
- "include": ["src/**/*", "node_modules/@abcnews/aunty/ts/*"]
4
- }
@@ -1,23 +0,0 @@
1
- .root {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: center;
5
- align-items: center;
6
- width: 100%;
7
- height: 100%;
8
- min-height: 320px;
9
- background-color: #<% if (isTS) { %>3178c7<% } else { %>f0db4e<% } %>;
10
- color: #<% if (isTS) { %>fff<% } else { %>000<% } %>;
11
- text-align: center;
12
-
13
- h1 {
14
- margin: 0;
15
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
16
- font-size: 24px !important;
17
- font-weight: normal !important;
18
- line-height: normal !important;
19
- letter-spacing: normal !important;
20
- }
21
- }
22
-
23
-
@@ -1,16 +0,0 @@
1
- .root {
2
- position: fixed;
3
- overflow: auto;
4
- left: 0;
5
- top: 0;
6
- z-index: 10000;
7
- box-sizing: border-box;
8
- margin: 0;
9
- padding: 2rem;
10
- width: 100vw;
11
- height: 100vh;
12
- background-color: #900;
13
- color: #fff;
14
- font-family: Menlo, Consolas, monospace;
15
- font-size: large;
16
- }
@@ -1,4 +0,0 @@
1
- .root {
2
- width: 240px;
3
- height: auto;
4
- }
@@ -1,9 +0,0 @@
1
- import App from './index';<% if (isTS) { %>
2
- import type { AppProps } from './index';<% } %>
3
-
4
- test('it renders', () => {
5
- const props<% if (isTS) { %>: AppProps<% } %> = { x: 42, y: 'text', z: true };
6
- const component = new App(props);
7
-
8
- expect(component.el.innerHTML).toContain(JSON.stringify(props));
9
- });
@@ -1,22 +0,0 @@
1
- import Worm from '../Worm';
2
- import styles from './styles.scss';
3
- <% if (isTS) { %>
4
- export type AppProps = {
5
- x: number;
6
- y: string;
7
- z: boolean;
8
- }
9
- <% } %>
10
- export default class App {<% if (isTS) { %>
11
- el: Element;
12
- <% } %>
13
- constructor({ x, y, z }<% if (isTS) { %>: AppProps<% } %>) {
14
- this.el = document.createElement('div');
15
- this.el.className = styles.root;
16
- this.el.innerHTML = `
17
- ${new Worm().el.outerHTML}
18
- <pre>${JSON.stringify({ x, y, z })}</pre>
19
- <h1><%= projectName %></h1>
20
- `;
21
- }
22
- }
@@ -1,24 +0,0 @@
1
- import styles from './styles.scss';
2
- <% if (isTS) { %>
3
- type ErrorBoxProps = {
4
- error: Error;
5
- }
6
- <% } %>
7
- export default class ErrorBox {<% if (isTS) { %>
8
- el: Element;
9
- <% } %>
10
- constructor({ error }<% if (isTS) { %>: ErrorBoxProps<% } %>) {
11
- const el = (this.el = document.createElement('pre'));
12
-
13
- el.className = styles.root;
14
- el.textContent = `${String(error)}\n\n${error.stack}`;
15
-
16
- (function logOnMount() {
17
- if (!el.parentNode) {
18
- return setTimeout(logOnMount, 100);
19
- }
20
-
21
- console.error(error);
22
- })();
23
- }
24
- }
@@ -1,7 +0,0 @@
1
- import Worm from './index';
2
-
3
- test('it renders', () => {
4
- const component = new Worm();
5
-
6
- expect(component.el.src).toContain('worm.svg');
7
- });
@@ -1,12 +0,0 @@
1
- import styles from './styles.scss';
2
- import worm from './worm.svg';
3
-
4
- export default class Worm {<% if (isTS) { %>
5
- el: HTMLImageElement;
6
- <% } %>
7
- constructor() {
8
- this.el = document.createElement('img');
9
- this.el.className = styles.root;
10
- this.el.src = worm;
11
- }
12
- }
@@ -1,50 +0,0 @@
1
- import acto from '@abcnews/alternating-case-to-object';
2
- import { <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %> } from '@abcnews/env-utils';
3
- import { getMountValue, selectMounts } from '@abcnews/mount-utils';<% if (isTS) { %>
4
- import type { Mount } from '@abcnews/mount-utils';<% } %>
5
- import App from './components/App';<% if (isTS) { %>
6
- import type { AppProps } from './components/App';<% } %>
7
-
8
- let appMountEl<% if (isTS) { %>: Mount<% } %>;
9
- let appProps<% if (isTS) { %>: AppProps<% } %>;
10
-
11
- function renderApp() {
12
- render(new App(appProps).el, appMountEl);
13
- }
14
-
15
- <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %>.then(() => {
16
- [appMountEl] = selectMounts('<%= projectNameFlat %>');
17
-
18
- if (appMountEl) {
19
- appProps = acto(getMountValue(appMountEl))<% if (isTS) { %> as AppProps<% } %>;
20
- renderApp();
21
- }
22
- });
23
-
24
- if (module.hot) {
25
- module.hot.accept('./components/App', () => {
26
- try {
27
- renderApp();
28
- } catch (err) {
29
- import('./components/ErrorBox').then(({ default: ErrorBox }) => {
30
- render(new ErrorBox({ error: err<% if (isTS) { %> as Error<% } %> }).el, appMountEl);
31
- });
32
- }
33
- });
34
- }
35
-
36
- if (process.env.NODE_ENV === 'development') {
37
- console.debug(`[<%= projectName %>] public path: ${__webpack_public_path__}`);
38
- }
39
-
40
- function render(el<% if (isTS) { %>: Element<% } %>, parentEl<% if (isTS) { %>: Element | null<% } %>) {
41
- if (parentEl === null) {
42
- throw new Error('parentEl is not an Element');
43
- }
44
-
45
- while (parentEl.firstElementChild) {
46
- parentEl.removeChild(parentEl.firstElementChild);
47
- }
48
-
49
- parentEl.appendChild(el);
50
- }
@@ -1,21 +0,0 @@
1
- import { h } from 'preact';
2
- import render from 'preact-render-to-string';
3
- import htmlLooksLike from 'html-looks-like';
4
- import App from '.';<% if (isTS) { %>
5
- import type { AppProps } from '.';<% } %>
6
-
7
- describe('App', () => {
8
- test('It renders', () => {
9
- const props<% if (isTS) { %>: AppProps<% } %> = { x: 42, y: 'text', z: true };
10
- const actual = render(<App {...props} />);
11
- const expected = `
12
- <div>
13
- {{ ... }}
14
- <pre>${JSON.stringify(props)}</pre>
15
- <h1><%= projectName %></h1>
16
- </div>
17
- `;
18
-
19
- htmlLooksLike(actual, expected);
20
- });
21
- });
@@ -1,21 +0,0 @@
1
- import { h<% if (isTS) { %>, type FunctionalComponent<% } %> } from 'preact';
2
- import Worm from '../Worm';
3
- import styles from './styles.scss';
4
- <% if (isTS) { %>
5
- export type AppProps = {
6
- x: number;
7
- y: string;
8
- z: boolean;
9
- }
10
- <% } %>
11
- const App<% if (isTS) { %>: FunctionalComponent<AppProps><% } %> = ({ x, y, z }) => {
12
- return (
13
- <div className={styles.root}>
14
- <Worm />
15
- <pre>{JSON.stringify({ x, y, z })}</pre>
16
- <h1><%= projectName %></h1>
17
- </div>
18
- );
19
- };
20
-
21
- export default App;
@@ -1,15 +0,0 @@
1
- import { h<% if (isTS) { %>, type FunctionalComponent<% } %> } from 'preact';
2
- import { useEffect } from 'preact/hooks';
3
- import styles from './styles.scss';
4
- <% if (isTS) { %>
5
- type ErrorBoxProps = {
6
- error: Error;
7
- }
8
- <% } %>
9
- const ErrorBox<% if (isTS) { %>: FunctionalComponent<ErrorBoxProps><% } %> = ({ error }) => {
10
- useEffect(() => console.log(error), []);
11
-
12
- return <pre className={styles.root}>{`${String(error)}\n\n${error.stack}`}</pre>;
13
- };
14
-
15
- export default ErrorBox;
@@ -1,14 +0,0 @@
1
- import { h } from 'preact';
2
- import render from 'preact-render-to-string';
3
- import htmlLooksLike from 'html-looks-like';
4
-
5
- import Worm from '.';
6
-
7
- describe('Worm', () => {
8
- test('It renders', () => {
9
- const actual = render(<Worm />);
10
- const expected = `<img src="worm.svg">`;
11
-
12
- htmlLooksLike(actual, expected);
13
- });
14
- });
@@ -1,9 +0,0 @@
1
- import { h<% if (isTS) { %>, type FunctionalComponent<% } %> } from 'preact';
2
- import styles from './styles.scss';
3
- import worm from './worm.svg';
4
-
5
- const Worm<% if (isTS) { %>: FunctionalComponent<% } %> = () => {
6
- return <img className={styles.root} src={worm} />;
7
- };
8
-
9
- export default Worm;
@@ -1,42 +0,0 @@
1
- import acto from '@abcnews/alternating-case-to-object';
2
- import { <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %> } from '@abcnews/env-utils';
3
- import { getMountValue, selectMounts } from '@abcnews/mount-utils';<% if (isTS) { %>
4
- import type { Mount } from '@abcnews/mount-utils';<% } %>
5
- import { h, render } from 'preact';
6
- import App from './components/App';<% if (isTS) { %>
7
- import type { AppProps } from './components/App';<% } %>
8
-
9
- let appMountEl<% if (isTS) { %>: Mount<% } %>;
10
- let appProps<% if (isTS) { %>: AppProps<% } %>;
11
-
12
- function renderApp() {
13
- render(<App {...appProps} />, appMountEl);
14
- }
15
-
16
- <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %>.then(() => {
17
- [appMountEl] = selectMounts('<%= projectNameFlat %>');
18
-
19
- if (appMountEl) {
20
- appProps = acto(getMountValue(appMountEl))<% if (isTS) { %> as AppProps<% } %>;
21
- renderApp();
22
- }
23
- });
24
-
25
- if (module.hot) {
26
- module.hot.accept('./components/App', () => {
27
- try {
28
- renderApp();
29
- } catch (err<% if (isTS) { %>: any<% } %>) {
30
- import('./components/ErrorBox').then(({ default: ErrorBox }) => {
31
- if (appMountEl) {
32
- render(<ErrorBox error={err} />, appMountEl);
33
- }
34
- });
35
- }
36
- });
37
- }
38
-
39
- if (process.env.NODE_ENV === 'development') {
40
- require('preact/debug');
41
- console.debug(`[<%= projectName %>] public path: ${__webpack_public_path__}`);
42
- }
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import renderer from 'react-test-renderer';
3
- import App from '.';<% if (isTS) { %>
4
- import type { AppProps } from '.';<% } %>
5
-
6
- describe('App', () => {
7
- test('It renders', () => {
8
- const props<% if (isTS) { %>: AppProps<% } %> = { x: 42, y: 'text', z: true };
9
- const component = renderer.create(<App {...props} />);
10
-
11
- let tree = component.toJSON();
12
- expect(tree).toMatchSnapshot();
13
- });
14
- });
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import Worm from '../Worm';
3
- import styles from './styles.scss';
4
- <% if (isTS) { %>
5
- export type AppProps = {
6
- x: number;
7
- y: string;
8
- z: boolean;
9
- }
10
- <% } %>
11
- const App<% if (isTS) { %>: React.FC<AppProps><% } %> = ({ x, y, z }) => {
12
- return (
13
- <div className={styles.root}>
14
- <Worm />
15
- <pre>{JSON.stringify({ x, y, z })}</pre>
16
- <h1><%= projectName %></h1>
17
- </div>
18
- );
19
- };
20
-
21
- export default App;
@@ -1,14 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import styles from './styles.scss';
3
- <% if (isTS) { %>
4
- type ErrorBoxProps = {
5
- error: Error;
6
- }
7
- <% } %>
8
- const ErrorBox<% if (isTS) { %>: React.FC<ErrorBoxProps><% } %> = ({ error }) => {
9
- useEffect(() => console.log(error), []);
10
-
11
- return <pre className={styles.root}>{`${String(error)}\n\n${error.stack}`}</pre>;
12
- };
13
-
14
- export default ErrorBox;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import renderer from 'react-test-renderer';
3
-
4
- import Worm from '.';
5
-
6
- describe('Worm', () => {
7
- test('It renders', () => {
8
- const component = renderer.create(<Worm />);
9
-
10
- let tree = component.toJSON();
11
- expect(tree).toMatchSnapshot();
12
- });
13
- });
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import styles from './styles.scss';
3
- import worm from './worm.svg';
4
-
5
- const Worm<% if (isTS) { %>: React.FC<% } %> = () => {
6
- return <img className={styles.root} src={worm} />;
7
- };
8
-
9
- export default Worm;
@@ -1,40 +0,0 @@
1
- import acto from '@abcnews/alternating-case-to-object';
2
- import { <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %> } from '@abcnews/env-utils';
3
- import { getMountValue, selectMounts } from '@abcnews/mount-utils';
4
- import React from 'react';
5
- import { createRoot<% if (isTS) { %>, type Root<% } %> } from 'react-dom/client';
6
- import App from './components/App';<% if (isTS) { %>
7
- import type { AppProps } from './components/App';<% } %>
8
-
9
- let root<% if (isTS) { %>: Root<% } %>;
10
- let appProps<% if (isTS) { %>: AppProps<% } %>;
11
-
12
- function renderApp() {
13
- root.render(<App {...appProps} />);
14
- }
15
-
16
- <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %>.then(() => {
17
- const [appMountEl] = selectMounts('<%= projectNameFlat %>');
18
-
19
- if (appMountEl) {
20
- root = createRoot(appMountEl);
21
- appProps = acto(getMountValue(appMountEl))<% if (isTS) { %> as AppProps<% } %>;
22
- renderApp();
23
- }
24
- });
25
-
26
- if (module.hot) {
27
- module.hot.accept('./components/App', () => {
28
- try {
29
- renderApp();
30
- } catch (err<% if (isTS) { %>: any<% } %>) {
31
- import('./components/ErrorBox').then(({ default: ErrorBox }) => {
32
- root.render(<ErrorBox error={err} />);
33
- });
34
- }
35
- });
36
- }
37
-
38
- if (process.env.NODE_ENV === 'development') {
39
- console.debug(`[<%= projectName %>] public path: ${__webpack_public_path__}`);
40
- }
@@ -1,37 +0,0 @@
1
- <script<% if (isTS) { %> lang="ts"<% } %>>
2
- import Worm from '../Worm/Worm.svelte';
3
-
4
- export let x<% if (isTS) { %>: number<% } %>;
5
- export let y<% if (isTS) { %>: string<% } %>;
6
- export let z<% if (isTS) { %>: boolean<% } %>;
7
- </script>
8
-
9
- <div>
10
- <Worm />
11
- <pre>{JSON.stringify({ x, y, z })}</pre>
12
- <h1><%= projectName %></h1>
13
- </div>
14
-
15
- <style lang="scss">
16
- div {
17
- display: flex;
18
- flex-direction: column;
19
- justify-content: center;
20
- align-items: center;
21
- width: 100%;
22
- height: 100%;
23
- min-height: 320px;
24
- background-color: #<% if (isTS) { %>3178c7<% } else { %>f0db4e<% } %>;
25
- color: #<% if (isTS) { %>fff<% } else { %>000<% } %>;
26
- text-align: center;
27
- }
28
-
29
- h1 {
30
- margin: 0;
31
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
32
- font-size: 24px !important;
33
- font-weight: normal !important;
34
- line-height: normal !important;
35
- letter-spacing: normal !important;
36
- }
37
- </style>
@@ -1,18 +0,0 @@
1
- import { render } from '@testing-library/svelte';
2
- import App from './App.svelte';
3
-
4
- const props = { x: 42, y: 'text', z: true };
5
-
6
- describe('App', () => {
7
- it('should render correct contents', () => {
8
- const { container } = render(App, {...props});
9
-
10
- expect(container.textContent).toContain(JSON.stringify(props));
11
- });
12
-
13
- it('renders a snapshot', () => {
14
- const { container } = render(App, {...props});
15
-
16
- expect(container).toMatchSnapshot();
17
- });
18
- });
@@ -1,12 +0,0 @@
1
- <script<% if (isTS) { %> lang="ts"<% } %>>
2
- import worm from './worm.svg';
3
- </script>
4
-
5
- <img src={worm} alt="" />
6
-
7
- <style lang="scss">
8
- img {
9
- width: 240px;
10
- height: auto;
11
- }
12
- </style>
@@ -1,16 +0,0 @@
1
- import { render } from '@testing-library/svelte';
2
- import Worm from './Worm.svelte';
3
-
4
- describe('Worm', () => {
5
- it('should render correct contents', () => {
6
- const { container } = render(Worm);
7
-
8
- expect(container.querySelector('img')).toBeDefined();
9
- });
10
-
11
- it('renders a snapshot', () => {
12
- const { container } = render(Worm);
13
-
14
- expect(container).toMatchSnapshot();
15
- });
16
- });
@@ -1,26 +0,0 @@
1
- import acto from '@abcnews/alternating-case-to-object';
2
- import { <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %> } from '@abcnews/env-utils';
3
- import { getMountValue, selectMounts } from '@abcnews/mount-utils';<% if (isTS) { %>
4
- import type { Mount } from '@abcnews/mount-utils';<% } %>
5
- import App from './components/App/App.svelte';
6
- import { mount } from 'svelte';
7
-
8
- let appMountEl<% if (isTS) { %>: Mount<% } %>;
9
- let appProps;
10
-
11
- <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %>.then(() => {
12
- [appMountEl] = selectMounts('<%= projectNameFlat %>');
13
-
14
- if (appMountEl) {
15
- appProps = acto(getMountValue(appMountEl));
16
-
17
- mount(App, {
18
- target: appMountEl,
19
- props: appProps
20
- });
21
- }
22
- });
23
-
24
- if (process.env.NODE_ENV === 'development') {
25
- console.debug(`[<%= projectName %>] public path: ${__webpack_public_path__}`);
26
- }
@@ -1,13 +0,0 @@
1
- const pack = (module.exports.pack = promise => promise.then(result => [null, result]).catch(err => [err]));
2
-
3
- module.exports.packs = fn => (...fnArgs) => pack(fn(...fnArgs));
4
-
5
- const throws = (module.exports.throws = packed => {
6
- if (packed[0]) {
7
- throw packed[0];
8
- }
9
-
10
- return packed;
11
- });
12
-
13
- module.exports.unpack = (packed, ignoreErrors) => (ignoreErrors ? packed[1] : throws(packed)[1]);
@@ -1,30 +0,0 @@
1
- // Native
2
- const { execSync, spawn } = require('child_process');
3
- const { join } = require('path');
4
-
5
- const ANNOUNCEMENT_FILENAME = join(__dirname, '../../assets/done.mp3');
6
-
7
- function has(cmd) {
8
- try {
9
- execSync('which ' + cmd + ' 2>/dev/null 2>/dev/null');
10
- return true;
11
- } catch (err) {
12
- return false;
13
- }
14
- }
15
-
16
- module.exports.announce = () => {
17
- const args = [ANNOUNCEMENT_FILENAME];
18
- let bin = 'play';
19
-
20
- if (process.platform == 'darwin') {
21
- bin = 'afplay';
22
- }
23
-
24
- if (has('mplayer')) {
25
- bin = 'mplayer';
26
- args.unshift('-really-quiet');
27
- }
28
-
29
- spawn(bin, args);
30
- };