@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.
- package/README.md +10 -0
- package/dist/bin/aunty.js +3 -0
- package/dist/lib/constants.js +8 -0
- package/package.json +25 -82
- 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/README.md
CHANGED
|
@@ -83,6 +83,16 @@ module.exports = {
|
|
|
83
83
|
}
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
For example to include a package that needs to be pre-processed, include in `aunty.config.js`
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
module.exports = {
|
|
90
|
+
build: {
|
|
91
|
+
includedDependencies: ["runed"],
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
86
96
|
Supported project `type`s (currently: `basic`, `preact`, `react` & `svelte`) have their own default build configuration, but you can override it by extending your project configuration.
|
|
87
97
|
|
|
88
98
|
The `build`, `serve` and `deploy` properties allow you to override the default settings for those respective commands. Their respective properties (and default values) are documented below.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const constants = {
|
|
2
|
+
OUTPUT_DIRECTORY_NAME: ".aunty",
|
|
3
|
+
BUILD_DIRECTORY_NAME: "build",
|
|
4
|
+
DEPLOY_FILE_NAME: "deploy.json",
|
|
5
|
+
PROJECT_CONFIG_FILE_NAME: "aunty.config.js",
|
|
6
|
+
INTERNAL_TEST_HOST: "master-news-web.news-web-developer.presentation-layer.abc-prod.net.au",
|
|
7
|
+
};
|
|
8
|
+
export default constants;
|
package/package.json
CHANGED
|
@@ -1,104 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abcnews/aunty",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "17.0.0-next.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "ABC News Digital developer toolkit",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/abcnews/aunty.git"
|
|
9
|
+
},
|
|
6
10
|
"license": "MIT",
|
|
7
11
|
"contributors": [
|
|
8
12
|
"Colin Gourlay <gourlay.colin@abc.net.au>",
|
|
9
13
|
"Simon Elvery <elvery.simon@abc.net.au>",
|
|
10
14
|
"Joshua Byrd <byrd.joshua@abc.net.au>",
|
|
11
|
-
"Ash Kyd <kyd.ashley@abc.net.au>"
|
|
12
|
-
"Nathan Hoad"
|
|
15
|
+
"Ash Kyd <kyd.ashley@abc.net.au>"
|
|
13
16
|
],
|
|
14
17
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"test": "
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsx src/bin/aunty.ts",
|
|
20
|
+
"test": "echo \"Put your tests here\" && exit 1",
|
|
21
|
+
"lint": "eslint src",
|
|
22
|
+
"clean": "rimraf dist",
|
|
23
|
+
"prebuild": "npm run clean"
|
|
18
24
|
},
|
|
19
25
|
"files": [
|
|
20
|
-
"
|
|
21
|
-
"scripts",
|
|
22
|
-
"src",
|
|
23
|
-
"ts"
|
|
26
|
+
"dist"
|
|
24
27
|
],
|
|
25
28
|
"publishConfig": {
|
|
26
29
|
"access": "public"
|
|
27
30
|
},
|
|
28
31
|
"bin": {
|
|
29
|
-
"aunty": "
|
|
30
|
-
"nt": "
|
|
32
|
+
"aunty": "dist/bin/aunty.js",
|
|
33
|
+
"nt": "dist/bin/aunty.js"
|
|
31
34
|
},
|
|
32
|
-
"main": "src/api",
|
|
33
35
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@babel/core": "^7.11.4",
|
|
38
|
-
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
|
39
|
-
"@babel/plugin-transform-react-jsx": "^7.3.0",
|
|
40
|
-
"@babel/preset-env": "^7.6.0",
|
|
41
|
-
"@babel/preset-react": "^7.0.0",
|
|
42
|
-
"@babel/preset-typescript": "^7.10.4",
|
|
43
|
-
"await-to-js": "^3.0.0",
|
|
44
|
-
"babel-core": "^7.0.0-bridge.0",
|
|
45
|
-
"babel-jest": "^26.1.0",
|
|
46
|
-
"babel-loader": "^8.2.2",
|
|
47
|
-
"basic-ftp": "^5.0.2",
|
|
48
|
-
"chalk": "^4.1.2",
|
|
49
|
-
"cli-select": "^1.1.2",
|
|
50
|
-
"copy-webpack-plugin": "^11.0.0",
|
|
51
|
-
"css-loader": "^6.7.1",
|
|
52
|
-
"csv-loader": "^3.0.3",
|
|
53
|
-
"deepmerge": "^4.0.0",
|
|
54
|
-
"del": "^6.0.0",
|
|
55
|
-
"dotenv": "^16.0.3",
|
|
56
|
-
"dotenv-webpack": "^8.0.1",
|
|
57
|
-
"execa": "^5.0.0",
|
|
58
|
-
"fork-ts-checker-webpack-plugin": "^6.2.1",
|
|
59
|
-
"ftp-deploy": "^2.3.8",
|
|
60
|
-
"get-all-paths": "^1.0.1",
|
|
61
|
-
"guess-root-path": "^1.0.0",
|
|
62
|
-
"i": "^0.3.6",
|
|
63
|
-
"import-lazy": "^4.0.0",
|
|
64
|
-
"import-local": "^3.0.2",
|
|
65
|
-
"jest": "^26.4.1",
|
|
66
|
-
"load-json-file": "^6.2.0",
|
|
67
|
-
"log-symbols": "^4.0.0",
|
|
68
|
-
"make-dir": "^3.0.0",
|
|
69
|
-
"mem": "^8.1.0",
|
|
70
|
-
"mini-css-extract-plugin": "^1.4.1",
|
|
71
|
-
"minimist": "^1.2.5",
|
|
72
|
-
"node-fetch": "^2.6.0",
|
|
73
|
-
"ora": "^5.0.0",
|
|
74
|
-
"pify": "^5.0.0",
|
|
75
|
-
"prettier": "^2.0.5",
|
|
76
|
-
"requireg": "^0.2.2",
|
|
77
|
-
"rsyncwrapper": "^3.0.1",
|
|
78
|
-
"sass": "^1.26.10",
|
|
79
|
-
"sass-loader": "^11.0.1",
|
|
80
|
-
"semver": "^7.3.2",
|
|
81
|
-
"style-loader": "^2.0.0",
|
|
82
|
-
"svelte": "^5.17.4",
|
|
83
|
-
"svelte-loader": "^3.2.4",
|
|
84
|
-
"svelte-preprocess": "^5.1.1",
|
|
85
|
-
"tcp-ping-sync": "^1.0.0",
|
|
86
|
-
"ts-loader": "^9.5.1",
|
|
87
|
-
"typescript": "^5.3.2",
|
|
88
|
-
"update-notifier": "^6.0.2",
|
|
89
|
-
"webpack": "^5.33.2",
|
|
90
|
-
"webpack-bundle-analyzer": "^4.5.0",
|
|
91
|
-
"webpack-dev-server": "^4.6.0",
|
|
92
|
-
"write-json-file": "^4.2.0",
|
|
93
|
-
"yeoman-environment": "^3.2.0",
|
|
94
|
-
"yeoman-generator": "^5.2.0"
|
|
36
|
+
"node": ">=20"
|
|
95
37
|
},
|
|
96
38
|
"devDependencies": {
|
|
97
|
-
"@
|
|
98
|
-
"
|
|
99
|
-
"eslint": "^
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
39
|
+
"@eslint/js": "^9.39.2",
|
|
40
|
+
"@types/node": "^25.0.10",
|
|
41
|
+
"eslint": "^9.39.2",
|
|
42
|
+
"rimraf": "^6.1.2",
|
|
43
|
+
"tsx": "^4.21.0",
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"typescript-eslint": "^8.54.0"
|
|
103
46
|
}
|
|
104
47
|
}
|
package/assets/done.mp3
DELETED
|
Binary file
|
package/scripts/postinstall.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Aunty v13 changes how build artefacts are created. When building a project,
|
|
3
|
-
pre-v13, a .build folder and .deploy files were created inside your project
|
|
4
|
-
directory. In v13, this was changed to a single .aunty directory, which
|
|
5
|
-
contains a build filder and deploy.json file.
|
|
6
|
-
|
|
7
|
-
This script runs after aunty is installed inside a project directory, and
|
|
8
|
-
if the project was upgraded from a pre-v13 aunty, it will delete any old
|
|
9
|
-
build artefacts, and update the .gitignore file to make sure the .aunty
|
|
10
|
-
directory isn't committed, and remove the .build & .deploy references.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const { existsSync, readFileSync, rmSync, rmdirSync, writeFileSync } = require('fs');
|
|
14
|
-
const { join } = require('path');
|
|
15
|
-
|
|
16
|
-
const INSTALLATION_DIRECTORY = process.env.INIT_CWD || '.';
|
|
17
|
-
|
|
18
|
-
const PRE_AUNTY_13_GITIGNORE_PATTERN = /\/\.build\n\/\.deploy/;
|
|
19
|
-
const POST_AUNTY_13_GITIGNORE_REPLACEMENT = `/.aunty`;
|
|
20
|
-
|
|
21
|
-
const PRE_AUNTY_13_BUILD_DIR_PATH = join(INSTALLATION_DIRECTORY, '.build');
|
|
22
|
-
const PRE_AUNTY_13_DEPLOY_CONFIG_FILE_PATH = join(INSTALLATION_DIRECTORY, '.deploy');
|
|
23
|
-
const GITIGNORE_PATH = join(INSTALLATION_DIRECTORY, '.gitignore');
|
|
24
|
-
|
|
25
|
-
if (existsSync(PRE_AUNTY_13_BUILD_DIR_PATH)) {
|
|
26
|
-
rmdirSync(PRE_AUNTY_13_BUILD_DIR_PATH, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (existsSync(PRE_AUNTY_13_DEPLOY_CONFIG_FILE_PATH)) {
|
|
30
|
-
rmSync(PRE_AUNTY_13_DEPLOY_CONFIG_FILE_PATH);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (existsSync(GITIGNORE_PATH)) {
|
|
34
|
-
const fileContents = readFileSync(GITIGNORE_PATH, 'utf8');
|
|
35
|
-
|
|
36
|
-
if (PRE_AUNTY_13_GITIGNORE_PATTERN.test(fileContents)) {
|
|
37
|
-
const updatedFileContents = fileContents.replace(
|
|
38
|
-
PRE_AUNTY_13_GITIGNORE_PATTERN,
|
|
39
|
-
POST_AUNTY_13_GITIGNORE_REPLACEMENT
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
writeFileSync(GITIGNORE_PATH, updatedFileContents);
|
|
43
|
-
}
|
|
44
|
-
}
|
package/src/api/index.js
DELETED
package/src/bin/aunty.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
if (!require('import-local')(__filename)) {
|
|
4
|
-
(async () => {
|
|
5
|
-
const importLazy = require('import-lazy')(require);
|
|
6
|
-
const { cli } = require('../cli');
|
|
7
|
-
const { createErrorLogo } = importLazy('../utils/branding');
|
|
8
|
-
const { error, log } = importLazy('../utils/logging');
|
|
9
|
-
|
|
10
|
-
function exit(err) {
|
|
11
|
-
if (err) {
|
|
12
|
-
log(createErrorLogo());
|
|
13
|
-
error(err);
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
process.exit(0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
process.on('uncaughtException', exit);
|
|
21
|
-
process.on('unhandledRejection', exit);
|
|
22
|
-
|
|
23
|
-
const [err] = await cli(process.argv.slice(2));
|
|
24
|
-
|
|
25
|
-
exit(err);
|
|
26
|
-
})();
|
|
27
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Ours
|
|
2
|
-
const { cmd, hvy, opt, sec, req } = require('../../utils/color');
|
|
3
|
-
|
|
4
|
-
module.exports.OPTIONS = {
|
|
5
|
-
boolean: ['local'],
|
|
6
|
-
string: ['id'],
|
|
7
|
-
alias: {
|
|
8
|
-
id: 'i',
|
|
9
|
-
local: 'l'
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// TODO: Add aunty config section to usage
|
|
14
|
-
|
|
15
|
-
module.exports.MESSAGES = {
|
|
16
|
-
build: ({ id, publicPaths }) => `Build (${hvy(process.env.NODE_ENV)}):${
|
|
17
|
-
id
|
|
18
|
-
? `
|
|
19
|
-
┣ ${hvy('id')}: ${req(id)}`
|
|
20
|
-
: ''
|
|
21
|
-
}
|
|
22
|
-
┗ ${hvy('publicPaths')}:${publicPaths
|
|
23
|
-
.map(
|
|
24
|
-
(publicPath, index) => `
|
|
25
|
-
${index === publicPaths.length - 1 ? '┗' : '┣'} ${hvy(`[${index}]`)}: ${req(publicPath)}`
|
|
26
|
-
)
|
|
27
|
-
.join('')}`,
|
|
28
|
-
usage: name => `Usage: ${cmd(`aunty ${name}`)} ${opt('[options]')}
|
|
29
|
-
|
|
30
|
-
${sec('Options')}
|
|
31
|
-
|
|
32
|
-
${opt('-d')}, ${opt('--dry')} Output the generated webpack (& deploy) configuration, then exit
|
|
33
|
-
${opt('-l')}, ${opt('--local')} Only build for local purposes; don't output deploy configuration
|
|
34
|
-
${opt('-i NAME')}, ${opt('--id=NAME')} Id for this build (can be used in deploy 'to' path) ${opt(
|
|
35
|
-
`[default: ${cmd('git branch')}]`
|
|
36
|
-
)}
|
|
37
|
-
|
|
38
|
-
${sec('Environment variables')}
|
|
39
|
-
|
|
40
|
-
• Builds will assume you have set ${cmd('NODE_ENV=production')}, unless you specify otherwise.
|
|
41
|
-
`,
|
|
42
|
-
multipleErrors: errors => `Multiple build errors:
|
|
43
|
-
|
|
44
|
-
${errors.join('\n\n')}
|
|
45
|
-
`
|
|
46
|
-
};
|
package/src/cli/build/index.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// Native
|
|
2
|
-
const { join } = require('path');
|
|
3
|
-
|
|
4
|
-
// External
|
|
5
|
-
const importLazy = require('import-lazy')(require);
|
|
6
|
-
const pify = importLazy('pify');
|
|
7
|
-
const webpack = importLazy('webpack');
|
|
8
|
-
const writeJsonFile = importLazy('write-json-file');
|
|
9
|
-
|
|
10
|
-
// Ours
|
|
11
|
-
const { getDeployConfig } = require('../../config/deploy');
|
|
12
|
-
const { getProjectConfig } = require('../../config/project');
|
|
13
|
-
const { getWebpackConfig } = require('../../config/webpack');
|
|
14
|
-
const { DEPLOY_FILE_NAME, OUTPUT_DIRECTORY_NAME } = require('../../constants');
|
|
15
|
-
const { packs, throws, unpack } = require('../../utils/async');
|
|
16
|
-
const { dry, info, spin, warn } = require('../../utils/logging');
|
|
17
|
-
const { combine } = require('../../utils/structures');
|
|
18
|
-
const { command } = require('../');
|
|
19
|
-
const cleanCommand = require('../clean');
|
|
20
|
-
const { MESSAGES, OPTIONS } = require('./constants');
|
|
21
|
-
|
|
22
|
-
const build = async argv => {
|
|
23
|
-
const { root } = getProjectConfig();
|
|
24
|
-
const webpackConfig = getWebpackConfig();
|
|
25
|
-
let deployConfig;
|
|
26
|
-
|
|
27
|
-
if (!argv.local) {
|
|
28
|
-
deployConfig = getDeployConfig({ id: argv.id });
|
|
29
|
-
webpackConfig.forEach(config => {
|
|
30
|
-
config.output.publicPath = deployConfig.targets[0].publicPath;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (argv.dry) {
|
|
35
|
-
return dry(
|
|
36
|
-
combine(
|
|
37
|
-
{
|
|
38
|
-
'Webpack config': webpackConfig
|
|
39
|
-
},
|
|
40
|
-
deployConfig
|
|
41
|
-
? {
|
|
42
|
-
'Deploy config': deployConfig
|
|
43
|
-
}
|
|
44
|
-
: {}
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
throws(await cleanCommand(['--quiet']));
|
|
50
|
-
|
|
51
|
-
info(
|
|
52
|
-
MESSAGES.build({
|
|
53
|
-
id: deployConfig ? deployConfig.id : null,
|
|
54
|
-
publicPaths: deployConfig ? deployConfig.targets.map(x => x.publicPath) : [webpackConfig[0].output.publicPath]
|
|
55
|
-
})
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
let spinner = spin('Building');
|
|
59
|
-
const startTime = Date.now();
|
|
60
|
-
const compiler = webpack(webpackConfig);
|
|
61
|
-
const stats = unpack(await packs(pify(compiler.run.bind(compiler)))());
|
|
62
|
-
|
|
63
|
-
if (stats.hasErrors()) {
|
|
64
|
-
const errors = stats.toJson({}, true).errors;
|
|
65
|
-
|
|
66
|
-
spinner.fail();
|
|
67
|
-
|
|
68
|
-
if (errors.length > 1) {
|
|
69
|
-
throw MESSAGES.multipleErrors(errors.map(error => error.message));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
throw errors[0];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (stats.hasWarnings()) {
|
|
76
|
-
spinner.warn();
|
|
77
|
-
stats.toJson({}, true).warnings.forEach(warning => warn(warning.message));
|
|
78
|
-
} else {
|
|
79
|
-
spinner.succeed(`Built in ${((Date.now() - startTime) / 1000).toFixed(2)}s`);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (deployConfig) {
|
|
83
|
-
spinner = spin('Creating deploy configuration');
|
|
84
|
-
writeJsonFile.sync(join(root, OUTPUT_DIRECTORY_NAME, DEPLOY_FILE_NAME), deployConfig);
|
|
85
|
-
spinner.succeed('Created deploy configuration');
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
module.exports = command(
|
|
90
|
-
{
|
|
91
|
-
name: 'build',
|
|
92
|
-
nodeEnv: 'production',
|
|
93
|
-
options: OPTIONS,
|
|
94
|
-
usage: MESSAGES.usage
|
|
95
|
-
},
|
|
96
|
-
build
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
// Expose this for the tests
|
|
100
|
-
module.exports._testBuild = build;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Ours
|
|
2
|
-
const { cmd, hvy } = require('../../utils/color');
|
|
3
|
-
const { inlineList } = require('../../utils/text');
|
|
4
|
-
|
|
5
|
-
module.exports.MESSAGES = {
|
|
6
|
-
clean: paths => `Clean:
|
|
7
|
-
┗ ${hvy('paths')} ${inlineList(paths)}`,
|
|
8
|
-
usage: name => `Usage: ${cmd(`aunty ${name}`)}
|
|
9
|
-
`
|
|
10
|
-
};
|
package/src/cli/clean/index.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// External
|
|
2
|
-
const importLazy = require('import-lazy')(require);
|
|
3
|
-
const del = importLazy('del');
|
|
4
|
-
|
|
5
|
-
// Ours
|
|
6
|
-
const { getProjectConfig } = require('../../config/project');
|
|
7
|
-
const { OUTPUT_DIRECTORY_NAME } = require('../../constants');
|
|
8
|
-
const { dry, info, spin } = require('../../utils/logging');
|
|
9
|
-
const { command } = require('../');
|
|
10
|
-
const { MESSAGES } = require('./constants');
|
|
11
|
-
|
|
12
|
-
module.exports = command(
|
|
13
|
-
{
|
|
14
|
-
name: 'clean',
|
|
15
|
-
usage: MESSAGES.usage
|
|
16
|
-
},
|
|
17
|
-
async argv => {
|
|
18
|
-
const { root } = getProjectConfig();
|
|
19
|
-
const globs = [OUTPUT_DIRECTORY_NAME];
|
|
20
|
-
|
|
21
|
-
if (argv.dry) {
|
|
22
|
-
return dry({
|
|
23
|
-
'Deletion paths': { globs, cwd: root }
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let spinner;
|
|
28
|
-
|
|
29
|
-
if (!argv.quiet) {
|
|
30
|
-
info(MESSAGES.clean(globs));
|
|
31
|
-
spinner = spin(`Cleaning`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
await del(globs, { cwd: root });
|
|
35
|
-
|
|
36
|
-
if (!argv.quiet) {
|
|
37
|
-
spinner.succeed('Cleaned');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
);
|
package/src/cli/constants.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// Ours
|
|
2
|
-
const { createLogo } = require('../utils/branding');
|
|
3
|
-
const { cmd, dim, hvy, opt, req, sec } = require('../utils/color');
|
|
4
|
-
|
|
5
|
-
const COMMAND_ALIASES = (module.exports.COMMAND_ALIASES = {
|
|
6
|
-
b: 'build',
|
|
7
|
-
c: 'clean',
|
|
8
|
-
d: 'deploy',
|
|
9
|
-
g: 'generate',
|
|
10
|
-
r: 'release',
|
|
11
|
-
s: 'serve',
|
|
12
|
-
sc: 'sign-cert',
|
|
13
|
-
t: 'test'
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
module.exports.COMMANDS = new Set(Object.values(COMMAND_ALIASES));
|
|
17
|
-
|
|
18
|
-
module.exports.DEFAULTS = {
|
|
19
|
-
name: '__command__',
|
|
20
|
-
options: {
|
|
21
|
-
'--': true,
|
|
22
|
-
boolean: ['dry', 'force', 'help', 'quiet'],
|
|
23
|
-
string: [],
|
|
24
|
-
alias: {
|
|
25
|
-
dry: 'd',
|
|
26
|
-
force: 'f',
|
|
27
|
-
help: 'h',
|
|
28
|
-
quiet: 'q'
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
usage: name => `Usage: ${cmd('aunty')} ${cmd(name)} ${opt('[options]')}
|
|
32
|
-
`
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
module.exports.DRY_VARIATIONS = ['--dry', '-d'];
|
|
36
|
-
module.exports.HELP_VARIATIONS = ['--help', '-h', 'h', 'help'];
|
|
37
|
-
module.exports.VERSION_VARIATIONS = ['--version', '-v'];
|
|
38
|
-
|
|
39
|
-
module.exports.MESSAGES = {
|
|
40
|
-
version: versionNumber => `
|
|
41
|
-
${cmd('aunty')} v${versionNumber}`,
|
|
42
|
-
unrecognised: commandName => `Unrecognised command: ${req(commandName)}`,
|
|
43
|
-
usage: isProject => `${createLogo()}
|
|
44
|
-
|
|
45
|
-
Usage: ${cmd('aunty')} ${req('<command>')} ${opt('[options]')} ${opt('[command_options]')}
|
|
46
|
-
|
|
47
|
-
${sec('Options')}
|
|
48
|
-
|
|
49
|
-
${opt('-v')}, ${opt('--version')} Print ${hvy('aunty')}'s version
|
|
50
|
-
|
|
51
|
-
${sec('Project creation commands')}
|
|
52
|
-
|
|
53
|
-
${
|
|
54
|
-
!isProject
|
|
55
|
-
? `${cmd('aunty new')} ${req('<project_name>')}
|
|
56
|
-
Create a project in a new directory
|
|
57
|
-
|
|
58
|
-
${cmd('aunty init')}
|
|
59
|
-
Create a project in the current directory`
|
|
60
|
-
: dim(`[available outside project directory]`)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
${sec('Development commands')}
|
|
64
|
-
|
|
65
|
-
${
|
|
66
|
-
isProject
|
|
67
|
-
? `${cmd('aunty generate')} ${req('<generator>')}
|
|
68
|
-
Generate code for your project or Core Media
|
|
69
|
-
|
|
70
|
-
${cmd('aunty clean')}
|
|
71
|
-
Delete the current project's build output directories.
|
|
72
|
-
|
|
73
|
-
${cmd('aunty build')}
|
|
74
|
-
Clean & build the current project.
|
|
75
|
-
|
|
76
|
-
${cmd('aunty serve')}
|
|
77
|
-
Build & serve the current project, re-building as files change
|
|
78
|
-
|
|
79
|
-
${cmd('aunty test')}
|
|
80
|
-
Run any tests in the current project.`
|
|
81
|
-
: dim(`[available inside project directory]`)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
${sec('Deployment commands')}
|
|
85
|
-
|
|
86
|
-
${
|
|
87
|
-
isProject
|
|
88
|
-
? `${cmd('aunty deploy')}
|
|
89
|
-
Deploy the current project.
|
|
90
|
-
|
|
91
|
-
${cmd('aunty release')}
|
|
92
|
-
Build, version bump, then deploy the current project.`
|
|
93
|
-
: dim(`[available inside project directory]`)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
${sec('Helper commands')}
|
|
97
|
-
|
|
98
|
-
${cmd('aunty help')} ${req('<command>')}
|
|
99
|
-
Display complete help for this ${req('command')}.
|
|
100
|
-
|
|
101
|
-
${cmd('aunty sign-cert')} # Mac OS only (for now)
|
|
102
|
-
Create a consistent SSL certificate for the dev server
|
|
103
|
-
`
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const NEW_SHORTHAND_EXPANSION = ['generate', 'project', '--'];
|
|
107
|
-
const INIT_SHORTHAND_EXPANSION = NEW_SHORTHAND_EXPANSION.concat(['--here']);
|
|
108
|
-
|
|
109
|
-
module.exports.SHORTHANDS = {
|
|
110
|
-
i: INIT_SHORTHAND_EXPANSION,
|
|
111
|
-
init: INIT_SHORTHAND_EXPANSION,
|
|
112
|
-
n: NEW_SHORTHAND_EXPANSION,
|
|
113
|
-
new: NEW_SHORTHAND_EXPANSION
|
|
114
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Ours
|
|
2
|
-
const { cmd, hvy, opt, req, sec } = require('../../utils/color');
|
|
3
|
-
const { styleLastSegment } = require('../../utils/text');
|
|
4
|
-
|
|
5
|
-
const VALID_TYPES = (module.exports.VALID_TYPES = new Map());
|
|
6
|
-
VALID_TYPES.set('ftp', {
|
|
7
|
-
REQUIRED_PROPERTIES: ['from', 'to', 'type', 'username', 'password', 'host']
|
|
8
|
-
});
|
|
9
|
-
VALID_TYPES.set('ssh', {
|
|
10
|
-
REQUIRED_PROPERTIES: ['from', 'to', 'type', 'username', 'host']
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
module.exports.MESSAGES = {
|
|
14
|
-
deploy: ({ from, host, to, type }) => `Deploy (${hvy(type)}):
|
|
15
|
-
┣ ${hvy('from')}: ${styleLastSegment(from, req)}
|
|
16
|
-
┣ ${hvy('to')}: ${styleLastSegment(to, req)}
|
|
17
|
-
┗ ${hvy('host')}: ${req(host)}`,
|
|
18
|
-
deployed: publicPath => `Deployed at ${sec(publicPath)}`,
|
|
19
|
-
deploying: 'Deploying',
|
|
20
|
-
missingProperty: prop => `Missing required property: '${hvy(prop)}'`,
|
|
21
|
-
noDeployConfigFile:
|
|
22
|
-
'No deploy configuration file was found, or its format was unrecognisable. Please re-build the project.',
|
|
23
|
-
noFromDirectory: from => `Directory specified by 'from' property does not exist: ${hvy(from)}`,
|
|
24
|
-
publicURL: url => `Public URL: ${hvy(url)}`,
|
|
25
|
-
unrecognisedType: type =>
|
|
26
|
-
`${type ? 'Unrecognised' : 'No'} deploy type${type ? `: ${hvy(type)}` : ''}. Acceptable types are: ${Array.from(
|
|
27
|
-
VALID_TYPES.keys()
|
|
28
|
-
)
|
|
29
|
-
.map(x => hvy(x))
|
|
30
|
-
.join(', ')}`,
|
|
31
|
-
|
|
32
|
-
// TODO: Add aunty config section to usage
|
|
33
|
-
usage: name => `Usage: ${cmd(`aunty ${name}`)} ${opt('[options]')}
|
|
34
|
-
|
|
35
|
-
${sec('Options')}
|
|
36
|
-
|
|
37
|
-
${opt('-d')}, ${opt('--dry')} Output the deploy configuration, then exit
|
|
38
|
-
${opt('-f')}, ${opt('--force')} Do not prompt to overwrite ftp deploy directory ${opt('[default: false]')}
|
|
39
|
-
`
|
|
40
|
-
};
|