diff --git a/README.md b/README.md index 6dc3eb3..9054458 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Shopify development tool using themekit and webpack. Also a compatible replaceme - Multiple entrypoints for templates and layouts - List themes on store - Delete themes from CLI -- Create new empty theme in Shopify from CLI, adds theme id to config.json +- Create new empty theme in Shopify from CLI, adds theme id to packer.config.json - Download existing themes - Download files/sync changes - Init base packer theme from cli or use a custom github repo @@ -86,7 +86,7 @@ yarn global add @hayes0724/shopify-packer ``` packer init ``` -2. Add app password and store url to config.json +2. Add app password and store url to packer.config.json 3. Create new empty theme on shopify ``` @@ -130,7 +130,7 @@ packer start [--env=my-custom-env-name] [--skipPrompts] [--skipFirstDeploy] |               Flag               | Description | | --- | --- | -| `--env` | Targets a custom environment. Setting --env=production would use the production settings in config.json | +| `--env` | Targets a custom environment. Setting --env=production would use the production settings in packer.config.json | | `--skipPrompts` | Skips all prompts. This is especially useful when using Packer with continuous integration tools | | `--skipFirstDeploy` | Skips the file upload sequence and simply boots up the local Express server | @@ -146,7 +146,7 @@ packer deploy [--env=my-custom-env-name] [--skipPrompts] [--replace] ``` |               Flag               | Description | | --- | --- | -| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in config.json | +| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in packer.config.json | | ``--skipPrompts`` | Skips all prompts. This is especially useful when using Packer with continuous integration tools | | ``--nodelete`` | By default deploy will replace all files in theme, use this flag to update without removing existing files | ### build @@ -184,21 +184,21 @@ Compiles the contents of the dist directory and creates a ZIP file in the root o packer zip ``` ### theme:list -Lists all themes (shows name, themeID, etc...) on the site, requires app password and store url be set first. By default looks at the store for development env in config.json +Lists all themes (shows name, themeID, etc...) on the site, requires app password and store url be set first. By default looks at the store for development env in packer.config.json ```bash packer theme:list ``` | Flag | Description | | --- | --- | -| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in config.json | +| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in packer.config.json | ### theme:create -Creates a new empty theme on Shopify and updates config.json for the selected env with the proper themeID +Creates a new empty theme on Shopify and updates packer.config.json for the selected env with the proper themeID ```bash packer theme:create ``` |                   Flag                   | Description | | --- | --- | -| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in config.json | +| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in packer.config.json | | ``--name=my-theme-name `` | Sets the theme name on Shopify, it's required | ### theme:remove Removes the theme set in the selected env from Shopify @@ -207,7 +207,8 @@ packer theme:remove ``` | Flag | Description | | --- | --- | -| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in config.json | +| ``--env`` | Targets a custom environment (defaults to development). Setting --env=production would use the production settings in packer.config.json | +| ``--id`` | Delete a theme by using its ID | ### theme:download Downloads the theme set in the selected env from Shopify @@ -216,7 +217,7 @@ packer theme:download ``` | Flag | Description | | --- | --- | -| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in config.json | +| ``--env`` | Targets a custom environment. Setting --env=production would use the production settings in packer.config.json | ### help diff --git a/cli/commands/help.js b/cli/commands/help.js index c74f1bd..015a59c 100644 --- a/cli/commands/help.js +++ b/cli/commands/help.js @@ -79,20 +79,21 @@ module.exports = () => { ]); commands.push([ chalk.greenBright.bold('theme:list'), - 'Lists all themes on the store using credentials in config.json', + 'Lists all themes on the store using credentials in packer.config.json', '--env=my-custom-env-name', ]); commands.push([ chalk.greenBright.bold('theme:create'), - 'Create a new theme using credentials in config.json, it will add the store id to your config', + 'Create a new theme using credentials in packer.config.json, it will add the store id to your config', `--env=my-custom-env-name --name=my-theme-name --deploy`, ]); commands.push([ chalk.greenBright.bold('theme:remove'), - 'Completely deletes the theme using the id set in config.json', + 'Completely deletes the theme using the id set in packer.config.json or by providing a id flag', '--env=my-custom-env-name\n', + '--id=1234456789\n', ]); commands.push([ chalk.greenBright.bold('theme:download'), diff --git a/cli/commands/theme.js b/cli/commands/theme.js index e7779e9..212b815 100644 --- a/cli/commands/theme.js +++ b/cli/commands/theme.js @@ -17,7 +17,7 @@ module.exports = async (args) => { await createTheme(args); } if (args.remove) { - await removeTheme(); + await removeTheme(args); } if (args.download) { downloadTheme() diff --git a/src/theme/api.js b/src/theme/api.js index 1a6aaed..7e011f4 100644 --- a/src/theme/api.js +++ b/src/theme/api.js @@ -64,9 +64,9 @@ const create = (args) => { }); }; -const remove = async () => { +const remove = async (themeIdFlag = null) => { _headers(); - const themeId = getThemeIdValue(); + const themeId = themeIdFlag ? themeIdFlag : getThemeIdValue(); const mainTheme = await _isMainTheme(themeId); if (mainTheme.status === 'error') { return { diff --git a/src/theme/index.js b/src/theme/index.js index 90ae9f6..6a35541 100644 --- a/src/theme/index.js +++ b/src/theme/index.js @@ -62,18 +62,19 @@ const createTheme = async (args) => { spinner.succeed( `Theme ${chalk.cyan(result.theme.name)} with id ${chalk.cyan( result.theme.id - )} created and config.json updated!` + )} created and packer.config.json updated!` ); console.log(table(parsed)); }; -const removeTheme = async () => { +const removeTheme = async (args) => { + const themeIdFlag = args.id ? args.id : null; clearConsole(); const spinner = ora( chalk.magenta(`'Deleting theme for environment: ${getEnvNameValue()} ...'`) ); spinner.start(); - const result = await remove(); + const result = await remove(themeIdFlag); if (result.status === 'error') { spinner.color = 'red'; spinner.fail(chalk.red(result.message));