@adobe/aem-cli 15.0.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/CHANGELOG.md +5262 -0
- package/CODE_OF_CONDUCT.md +74 -0
- package/CONTRIBUTING.md +64 -0
- package/LICENSE.txt +264 -0
- package/README.md +147 -0
- package/index.js +25 -0
- package/package.json +97 -0
- package/src/abstract-server.cmd.js +143 -0
- package/src/abstract.cmd.js +42 -0
- package/src/cli-util.js +74 -0
- package/src/cli.js +137 -0
- package/src/config/config-utils.js +49 -0
- package/src/fetch-utils.js +65 -0
- package/src/git-utils.js +265 -0
- package/src/hack.cmd.js +48 -0
- package/src/hack.js +50 -0
- package/src/import.cmd.js +103 -0
- package/src/import.js +110 -0
- package/src/log-common.js +132 -0
- package/src/md5.js +34 -0
- package/src/package.cjs +12 -0
- package/src/server/BaseProject.js +137 -0
- package/src/server/BaseServer.js +205 -0
- package/src/server/HeadHtmlSupport.js +180 -0
- package/src/server/HelixImportProject.js +30 -0
- package/src/server/HelixImportServer.js +207 -0
- package/src/server/HelixProject.js +130 -0
- package/src/server/HelixServer.js +120 -0
- package/src/server/Indexer.js +152 -0
- package/src/server/LiveReload.js +276 -0
- package/src/server/RequestContext.js +205 -0
- package/src/server/utils.js +457 -0
- package/src/up.cmd.js +171 -0
- package/src/up.js +120 -0
package/src/up.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2018 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { getOrCreateLogger } from './log-common.js';
|
|
14
|
+
|
|
15
|
+
export default function up() {
|
|
16
|
+
let executor;
|
|
17
|
+
return {
|
|
18
|
+
set executor(value) {
|
|
19
|
+
executor = value;
|
|
20
|
+
},
|
|
21
|
+
command: 'up',
|
|
22
|
+
description: 'Run a AEM development server',
|
|
23
|
+
builder: (yargs) => {
|
|
24
|
+
yargs
|
|
25
|
+
.option('open', {
|
|
26
|
+
describe: 'Open a browser window at specified path',
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: '/',
|
|
29
|
+
})
|
|
30
|
+
.option('no-open', {
|
|
31
|
+
// negation of the open option (resets open default)
|
|
32
|
+
// see https://github.com/yargs/yargs/blob/master/docs/tricks.md#negating-boolean-arguments
|
|
33
|
+
alias: 'noOpen',
|
|
34
|
+
describe: 'Disable automatic opening of browser window',
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
})
|
|
37
|
+
.option('livereload', {
|
|
38
|
+
describe: 'Enable automatic reloading of modified sources in browser.',
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
default: true,
|
|
41
|
+
})
|
|
42
|
+
.option('no-livereload', {
|
|
43
|
+
// negation of the livereload option (resets open default)
|
|
44
|
+
// see https://github.com/yargs/yargs/blob/master/docs/tricks.md#negating-boolean-arguments
|
|
45
|
+
alias: 'noLiveReload',
|
|
46
|
+
describe: 'Disable live-reload',
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
})
|
|
49
|
+
.option('port', {
|
|
50
|
+
describe: 'Start development server on port',
|
|
51
|
+
type: 'int',
|
|
52
|
+
default: 3000,
|
|
53
|
+
})
|
|
54
|
+
.option('addr', {
|
|
55
|
+
describe: 'Bind development server on addr. use * to bind to any address and allow external connections.',
|
|
56
|
+
type: 'string',
|
|
57
|
+
default: '127.0.0.1',
|
|
58
|
+
})
|
|
59
|
+
.option('tls-cert', {
|
|
60
|
+
alias: 'tlsCert',
|
|
61
|
+
describe: 'File location for your .pem file for local TLS support',
|
|
62
|
+
type: 'string',
|
|
63
|
+
default: undefined,
|
|
64
|
+
})
|
|
65
|
+
.option('tls-key', {
|
|
66
|
+
alias: 'tlsKey',
|
|
67
|
+
describe: 'File location for your .key file for local TLS support',
|
|
68
|
+
type: 'string',
|
|
69
|
+
default: undefined,
|
|
70
|
+
})
|
|
71
|
+
.option('stop-other', {
|
|
72
|
+
alias: 'stopOther',
|
|
73
|
+
describe: 'Stop other AEM CLI running on the above port',
|
|
74
|
+
type: 'boolean',
|
|
75
|
+
default: true,
|
|
76
|
+
})
|
|
77
|
+
.option('print-index', {
|
|
78
|
+
alias: 'printIndex',
|
|
79
|
+
describe: 'Prints the indexed records for the current page.',
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
default: false,
|
|
82
|
+
})
|
|
83
|
+
.group(['port', 'addr', 'stop-other', 'tls-cert', 'tls-key'], 'Server options')
|
|
84
|
+
.option('url', {
|
|
85
|
+
alias: ['pagesUrl', 'pages-url'],
|
|
86
|
+
describe: 'The origin url to fetch content from.',
|
|
87
|
+
type: 'string',
|
|
88
|
+
})
|
|
89
|
+
.option('alpha-cache', {
|
|
90
|
+
alias: 'alphaCache',
|
|
91
|
+
describe: 'Path to local folder to cache the responses (note: this is an alpha feature, it may be removed without notice)',
|
|
92
|
+
type: 'string',
|
|
93
|
+
})
|
|
94
|
+
.group(['url', 'livereload', 'no-livereload', 'open', 'no-open', 'print-index', 'cache'], 'AEM Options')
|
|
95
|
+
|
|
96
|
+
.help();
|
|
97
|
+
},
|
|
98
|
+
handler: async (argv) => {
|
|
99
|
+
if (!executor) {
|
|
100
|
+
// eslint-disable-next-line global-require
|
|
101
|
+
const UpCommand = (await import('./up.cmd.js')).default; // lazy load the handler to speed up execution time
|
|
102
|
+
executor = new UpCommand(getOrCreateLogger(argv));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
await executor
|
|
106
|
+
.withHttpPort(argv.port)
|
|
107
|
+
.withBindAddr(argv.addr)
|
|
108
|
+
// only open browser window when executable is `aem`
|
|
109
|
+
// this prevents the window to be opened during integration tests
|
|
110
|
+
.withOpen(path.basename(argv.$0) === 'aem' ? argv.open : false)
|
|
111
|
+
.withTLS(argv.tlsKey, argv.tlsCert)
|
|
112
|
+
.withLiveReload(argv.livereload)
|
|
113
|
+
.withUrl(argv.url)
|
|
114
|
+
.withPrintIndex(argv.printIndex)
|
|
115
|
+
.withKill(argv.stopOther)
|
|
116
|
+
.withCache(argv.alphaCache)
|
|
117
|
+
.run();
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|