@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.
- package/README.md +1 -160
- package/package.json +39 -82
- package/src/bin/aunty.ts +60 -0
- package/assets/done.mp3 +0 -0
- package/scripts/postinstall.js +0 -44
- package/src/api/index.js +0 -5
- package/src/bin/aunty.js +0 -27
- package/src/cli/build/constants.js +0 -46
- package/src/cli/build/index.js +0 -100
- package/src/cli/clean/constants.js +0 -10
- package/src/cli/clean/index.js +0 -40
- package/src/cli/constants.js +0 -114
- package/src/cli/deploy/constants.js +0 -40
- package/src/cli/deploy/index.js +0 -151
- package/src/cli/generate/constants.js +0 -39
- package/src/cli/generate/index.js +0 -72
- package/src/cli/index.js +0 -154
- package/src/cli/release/constants.js +0 -67
- package/src/cli/release/index.js +0 -162
- package/src/cli/serve/constants.js +0 -33
- package/src/cli/serve/index.js +0 -128
- package/src/cli/sign-cert/constants.js +0 -42
- package/src/cli/sign-cert/index.js +0 -50
- package/src/cli/test/constants.js +0 -15
- package/src/cli/test/index.js +0 -30
- package/src/config/babel.js +0 -75
- package/src/config/build.js +0 -39
- package/src/config/deploy.js +0 -143
- package/src/config/jest/index.js +0 -20
- package/src/config/jest/transformer-default.js +0 -27
- package/src/config/jest/transformer-svelte-preprocess.js +0 -8
- package/src/config/jest/transformer-svelte.js +0 -32
- package/src/config/project.js +0 -57
- package/src/config/serve.js +0 -144
- package/src/config/webpack.js +0 -325
- package/src/config/webpackDevServer.js +0 -46
- package/src/constants.js +0 -7
- package/src/generators/component/index.js +0 -172
- package/src/generators/component/templates/_non_sfc/styles.scss +0 -6
- package/src/generators/component/templates/basic/component-with-d3.test.ts +0 -7
- package/src/generators/component/templates/basic/component-with-d3.ts +0 -30
- package/src/generators/component/templates/basic/component.test.ts +0 -7
- package/src/generators/component/templates/basic/component.ts +0 -11
- package/src/generators/component/templates/preact/component-with-d3.test.tsx +0 -16
- package/src/generators/component/templates/preact/component-with-d3.tsx +0 -45
- package/src/generators/component/templates/preact/component.test.tsx +0 -18
- package/src/generators/component/templates/preact/component.tsx +0 -14
- package/src/generators/component/templates/react/component-with-d3.test.tsx +0 -13
- package/src/generators/component/templates/react/component-with-d3.tsx +0 -44
- package/src/generators/component/templates/react/component.test.tsx +0 -13
- package/src/generators/component/templates/react/component.tsx +0 -14
- package/src/generators/component/templates/svelte/component-with-d3.svelte +0 -46
- package/src/generators/component/templates/svelte/component-with-d3.test.ts +0 -10
- package/src/generators/component/templates/svelte/component.svelte +0 -17
- package/src/generators/component/templates/svelte/component.test.ts +0 -10
- package/src/generators/project/index.js +0 -244
- package/src/generators/project/templates/_common/.editorconfig +0 -12
- package/src/generators/project/templates/_common/.prettierrc +0 -6
- package/src/generators/project/templates/_common/LICENSE +0 -21
- package/src/generators/project/templates/_common/README.md +0 -3
- package/src/generators/project/templates/_common/_.gitignore +0 -12
- package/src/generators/project/templates/_common/package.json +0 -18
- package/src/generators/project/templates/_common/public/index.html +0 -21
- package/src/generators/project/templates/_common/src/components/Worm/worm.svg +0 -4
- package/src/generators/project/templates/_common/tsconfig.json +0 -4
- package/src/generators/project/templates/_non_sfc/src/components/App/styles.scss +0 -23
- package/src/generators/project/templates/_non_sfc/src/components/ErrorBox/styles.scss +0 -16
- package/src/generators/project/templates/_non_sfc/src/components/Worm/styles.scss +0 -4
- package/src/generators/project/templates/basic/src/components/App/index.test.ts +0 -9
- package/src/generators/project/templates/basic/src/components/App/index.ts +0 -22
- package/src/generators/project/templates/basic/src/components/ErrorBox/index.ts +0 -24
- package/src/generators/project/templates/basic/src/components/Worm/index.test.ts +0 -7
- package/src/generators/project/templates/basic/src/components/Worm/index.ts +0 -12
- package/src/generators/project/templates/basic/src/index.ts +0 -50
- package/src/generators/project/templates/preact/src/components/App/index.test.tsx +0 -21
- package/src/generators/project/templates/preact/src/components/App/index.tsx +0 -21
- package/src/generators/project/templates/preact/src/components/ErrorBox/index.tsx +0 -15
- package/src/generators/project/templates/preact/src/components/Worm/index.test.tsx +0 -14
- package/src/generators/project/templates/preact/src/components/Worm/index.tsx +0 -9
- package/src/generators/project/templates/preact/src/index.tsx +0 -42
- package/src/generators/project/templates/react/src/components/App/index.test.tsx +0 -14
- package/src/generators/project/templates/react/src/components/App/index.tsx +0 -21
- package/src/generators/project/templates/react/src/components/ErrorBox/index.tsx +0 -14
- package/src/generators/project/templates/react/src/components/Worm/index.test.tsx +0 -13
- package/src/generators/project/templates/react/src/components/Worm/index.tsx +0 -9
- package/src/generators/project/templates/react/src/index.tsx +0 -40
- package/src/generators/project/templates/svelte/src/components/App/App.svelte +0 -37
- package/src/generators/project/templates/svelte/src/components/App/App.test.ts +0 -18
- package/src/generators/project/templates/svelte/src/components/Worm/Worm.svelte +0 -12
- package/src/generators/project/templates/svelte/src/components/Worm/Worm.test.ts +0 -16
- package/src/generators/project/templates/svelte/src/index.ts +0 -26
- package/src/utils/async.js +0 -13
- package/src/utils/audio.js +0 -30
- package/src/utils/branding.js +0 -57
- package/src/utils/color.js +0 -12
- package/src/utils/ftp.js +0 -80
- package/src/utils/git.js +0 -127
- package/src/utils/logging.js +0 -74
- package/src/utils/npm.js +0 -59
- package/src/utils/remote.js +0 -81
- package/src/utils/structures.js +0 -33
- package/src/utils/text.js +0 -64
- package/ts/config.json +0 -22
- package/ts/custom.d.ts +0 -120
package/src/utils/git.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
// Native
|
|
2
|
-
const { spawnSync } = require('child_process');
|
|
3
|
-
|
|
4
|
-
// External
|
|
5
|
-
const execa = require('execa');
|
|
6
|
-
const fetch = require('node-fetch');
|
|
7
|
-
const { compare, valid } = require('semver');
|
|
8
|
-
|
|
9
|
-
// Ours
|
|
10
|
-
const { pack } = require('./async');
|
|
11
|
-
const { spin } = require('./logging');
|
|
12
|
-
const { combine } = require('./structures');
|
|
13
|
-
|
|
14
|
-
const PATTERNS = {
|
|
15
|
-
ACTIVE_BRANCH: /\*\s+([^\n]+)/,
|
|
16
|
-
REMOTE_HEAD_BRANCH: /HEAD branch: ([\w-]+)/,
|
|
17
|
-
DETACHED_HEAD: /\(HEAD detached at ([\w]+)\)/
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const GIT_DEFAULT_INIT_DEFAULT_BRANCH = 'master';
|
|
21
|
-
|
|
22
|
-
function git(args = [], options = {}) {
|
|
23
|
-
args = typeof args === 'string' ? args.split(' ') : args;
|
|
24
|
-
|
|
25
|
-
return execa('git', args, options);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const GIT_SYNC_DEFAULTS = {
|
|
29
|
-
encoding: 'utf-8'
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
function gitSync(args = '', options = {}) {
|
|
33
|
-
args = typeof args === 'string' ? args.split(' ') : args;
|
|
34
|
-
|
|
35
|
-
return spawnSync('git', args, combine(GIT_SYNC_DEFAULTS, options));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports.isRepo = async () => !(await pack(git('rev-parse --git-dir')))[0];
|
|
39
|
-
|
|
40
|
-
module.exports.isRepoSync = () => !gitSync('rev-parse --git-dir').stderr;
|
|
41
|
-
|
|
42
|
-
const getConfigValue = (module.exports.getConfigValue = async key => (await git(`config --get ${key}`)).stdout);
|
|
43
|
-
|
|
44
|
-
const getRemotes = (module.exports.getRemotes = async () =>
|
|
45
|
-
new Set((await git('remote')).stdout.split('\n').filter(x => x)));
|
|
46
|
-
|
|
47
|
-
module.exports.hasChanges = async () => (await git('status -s')).stdout.length > 0;
|
|
48
|
-
|
|
49
|
-
const _parseLabel = stdout => {
|
|
50
|
-
const [, branch] = stdout.match(PATTERNS.ACTIVE_BRANCH) || [null, 'uncommitted'];
|
|
51
|
-
const [, detachedHeadCommit] = branch.match(PATTERNS.DETACHED_HEAD) || [];
|
|
52
|
-
|
|
53
|
-
return detachedHeadCommit || branch;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
module.exports.getCurrentLabel = async () => {
|
|
57
|
-
return _parseLabel((await git('branch')).stdout);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
module.exports.getCurrentLabelSync = () => {
|
|
61
|
-
return _parseLabel(gitSync('branch').stdout);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
module.exports.commitAll = message => git(['commit', '-a', '-m', `${message}`]);
|
|
65
|
-
|
|
66
|
-
module.exports.push = () => git('push');
|
|
67
|
-
|
|
68
|
-
module.exports.createTag = tag => git(['tag', '-a', tag, '-m', `Tagging version ${tag}`]);
|
|
69
|
-
|
|
70
|
-
module.exports.pushTag = (remote, tag) => git(['push', remote, tag]);
|
|
71
|
-
|
|
72
|
-
module.exports.createRepo = async cwd => {
|
|
73
|
-
await git('init', { cwd });
|
|
74
|
-
await git('add .', { cwd });
|
|
75
|
-
return git(['commit', '-m', 'Initial commit'], { cwd });
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Look up the current package.json version of a repo's default branch
|
|
80
|
-
*/
|
|
81
|
-
module.exports.getGithubVersion = async (repo, defaultBranch) => {
|
|
82
|
-
const spinner = spin(`Fetching latest version of ${repo}`);
|
|
83
|
-
const p = await fetch(`https://raw.githubusercontent.com/${repo}/${defaultBranch}/package.json`).then(r => r.json());
|
|
84
|
-
|
|
85
|
-
spinner.stop();
|
|
86
|
-
|
|
87
|
-
return p.version;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
module.exports.getDefaultBranch = async remote => {
|
|
91
|
-
const remotes = await getRemotes();
|
|
92
|
-
let localDefaultBranch;
|
|
93
|
-
|
|
94
|
-
if (remotes.has(remote)) {
|
|
95
|
-
// If we have a valid remote, find out which local branch is configured to pull from the remote default branch
|
|
96
|
-
try {
|
|
97
|
-
const remoteShowStdout = (await git(`remote show ${remote}`)).stdout;
|
|
98
|
-
const remoteDefaultBranch = (remoteShowStdout.match(PATTERNS.REMOTE_HEAD_BRANCH) || [])[1];
|
|
99
|
-
if (remoteDefaultBranch) {
|
|
100
|
-
localDefaultBranch = (remoteShowStdout.match(
|
|
101
|
-
new RegExp(`([\\w-]+)\\s+merges with remote ${remoteDefaultBranch}`)
|
|
102
|
-
) || [])[1];
|
|
103
|
-
}
|
|
104
|
-
} catch (err) {}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (!localDefaultBranch) {
|
|
108
|
-
// git v2.28 allows you to set `init.defaultBranch` in your global config.
|
|
109
|
-
// Assume we used this for our local branch (before we set up a remote)
|
|
110
|
-
try {
|
|
111
|
-
localDefaultBranch = (await getConfigValue(`--global init.defaultBranch`)).trim();
|
|
112
|
-
} catch (err) {}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Return a determined local default branch or git's default branch name (master, for now)
|
|
116
|
-
return localDefaultBranch || GIT_DEFAULT_INIT_DEFAULT_BRANCH;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
module.exports.getSemverTags = async () => (await git('tag')).stdout.split('\n').filter(valid).sort(compare);
|
|
120
|
-
|
|
121
|
-
const hasTag = async tag => !(await pack(git(`show-ref --tags --verify refs/tags/${tag}`)))[0];
|
|
122
|
-
|
|
123
|
-
module.exports.getChangelog = async tag =>
|
|
124
|
-
(await git(`log ${(await hasTag(tag)) ? `${tag}..HEAD ` : ''}--oneline --color`)).stdout
|
|
125
|
-
.split('\n')
|
|
126
|
-
.filter(x => x)
|
|
127
|
-
.reverse();
|
package/src/utils/logging.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// Global
|
|
2
|
-
const { error, log, time, timeEnd } = console;
|
|
3
|
-
|
|
4
|
-
// Native
|
|
5
|
-
const { inspect } = require('util');
|
|
6
|
-
|
|
7
|
-
// External
|
|
8
|
-
const logSymbols = require('log-symbols');
|
|
9
|
-
const ora = require('ora');
|
|
10
|
-
|
|
11
|
-
// Ours
|
|
12
|
-
const { SPINNER_FRAMES } = require('./branding');
|
|
13
|
-
const { cmd, opt, sec } = require('./color');
|
|
14
|
-
|
|
15
|
-
inspect.styles.name = 'blue';
|
|
16
|
-
|
|
17
|
-
const DEBUG_SYMBOL = cmd('»');
|
|
18
|
-
const UTIL_INSPECT_OPTIONS = { colors: true, depth: null };
|
|
19
|
-
|
|
20
|
-
module.exports.debug = (...args) => log(...[DEBUG_SYMBOL].concat(args));
|
|
21
|
-
module.exports.error = (...args) => error(...[logSymbols.error].concat(args));
|
|
22
|
-
module.exports.info = (...args) => log(...[logSymbols.info].concat(args));
|
|
23
|
-
module.exports.log = log;
|
|
24
|
-
module.exports.success = (...args) => log(...[logSymbols.success].concat(args));
|
|
25
|
-
module.exports.warn = (...args) => error(...[logSymbols.warning].concat(args));
|
|
26
|
-
|
|
27
|
-
module.exports.timer = name => {
|
|
28
|
-
const label = `${DEBUG_SYMBOL} ${opt(name)} time`;
|
|
29
|
-
|
|
30
|
-
time(label);
|
|
31
|
-
|
|
32
|
-
return () => timeEnd(label);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Can be used as a funtion or a tagged template literal;
|
|
36
|
-
const pretty = (module.exports.pretty = (inputs, ...values) => {
|
|
37
|
-
if (values.length === 0 || !Array.isArray(inputs) || inputs.filter(str => typeof str !== 'string').length > 0) {
|
|
38
|
-
values = [...arguments];
|
|
39
|
-
inputs = values.map(() => '');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const pairWithValue = (str, index) => {
|
|
43
|
-
const value = values[index];
|
|
44
|
-
const valueStr = value == null ? '' : typeof value === 'string' ? value : inspect(value, UTIL_INSPECT_OPTIONS);
|
|
45
|
-
|
|
46
|
-
return str + valueStr;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return inputs.map(pairWithValue).join('');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
module.exports.dry = config => {
|
|
53
|
-
Object.keys(config).forEach(key =>
|
|
54
|
-
log(
|
|
55
|
-
`${opt('[dry]')} ${sec(key)}
|
|
56
|
-
|
|
57
|
-
${pretty`${config[key]}`}
|
|
58
|
-
`
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
module.exports.spin = (text, { color = 'cyan', frames = SPINNER_FRAMES } = {}) => {
|
|
64
|
-
const spinner = ora({
|
|
65
|
-
color,
|
|
66
|
-
spinner: {
|
|
67
|
-
frames,
|
|
68
|
-
interval: 80
|
|
69
|
-
},
|
|
70
|
-
text
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return spinner.start();
|
|
74
|
-
};
|
package/src/utils/npm.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Native
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
// External
|
|
5
|
-
const execa = require('execa');
|
|
6
|
-
|
|
7
|
-
// Ours
|
|
8
|
-
const { getProjectConfig } = require('../config/project');
|
|
9
|
-
const { SPINNER_FRAMES } = require('./branding');
|
|
10
|
-
const { bgRed, cmd, ok } = require('./color');
|
|
11
|
-
const { log: _log, spin } = require('./logging');
|
|
12
|
-
|
|
13
|
-
const NPM_INSTALL_SPINNER_FRAMES = SPINNER_FRAMES.map(x => ` ${cmd(x)}`);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Take a list of dependencies and filter out any that are already in the package.json
|
|
17
|
-
* @param {Array} dependencies
|
|
18
|
-
* @param {boolean} isDev
|
|
19
|
-
*/
|
|
20
|
-
const onlyNewDependencies = (dependencies, isDev) => {
|
|
21
|
-
try {
|
|
22
|
-
const { pkg } = getProjectConfig();
|
|
23
|
-
const existingDependencies = Object.keys(pkg[isDev ? 'devDependencies' : 'dependencies...']);
|
|
24
|
-
|
|
25
|
-
return dependencies.filter(dep => !existingDependencies.includes(dep) && dep !== null);
|
|
26
|
-
} catch (ex) {
|
|
27
|
-
// nothing
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return dependencies;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Install dependencies (only if needed)
|
|
35
|
-
* @param {Array} dependencies
|
|
36
|
-
* @param {Array} args
|
|
37
|
-
*/
|
|
38
|
-
module.exports.installDependencies = async (dependencies, args, log = _log) => {
|
|
39
|
-
args = args || [];
|
|
40
|
-
dependencies = onlyNewDependencies(dependencies, args.includes('--save-dev'));
|
|
41
|
-
|
|
42
|
-
if (dependencies.length === 0) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const spinner = spin(
|
|
47
|
-
`${bgRed.white('npm')} installing ${dependencies.length}${
|
|
48
|
-
args.includes('--save-dev') ? ' development' : ''
|
|
49
|
-
} dependenc${dependencies.length == 1 ? 'y' : 'ies'}`,
|
|
50
|
-
{ frames: NPM_INSTALL_SPINNER_FRAMES }
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
args = ['install', '--silent', '--no-progress'].concat(args).concat(dependencies);
|
|
54
|
-
|
|
55
|
-
await execa('npm', args);
|
|
56
|
-
|
|
57
|
-
spinner.stop();
|
|
58
|
-
dependencies.forEach(x => log(`${ok('installed')} ${x}`));
|
|
59
|
-
};
|
package/src/utils/remote.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// External
|
|
2
|
-
const importLazy = require('import-lazy')(require);
|
|
3
|
-
const FTPDeploy = importLazy('ftp-deploy');
|
|
4
|
-
const pify = importLazy('pify');
|
|
5
|
-
const rsyncwrapper = importLazy('rsyncwrapper');
|
|
6
|
-
|
|
7
|
-
// Ours
|
|
8
|
-
const { packs } = require('./async');
|
|
9
|
-
const { dim } = require('./color');
|
|
10
|
-
const { combine } = require('./structures');
|
|
11
|
-
const { padLeft } = require('./text');
|
|
12
|
-
|
|
13
|
-
const DEFAULT_FTP_CONFIG = {
|
|
14
|
-
port: 21
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const DEFAULT_RSYNC_CONFIG = {
|
|
18
|
-
ssh: true,
|
|
19
|
-
recursive: true
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
module.exports.ftp = packs(
|
|
23
|
-
({ files, from, host, password, port, to, username }, spinner) =>
|
|
24
|
-
new Promise((resolve, reject) => {
|
|
25
|
-
const ftpDeploy = new FTPDeploy();
|
|
26
|
-
const originalSpinnerText = spinner ? spinner.text : null;
|
|
27
|
-
|
|
28
|
-
if (spinner) {
|
|
29
|
-
ftpDeploy.on('uploaded', data => {
|
|
30
|
-
const numFilesTransferred = data.transferredFileCount - 1; // `ftp-deploy` starts counting from 1 for some reason
|
|
31
|
-
const filesTransferred = padLeft(numFilesTransferred, data.totalFilesCount.toString().length, ' ');
|
|
32
|
-
const filename = numFilesTransferred === data.totalFilesCount ? '' : ` ${data.filename}`;
|
|
33
|
-
|
|
34
|
-
spinner.text = `${originalSpinnerText} ${dim(`(${filesTransferred}/${data.totalFilesCount})${filename}`)}`;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// [1] The `ftp-deploy` package logs when it connects, and doesn't allow us to
|
|
39
|
-
// make it quiet. While this task runs, temporarily re-map `console.log`.
|
|
40
|
-
const _log = console.log;
|
|
41
|
-
console.log = () => {};
|
|
42
|
-
|
|
43
|
-
ftpDeploy.deploy(
|
|
44
|
-
combine(DEFAULT_FTP_CONFIG, {
|
|
45
|
-
host,
|
|
46
|
-
port: port || 21,
|
|
47
|
-
user: username,
|
|
48
|
-
password,
|
|
49
|
-
localRoot: from,
|
|
50
|
-
remoteRoot: to,
|
|
51
|
-
include: [files],
|
|
52
|
-
exclude: [],
|
|
53
|
-
deleteRoot: false
|
|
54
|
-
}),
|
|
55
|
-
err => {
|
|
56
|
-
// * [1]
|
|
57
|
-
console.log = _log;
|
|
58
|
-
|
|
59
|
-
if (err) {
|
|
60
|
-
return reject(err);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (spinner) {
|
|
64
|
-
spinner.text = originalSpinnerText;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return resolve();
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
})
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
module.exports.rsync = packs(({ files, from, host, to, username }) =>
|
|
74
|
-
pify(rsyncwrapper)(
|
|
75
|
-
combine(DEFAULT_RSYNC_CONFIG, {
|
|
76
|
-
src: `${from}/${Array.isArray(files) ? files[0] : files}`,
|
|
77
|
-
dest: `${username}@${host}:${to}`,
|
|
78
|
-
args: [`--rsync-path="mkdir -p ${to} && rsync"`]
|
|
79
|
-
})
|
|
80
|
-
)
|
|
81
|
-
);
|
package/src/utils/structures.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const deepmerge = require('deepmerge');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Merge a function or object into the target object
|
|
5
|
-
* @param target an object to merge into
|
|
6
|
-
* @param source an object to merge with `target`, or a function that takes `target` as an argument
|
|
7
|
-
* @param isDeep use deepmerge to merge
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
const combine = (target, source, isDeep) =>
|
|
11
|
-
typeof source === 'function'
|
|
12
|
-
? source(target)
|
|
13
|
-
: typeof source === 'object'
|
|
14
|
-
? isDeep === true
|
|
15
|
-
? deepmerge(target, source, { clone: false })
|
|
16
|
-
: Object.assign(target, source)
|
|
17
|
-
: target;
|
|
18
|
-
|
|
19
|
-
const combineDeep = (memo, source) => combine(memo, source, true);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Shallow merge an array of objects. Earlier values overwritten by later values
|
|
23
|
-
* @param sources Array of objects and functions to be merged using `combine`
|
|
24
|
-
* @see combine
|
|
25
|
-
*/
|
|
26
|
-
module.exports.combine = (...sources) => sources.reduce(combine, {});
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Deep merge an array of objects. Earlier values overwritten by later values.
|
|
30
|
-
* @param sources Array of objects and functions to be merged using `combine`
|
|
31
|
-
* @see combine
|
|
32
|
-
*/
|
|
33
|
-
module.exports.merge = (...sources) => sources.reduce(combineDeep, {});
|
package/src/utils/text.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const EMPTY = '';
|
|
2
|
-
const NEWLINE = '\n';
|
|
3
|
-
const SLASH = '/';
|
|
4
|
-
const SPACE = ' ';
|
|
5
|
-
|
|
6
|
-
const identity = x => x;
|
|
7
|
-
|
|
8
|
-
const getLongest = items => items.reduce((a, b) => (a.length > b.length ? a : b));
|
|
9
|
-
|
|
10
|
-
module.exports.indented = (str, indent = 2) => str.split(`${NEWLINE}`).join(`${NEWLINE}${SPACE.repeat(indent)}`);
|
|
11
|
-
|
|
12
|
-
module.exports.bulleted = strs => strs.map(str => `• ${str}`).join(NEWLINE);
|
|
13
|
-
|
|
14
|
-
module.exports.inlineList = strs =>
|
|
15
|
-
strs.reduce((acc, str, index) => [acc, str].join(index === strs.length - 1 ? ' & ' : ', '));
|
|
16
|
-
|
|
17
|
-
const padding = (module.exports.padding = (str, len, char = SPACE) =>
|
|
18
|
-
char.repeat(len > str.length ? len - str.length : 0));
|
|
19
|
-
|
|
20
|
-
module.exports.padLeft = (str, len, char = SPACE) => padding(str, len, char) + String(str);
|
|
21
|
-
|
|
22
|
-
const padRight = (module.exports.padRight = (str, len, char = SPACE) => String(str) + padding(str, len, char));
|
|
23
|
-
|
|
24
|
-
module.exports.listPairs = (x, style = identity) => {
|
|
25
|
-
const keys = Object.keys(x);
|
|
26
|
-
const longest = getLongest(keys).length;
|
|
27
|
-
|
|
28
|
-
return keys
|
|
29
|
-
.map(key => {
|
|
30
|
-
return `${style(padRight(key, longest))} ${x[key]}`;
|
|
31
|
-
})
|
|
32
|
-
.join(NEWLINE);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
module.exports.zipTemplateLiterals = (literals, numSpacesBetween) => {
|
|
36
|
-
const literalsLines = literals.map(literal => literal.split(NEWLINE));
|
|
37
|
-
|
|
38
|
-
return literalsLines[0].reduce(
|
|
39
|
-
(memo, _, index) =>
|
|
40
|
-
[memo, NEWLINE].join(literalsLines.map(lines => lines[index]).join(SPACE.repeat(numSpacesBetween))),
|
|
41
|
-
EMPTY
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
module.exports.styleLastSegment = (str, style = identity, separator = SLASH) => {
|
|
46
|
-
return str
|
|
47
|
-
.split(separator)
|
|
48
|
-
.map((segment, index, segments) => {
|
|
49
|
-
return index === segments.length - 1 ? style(segment) : segment;
|
|
50
|
-
})
|
|
51
|
-
.join(separator);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Return a sluggified version of the string
|
|
56
|
-
*
|
|
57
|
-
* @param {string} input - The string to convert
|
|
58
|
-
* @returns {string}
|
|
59
|
-
*/
|
|
60
|
-
module.exports.sluggify = input =>
|
|
61
|
-
input
|
|
62
|
-
.toLowerCase()
|
|
63
|
-
.replace(/\s/g, '-')
|
|
64
|
-
.replace(/[^0-9a-z\-\_]/g, '');
|
package/ts/config.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"lib": ["esnext", "es2015", "dom"],
|
|
5
|
-
"allowJs": false,
|
|
6
|
-
"checkJs": false,
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"module": "esnext",
|
|
9
|
-
"moduleResolution": "node",
|
|
10
|
-
"noImplicitAny": false,
|
|
11
|
-
"jsx": "preserve",
|
|
12
|
-
"sourceMap": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"forceConsistentCasingInFileNames": true,
|
|
16
|
-
"allowSyntheticDefaultImports": true,
|
|
17
|
-
"verbatimModuleSyntax": true,
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"isolatedModules": true,
|
|
20
|
-
"strictNullChecks": true
|
|
21
|
-
}
|
|
22
|
-
}
|
package/ts/custom.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// JSX intrinsic elements support (for preact)
|
|
2
|
-
|
|
3
|
-
declare namespace JSX {
|
|
4
|
-
interface IntrinsicElements {
|
|
5
|
-
[elemName: string]: any;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Webpack loaders module declarations
|
|
10
|
-
|
|
11
|
-
declare module '*.svelte' {
|
|
12
|
-
const component: any;
|
|
13
|
-
export default component;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type CSSModule = {
|
|
17
|
-
[className: string]: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
type OptionalCSSModule = void | CSSModule;
|
|
21
|
-
|
|
22
|
-
declare module '*.css' {
|
|
23
|
-
const optionalCSSModule: CSSModule;
|
|
24
|
-
export default optionalCSSModule;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare module '*.scss' {
|
|
28
|
-
const optionalCSSModule: CSSModule;
|
|
29
|
-
export default optionalCSSModule;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare module '*.jpg' {
|
|
33
|
-
const url: string;
|
|
34
|
-
export default url;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare module '*.png' {
|
|
38
|
-
const url: string;
|
|
39
|
-
export default url;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
declare module '*.gif' {
|
|
43
|
-
const url: string;
|
|
44
|
-
export default url;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare module '*.mp4' {
|
|
48
|
-
const url: string;
|
|
49
|
-
export default url;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
declare module '*.m4v' {
|
|
53
|
-
const url: string;
|
|
54
|
-
export default url;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
declare module '*.flv' {
|
|
58
|
-
const url: string;
|
|
59
|
-
export default url;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
declare module '*.mp3' {
|
|
63
|
-
const url: string;
|
|
64
|
-
export default url;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
declare module '*.wav' {
|
|
68
|
-
const url: string;
|
|
69
|
-
export default url;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare module '*.m4a' {
|
|
73
|
-
const url: string;
|
|
74
|
-
export default url;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
declare module '*.woff' {
|
|
78
|
-
const url: string;
|
|
79
|
-
export default url;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
declare module '*.woff2' {
|
|
83
|
-
const url: string;
|
|
84
|
-
export default url;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare module '*.ttf' {
|
|
88
|
-
const url: string;
|
|
89
|
-
export default url;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
declare module '*.eot' {
|
|
93
|
-
const url: string;
|
|
94
|
-
export default url;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
declare module '*.svg' {
|
|
98
|
-
const url: string;
|
|
99
|
-
export default url;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
declare module '*.html' {
|
|
103
|
-
const html: string;
|
|
104
|
-
export default html;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
declare module '*.webp' {
|
|
108
|
-
const webp: string;
|
|
109
|
-
export default webp;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
declare module '*.webm' {
|
|
113
|
-
const webm: string;
|
|
114
|
-
export default webm;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
declare module '*.avif' {
|
|
118
|
-
const avif: string;
|
|
119
|
-
export default avif;
|
|
120
|
-
}
|