@abcnews/aunty 16.0.1 → 17.0.0-next.2

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 (104) hide show
  1. package/README.md +1 -160
  2. package/package.json +39 -82
  3. package/src/bin/aunty.ts +60 -0
  4. package/assets/done.mp3 +0 -0
  5. package/scripts/postinstall.js +0 -44
  6. package/src/api/index.js +0 -5
  7. package/src/bin/aunty.js +0 -27
  8. package/src/cli/build/constants.js +0 -46
  9. package/src/cli/build/index.js +0 -100
  10. package/src/cli/clean/constants.js +0 -10
  11. package/src/cli/clean/index.js +0 -40
  12. package/src/cli/constants.js +0 -114
  13. package/src/cli/deploy/constants.js +0 -40
  14. package/src/cli/deploy/index.js +0 -151
  15. package/src/cli/generate/constants.js +0 -39
  16. package/src/cli/generate/index.js +0 -72
  17. package/src/cli/index.js +0 -154
  18. package/src/cli/release/constants.js +0 -67
  19. package/src/cli/release/index.js +0 -162
  20. package/src/cli/serve/constants.js +0 -33
  21. package/src/cli/serve/index.js +0 -128
  22. package/src/cli/sign-cert/constants.js +0 -42
  23. package/src/cli/sign-cert/index.js +0 -50
  24. package/src/cli/test/constants.js +0 -15
  25. package/src/cli/test/index.js +0 -30
  26. package/src/config/babel.js +0 -75
  27. package/src/config/build.js +0 -39
  28. package/src/config/deploy.js +0 -143
  29. package/src/config/jest/index.js +0 -20
  30. package/src/config/jest/transformer-default.js +0 -27
  31. package/src/config/jest/transformer-svelte-preprocess.js +0 -8
  32. package/src/config/jest/transformer-svelte.js +0 -32
  33. package/src/config/project.js +0 -57
  34. package/src/config/serve.js +0 -144
  35. package/src/config/webpack.js +0 -325
  36. package/src/config/webpackDevServer.js +0 -46
  37. package/src/constants.js +0 -7
  38. package/src/generators/component/index.js +0 -172
  39. package/src/generators/component/templates/_non_sfc/styles.scss +0 -6
  40. package/src/generators/component/templates/basic/component-with-d3.test.ts +0 -7
  41. package/src/generators/component/templates/basic/component-with-d3.ts +0 -30
  42. package/src/generators/component/templates/basic/component.test.ts +0 -7
  43. package/src/generators/component/templates/basic/component.ts +0 -11
  44. package/src/generators/component/templates/preact/component-with-d3.test.tsx +0 -16
  45. package/src/generators/component/templates/preact/component-with-d3.tsx +0 -45
  46. package/src/generators/component/templates/preact/component.test.tsx +0 -18
  47. package/src/generators/component/templates/preact/component.tsx +0 -14
  48. package/src/generators/component/templates/react/component-with-d3.test.tsx +0 -13
  49. package/src/generators/component/templates/react/component-with-d3.tsx +0 -44
  50. package/src/generators/component/templates/react/component.test.tsx +0 -13
  51. package/src/generators/component/templates/react/component.tsx +0 -14
  52. package/src/generators/component/templates/svelte/component-with-d3.svelte +0 -46
  53. package/src/generators/component/templates/svelte/component-with-d3.test.ts +0 -10
  54. package/src/generators/component/templates/svelte/component.svelte +0 -17
  55. package/src/generators/component/templates/svelte/component.test.ts +0 -10
  56. package/src/generators/project/index.js +0 -244
  57. package/src/generators/project/templates/_common/.editorconfig +0 -12
  58. package/src/generators/project/templates/_common/.prettierrc +0 -6
  59. package/src/generators/project/templates/_common/LICENSE +0 -21
  60. package/src/generators/project/templates/_common/README.md +0 -3
  61. package/src/generators/project/templates/_common/_.gitignore +0 -12
  62. package/src/generators/project/templates/_common/package.json +0 -18
  63. package/src/generators/project/templates/_common/public/index.html +0 -21
  64. package/src/generators/project/templates/_common/src/components/Worm/worm.svg +0 -4
  65. package/src/generators/project/templates/_common/tsconfig.json +0 -4
  66. package/src/generators/project/templates/_non_sfc/src/components/App/styles.scss +0 -23
  67. package/src/generators/project/templates/_non_sfc/src/components/ErrorBox/styles.scss +0 -16
  68. package/src/generators/project/templates/_non_sfc/src/components/Worm/styles.scss +0 -4
  69. package/src/generators/project/templates/basic/src/components/App/index.test.ts +0 -9
  70. package/src/generators/project/templates/basic/src/components/App/index.ts +0 -22
  71. package/src/generators/project/templates/basic/src/components/ErrorBox/index.ts +0 -24
  72. package/src/generators/project/templates/basic/src/components/Worm/index.test.ts +0 -7
  73. package/src/generators/project/templates/basic/src/components/Worm/index.ts +0 -12
  74. package/src/generators/project/templates/basic/src/index.ts +0 -50
  75. package/src/generators/project/templates/preact/src/components/App/index.test.tsx +0 -21
  76. package/src/generators/project/templates/preact/src/components/App/index.tsx +0 -21
  77. package/src/generators/project/templates/preact/src/components/ErrorBox/index.tsx +0 -15
  78. package/src/generators/project/templates/preact/src/components/Worm/index.test.tsx +0 -14
  79. package/src/generators/project/templates/preact/src/components/Worm/index.tsx +0 -9
  80. package/src/generators/project/templates/preact/src/index.tsx +0 -42
  81. package/src/generators/project/templates/react/src/components/App/index.test.tsx +0 -14
  82. package/src/generators/project/templates/react/src/components/App/index.tsx +0 -21
  83. package/src/generators/project/templates/react/src/components/ErrorBox/index.tsx +0 -14
  84. package/src/generators/project/templates/react/src/components/Worm/index.test.tsx +0 -13
  85. package/src/generators/project/templates/react/src/components/Worm/index.tsx +0 -9
  86. package/src/generators/project/templates/react/src/index.tsx +0 -40
  87. package/src/generators/project/templates/svelte/src/components/App/App.svelte +0 -37
  88. package/src/generators/project/templates/svelte/src/components/App/App.test.ts +0 -18
  89. package/src/generators/project/templates/svelte/src/components/Worm/Worm.svelte +0 -12
  90. package/src/generators/project/templates/svelte/src/components/Worm/Worm.test.ts +0 -16
  91. package/src/generators/project/templates/svelte/src/index.ts +0 -26
  92. package/src/utils/async.js +0 -13
  93. package/src/utils/audio.js +0 -30
  94. package/src/utils/branding.js +0 -57
  95. package/src/utils/color.js +0 -12
  96. package/src/utils/ftp.js +0 -80
  97. package/src/utils/git.js +0 -127
  98. package/src/utils/logging.js +0 -74
  99. package/src/utils/npm.js +0 -59
  100. package/src/utils/remote.js +0 -81
  101. package/src/utils/structures.js +0 -33
  102. package/src/utils/text.js +0 -64
  103. package/ts/config.json +0 -22
  104. package/ts/custom.d.ts +0 -120
