Skip to content

Commit aeb2f28

Browse files
Remove all remnants of --local (#854)
1 parent fd0d8ec commit aeb2f28

22 files changed

Lines changed: 167 additions & 1729 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ coverage
1414
oclif.manifest.json
1515
package-lock.json
1616

17-
bin/openwhisk-standalone*.jar

bin/openwhisk-standalone-config/get-runtimes.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

bin/openwhisk-standalone-config/runtimes.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
"archiver": "^5.3.1",
2828
"chalk": "^4",
2929
"chokidar": "^3.5.2",
30-
"debug": "^4.1.1",
31-
"dedent-js": "^1.0.1",
32-
"dotenv": "^16",
3330
"execa": "^5.0.0",
3431
"fs-extra": "^11.1.1",
3532
"get-port": "^5",

src/commands/app/deploy.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ class Deploy extends BuildCommand {
185185
if (!script) {
186186
const hookResults = await this.config.runHook('deploy-actions', {
187187
appConfig: config,
188-
filterEntities: filterActions || [],
189-
isLocalDev: false
188+
filterEntities: filterActions || []
190189
})
191190
if (hookResults?.failures?.length > 0) {
192191
// output should be "Error : <plugin-name> : <error-message>\n" for each failure

src/commands/app/get-url.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const BaseCommand = require('../../BaseCommand')
1818
const { wrapError } = require('../../lib/app-helper')
1919
const { getActionUrls } = require('@adobe/aio-lib-runtime').utils
2020
const yaml = require('js-yaml')
21-
const { loadLocalDevConfig } = require('../../lib/run-local-runtime')
2221

2322
class GetUrlCommand extends BaseCommand {
2423
async run () {
@@ -46,16 +45,10 @@ class GetUrlCommand extends BaseCommand {
4645
}
4746

4847
const actionUrls = {}
49-
if (flags.local) {
50-
Object.values(fullConfig.all).forEach(config => {
51-
const localDevConfig = loadLocalDevConfig(config)
52-
Object.assign(actionUrls, getActionUrls(localDevConfig, false, true))
53-
})
54-
} else {
55-
Object.values(fullConfig.all).forEach(config => {
56-
Object.assign(actionUrls, getActionUrls(config, true))
57-
})
58-
}
48+
49+
Object.values(fullConfig.all).forEach(config => {
50+
Object.assign(actionUrls, getActionUrls(config, true))
51+
})
5952
urls.runtime = actionUrls
6053
const cdnUrls = {}
6154
if (options.cdn) {
@@ -110,9 +103,6 @@ GetUrlCommand.flags = {
110103
yml: Flags.boolean({
111104
description: 'Output yml',
112105
char: 'y'
113-
}),
114-
local: Flags.boolean({
115-
description: 'Display locally based action URLs'
116106
})
117107
}
118108

src/commands/app/run.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const fs = require('fs-extra')
1616
const https = require('https')
1717
const getPort = require('get-port')
1818
const open = require('open')
19-
const os = require('node:os')
2019

2120
const { Flags, ux } = require('@oclif/core')
2221
const coreConfig = require('@adobe/aio-lib-core-config')
@@ -36,16 +35,6 @@ class Run extends BaseCommand {
3635
// cli input
3736
const { flags } = await this.parse(Run)
3837

39-
if (flags.local) {
40-
const [firstCpu] = os.cpus()
41-
// note: the earliest versions of M1 macs return 'Apple processor' under model.
42-
if (firstCpu?.model?.startsWith('Apple')) {
43-
this.error('The --local flag is not supported on Apple Silicon Macs.')
44-
} else {
45-
this.warn('The --local flag is deprecated and will be removed in the next major release.')
46-
}
47-
}
48-
4938
const spinner = ora()
5039

5140
const runConfigs = await this.getAppExtConfigs(flags)
@@ -87,7 +76,6 @@ class Run extends BaseCommand {
8776
shouldContentHash: false
8877
},
8978
fetchLogs: true,
90-
isLocal: flags.local,
9179
verbose: flags.verbose
9280
}
9381

@@ -107,7 +95,7 @@ class Run extends BaseCommand {
10795
}
10896
}
10997

110-
const verboseOutput = flags.verbose || flags.local || headlessApp
98+
const verboseOutput = flags.verbose || headlessApp
11199
// we should evaluate this, a lot of output just disappears in the spinner text and
112100
// using verbose dumps ALL of parcel's output, so this become unreadable
113101
// we need a middle ground. -jm
@@ -217,10 +205,6 @@ Run.args = {}
217205

218206
Run.flags = {
219207
...BaseCommand.flags,
220-
local: Flags.boolean({
221-
description: '[deprecated] Run/debug actions locally (requires Docker running, not available on Apple Silicon Macs)',
222-
exclusive: ['no-actions']
223-
}),
224208
serve: Flags.boolean({
225209
description: '[default: true] Start frontend server (experimental)',
226210
default: true,

src/lib/actions-watcher.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const deployActions = require('./deploy-actions')
2424
/**
2525
* @typedef {object} WatcherOptions
2626
* @property {object} config the app config (see src/lib/config-loader.js)
27-
* @property {boolean} isLocal whether the deployment is local or not
2827
* @property {Function} log the app logger
2928
* @property {object} [watcher] the watcher itself
3029
*/
@@ -61,10 +60,9 @@ module.exports = async (watcherOptions) => {
6160
* @param {Array<string>} filterActions add filters to deploy only specified OpenWhisk actions
6261
*/
6362
async function buildAndDeploy (watcherOptions, filterActions) {
64-
const { config, isLocal, log, inprocHook } = watcherOptions
63+
const { config, log, inprocHook } = watcherOptions
6564
await buildActions(config, filterActions)
6665
const deployConfig = {
67-
isLocalDev: isLocal,
6866
filterEntities: {
6967
actions: filterActions
7068
}

src/lib/app-helper.js

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const which = require('which')
1616
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:lib-app-helper', { provider: 'debug' })
1717
const { getToken, context } = require('@adobe/aio-lib-ims')
1818
const { CLI } = require('@adobe/aio-lib-ims/src/context')
19-
const { createFetch } = require('@adobe/aio-lib-core-networking')
2019
const chalk = require('chalk')
2120
const aioConfig = require('@adobe/aio-lib-core-config')
2221
const { AIO_CONFIG_WORKSPACE_SERVICES, AIO_CONFIG_ORG_SERVICES } = require('./defaults')
@@ -262,116 +261,6 @@ function writeConfig (file, config) {
262261
)
263262
}
264263

265-
/** @private */
266-
async function isDockerRunning () {
267-
// todo more checks
268-
const args = ['info']
269-
try {
270-
await execa('docker', args)
271-
return true
272-
} catch (error) {
273-
aioLogger.debug('Error spawning docker info: ' + error)
274-
}
275-
return false
276-
}
277-
278-
/** @private */
279-
async function hasDockerCLI () {
280-
// todo check min version
281-
try {
282-
const result = await execa('docker', ['-v'])
283-
aioLogger.debug('docker version : ' + result.stdout)
284-
return true
285-
} catch (error) {
286-
aioLogger.debug('Error spawning docker info: ' + error)
287-
}
288-
return false
289-
}
290-
291-
/** @private */
292-
async function hasJavaCLI () {
293-
// todo check min version
294-
try {
295-
const result = await execa('java', ['-version'])
296-
// stderr is where the version is printed out for
297-
aioLogger.debug('java version : ' + result.stderr)
298-
return true
299-
} catch (error) {
300-
aioLogger.debug('Error spawning java info: ' + error)
301-
}
302-
return false
303-
}
304-
305-
/** @private */
306-
async function downloadOWJar (url, outFile) {
307-
aioLogger.debug(`downloadOWJar - url: ${url} outFile: ${outFile}`)
308-
let response
309-
try {
310-
const fetch = createFetch()
311-
response = await fetch(url)
312-
} catch (e) {
313-
aioLogger.debug(`connection error while downloading '${url}'`, e)
314-
throw new Error(`connection error while downloading '${url}', are you online?`)
315-
}
316-
if (!response.ok) throw new Error(`unexpected response while downloading '${url}': ${response.statusText}`)
317-
fs.ensureDirSync(path.dirname(outFile))
318-
const fstream = fs.createWriteStream(outFile)
319-
320-
return new Promise((resolve, reject) => {
321-
response.body.pipe(fstream)
322-
response.body.on('error', (err) => {
323-
reject(err)
324-
})
325-
fstream.on('finish', () => {
326-
resolve()
327-
})
328-
})
329-
}
330-
331-
/** @private */
332-
async function waitForOpenWhiskReadiness (host, endTime, period, timeout, lastStatus, waitFunc) {
333-
if (Date.now() > endTime) {
334-
throw new Error(`local openwhisk stack startup timed out after ${timeout}ms due to ${lastStatus}`)
335-
}
336-
337-
let ok, status
338-
339-
try {
340-
const fetch = createFetch()
341-
const response = await fetch(host + '/api/v1')
342-
ok = response.ok
343-
status = response.statusText
344-
} catch (e) {
345-
ok = false
346-
status = e.toString()
347-
}
348-
349-
if (!ok) {
350-
await waitFunc(period)
351-
return waitForOpenWhiskReadiness(host, endTime, period, timeout, status, waitFunc)
352-
}
353-
}
354-
355-
/** @private */
356-
function waitFor (t) {
357-
return new Promise(resolve => setTimeout(resolve, t))
358-
}
359-
360-
/** @private */
361-
async function runOpenWhiskJar (jarFile, runtimeConfigFile, apihost, waitInitTime, waitPeriodTime, timeout, /* istanbul ignore next */ execaOptions = {}) {
362-
aioLogger.debug(`runOpenWhiskJar - jarFile: ${jarFile} runtimeConfigFile ${runtimeConfigFile} apihost: ${apihost} waitInitTime: ${waitInitTime} waitPeriodTime: ${waitPeriodTime} timeout: ${timeout}`)
363-
const jvmConfig = aioConfig.get('ow.jvm.args')
364-
const jvmArgs = jvmConfig ? jvmConfig.split(' ') : []
365-
const proc = execa('java', ['-jar', '-Dwhisk.concurrency-limit.max=10', ...jvmArgs, jarFile, '-m', runtimeConfigFile, '--no-ui', '--disable-color-logging'], execaOptions)
366-
367-
const endTime = Date.now() + timeout
368-
await waitFor(waitInitTime)
369-
await waitForOpenWhiskReadiness(apihost, endTime, waitPeriodTime, timeout, null, waitFor)
370-
371-
// must wrap in an object as execa return value is awaitable
372-
return { proc }
373-
}
374-
375264
/**
376265
*
377266
*Converts a service array to an input string that can be consumed by generator-aio-app
@@ -599,14 +488,8 @@ module.exports = {
599488
removeProtocolFromURL,
600489
urlJoin,
601490
checkFile,
602-
hasDockerCLI,
603-
hasJavaCLI,
604-
isDockerRunning,
605491
writeConfig,
606-
downloadOWJar,
607-
runOpenWhiskJar,
608492
servicesToGeneratorInput,
609-
waitForOpenWhiskReadiness,
610493
warnIfOverwriteServicesInProductionWorkspace,
611494
setOrgServicesConfig,
612495
setWorkspaceServicesConfig,

0 commit comments

Comments
 (0)