Skip to content

Commit

Permalink
Merge branch 'main' into StandardBadges
Browse files Browse the repository at this point in the history
  • Loading branch information
purplecabbage authored Jan 27, 2024
2 parents 4b20beb + 743f96e commit 5e48198
Show file tree
Hide file tree
Showing 15 changed files with 181 additions and 169 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
},
"parserOptions": {
"ecmaVersion": 2020
"ecmaVersion": "latest"
}
}
4 changes: 2 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
dependencies-to-update:
description: 'csv of dependencies to update with the dist-tag'
required: false
default: '@adobe/aio-lib-console-project-installation,@adobe/aio-lib-templates'
default: '@adobe/aio-cli-lib-app-config,@adobe/aio-cli-lib-console,@adobe/aio-lib-console-project-installation,@adobe/aio-lib-core-config,@adobe/aio-lib-core-logging,@adobe/aio-lib-env,@adobe/aio-lib-ims,@adobe/aio-lib-templates'
jobs:
checkout:
name: checkout
Expand All @@ -25,7 +25,7 @@ jobs:
git config user.email github-actions@github.com
- uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18
- run: |
npm install
npm test
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/run-tests-on-pr-and-push-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x, 16.x]
node-version: [18.x, 20.x]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
Expand All @@ -30,7 +30,6 @@ jobs:
- run: npm test
- name: upload coverage
if: success()
run: curl -s https://codecov.io/bash | bash
env:
CODECOV_NAME: ${{ runner.os }} node.js ${{ matrix.node-version }}
shell: bash
uses: codecov/codecov-action@v3.1.1
with:
name: ${{ runner.os }} node.js ${{ matrix.node-version }}
56 changes: 35 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ DESCRIPTION
Discover, install, or uninstall a new template into an existing Adobe Developer App Builder App
```

_See code: [src/commands/templates/index.js](https://github.com/adobe/aio-cli-plugin-app-templates/blob/1.5.1/src/commands/templates/index.js)_
_See code: [src/commands/templates/index.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/index.ts)_

## `aio templates disco`

Expand Down Expand Up @@ -123,24 +123,26 @@ ALIASES
$ aio templates disco
```

_See code: [src/commands/templates/discover.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/discover.ts)_

## `aio templates i PATH`

Install an Adobe Developer App Builder template

```
USAGE
$ aio templates i [PATH] [-v] [-y] [--install] [--process-install-config] [--template-options <value>]
$ aio templates i PATH [-v] [-y] [--install] [--process-install-config] [--template-options <value>]
ARGUMENTS
PATH path to the template (npm package name, file path, url). See examples
FLAGS
-v, --verbose Verbose output
-y, --yes Skip questions, and use all default values
--[no-]install [default: true] Run npm installation after files are created
--[no-]process-install-config [default: true] Process the template install.yml configuration file, defaults to true,
to skip processing install.yml use --no-process-install-config
--template-options=<value> Additional template options, as a base64-encoded json string
-v, --verbose Verbose output
-y, --yes Skip questions, and use all default values
--[no-]install [default: true] Run npm installation after files are created
--[no-]process-install-config [default: true] Process the template install.yml configuration file, defaults to
true, to skip processing install.yml use --no-process-install-config
--template-options=<value> Additional template options, as a base64-encoded json string
DESCRIPTION
Install an Adobe Developer App Builder template
Expand Down Expand Up @@ -192,24 +194,26 @@ DESCRIPTION
List all App Builder templates that are installed
```

_See code: [src/commands/templates/info.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/info.ts)_

## `aio templates install PATH`

Install an Adobe Developer App Builder template