@@ -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
- };
@@ -1,57 +0,0 @@
1
- // Ours
2
- const { blue, cyan, dim, green, hvy, magenta, red, yellow } = require('./color');
3
- const { zipTemplateLiterals } = require('./text');
4
-
5
- const COLORS = [blue, cyan, green, magenta, yellow];
6
-
7
- function pickRandomColor() {
8
- return COLORS[Math.floor(Math.random() * COLORS.length)];
9
- }
10
-
11
- const createLogo = (module.exports.createLogo = color =>
12
- (color || pickRandomColor())(`
13
- ⣾${dim('⢷')}⡾⢷${dim('⡾')}⣷
14
- ⢿⡾${dim('⢷⡾')}⢷⡿ `));
15
-
16
- module.exports.createCommandLogo = (commandName, isDry) =>
17
- zipTemplateLiterals([
18
- createLogo(),
19
- `
20
- ${dim('aunty')}
21
- ${hvy(commandName)}${isDry ? ` ${cyan('[dry]')}` : ''}`
22
- ]);
23
-
24
- module.exports.createErrorLogo = () =>
25
- zipTemplateLiterals([
26
- createLogo(red),
27
- `
28
- ${red(dim('ERROR'))}
29
- ${red(hvy('ЯOЯЯƎ'))}`
30
- ]);
31
-
32
- module.exports.SPINNER_FRAMES = [
33
- '⣏⠀⠀',
34
- '⡟⠀⠀',
35
- '⠟⠄⠀',
36
- '⠛⡄⠀',
37
- '⠙⣄⠀',
38
- '⠘⣤⠀',
39
- '⠐⣤⠂',
40
- '⠀⣤⠃',
41
- '⠀⣠⠋',
42
- '⠀⢠⠛',
43
- '⠀⠠⠻',
44
- '⠀⠀⢻',
45
- '⠀⠀⣹',
46
- '⠀⠀⣼',
47
- '⠀⠐⣴',
48
- '⠀⠘⣤',
49
- '⠀⠙⣄',
50
- '⠀⠛⡄',
51
- '⠠⠛⠄',
52
- '⢠⠛⠀',
53
- '⣠⠋⠀',
54
- '⣤⠃⠀',
55
- '⣦⠂⠀',
56
- '⣧⠀⠀'
57
- ];
@@ -1,12 +0,0 @@
1
- // External
2
- const chalk = require('chalk');
3
-
4
- module.exports = Object.assign(chalk, {
5
- bad: chalk.red,
6
- cmd: chalk.yellow,
7
- hvy: chalk.bold,
8
- ok: chalk.green,
9
- opt: chalk.cyan,
10
- req: chalk.magenta,
11
- sec: chalk.bold.underline
12
- });
package/src/utils/ftp.js DELETED
@@ -1,80 +0,0 @@
1
- // External
2
- const ftp = require('basic-ftp');
3
- const { to: wrap } = require('await-to-js');
4
- const { probe } = require('tcp-ping-sync');
5
-
6
- const { addProfileProperties, addKnownProfileProperties } = require('../config/deploy');
7
- const { INTERNAL_TEST_HOST } = require('../constants');
8
-
9
- /**
10
- * Check if a project exists on FTP
11
- * @param {string} projectNameSlug
12
- * @returns {Promise<boolean>}
13
- */
14
- const projectExists = async projectNameSlug => {
15
- // If not on internal network FTP won't connect, so bail out
16
- const isOnInternalNetwork = probe(INTERNAL_TEST_HOST);
17
- if (!isOnInternalNetwork) throw new Error('Not on internal network');
18
-
19
- const config = addProfileProperties(addKnownProfileProperties({}));
20
- const { host, username: user, password, to } = config;
21
- const [baseDir] = to.split('<name>');
22
-
23
- if (!host || !user || !password) throw new Error('Missing FTP credentials');
24
-
25
- const client = new ftp.Client();
26
-
27
- try {
28
- await client.access({
29
- host,
30
- user,
31
- password,
32
- secure: false
33
- });
34
- await client.cd(baseDir);
35
- const list = await client.list();
36
-
37
- for (const item of list) {
38
- if (projectNameSlug === item.name) return true;
39
- }
40
- } catch (err) {
41
- throw err;
42
- }
43
-
44
- client.close();
45
-
46
- return false;
47
- };
48
-
49
- /**
50
- * Quick FTP check if deployment dir exists
51
- * @param {string} deployToDir - Remote dir to check
52
- * @returns {Promise<boolean>}
53
- */
54
- const deploymentExists = async deployToDir => {
55
- const config = addProfileProperties(addKnownProfileProperties({}));
56
- const { host, username: user, password, to } = config;
57
-
58
- const client = new ftp.Client();
59
-
60
- const [accessErr] = await wrap(
61
- client.access({
62
- host,
63
- user,
64
- password,
65
- secure: false
66
- })
67
- );
68
- if (accessErr) throw accessErr;
69
-
70
- const [cdError] = await wrap(client.cd(deployToDir));
71
- if (cdError) {
72
- throw cdError;
73
- }
74
-
75
- client.close();
76
-
77
- return false;
78
- };
79
-
80
- module.exports = { projectExists, deploymentExists };