diff --git a/packages/nx-shopify/executors.json b/packages/nx-shopify/executors.json index 2eb469b..50065fe 100644 --- a/packages/nx-shopify/executors.json +++ b/packages/nx-shopify/executors.json @@ -16,5 +16,22 @@ "schema": "./src/executors/deploy/schema.json", "description": "Deploy a Shopify theme to Shopify" } + }, + "builders": { + "build": { + "implementation": "./src/executors/build/ng-compat", + "schema": "./src/executors/build/schema.json", + "description": "Build a Shopify theme" + }, + "serve": { + "implementation": "./src/executors/serve/ng-compat", + "schema": "./src/executors/serve/schema.json", + "description": "Serves a Shopify theme for local development" + }, + "deploy": { + "implementation": "./src/executors/deploy/ng-compat", + "schema": "./src/executors/deploy/schema.json", + "description": "Deploy a Shopify theme to Shopify" + } } } diff --git a/packages/nx-shopify/generators.json b/packages/nx-shopify/generators.json index 24ec27f..ee4a1c9 100644 --- a/packages/nx-shopify/generators.json +++ b/packages/nx-shopify/generators.json @@ -6,7 +6,8 @@ "init": { "factory": "./src/generators/init/init.generator", "schema": "./src/generators/init/schema.json", - "description": "Initialize plugin" + "description": "Initialize @trafilea/nx-shopify plugin", + "aliases": ["ng-add"] }, "theme": { "factory": "./src/generators/theme/theme.generator", @@ -16,22 +17,63 @@ "layout": { "factory": "./src/generators/layout/layout.generator", "schema": "./src/generators/layout/schema.json", - "description": "Generate a theme layout" + "description": "Generate a theme layout", + "aliases": ["l"] }, "template": { "factory": "./src/generators/template/template.generator", "schema": "./src/generators/template/schema.json", - "description": "Generate a theme template" + "description": "Generate a theme template", + "aliases": ["t"] }, "snippet": { "factory": "./src/generators/snippet/snippet.generator", "schema": "./src/generators/snippet/schema.json", - "description": "Generate a theme snippet" + "description": "Generate a theme snippet", + "aliases": ["snip"] }, "section": { "factory": "./src/generators/section/section.generator", "schema": "./src/generators/section/schema.json", - "description": "Generate a theme section" + "description": "Generate a theme section", + "aliases": ["sec"] + } + }, + "schematics": { + "init": { + "factory": "./src/generators/init/init.generator#nxShopifyInitSchematic", + "schema": "./src/generators/init/schema.json", + "description": "Initialize @trafilea/nx-shopify plugin", + "aliases": ["ng-add"] + }, + "theme": { + "factory": "./src/generators/theme/theme.generator#nxShopifyThemeSchematic", + "schema": "./src/generators/theme/schema.json", + "description": "Generate a new Shopify theme" + }, + "layout": { + "factory": "./src/generators/layout/layout.generator#nxShopifyLayoutSchematic", + "schema": "./src/generators/layout/schema.json", + "description": "Generate a theme layout", + "aliases": ["l"] + }, + "template": { + "factory": "./src/generators/template/template.generator#nxShopifyTemplateSchematic", + "schema": "./src/generators/template/schema.json", + "description": "Generate a theme template", + "aliases": ["t"] + }, + "snippet": { + "factory": "./src/generators/snippet/snippet.generator#nxShopifySnippetSchematic", + "schema": "./src/generators/snippet/schema.json", + "description": "Generate a theme snippet", + "aliases": ["snip"] + }, + "section": { + "factory": "./src/generators/section/section.generator#nxShopifySectionSchematic", + "schema": "./src/generators/section/schema.json", + "description": "Generate a theme section", + "aliases": ["sec"] } } } diff --git a/packages/nx-shopify/src/executors/build/ng-compat.ts b/packages/nx-shopify/src/executors/build/ng-compat.ts new file mode 100644 index 0000000..5c7714c --- /dev/null +++ b/packages/nx-shopify/src/executors/build/ng-compat.ts @@ -0,0 +1,4 @@ +import { convertNxExecutor } from '@nrwl/devkit'; +import { buildExecutor } from './build.executor'; + +export default convertNxExecutor(buildExecutor); diff --git a/packages/nx-shopify/src/executors/deploy/ng-compat.ts b/packages/nx-shopify/src/executors/deploy/ng-compat.ts new file mode 100644 index 0000000..9689431 --- /dev/null +++ b/packages/nx-shopify/src/executors/deploy/ng-compat.ts @@ -0,0 +1,4 @@ +import { convertNxExecutor } from '@nrwl/devkit'; +import { deployExecutor } from './deploy.executor'; + +export default convertNxExecutor(deployExecutor); diff --git a/packages/nx-shopify/src/executors/serve/ng-compat.ts b/packages/nx-shopify/src/executors/serve/ng-compat.ts new file mode 100644 index 0000000..6136fa8 --- /dev/null +++ b/packages/nx-shopify/src/executors/serve/ng-compat.ts @@ -0,0 +1,4 @@ +import { convertNxExecutor } from '@nrwl/devkit'; +import { serveExecutor } from './serve.executor'; + +export default convertNxExecutor(serveExecutor); diff --git a/packages/nx-shopify/src/executors/serve/serve.executor.ts b/packages/nx-shopify/src/executors/serve/serve.executor.ts index 35e046d..f89097b 100644 --- a/packages/nx-shopify/src/executors/serve/serve.executor.ts +++ b/packages/nx-shopify/src/executors/serve/serve.executor.ts @@ -10,8 +10,8 @@ import { } from '../../utils/local-server/network-utils'; import { normalizeBuildOptions } from '../../utils/normalize-utils'; import { - isLiveTheme, getThemekitEnvironmentConfig, + isLiveTheme, } from '../../utils/themekit'; import { getSourceRoot } from '../../utils/workspace-utils'; import { getShopifyWebpackConfig } from '../../webpack/configs/shopify.config'; @@ -91,7 +91,7 @@ export async function serveExecutor( devServer, themekitEnvConfig, }); - return new Promise(() => { + return new Promise<{ success: boolean }>(() => { assetServer.start(options); }); } catch (error) { diff --git a/packages/nx-shopify/src/generators/layout/layout.generator.ts b/packages/nx-shopify/src/generators/layout/layout.generator.ts index 0530e63..f15a253 100644 --- a/packages/nx-shopify/src/generators/layout/layout.generator.ts +++ b/packages/nx-shopify/src/generators/layout/layout.generator.ts @@ -1,4 +1,5 @@ import { + convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -105,3 +106,4 @@ export async function layoutGenerator( } export default layoutGenerator; +export const nxShopifyLayoutSchematic = convertNxGenerator(layoutGenerator); diff --git a/packages/nx-shopify/src/generators/section/section.generator.ts b/packages/nx-shopify/src/generators/section/section.generator.ts index 7e888b7..2162d4b 100644 --- a/packages/nx-shopify/src/generators/section/section.generator.ts +++ b/packages/nx-shopify/src/generators/section/section.generator.ts @@ -1,4 +1,5 @@ import { + convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -105,3 +106,4 @@ export async function sectionGenerator( } export default sectionGenerator; +export const nxShopifySectionSchematic = convertNxGenerator(sectionGenerator); diff --git a/packages/nx-shopify/src/generators/snippet/snippet.generator.ts b/packages/nx-shopify/src/generators/snippet/snippet.generator.ts index fd9e890..46acf92 100644 --- a/packages/nx-shopify/src/generators/snippet/snippet.generator.ts +++ b/packages/nx-shopify/src/generators/snippet/snippet.generator.ts @@ -1,4 +1,5 @@ import { + convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -105,3 +106,4 @@ export async function snippetGenerator( } export default snippetGenerator; +export const nxShopifySnippetSchematic = convertNxGenerator(snippetGenerator); diff --git a/packages/nx-shopify/src/generators/template/template.generator.ts b/packages/nx-shopify/src/generators/template/template.generator.ts index 8a09254..29a2ecb 100644 --- a/packages/nx-shopify/src/generators/template/template.generator.ts +++ b/packages/nx-shopify/src/generators/template/template.generator.ts @@ -1,4 +1,5 @@ import { + convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -105,3 +106,4 @@ export async function templateGenerator( } export default templateGenerator; +export const nxShopifyTemplateSchematic = convertNxGenerator(templateGenerator); diff --git a/packages/nx-shopify/src/generators/theme/theme.generator.ts b/packages/nx-shopify/src/generators/theme/theme.generator.ts index fd1958a..1d33f95 100644 --- a/packages/nx-shopify/src/generators/theme/theme.generator.ts +++ b/packages/nx-shopify/src/generators/theme/theme.generator.ts @@ -257,4 +257,4 @@ export async function themeGenerator( } export default themeGenerator; -export const themeSchematic = convertNxGenerator(themeGenerator); +export const nxShopifyThemeSchematic = convertNxGenerator(themeGenerator);