```
USAGE
$ aio templates install [PATH] [-v] [-y] [--install] [--process-install-config] [--template-options <value>]
$ aio templates install PATH [-v] [-y] [--install] [--process-install-config] [--template-options <value>]
ARGUMENTS
PATH path to the template (npm package name, file path, url). See examples
FLAGS
-v, --verbose Verbose output
-y, --yes Skip questions, and use all default values
--[no-]install [default: true] Run npm installation after files are created
--[no-]process-install-config [default: true] Process the template install.yml configuration file, defaults to true,
to skip processing install.yml use --no-process-install-config
--template-options=<value> Additional template options, as a base64-encoded json string
-v, --verbose Verbose output
-y, --yes Skip questions, and use all default values
--[no-]install [default: true] Run npm installation after files are created
--[no-]process-install-config [default: true] Process the template install.yml configuration file, defaults to
true, to skip processing install.yml use --no-process-install-config
--template-options=<value> Additional template options, as a base64-encoded json string
DESCRIPTION
Install an Adobe Developer App Builder template
Expand Down Expand Up @@ -243,13 +247,15 @@ EXAMPLES
$ aio templates install @scope/npm-package-name@tagOrVersion
```

_See code: [src/commands/templates/install.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/install.ts)_

## `aio templates remove NAME`

Remove an Adobe Developer App Builder template from the Template Registry

```
USAGE
$ aio templates remove [NAME] [-v]
$ aio templates remove NAME [-v]
ARGUMENTS
NAME The name of the package implementing the template on npmjs.com
Expand All @@ -267,13 +273,15 @@ EXAMPLES
$ aio templates remove @adobe/app-builder-template
```

_See code: [src/commands/templates/remove.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/remove.ts)_

## `aio templates rm NAME`

Remove an Adobe Developer App Builder template from the Template Registry

```
USAGE
$ aio templates rm [NAME] [-v]
$ aio templates rm NAME [-v]
ARGUMENTS
NAME The name of the package implementing the template on npmjs.com
Expand Down Expand Up @@ -309,13 +317,15 @@ DESCRIPTION
Clears all installed templates
```

_See code: [src/commands/templates/rollback.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/rollback.ts)_

## `aio templates sub NAME GITHUBREPOURL`

Submit an Adobe Developer App Builder template

```
USAGE
$ aio templates sub [NAME] [GITHUBREPOURL] [-v]
$ aio templates sub NAME GITHUBREPOURL [-v]
ARGUMENTS
NAME The name of the package implementing the template on npmjs.com
Expand All @@ -340,7 +350,7 @@ Submit an Adobe Developer App Builder template

```
USAGE
$ aio templates submit [NAME] [GITHUBREPOURL] [-v]
$ aio templates submit NAME GITHUBREPOURL [-v]
ARGUMENTS
NAME The name of the package implementing the template on npmjs.com
Expand All @@ -359,13 +369,15 @@ EXAMPLES
$ aio templates submit @adobe/app-builder-template https://github.com/adobe/app-builder-template
```

_See code: [src/commands/templates/submit.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/submit.ts)_

## `aio templates un PACKAGE-NAME`

Uninstall an Adobe Developer App Builder template

```
USAGE
$ aio templates un [PACKAGE-NAME] [-v]
$ aio templates un PACKAGE-NAME [-v]
ARGUMENTS
PACKAGE-NAME package name of the template
Expand All @@ -386,7 +398,7 @@ Uninstall an Adobe Developer App Builder template

```
USAGE
$ aio templates uninstall [PACKAGE-NAME] [-v]
$ aio templates uninstall PACKAGE-NAME [-v]
ARGUMENTS
PACKAGE-NAME package name of the template
Expand All @@ -400,6 +412,8 @@ DESCRIPTION
ALIASES
$ aio templates un
```

