@softlimit/theme-envy 0.1.2-alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/.eslintrc.js +26 -0
  2. package/.github/CODEOWNERS +1 -0
  3. package/.github/workflows/release-please.yml +19 -0
  4. package/LICENSE +21 -0
  5. package/README.md +259 -0
  6. package/build/functions/failed-hook-installs.js +18 -0
  7. package/build/functions/get-all.js +102 -0
  8. package/build/functions/index.js +7 -0
  9. package/build/functions/liquid/functions/extend-liquid.js +77 -0
  10. package/build/functions/liquid/functions/flatten-shopify-directory-structure.js +29 -0
  11. package/build/functions/liquid/functions/index.js +6 -0
  12. package/build/functions/liquid/functions/list-dependencies.js +47 -0
  13. package/build/functions/liquid/functions/section-schema-inject.js +26 -0
  14. package/build/functions/liquid/index.js +36 -0
  15. package/build/functions/parent-theme-files.js +25 -0
  16. package/build/functions/tailwind.js +31 -0
  17. package/build/functions/theme-envy.js +85 -0
  18. package/build/functions/webpack.js +44 -0
  19. package/build/index.js +45 -0
  20. package/build/requires/assets.js +22 -0
  21. package/build/requires/config.js +44 -0
  22. package/build/requires/globals/index.js +10 -0
  23. package/build/requires/globals/parent-theme.js +28 -0
  24. package/build/requires/globals/prepare-install-hooks-schema.js +58 -0
  25. package/build/requires/globals/progress-bar.js +52 -0
  26. package/build/requires/globals/theme-require.js +190 -0
  27. package/build/requires/index.js +21 -0
  28. package/build/requires/locales.js +16 -0
  29. package/build/requires/scripts/index.js +5 -0
  30. package/build/requires/scripts/public-path.js +9 -0
  31. package/build/requires/scripts/script-builders/elements.build.js +44 -0
  32. package/build/requires/scripts/script-builders/features.build.js +15 -0
  33. package/build/requires/scripts/theme-envy.js +7 -0
  34. package/build/requires/snippets/index.js +11 -0
  35. package/build/requires/snippets/liquid-builders/theme-envy.liquid.build.js +21 -0
  36. package/build/requires/styles/index.js +1 -0
  37. package/build/requires/styles/styles-builders/theme-envy.css.js +11 -0
  38. package/build/requires/styles/tailwind-base.css +3 -0
  39. package/build/requires/templates.js +20 -0
  40. package/build/theme-envy.config.js +71 -0
  41. package/convert/functions/convert-sections-to-features.js +56 -0
  42. package/convert/functions/detect-children.js +30 -0
  43. package/convert/functions/index.js +6 -0
  44. package/convert/functions/install-hooks.js +68 -0
  45. package/convert/functions/set-settings-schema-js.js +14 -0
  46. package/convert/index.js +50 -0
  47. package/helpers/functions/dev.js +15 -0
  48. package/helpers/functions/dist-clean.js +19 -0
  49. package/helpers/functions/ensure-directories.js +26 -0
  50. package/helpers/functions/find-orphans.js +20 -0
  51. package/helpers/functions/global-theme-envy.js +20 -0
  52. package/helpers/functions/liquid-prettify.js +24 -0
  53. package/helpers/functions/liquid-tree/functions/count-results.js +13 -0
  54. package/helpers/functions/liquid-tree/functions/get-depth.js +12 -0
  55. package/helpers/functions/liquid-tree/functions/get-file-info.js +11 -0
  56. package/helpers/functions/liquid-tree/functions/index.js +5 -0
  57. package/helpers/functions/liquid-tree/index.js +48 -0
  58. package/helpers/functions/liquid-tree/objects/dependencies.js +74 -0
  59. package/helpers/functions/liquid-tree/objects/index.js +3 -0
  60. package/helpers/functions/log-symbols.js +28 -0
  61. package/helpers/functions/pull-json.js +22 -0
  62. package/helpers/functions/scaffold-new/functions/element.js +15 -0
  63. package/helpers/functions/scaffold-new/functions/feature.js +76 -0
  64. package/helpers/functions/scaffold-new/functions/index.js +6 -0
  65. package/helpers/functions/scaffold-new/functions/load-dir.js +24 -0
  66. package/helpers/functions/scaffold-new/functions/starter-content.js +21 -0
  67. package/helpers/functions/scaffold-new/functions/upper-first-letter.js +3 -0
  68. package/helpers/functions/scaffold-new/index.js +28 -0
  69. package/helpers/functions/scaffold-new/objects/index.js +3 -0
  70. package/helpers/functions/scaffold-new/objects/starter-configs.js +7 -0
  71. package/helpers/functions/unicode-supported.js +21 -0
  72. package/helpers/index.js +10 -0
  73. package/index.js +190 -0
  74. package/init/functions/add-theme-envy-features/features/theme-envy/install.js +6 -0
  75. package/init/functions/add-theme-envy-features/index.js +21 -0
  76. package/init/functions/copy-example-feature/example-feature/config/_example-feature.js +8 -0
  77. package/init/functions/copy-example-feature/example-feature/index.js +5 -0
  78. package/init/functions/copy-example-feature/example-feature/install.js +10 -0
  79. package/init/functions/copy-example-feature/example-feature/partials/_example-feature-partial.liquid +3 -0
  80. package/init/functions/copy-example-feature/example-feature/schema/schema-example-feature-schema-partial.js +16 -0
  81. package/init/functions/copy-example-feature/example-feature/schema/schema-example-feature-section.js +14 -0
  82. package/init/functions/copy-example-feature/example-feature/scripts/example-feature.js +3 -0
  83. package/init/functions/copy-example-feature/example-feature/sections/example-feature-section.liquid +11 -0
  84. package/init/functions/copy-example-feature/example-feature/snippets/example-feature-snippet.liquid +1 -0
  85. package/init/functions/copy-example-feature/index.js +25 -0
  86. package/init/functions/copy-starter-config-files/configs/postcss.config.js +9 -0
  87. package/init/functions/copy-starter-config-files/configs/tailwind.config.js +16 -0
  88. package/init/functions/copy-starter-config-files/configs/theme.config.js +25 -0
  89. package/init/functions/copy-starter-config-files/index.js +28 -0
  90. package/init/functions/copy-starter-config-files/utils/starter-config.js +17 -0
  91. package/init/functions/copy-starter-config-files/utils/starter-element.js +16 -0
  92. package/init/functions/copy-starter-config-files/utils/starter-install.js +14 -0
  93. package/init/functions/copy-starter-config-files/utils/starter-schema.js +32 -0
  94. package/init/functions/copy-starter-config-files/utils/starter-section.js +16 -0
  95. package/init/functions/create-empty-settings-data.js +19 -0
  96. package/init/functions/create-settings-schema.js +29 -0
  97. package/init/functions/if-shopify-theme-exists.js +26 -0
  98. package/init/functions/import-from-git.js +21 -0
  99. package/init/functions/index.js +10 -0
  100. package/init/functions/validate-source-theme.js +28 -0
  101. package/init/index.js +87 -0
  102. package/package.json +88 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @private
