@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/README.md
CHANGED
|
@@ -2,163 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
A toolkit for working with ABC News projects
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
To use the CLI to create new projects, install the latest aunty release globally:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install --global @abcnews/aunty
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Projects based on aunty's project templates already have aunty listed as a local dependency, locked to the version used to create it.
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
For usage instructions, run `aunty` with no arguments, or for details on specific commands, run:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
aunty help <command>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
The CLI contains four types of command, grouped by purpose:
|
|
24
|
-
|
|
25
|
-
- Creating new projects (`new`, `init`)
|
|
26
|
-
- Generating stuff (`generate`) like components
|
|
27
|
-
- Developing projects (`clean`, `build`, `serve`, `test`)
|
|
28
|
-
- Deploying (un)versioned projects (`deploy`, `release`)
|
|
29
|
-
|
|
30
|
-
### Starting projects
|
|
31
|
-
|
|
32
|
-
When creating new projects, you should be using the global **aunty**:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
/some/parent/directory $ aunty new
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
or, from within a (preferably empty) directory:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
/some/parent/directory/my-project $ aunty init
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Developing projects
|
|
45
|
-
|
|
46
|
-
When working inside a project directory that has the aunty dependency installed, you'll automatically be running that local `aunty`:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
/some/parent/directory/my-project $ aunty <build|serve|...> [options]
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
This ensures that any changes to future versions of aunty won't impact your project, and you can manually update the local aunty when you're ready to accommodate those changes.
|
|
53
|
-
|
|
54
|
-
Project-level commands can use an optional configuration, which you can either export from a project-level `aunty.config.js` file:
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
module.exports = {
|
|
58
|
-
type: '<project_type>',
|
|
59
|
-
// aunty command configuration
|
|
60
|
-
build: {…},
|
|
61
|
-
serve: {…},
|
|
62
|
-
deploy: [{…}],
|
|
63
|
-
// internal tools configuration
|
|
64
|
-
babel: {…},
|
|
65
|
-
jest: {…},
|
|
66
|
-
webpack: {…},
|
|
67
|
-
webpackDevServer: {…}
|
|
68
|
-
};
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
...or add to your `package.json` file as an `aunty` property:
|
|
72
|
-
|
|
73
|
-
```js
|
|
74
|
-
"aunty": {
|
|
75
|
-
"type": "<project_type>",
|
|
76
|
-
"build": {…},
|
|
77
|
-
"serve": {…},
|
|
78
|
-
"deploy": [{…}],
|
|
79
|
-
"babel": {…},
|
|
80
|
-
"jest": {…},
|
|
81
|
-
"webpack": {…},
|
|
82
|
-
"webpackDevServer": {…}
|
|
83
|
-
}
|
|
84
|
-
```
|
|
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
|
-
|
|
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.
|
|
97
|
-
|
|
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.
|
|
99
|
-
|
|
100
|
-
Aunty uses some tools internally, which you can also provide custom configuration for. If you supply an object for the `babel`, `jest`, `webpack`, and/or `webpackDevServer` properties, that object will be merged into the default configuration. Optionally, you can supply a function (for any property), which will be passed the default configuration for you to manually modify and return.
|
|
101
|
-
|
|
102
|
-
If you're looking to see what the default configuration is for any command (and their internal tools), or the impact of your additions, you can always perform a dry run of the command by using the `--dry` (or `-d`) flag:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
/some/parent/directory/my-project $ aunty serve --dry
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Overrides should be used sparingly, as the advantages of using a single-dependency toolkit are most apparent when we don't deviate far from the defaults.
|
|
109
|
-
|
|
110
|
-
If you don't need to override any of the project defaults, your entire aunty configuration can be a string containing the project type, as a shorthand for `{type: "<project_type>"}`. `type` is the only required property in your aunty configuration.
|
|
111
|
-
|
|
112
|
-
#### `build` config properties
|
|
113
|
-
|
|
114
|
-
| property | default | description |
|
|
115
|
-
| ---------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
-
| `entry` | `"index"` | The entry file for your project (extension should be unspecified). You can optionally supply an array for multiple entry points, which will result in multiple outputs. |
|
|
117
|
-
| `from` | `"src"` | The source directory that aunty will look for your entry file(s) in. |
|
|
118
|
-
| `to` | `".aunty/build"` | The destination directory for your compiled and static assets. |
|
|
119
|
-
| `staticDir` | `"public"` | The directory you store static assets in. You can optionally supply an array of directories, which will be merged at build time. |
|
|
120
|
-
| `addModernJS` | `false` | Setting this to true will enable a 2nd output file for each entry file named `{name}.modern.js`, which is skips browserlist-based feature polyfilling |
|
|
121
|
-
| `includedDependencies` | `[]` | Any packages (defined by name string or name-matching `RegExp`s) you add to this array will be transpiled in the same manner as the project source. |
|
|
122
|
-
| `extractCSS` | `false` | Setting this to true will create a separate `{name}.css` output for each input, rather than bundling it with the JS (for dynamic `<style>` insertion). |
|
|
123
|
-
| `useCSSModules` | `true` | Setting this to false will turn off CSS module compilation. All styles written will be 'global', and importing CSS files will not give you an object of `className` references. |
|
|
124
|
-
| `showDeprecations` | `false` | Setting this to true will allow NodeJS to output stack traces of deprecation warnings. |
|
|
125
|
-
|
|
126
|
-
#### `serve` config properties
|
|
127
|
-
|
|
128
|
-
| property | default | description |
|
|
129
|
-
| ------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
130
|
-
| `hasBundleAnalysis` | `false` | Setting this to true will spin up a second server on another port, allowing you to inspect your bundle. The address will be logged to the console when the dev server starts. |
|
|
131
|
-
| `host` | `"localhost"` | The hostname of your dev server. If you're on the ABC internal network, the default will change to your machine's hostname (`ws<number>.aus.aunty.abc.net.au`). The `AUNTY_HOST` environment variable, if present, will override this setting. |
|
|
132
|
-
| `hot` | `true` | Should the dev server enable hot reloading. If `NODE_ENV !== "development"`, the default will change to `false`. |
|
|
133
|
-
| `https` | `true` | Should the dev server use SSL (with a self-signed certificate matching the `host`). You can alternatively supply your own `{cert: string, key: string}` object if you've generated your certificate some other way. |
|
|
134
|
-
| `port` | `8000` | The port number of your dev server. If the port specified is unavailable, **aunty** will try incrementing the port number until it finds an available one. The `AUNTY_PORT` environment variable, if present, will override this setting. |
|
|
135
|
-
|
|
136
|
-
#### `deploy` config properties
|
|
137
|
-
|
|
138
|
-
`deploy` should be an array of config objects, one for each deployment target (e.g. ContentFTP)
|
|
139
|
-
|
|
140
|
-
| property | default | description |
|
|
141
|
-
| ------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
142
|
-
| `from` | build config `to` value | The directory to deploy files from (if you haven't overridden the build `to` value, it should be ".aunty/build") |
|
|
143
|
-
| `files` | `"**"` | A glob matching the files under your `from` directory to deploy |
|
|
144
|
-
| `profile` | `"contentftp"` | This should be the name of a key in your `~/.abc-credentials` file, which will be consulted to populate login credentials. If this is `"contentftp"` it will also populate the config's `to` and `resolvePublicPath` properties. |
|
|
145
|
-
| `publicPath` | `"/"` | If `resolvePublicPath` is defined, `publicPath` will be overwritten by the return value of that function. |
|
|
146
|
-
| `resolvePublicPath` | `undefined` | A function which takes the initial config as an object, and returns an updated `publicPath`. If `profile="contentftp"`, this will be a function that knows how ContentFTP directories map onto ABC URLs. |
|
|
147
|
-
| `to` | `undefined` | The directory on your target to deploy files to. If `profile="contentftp"` , this will be a versioned directory where we deploy News projects to. If you set this to a string, the patterns `<name>` and `<id>` will be replaced by the project name, and the current deployment ID, respectively. During releases, `id` is the current version; during development, it's the current git branch name. You can also specify a custom deployment ID by using the `--id` flag when running `aunty build`. |
|
|
148
|
-
|
|
149
|
-
You _could_ also specify `type` (`"ftp"`/`"ssh"`), `host`, `port`, `username` & `password`, but these are best left inside your `.abc-credentials` file.
|
|
150
|
-
|
|
151
|
-
### Generators
|
|
152
|
-
|
|
153
|
-
Aunty comes with a few basic generators. Run `aunty generate --help` for the full list, or `aunty generate <generator> --help` for further details.
|
|
154
|
-
|
|
155
|
-
## Authors
|
|
156
|
-
|
|
157
|
-
- Colin Gourlay
|
|
158
|
-
- Simon Elvery ([elvery.simon@abc.net.au](mailto:elvery.simon@abc.net.au))
|
|
159
|
-
- Joshua Byrd ([byrd.joshua@abc.net.au](mailto:byrd.joshua@abc.net.au))
|
|
160
|
-
- Nathan Hoad
|
|
161
|
-
|
|
162
|
-
## Thanks
|
|
163
|
-
|
|
164
|
-
This project was originally inspired by [nwb](https://github.com/insin/nwb), a React/Preact/Inferno toolkit by [Jonny Buchanan](https://twitter.com/jbscript). If you're looking to develop your own toolkit, Jonny's created a fantastic [guide](https://github.com/insin/ad-hoc-reckons) to get you started.
|
|
5
|
+
THIS IS A NEW BRANCH FOR AUNTY@NEXT PLEASE BITE OFF A CHUNK OF WORK AND MERGE INTO the `aunty-next` BRANCH
|
package/package.json
CHANGED
|
@@ -1,104 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abcnews/aunty",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "17.0.0-next.2",
|
|
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
|
},
|
|
31
|
+
"main": "src/bin/aunty.ts",
|
|
28
32
|
"bin": {
|
|
29
|
-
"aunty": "src/bin/aunty.
|
|
30
|
-
"nt": "src/bin/aunty.
|
|
33
|
+
"aunty": "src/bin/aunty.ts",
|
|
34
|
+
"nt": "src/bin/aunty.ts"
|
|
31
35
|
},
|
|
32
|
-
"main": "src/api",
|
|
33
36
|
"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.96.0",
|
|
79
|
-
"sass-loader": "^16.0.6",
|
|
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"
|
|
37
|
+
"node": ">=20"
|
|
95
38
|
},
|
|
96
39
|
"devDependencies": {
|
|
97
|
-
"@
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
40
|
+
"@eslint/js": "^9.39.2",
|
|
41
|
+
"@types/async": "^3.2.25",
|
|
42
|
+
"@types/fs-extra": "^11.0.4",
|
|
43
|
+
"@types/node": "^25.0.10",
|
|
44
|
+
"eslint": "^9.39.2",
|
|
45
|
+
"install": "^0.13.0",
|
|
46
|
+
"npm": "^11.11.1",
|
|
47
|
+
"rimraf": "^6.1.2",
|
|
48
|
+
"tsx": "^4.21.0",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"typescript-eslint": "^8.54.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"async": "^3.2.6",
|
|
54
|
+
"basic-ftp": "^5.2.0",
|
|
55
|
+
"commander": "^14.0.3",
|
|
56
|
+
"ora": "^9.3.0",
|
|
57
|
+
"picocolors": "^1.1.1",
|
|
58
|
+
"slugify": "^1.6.8",
|
|
59
|
+
"zx": "^8.8.5"
|
|
103
60
|
}
|
|
104
61
|
}
|
package/src/bin/aunty.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Aunty - ABC News Digital developer toolkit
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { Command } from "commander";
|
|
9
|
+
import { run as runDeploy } from "../commands/deploy/index.ts";
|
|
10
|
+
import { run as runReleaseCheck } from "../commands/release-check/index.ts";
|
|
11
|
+
import { getLogo } from "../lib/terminal.ts";
|
|
12
|
+
import { loadJson } from "../lib/util.ts";
|
|
13
|
+
|
|
14
|
+
const pkgPath = path.join(import.meta.dirname, "../../package.json");
|
|
15
|
+
const pkg = (await loadJson(pkgPath)) as { version?: string } | null;
|
|
16
|
+
const version = pkg?.version || "0.0.0";
|
|
17
|
+
|
|
18
|
+
const program = new Command();
|
|
19
|
+
|
|
20
|
+
program
|
|
21
|
+
.name("aunty")
|
|
22
|
+
.description(`${getLogo()} ABC News developer toolkit`)
|
|
23
|
+
.version(version);
|
|
24
|
+
|
|
25
|
+
program
|
|
26
|
+
.command("deploy")
|
|
27
|
+
.description("Deploy the project to the content FTP")
|
|
28
|
+
.argument(
|
|
29
|
+
"[destDir]",
|
|
30
|
+
"Override the target folder name (defaults to package.json version)",
|
|
31
|
+
)
|
|
32
|
+
.option("-d, --dry-run", "Show what would happen without uploading", false)
|
|
33
|
+
.action(async (destDir, options) => {
|
|
34
|
+
try {
|
|
35
|
+
process.exit(await runDeploy({ destDir, ...options }));
|
|
36
|
+
} catch (err: unknown) {
|
|
37
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
38
|
+
console.error(`\n❌ ${message}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
program
|
|
44
|
+
.command("release-check")
|
|
45
|
+
.description("Perform pre-release checks (git and FTP)")
|
|
46
|
+
.action(async () => {
|
|
47
|
+
try {
|
|
48
|
+
process.exit(await runReleaseCheck());
|
|
49
|
+
} catch (err: unknown) {
|
|
50
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
51
|
+
console.error(`\n❌ ${message}`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
program.parse(process.argv);
|
|
57
|
+
|
|
58
|
+
if (!process.argv.slice(2).length) {
|
|
59
|
+
program.outputHelp();
|
|
60
|
+
}
|
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
|
-
);
|