_See code: [src/commands/templates/uninstall.ts](https://github.com/adobe/aio-cli-plugin-app-templates/blob/2.0.2/src/commands/templates/uninstall.ts)_
<!-- commandsstop -->

# Contributing
Expand Down
10 changes: 4 additions & 6 deletions jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ global.fixtureJson = (output) => {
expect.extend({
toMatchFixture (received, argument) {
const val = global.fixtureFile(argument)
// eslint-disable-next-line jest/no-standalone-expect
expect(eol.auto(received)).toEqual(eol.auto(val))
return { pass: true }
const isEqual = eol.auto(received) === eol.auto(val)
return { pass: isEqual }
}
})

expect.extend({
toMatchFixtureJson (received, argument) {
const val = global.fixtureJson(argument)
// eslint-disable-next-line jest/no-standalone-expect
expect(received).toEqual(val)
return { pass: true }
const isEqual = received === val
return { pass: isEqual }
}
})

Expand Down
51 changes: 27 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "@adobe/aio-cli-plugin-app-templates",
"version": "1.5.2",
"version": "2.0.2",
"description": "Discover, Install, Uninstall, Submit, and Remove Adobe App Builder templates",
"repository": {
"type": "git",
"url": "git+https://github.com/adobe/aio-cli-plugin-app-templates.git"
},
"dependencies": {
"@adobe/aio-cli-lib-app-config": "^0.2.2",
"@adobe/aio-cli-lib-console": "^4.0.0",
"@adobe/aio-lib-console-project-installation": "^2.2.2",
"@adobe/aio-lib-core-config": "^2.0.0",
"@adobe/aio-lib-core-logging": "^1.1.0",
"@adobe/aio-lib-env": "^2.0.0",
"@adobe/aio-lib-ims": "^6.0.1",
"@adobe/aio-lib-templates": "^2.2.0",
"@adobe/aio-cli-lib-app-config": "^4",
"@adobe/aio-cli-lib-console": "^5",
"@adobe/aio-lib-console-project-installation": "^3",
"@adobe/aio-lib-core-config": "^5",
"@adobe/aio-lib-core-logging": "^3",
"@adobe/aio-lib-env": "^3",
"@adobe/aio-lib-ims": "^7",
"@adobe/aio-lib-templates": "^3",
"@oclif/core": "^1.9.3",
"chalk": "^4.1.2",
"execa": "^4.1.0",
Expand All @@ -23,31 +23,33 @@
"js-yaml": "^3.14.1",
"node-fetch": "^2.6.7",
"ora": "^4.1.1",
"yeoman-environment": "^3.9.1"
"yeoman-environment": "^4.2.1"
},
"devDependencies": {
"@adobe/eslint-config-aio-lib-config": "^1.4.0",
"@adobe/eslint-config-aio-lib-config": "^2.0.2",
"@types/jest": "^28.1.5",
"acorn": "^7",
"cross-env": "^7.0.3",
"eol": "^0.9.1",
"eslint": "^7.5",
"eslint": "^8.56.0",
"eslint-config-oclif": "^3.1.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-jsdoc": "^37.9.7",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.2",
"eslint-plugin-jsdoc": "^42.0.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-standard": "^4.0.1",
"jest": "^27",
"jest-haste-map": "^24.5.0",
"jest": "^29.7.0",
"jest-junit": "^6.0.0",
"jest-resolve": "^24.5.0",
"oclif": "^3.2.0",
"stdout-stderr": "^0.1.9"
"oclif": "^4.3.6",
"stdout-stderr": "^0.1.9",
"typescript": "^5.3.3"
},
"engines": {
"node": "^14.18 || ^16.13 || >=18"
"node": ">=18"
},
"files": [
"/oclif.manifest.json",
Expand All @@ -67,7 +69,7 @@
"scripts": {
"pretest": "npm run lint:check",
"test": "npm run unit-tests",
"unit-tests": "jest --ci",
"unit-tests": "cross-env NODE_OPTIONS=--experimental-vm-modules ./node_modules/jest/bin/jest.js --ci",
"prepack": "oclif manifest && oclif readme --no-aliases",
"postpack": "rm -f oclif.manifest.json",
"version": "oclif readme && git add README.md",
Expand All @@ -80,7 +82,8 @@
"global": {
"branches": 100,
"lines": 100,
"statements": 100
"statements": 100,
"functions": 100
}
},
"collectCoverage": true,
Expand Down
6 changes: 3 additions & 3 deletions src/commands/templates/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const inquirer = require('inquirer')
const { TEMPLATE_PACKAGE_JSON_KEY, readPackageJson } = require('../../lib/npm-helper')
const { getTemplates } = require('../../lib/template-registry-helper')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app-templates:templates:discover', { provider: 'debug' })
const loadConfig = require('@adobe/aio-cli-lib-app-config')
const { load: loadConfig } = require('@adobe/aio-cli-lib-app-config')
const env = require('@adobe/aio-lib-env')
const LibConsoleCLI = require('@adobe/aio-cli-lib-console')
const { SEARCH_CRITERIA_FILTER_NOT } = require('@adobe/aio-lib-templates')
Expand All @@ -32,9 +32,9 @@ class DiscoverCommand extends BaseCommand {

await this.login()
const apiKey = env.getCliEnv() === 'prod' ? 'aio-cli-console-auth' : 'aio-cli-console-auth-stage'
const consoleCLI = await LibConsoleCLI.init({ accessToken: this.accessToken, env: env.getCliEnv(), apiKey: apiKey })
const consoleCLI = await LibConsoleCLI.init({ accessToken: this.accessToken, env: env.getCliEnv(), apiKey })

const appConfig = loadConfig({})
const appConfig = await loadConfig({})
let orgId = appConfig?.aio?.project?.org?.id
if (!orgId) {
const organizations = await consoleCLI.getOrganizations()
Expand Down
9 changes: 5 additions & 4 deletions src/commands/templates/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ const { runScript } = require('../../lib/helper')
const { writeObjectToPackageJson, readPackageJson, getNpmDependency, processNpmPackageSpec, TEMPLATE_PACKAGE_JSON_KEY } = require('../../lib/npm-helper')
const { getTemplateRequiredServiceNames } = require('../../lib/template-helper')
const ora = require('ora')
const yeoman = require('yeoman-environment')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app-templates:templates:install', { provider: 'debug' })
const { Flags } = require('@oclif/core')

// aio-lib-console-project-installation dependencies
const path = require('path')
const loadConfig = require('@adobe/aio-cli-lib-app-config')
const { load: loadConfig } = require('@adobe/aio-cli-lib-app-config')
const templateHandler = require('@adobe/aio-lib-console-project-installation')

class InstallCommand extends BaseCommand {
Expand All @@ -46,6 +45,8 @@ class InstallCommand extends BaseCommand {
}
aioLogger.debug(`templateName: ${templateName}`)

// eslint-disable-next-line node/no-unsupported-features/es-syntax
const yeoman = await import('yeoman-environment')
const env = yeoman.createEnv()
env.options = { skipInstall: !flags.install }
spinner.info(`Running template ${templateName}`)
Expand All @@ -62,7 +63,7 @@ class InstallCommand extends BaseCommand {
aioLogger.debug(`flags['template-options']: ${JSON.stringify(templateOptions)}`)

const templatePath = require.resolve(templateName, { paths: [process.cwd()] })
const gen = env.instantiate(require(templatePath), {
const gen = await env.instantiate(require(templatePath), {
options: { ...defaultOptions, ...templateOptions }
})
await env.runGenerator(gen)
Expand Down Expand Up @@ -111,7 +112,7 @@ class InstallCommand extends BaseCommand {
const templateManager = await templateHandler.init(this.accessToken, installConfigFile)

// 3. Install the template
const appConfig = loadConfig({})
const appConfig = await loadConfig({})
const orgId = appConfig?.aio?.project?.org?.id
const projectId = appConfig?.aio?.project?.id
if (orgId && projectId) {
Expand Down
Loading

0 comments on commit 5e48198

Please sign in to comment.