3
+ * @file adds config for the example feature to the theme config
4
+ */
5
+
6
+ module.exports = {
7
+
8
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @file imports all the scripts for the example feature
3
+ */
4
+
5
+ import './scripts/example-feature.js'
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file exports an array of objects for hooks and content to be added to the theme
3
+ */
4
+
5
+ module.exports = [
6
+ {
7
+ hook: 'some-hook-name',
8
+ content: 'html/liquid - could reference to snippet, section, or partial or include conditional etc'
9
+ }
10
+ ]
@@ -0,0 +1,3 @@
1
+ Partial content gets output directly in the file it is referenced from, so it can use any variables already defined in that file without passing them like snippets.
2
+
3
+ Additionally, any variables defined in a partial can be used after its reference in the file it's referenced from, unlike the strict, one-way scope of snippets.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @private
3
+ * @file a schema partial that can be re-used in multiple schema files ThemeRequire('schema-example-feature-schema-partial.js')
4
+ */
5
+ module.exports = [
6
+ {
7
+ type: 'Header',
8
+ content: 'Example Setting'
9
+ },
10
+ {
11
+ type: 'text',
12
+ id: 'title',
13
+ label: 'Title',
14
+ default: 'Title'
15
+ }
16
+ ]
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @private
3
+ * @file The schema for the example feature, included in example-feature-section.liquid {% schema 'schema-example-feature-section' %}
4
+ */
5
+ module.exports = {
6
+ name: 'Example Feature',
7
+ tag: 'div',
8
+ settings: [
9
+ ...ThemeRequire('schema-example-feature-schema-partial.js')
10
+ ],
11
+ presets: {
12
+ name: 'Example Feature'
13
+ }
14
+ }
@@ -0,0 +1,3 @@
1
+ /**
2
+ * @file write your example feature JS here
3
+ */
@@ -0,0 +1,11 @@
1
+ <div class="example-feature">
2
+ {% if section.settings.title != blank %}
3
+ <div class="w-full py-4 text-2xl text-center title">
4
+ {{ section.settings.title }}
5
+ </div>
6
+ {% endif %}
7
+ {% partial '_example-feature-partial' %}
8
+ {% snippet 'example-feature-snippet' %}
9
+ </div>
10
+
11
+ {% schema 'schema-example-feature-section.js' %}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @private
3
+ * @file Copy the example feature to the destination, used during init command
4
+ * @param {object} options - options object
5
+ * @param {string} options.dest - destination directory
6
+ */
7
+ const path = require('path')
8
+ const fs = require('fs-extra')
9
+ const chalk = require('chalk')
10
+ const logSymbols = require('#LogSymbols')
11
+
12
+ module.exports = function({ dest }) {
13
+ // define and create the destination example-feature
14
+ const target = path.resolve(dest, './theme-envy/features/example-feature')
15
+ fs.ensureDirSync(target)
16
+
17
+ // define the src example-feature path
18
+ const exampleSrc = path.resolve(__dirname, './example-feature')
19
+
20
+ // now copy the files
21
+ fs.copy(exampleSrc, target, err => {
22
+ if (err) return console.error(err)
23
+ console.log(logSymbols.success, chalk.green.bold('Example Feature'), 'copied')
24
+ })
25
+ }
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ plugins: [
3
+ require('postcss-import'),
4
+ require('tailwindcss/nesting'),
5
+ require('tailwindcss'),
6
+ require('autoprefixer'),
7
+ require('cssnano')
8
+ ]
9
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @private
3
+ * @type {import('tailwindcss').Config}
4
+ */
5
+ const theme = require('./theme.config.js')
6
+ const path = require('path')
7
+ const ThemeEnvy = require('./theme.config.js')
8
+
9
+ module.exports = {
10
+ content: [path.resolve(ThemeEnvy.themePath, '**/*.{liquid,js}')],
11
+ theme: {
12
+ extend: {},
13
+ },
14
+ screens: theme.breakpoints,
15
+ plugins: [],
16
+ }
@@ -0,0 +1,25 @@
1
+ module.exports = {
2
+ entry: {
3
+ // main: './src/scripts/main.js',
4
+ },
5
+ store: 'my-store.myshopify.com',
6
+ themePath: 'src',
7
+ outputPath: 'dist',
8
+ // tailwind: false,
9
+ breakpoints: {
10
+ sm: '640px',
11
+ // => @media (min-width: 640px) { ... }
12
+
13
+ md: '768px',
14
+ // => @media (min-width: 768px) { ... }
15
+
16
+ lg: '1024px',
17
+ // => @media (min-width: 1024px) { ... }
18
+
19
+ xl: '1280px',
20
+ // => @media (min-width: 1280px) { ... }
21
+
22
+ '2xl': '1536px'
23
+ // => @media (min-width: 1536px) { ... }
24
+ }
25
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @file Copies starter config files to target directory during init command
3
+ */
4
+
5
+ const path = require('path')
6
+ const fs = require('fs-extra')
7
+ const logSymbols = require('#LogSymbols')
8
+
9
+ module.exports = function({ target, opts }) {
10
+ // copy config files
11
+ const configSrc = path.resolve(__dirname, './configs')
12
+ fs.copy(configSrc, target, err => {
13
+ if (err) return console.error(err)
14
+ console.log(`${logSymbols.success} Config files copied`
15
+ )
16
+ if (opts.store) {
17
+ const themeConfig = fs.readFileSync(path.resolve(target, 'theme.config.js'), 'utf8')
18
+ fs.writeFileSync(path.resolve(target, 'theme.config.js'), themeConfig.replace(/store: '.*'/, `store: '${opts.store}'`))
19
+ }
20
+ })
21
+
22
+ // copy util starter files
23
+ const utilsSrc = path.resolve(__dirname, './utils')
24
+ fs.copy(utilsSrc, path.resolve(target, 'utils'), err => {
25
+ if (err) return console.error(err)
26
+ console.log(`${logSymbols.success} Utils starter files copied`)
27
+ })
28
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @file Used as a template for a new config file for a new feature or element
3
+ * @param {string} readableName - The name of the feature or element
4
+ */
5
+
6
+ module.exports = (readableName) => {
7
+ return `module.exports = [
8
+ {
9
+ name: '${readableName}',
10
+ settings: [
11
+
12
+ ]
13
+ }
14
+ ]
15
+
16
+ `
17
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Used as a template for a new script file for a new element
3
+ * @param {string} elementName - The name of the element
4
+ * @param {string} elementClass - The class name of the element
5
+ */
6
+
7
+ module.exports = (elementName, elementClass) => {
8
+ return `class ${elementClass} extends HTMLElement {
9
+ constructor() {
10
+ super()
11
+ console.log(this)
12
+ }
13
+ }
14
+ customElements.define('${elementName}', ${elementClass})
15
+ `
16
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @file Used as a template for a new install.js file for a new feature or element
3
+ * @param {string} elementName - The name of the feature or element
4
+ */
5
+
6
+ module.exports = (elementName) => {
7
+ return `module.exports = [
8
+ {
9
+ hook: 'body-end',
10
+ content: "{% render '${elementName}' %}"
11
+ }
12
+ ]
13
+ `
14
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file Used as a template for a new schema file for a new feature section
3
+ * @param {string} elementName - The name of the feature or element
4
+ * @param {string} readableName - The readable name of the feature or element
5
+ */
6
+
7
+ module.exports = (elementName, readableName) => {
8
+ return `module.exports = {
9
+ name: '${readableName}',
10
+ tag: 'section',
11
+ class: '${elementName}',
12
+ settings: [
13
+ ...ThemeRequire('schema-colors'),
14
+ ...ThemeRequire('schema-full-width'),
15
+ {
16
+ type: 'header',
17
+ content: 'Section Vertical Spacing'
18
+ },
19
+ ...ThemeRequire('schema-spacing-y'),
20
+ ...ThemeRequire('schema-lazy'),
21
+ ...ThemeRequire('schema-custom-classes'),
22
+ ],
23
+ presets: [
24
+ {
25
+ name: '${readableName}',
26
+ category: 'General',
27
+ settings: {},
28
+ },
29
+ ],
30
+ }
31
+ `
32
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Used as a template for a new section file for a new feature or element
3
+ * @param {string} extName - The name of the feature or element
4
+ * @param {string} tag - The tag name of the feature or element, e.g. 'section', 'div', or 'custom-element'
5
+ */
6
+
7
+ module.exports = (tag, extName) => {
8
+ return `<!-- softlimit { "action": "partial", "file": "section-spacing-y" } -->
9
+ <${tag} class="{{ sectionSpacingY }} {{ section.settings.custom_classes }}"{{ sectionColorStyle }}>
10
+ <div class="{% unless section.settings.full_width %}page-width {% endunless %}">
11
+
12
+ </div>
13
+ </${tag}>
14
+ {% schema 'schema-${extName}.js' %}
15
+ `
16
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @file Creates an empty settings_data.json file if it doesn't exist during init command
3
+ */
4
+
5
+ const path = require('path')
6
+ const fs = require('fs-extra')
7
+ const chalk = require('chalk')
8
+ const logSymbols = require('#LogSymbols')
9
+
10
+ module.exports = function({ dest }) {
11
+ // create settings_data.json
12
+ const settingsData = path.join(dest, 'config/settings_data.json')
13
+ if (!fs.existsSync(settingsData)) {
14
+ fs.writeFile(settingsData, '{}', 'utf8', (err) => {
15
+ if (err) throw err
16
+ console.log(`${logSymbols.success} ${chalk.green.bold('settings_data.json')} created`)
17
+ })
18
+ }
19
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @file Creates basic settings_schema.js file during init command
3
+ */
4
+
5
+ const path = require('path')
6
+ const fs = require('fs-extra')
7
+ const chalk = require('chalk')
8
+ const logSymbols = require('#LogSymbols')
9
+
10
+ module.exports = function({ dest }) {
11
+ // create settings_schema.js
12
+ const settingsSchema = path.join(dest, 'config/settings_schema.js')
13
+ const settingsSchemaMarkup = `module.exports = [
14
+ {
15
+ name: 'theme_info',
16
+ theme_name: 'Theme Envy',
17
+ theme_version: '1.0.0',
18
+ theme_author: 'Softlimit',
19
+ theme_documentation_url: 'http://www.softlimit.com',
20
+ theme_support_url: 'http://www.softlimit.com'
21
+ }
22
+ ]
23
+ `
24
+
25
+ fs.writeFile(settingsSchema, settingsSchemaMarkup, 'utf8', (err) => {
26
+ if (err) throw err
27
+ console.log(`${logSymbols.success} ${chalk.green.bold('settings_schema.js')} created`)
28
+ })
29
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @file check if a Shopify theme exists in the target directory and move it to the destination
3
+ * @description Used during the init process to move an existing Shopify theme to the new source folder
4
+ * @param {object} options - options object
5
+ * @param {string} options.target - target directory
6
+ * @param {string} options.dest - destination directory
7
+ */
8
+
9
+ const path = require('path')
10
+ const fs = require('fs-extra')
11
+ const { directories } = require('#EnsureDirectories')
12
+ const chalk = require('chalk')
13
+ const logSymbols = require('#LogSymbols')
14
+
15
+ module.exports = function({ target, dest }) {
16
+ // if we have a valid Shopify theme structure in the target directory move those files to the dest
17
+ const rootDirs = fs.readdirSync(target).filter(res => !res.includes('.'))
18
+ const shopifyThemeExistsInRoot = directories.every(dir => rootDirs.includes(dir))
19
+ if (shopifyThemeExistsInRoot) {
20
+ console.log(logSymbols.info, chalk.cyan('Existing theme present, moving to new source folder'))
21
+ directories.forEach(dir => {
22
+ fs.moveSync(path.join(target, dir), path.join(dest, dir))
23
+ })
24
+ console.log(logSymbols.success, 'Existing theme moved')
25
+ }
26
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @file Helper function to import a git repo into the src directory
3
+ * @param {object} options - options object
4
+ * @param {string} options.source - git repo url
5
+ * @param {string} options.dest - destination directory
6
+ * @returns {string} - destination directory
7
+ */
8
+
9
+ const fs = require('fs-extra')
10
+ const path = require('path')
11
+ const git = require('simple-git')(process.cwd())
12
+
13
+ module.exports = async function({ source, dest }) {
14
+ await git.clone(source, dest)
15
+ // remove .git directory
16
+ const remove = ['.git', '.github', '.gitignore', '.vscode']
17
+ remove.forEach(dir => {
18
+ if (fs.existsSync(path.resolve(process.cwd(), dest, dir))) fs.removeSync(path.resolve(process.cwd(), dest, dir))
19
+ })
20
+ return dest
21
+ }
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ addThemeEnvyFeatures: require('./add-theme-envy-features'),
3
+ copyExampleFeature: require('./copy-example-feature'),
4
+ copyStarterConfigFiles: require('./copy-starter-config-files'),
5
+ createEmptySettingsData: require('./create-empty-settings-data'),
6
+ createSettingsSchema: require('./create-settings-schema'),
7
+ ifShopifyThemeExists: require('./if-shopify-theme-exists'),
8
+ importFromGit: require('./import-from-git'),
9
+ validateSourceTheme: require('./validate-source-theme'),
10
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @file Validates source theme directory structure
3
+ * @description Used during the init process to validate the source theme directory structure
4
+ * @param {object} options - options object
5
+ * @param {string} options.sourceTheme - source theme directory
6
+ */
7
+
8
+ const fs = require('fs-extra')
9
+ const path = require('path')
10
+ const { directories } = require('#EnsureDirectories')
11
+ const chalk = require('chalk')
12
+ const logSymbols = require('#LogSymbols')
13
+
14
+ module.exports = function({ sourceTheme }) {
15
+ // verify source theme exists
16
+ if (!fs.existsSync(sourceTheme)) {
17
+ console.error(`${logSymbols.error} ${chalk.red.bold('Error:')} Source theme directory not found: ${sourceTheme}`)
18
+ process.exit(1)
19
+ }
20
+
21
+ // validate directory structure of source theme
22
+ directories.forEach(dir => {
23
+ if (!fs.existsSync(path.resolve(sourceTheme, dir))) {
24
+ console.error(`${logSymbols.error} ${chalk.red.bold('Error:')} Source theme required directory not found: ${path.resolve(sourceTheme, dir)}`)
25
+ process.exit(1)
26
+ }
27
+ })
28
+ }
package/init/index.js ADDED
@@ -0,0 +1,87 @@
1
+ /*
2
+ @file init/index.js
3
+ @param [optional]: --example --e: outputs example feature structure and dummy files with readme documentation in each subdirectory
4
+ @description creates skeleton structure for src folder
5
+ - Shopify directories
6
+ - Adds theme-envy directories
7
+ - config files
8
+ @example npx theme-envy init [source|git] [options]
9
+ */
10
+ const path = require('path')
11
+ const fs = require('fs-extra')
12
+ const chalk = require('chalk')
13
+ const logSymbols = require('#LogSymbols')
14
+ const { directories, ensureDirectories } = require('#EnsureDirectories')
15
+ const { setSettingsSchemaJs } = require('#Convert/functions')
16
+ const themeEnvyConvert = require('#Convert')
17
+ const {
18
+ ifShopifyThemeExists,
19
+ copyStarterConfigFiles,
20
+ addThemeEnvyFeatures,
21
+ createSettingsSchema,
22
+ createEmptySettingsData,
23
+ copyExampleFeature,
24
+ importFromGit,
25
+ validateSourceTheme
26
+ } = require('#Init/functions')
27
+
28
+ module.exports = async function(source, opts = {}) {
29
+ const target = path.resolve(process.cwd())
30
+
31
+ const dest = path.join(target, 'src')
32
+ fs.ensureDirSync(dest)
33
+ console.log(logSymbols.success, 'Destination directory created:', `\n${chalk.dim(dest)}\n`)
34
+
35
+ if (source) {
36
+ // we have a source directory, so we're importing a theme from a folder that is not the root
37
+ if (source.includes('.git')) {
38
+ console.log(
39
+ logSymbols.info,
40
+ chalk.cyan('Importing source from repo...')
41
+ )
42
+ source = await importFromGit({ source, dest })
43
+ console.log(`${logSymbols.success} ${chalk.green('Git repo cloned as source')}`)
44
+ }
45
+ const sourceTheme = path.resolve(process.cwd(), source)
46
+ const destTheme = path.resolve(process.cwd(), dest)
47
+ validateSourceTheme({ sourceTheme })
48
+ // Copy files from source to destination
49
+ if (sourceTheme !== destTheme) {
50
+ directories.forEach(dir => {
51
+ fs.copySync(path.resolve(sourceTheme, dir), path.resolve(destTheme, dir))
52
+ })
53
+ console.log(`${logSymbols.success} Source copied to destination folder`)
54
+ }
55
+ } else {
56
+ // if no source directory is provided, check if there is a Shopify theme in the current directory and move it to /src
57
+ ifShopifyThemeExists({ target, dest })
58
+ }
59
+
60
+ // setup our Theme Envy directories
61
+ ensureDirectories({ root: dest, envy: true })
62
+
63
+ console.log(`${logSymbols.success} Directory structure set up`)
64
+
65
+ copyStarterConfigFiles({ target, opts })
66
+
67
+ addThemeEnvyFeatures({ dest })
68
+
69
+ // if settings_schema.json exists, convert it to settings_schema.js, else create empty settings_schema.js
70
+ if (fs.existsSync(path.join(dest, 'config/settings_schema.json'))) {
71
+ setSettingsSchemaJs({ sourceTheme: dest })
72
+ } else {
73
+ createSettingsSchema({ dest })
74
+ }
75
+
76
+ // only runs if settings_data.json does not exist
77
+ createEmptySettingsData({ dest })
78
+
79
+ // if --example or --e flag is present, copy example-feature folder into theme-envy/features
80
+ if (opts.example) {
81
+ copyExampleFeature({ dest })
82
+ }
83
+
84
+ if (opts.convert) {
85
+ await themeEnvyConvert(dest, { addThemeEnvy: false })
86
+ }
87
+ }
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@softlimit/theme-envy",
3
+ "version": "0.1.2-alpha",
4
+ "description": "Softlimit Shopify Theme Development Environment",
5
+ "bin": {
6
+ "theme-envy": "./index.js"
7
+ },
8
+ "imports": {
9
+ "#Build": "./build/index.js",
10
+ "#Build/*": "./build/*",
11
+ "#Build/functions": "./build/functions/index.js",
12
+ "#Build/functions/*": "./build/functions/*",
13
+ "#Convert": "./convert/index.js",
14
+ "#Convert/*": "./convert/*",
15
+ "#Convert/functions": "./convert/functions/index.js",
16
+ "#Convert/functions/*": "./convert/functions/*",
17
+ "#Dev": "./dev/index.js",
18
+ "#Dev/*": "./dev/*",
19
+ "#Dev/functions": "./dev/functions/index.js",
20
+ "#Dev/functions/*": "./dev/functions/*",
21
+ "#EnsureDirectories": "./helpers/functions/ensure-directories.js",
22
+ "#Helpers": "./helpers/index.js",
23
+ "#Helpers/*": "./helpers/*",
24
+ "#Helpers/functions": "./helpers/functions/index.js",
25
+ "#Helpers/functions/*": "./helpers/functions/*",
26
+ "#Init": "./init/index.js",
27
+ "#Init/*": "./init/*",
28
+ "#Init/functions": "./init/functions/index.js",
29
+ "#Init/functions/*": "./init/functions/*",
30
+ "#LogSymbols": "./helpers/functions/log-symbols.js",
31
+ "#ParentTheme": "./parent-theme/index.js",
32
+ "#Root/*": "./*"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/softlimit/theme-envy"
37
+ },
38
+ "engines": {
39
+ "npm": "8.x"
40
+ },
41
+ "standard-version": {
42
+ "scripts": {
43
+ "posttag": "git push && git push --tags"
44
+ }
45
+ },
46
+ "scripts": {
47
+ "version": "standard-version",
48
+ "jsdoc": "./node_modules/.bin/jsdoc ./{build,convert,helpers,init}/**/*.js"
49
+ },
50
+ "author": "Softlimit LLC",
51
+ "license": "MIT",
52
+ "dependencies": {
53
+ "@shopify/prettier-plugin-liquid": "^1.0.6",
54
+ "ansi-colors": "^4.1.3",
55
+ "autoprefixer": "^10.4.13",
56
+ "chalk": "^4.1.2",
57
+ "chokidar": "^3.5.3",
58
+ "cli-progress": "^3.12.0",
59
+ "commander": "^10.0.0",
60
+ "css-loader": "^6.7.3",
61
+ "cssnano": "^5.1.15",
62
+ "esbuild-loader": "^3.0.1",
63
+ "fs-extra": "^11.1.0",
64
+ "glob": "^8.1.0",
65
+ "mini-css-extract-plugin": "^2.7.2",
66
+ "node-emoji": "^1.11.0",
67
+ "path": "^0.12.7",
68
+ "postcss-import": "^15.1.0",
69
+ "postcss-loader": "^7.0.2",
70
+ "prettier": "^2.8.4",
71
+ "promptly": "^3.2.0",
72
+ "simple-git": "^3.17.0",
73
+ "stmux": "^1.8.5",
74
+ "tailwindcss": "^3.2.7",
75
+ "terser-webpack-plugin": "^5.3.6",
76
+ "webpack": "^5.77.0",
77
+ "webpack-cli": "^5.0.1",
78
+ "webpack-remove-empty-scripts": "^1.0.1"
79
+ },
80
+ "devDependencies": {
81
+ "eslint": "^8.34.0",
82
+ "eslint-config-standard": "^17.0.0",
83
+ "eslint-plugin-import": "^2.27.5",
84
+ "eslint-plugin-n": "^15.6.1",
85
+ "eslint-plugin-promise": "^6.1.1",
86
+ "jsdoc": "^4.0.2"
87
+ }
88
+ }