@madgex/fert 6.0.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -1,12 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('node:fs');
4
- const chalk = require('chalk');
5
- const cli = require('cac')('fert');
6
- const { VERSION } = require('../constants');
7
- const { printBanner } = require('./utils/index.js');
3
+ import path from 'node:path';
4
+ import fs from 'node:fs';
5
+ import chalk from 'chalk';
6
+ import cac from 'cac';
7
+ import simpleUpdateNotifier from 'simple-update-notifier';
8
+ import { VERSION } from '../constants.js';
9
+ import { printBanner } from './utils/index.js';
10
+ import { serviceCommandBootstrap } from './commands/_service-command-bootstrap.js';
11
+ import { configsCommand } from './commands/configs.js';
12
+ import { initCommand } from './commands/init.js';
8
13
 
9
- const { serivceCommandBootstrap } = require('./commands/_service-command-bootstrap.js');
14
+ const cli = cac('fert');
10
15
 
11
16
  const run = () => {
12
17
  printBanner();
@@ -18,21 +23,21 @@ const run = () => {
18
23
  .option('--host [host]', '[string] specify hostname')
19
24
  .option('--port <port>', '[number] specify port')
20
25
  .option('--service-name <serviceName>', '[string] run a single service')
21
- .action((...args) => serivceCommandBootstrap('dev', ...args));
26
+ .action((...args) => serviceCommandBootstrap('dev', ...args));
22
27
 
23
28
  cli
24
29
  .command('build', 'Build project. Can supply a branding directory if running FERT standalone')
25
30
  .option('--only <task>', `Only run part of the build [ 'assets', 'tokens']`)
26
31
  .option('--config [dir]', 'Use custom rollup config file')
27
32
  .option('--service-name <serviceName>', '[string] run a single service')
28
- .action((...args) => serivceCommandBootstrap('build', ...args));
33
+ .action((...args) => serviceCommandBootstrap('build', ...args));
29
34
 
30
35
  cli
31
36
  .command('publish', 'Publish the project')
32
37
  .option('--target <env>', 'Environment to publish to, "dev" or "production"')
33
38
  .option('--service-name <serviceName>', '[string] run a single service')
34
39
  .option('--dry-run', 'Dry run, dont actually upload anything')
35
- .action((...args) => serivceCommandBootstrap('publish', ...args));
40
+ .action((...args) => serviceCommandBootstrap('publish', ...args));
36
41
 
37
42
  cli
38
43
  .command('configs', 'Query/Publish project configs')
@@ -42,12 +47,12 @@ const run = () => {
42
47
  'Download known configs from the Configuration API for environment "dev" or "production"',
43
48
  )
44
49
  .option('--query [configName]', 'Describe known keys for a config, omit to list all known configs')
45
- .action((...args) => require('./commands/configs')(...args));
50
+ .action((...args) => configsCommand(...args));
46
51
 
47
52
  cli
48
53
  .command('init [root]', 'Create a new branding project')
49
54
  .option('--cpid <cpid>', 'Specify the clientPropertyId to use in the new project')
50
- .action((...args) => require('./commands/init')(...args));
55
+ .action((...args) => initCommand(...args));
51
56
 
52
57
  cli.option('--no-cache', 'Do not use cache');
53
58
  cli.option('--purge-cache', 'Purge all caches');
@@ -56,10 +61,10 @@ const run = () => {
56
61
  cli.parse();
57
62
 
58
63
  // checks for available update
59
- const pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
64
+ const pkg = JSON.parse(fs.readFileSync(path.join(import.meta.dirname, '..', 'package.json')));
60
65
 
61
66
  if (pkg.version.indexOf('0.0.0') !== 0) {
62
- require('simple-update-notifier')({ pkg });
67
+ simpleUpdateNotifier({ pkg });
63
68
  }
64
69
  };
65
70
 
@@ -67,7 +72,7 @@ try {
67
72
  run();
68
73
  } catch (error) {
69
74
  if (error.name === 'CACError') {
70
- console.error(chalk`\n{red ${error.message}}`);
75
+ console.error(chalk.red(`\n${error.message}`));
71
76
  } else {
72
77
  console.error(error);
73
78
  }
@@ -1,24 +1,22 @@
1
- const chalk = require('chalk');
2
-
3
- const { loadServiceConfigFiles, loadConfigFromFile } = require('../utils/index.js');
4
-
5
- const commandDevSever = require('./dev-server.js');
6
- const commandBuild = require('./build.js');
7
- const commandPublish = require('./publish.js');
8
- const { FERT_SERVICE_CONFIG_FILENAME } = require('../../constants.js');
9
- const { log } = require('../utils/logging.js');
1
+ import chalk from 'chalk';
2
+ import { loadServiceConfigFiles, loadConfigFromFile } from '../utils/index.js';
3
+ import { createDevServer } from './dev-server.js';
4
+ import { build } from './build.js';
5
+ import { publish } from './publish.js';
6
+ import { FERT_SERVICE_CONFIG_FILENAME } from '../../constants.js';
7
+ import { log } from '../utils/logging.js';
10
8
 
11
9
  const commandMap = {
12
- dev: commandDevSever,
13
- build: commandBuild,
14
- publish: commandPublish,
10
+ dev: createDevServer,
11
+ build,
12
+ publish,
15
13
  };
16
14
 
17
15
  /**
18
16
  * determine if we are running a single service, otherwise search for all services
19
17
  * Then run command
20
18
  */
21
- module.exports.serivceCommandBootstrap = async function serivceCommandBootstrap(command, options) {
19
+ export async function serviceCommandBootstrap(command, options) {
22
20
  // explicitly run a single service - via CLI option
23
21
  if (options.serviceName) {
24
22
  console.log(`🔦 ${chalk.green('Running single service mode')}`);
@@ -71,4 +69,4 @@ module.exports.serivceCommandBootstrap = async function serivceCommandBootstrap(
71
69
  });
72
70
  }
73
71
  }
74
- };
72
+ }
@@ -1,8 +1,8 @@
1
- const Path = require('node:path');
2
- const fs = require('node:fs/promises');
3
- const { log } = require('../../utils/logging');
1
+ import Path from 'node:path';
2
+ import fs from 'node:fs/promises';
3
+ import { log } from '../../utils/logging.js';
4
4
 
5
- module.exports = async function buildExternalAssets(fertConfig) {
5
+ export async function buildExternalAssets(fertConfig) {
6
6
  const { externalAssets, workingDir } = fertConfig;
7
7
  const destination = Path.join(workingDir, `/dist/external-assets.json`);
8
8
 
@@ -13,4 +13,4 @@ module.exports = async function buildExternalAssets(fertConfig) {
13
13
  log.error(err);
14
14
  throw err;
15
15
  }
16
- };
16
+ }
@@ -1,10 +1,10 @@
1
- const Path = require('node:path');
2
- const fs = require('node:fs/promises');
3
- const { createStyleDictionary } = require('@madgex/design-system/style-dictionary');
4
- const { ensureTrailingSlash, exists } = require('../../utils');
5
- const { log } = require('../../utils/logging');
1
+ import Path from 'node:path';
2
+ import fs from 'node:fs/promises';
3
+ import { createStyleDictionary } from '@madgex/design-system/style-dictionary';
4
+ import { ensureTrailingSlash, exists } from '../../utils/index.js';
5
+ import { log } from '../../utils/logging.js';
6
6
 
7
- module.exports = async function buildCssFromTokens(_srcTokensPath, _buildPath) {
7
+ export async function buildCssFromTokens(_srcTokensPath, _buildPath) {
8
8
  const srcTokensPath = ensureTrailingSlash(Path.resolve(_srcTokensPath));
9
9
  const buildPath = ensureTrailingSlash(Path.resolve(_buildPath));
10
10
 
@@ -33,4 +33,4 @@ module.exports = async function buildCssFromTokens(_srcTokensPath, _buildPath) {
33
33
  await cleanTempFiles();
34
34
 
35
35
  log.success('Token build complete (CSS & JSON).');
36
- };
36
+ }
@@ -1,17 +1,20 @@
1
- const path = require('node:path');
2
- const _ = require('lodash');
3
- const vite = require('vite');
4
- const buildExternalAssets = require('./build-external-assets');
5
- const { log } = require('../../utils/logging');
1
+ import path from 'node:path';
2
+ import { pathToFileURL } from 'node:url';
3
+ import merge from 'lodash/merge.js';
4
+ import * as vite from 'vite';
5
+ import { buildExternalAssets } from './build-external-assets.js';
6
+ import { log } from '../../utils/logging.js';
6
7
 
7
- module.exports = async (fertConfig, options = {}) => {
8
+ export async function bundleEntry(fertConfig, options = {}) {
8
9
  let dynamicOptions = {};
9
10
  let viteConfig = {};
10
11
 
11
12
  if (options.config) {
12
- viteConfig = require(path.resolve(fertConfig.workingDir, options.config));
13
+ const viteConfigPkg = await import(pathToFileURL(path.resolve(fertConfig.workingDir, options.config)));
14
+ viteConfig = viteConfigPkg.default;
13
15
  } else {
14
- viteConfig = require(path.resolve(__dirname, '../../../vite.config.js'));
16
+ const viteConfigPkg = await import('../../../vite.config.js');
17
+ viteConfig = viteConfigPkg.default;
15
18
  }
16
19
 
17
20
  dynamicOptions = {
@@ -26,11 +29,11 @@ module.exports = async (fertConfig, options = {}) => {
26
29
  },
27
30
  };
28
31
 
29
- _.merge(viteConfig, dynamicOptions);
32
+ merge(viteConfig, dynamicOptions);
30
33
 
31
34
  await vite.build(viteConfig);
32
35
 
33
36
  await buildExternalAssets(fertConfig);
34
37
 
35
38
  log.success('Assets built.');
36
- };
39
+ }
@@ -1,13 +1,15 @@
1
- const path = require('node:path');
2
- const { rimraf } = require('rimraf');
3
- const { resolveConfig } = require('../utils');
4
- const { log } = require('../utils/logging');
5
- const bundleEntry = require('./build-tasks/bundle-entry');
6
- const buildCssFromTokens = require('./build-tasks/build-tokens');
7
- const buildExternalAssets = require('./build-tasks/build-external-assets');
8
- const { validateLocalConfigs } = require('../utils/configs.js');
9
-
10
- module.exports = async (options = {}) => {
1
+ import path from 'node:path';
2
+ import { rimraf } from 'rimraf';
3
+ import { resolveConfig } from '../utils/index.js';
4
+ import { log } from '../utils/logging.js';
5
+ import { bundleEntry } from './build-tasks/bundle-entry.js';
6
+ import { buildCssFromTokens } from './build-tasks/build-tokens.js';
7
+ import { buildExternalAssets } from './build-tasks/build-external-assets.js';
8
+ import { validateLocalConfigs } from '../utils/configs.js';
9
+
10
+ export { bundleEntry, buildExternalAssets };
11
+
12
+ export async function build(options = {}) {
11
13
  const fertConfig = await resolveConfig(options);
12
14
  await validateLocalConfigs({
13
15
  workingDir: fertConfig.rootDir,
@@ -16,34 +18,28 @@ module.exports = async (options = {}) => {
16
18
 
17
19
  if (!options.only) {
18
20
  await rimraf(path.resolve(fertConfig.workingDir, 'dist'));
19
- await exports.buildTokens(fertConfig, options);
20
- await exports.bundleEntry(fertConfig, options);
21
+ await buildTokens(fertConfig, options);
22
+ await bundleEntry(fertConfig, options);
21
23
 
22
24
  return;
23
25
  }
24
26
 
25
27
  switch (options.only) {
26
28
  case 'tokens':
27
- await exports.buildTokens(fertConfig, options);
29
+ await buildTokens(fertConfig, options);
28
30
  break;
29
31
  case 'assets':
30
- await exports.bundleEntry(fertConfig, options);
32
+ await bundleEntry(fertConfig, options);
31
33
  break;
32
34
  default:
33
35
  log.error('"--only param" not recognixed. Not building.');
34
36
  }
35
- };
36
-
37
- // eslint-disable-next-line n/no-exports-assign
38
- exports = module.exports; // allow default export & { named } exports
37
+ }
39
38
 
40
39
  // eslint-disable-next-line no-unused-vars
41
- exports.buildTokens = async (fertConfig, options = {}) => {
40
+ export async function buildTokens(fertConfig, options = {}) {
42
41
  const { workingDir } = fertConfig;
43
42
  const tokenDist = path.join(workingDir, `/public/tokens/`);
44
43
 
45
44
  buildCssFromTokens(workingDir, tokenDist);
46
- };
47
-
48
- exports.bundleEntry = bundleEntry;
49
- exports.buildExternalAssets = buildExternalAssets;
45
+ }
@@ -1,14 +1,14 @@
1
- const { loadConfigFromFile, findFertConfigDir } = require('../utils/index.js');
2
- const { getConfigAPI, updateProjectConfigs } = require('../utils/configs.js');
3
- const chalk = require('chalk');
4
- const { log } = require('../utils/logging.js');
5
- const { getSchemaMeta } = require('../utils/getSchemaMeta.js');
6
- const ora = require('ora');
7
- const { mkdir, writeFile } = require('node:fs/promises');
8
- const Path = require('node:path');
9
- const { CONFIG_DIR } = require('../../constants.js');
10
-
11
- const handleDownload = async ({ workingDir }, api, options) => {
1
+ import { loadConfigFromFile, findFertConfigDir } from '../utils/index.js';
2
+ import { getConfigAPI, updateProjectConfigs } from '../utils/configs.js';
3
+ import chalk from 'chalk';
4
+ import { log } from '../utils/logging.js';
5
+ import { getSchemaMeta } from '../utils/getSchemaMeta.js';
6
+ import ora from 'ora';
7
+ import { mkdir, writeFile } from 'node:fs/promises';
8
+ import Path from 'node:path';
9
+ import { CONFIG_DIR } from '../../constants.js';
10
+
11
+ export async function handleDownload({ workingDir }, api, options) {
12
12
  const validTargets = ['dev', 'production'];
13
13
 
14
14
  if (!validTargets.includes(options.download)) {
@@ -79,9 +79,9 @@ const handleDownload = async ({ workingDir }, api, options) => {
79
79
  await writeFile(filePath, JSON.stringify(data, null, 2));
80
80
  console.log(` - ${schemaName}.json`);
81
81
  }
82
- };
82
+ }
83
83
 
84
- const handlePublish = async ({ workingDir, clientPropertyId }, api, options) => {
84
+ export async function handlePublish({ workingDir, clientPropertyId }, api, options) {
85
85
  const validTargets = ['dev', 'production'];
86
86
 
87
87
  if (!validTargets.includes(options.publish)) {
@@ -99,9 +99,9 @@ const handlePublish = async ({ workingDir, clientPropertyId }, api, options) =>
99
99
  // eslint-disable-next-line n/no-process-exit
100
100
  process.exit(1);
101
101
  }
102
- };
102
+ }
103
103
 
104
- const handleQuery = async (/* { workingDir, clientPropertyId } */ _, api, options) => {
104
+ export async function handleQuery(/* { workingDir, clientPropertyId } */ _, api, options) {
105
105
  try {
106
106
  if (options.query !== true) {
107
107
  console.log(chalk.cyan(`\nGetting schema description for config: ${chalk.bold(options.query)}...`));
@@ -131,9 +131,9 @@ const handleQuery = async (/* { workingDir, clientPropertyId } */ _, api, option
131
131
  // eslint-disable-next-line n/no-process-exit
132
132
  process.exit(1);
133
133
  }
134
- };
134
+ }
135
135
 
136
- module.exports = async (options) => {
136
+ export async function configsCommand(options) {
137
137
  const fertConfigDir = await findFertConfigDir();
138
138
 
139
139
  const { clientPropertyId } = await loadConfigFromFile({
@@ -156,8 +156,4 @@ module.exports = async (options) => {
156
156
  } else if (options.query) {
157
157
  await handleQuery({ clientPropertyId, workingDir: fertConfigDir }, api, options);
158
158
  }
159
- };
160
-
161
- module.exports.handleDownload = handleDownload;
162
- module.exports.handlePublish = handlePublish;
163
- module.exports.handleQuery = handleQuery;
159
+ }
@@ -1,15 +1,17 @@
1
- const path = require('node:path');
2
- const chalk = require('chalk');
3
- const open = require('open');
4
- const chokidar = require('chokidar');
5
- const { resolveConfig, findFertConfigDir } = require('../utils/index.js');
6
- const { log } = require('../utils/logging.js');
7
- const { validateLocalConfigs } = require('../utils/configs.js');
8
- const { devServer } = require('../../server');
9
- const { buildTokens, buildExternalAssets } = require('./build.js');
10
- const { BRAND_JSON_FILENAME, FERT_CONFIG_FILENAME, FERT_SERVICE_CONFIG_FILENAME } = require('../../constants.js');
1
+ import path from 'node:path';
2
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
3
+ import { glob } from 'node:fs/promises';
4
+ import chalk from 'chalk';
5
+ import open from 'open';
6
+ import chokidar from 'chokidar4';
7
+ import { resolveConfig, findFertConfigDir } from '../utils/index.js';
8
+ import { log } from '../utils/logging.js';
9
+ import { validateLocalConfigs } from '../utils/configs.js';
10
+ import { devServer } from '../../server/server.js';
11
+ import { buildTokens, buildExternalAssets } from './build.js';
12
+ import { BRAND_JSON_FILENAME, FERT_CONFIG_FILENAME, FERT_SERVICE_CONFIG_FILENAME } from '../../constants.js';
11
13
 
12
- module.exports = async (options = {}) => {
14
+ export async function createDevServer(options = {}) {
13
15
  let fertConfig = await resolveConfig(options);
14
16
 
15
17
  console.log(
@@ -28,8 +30,8 @@ module.exports = async (options = {}) => {
28
30
  const fertConfigDir = await findFertConfigDir();
29
31
 
30
32
  // watch local configs - revalidate on change
31
- const configsPath = path.resolve(fertConfigDir, './config/*.json');
32
- chokidar.watch(configsPath, { ignoreInitial: true }).on('all', async () => {
33
+ const configPaths = await Array.fromAsync(glob(path.resolve(fertConfigDir, './config/*.json')));
34
+ chokidar.watch(configPaths, { ignoreInitial: true }).on('all', async () => {
33
35
  await validateLocalConfigs({
34
36
  workingDir: fertConfig.rootDir,
35
37
  clientPropertyId: fertConfig.clientPropertyId,
@@ -39,6 +41,7 @@ module.exports = async (options = {}) => {
39
41
 
40
42
  // watch brand.json & fert.config.js - refresh on change
41
43
  const brandPath = path.resolve(fertConfig.workingDir, BRAND_JSON_FILENAME);
44
+
42
45
  chokidar.watch(brandPath, { ignoreInitial: true }).on('all', async () => {
43
46
  await buildTokens(fertConfig);
44
47
  });
@@ -66,4 +69,4 @@ module.exports = async (options = {}) => {
66
69
  if (options.open) {
67
70
  await open(server.info.uri);
68
71
  }
69
- };
72
+ }
@@ -1,18 +1,17 @@
1
- const path = require('node:path');
2
- const fs = require('node:fs');
3
- const chalk = require('chalk');
4
- const prompts = require('prompts');
5
- const uuidValidator = require('uuid-validate');
6
- const ora = require('ora');
7
- const { cpidLookup } = require('../utils/cpid-lookup');
8
- const fertPackageJSON = require('../../package.json');
9
-
10
- const { isEmptyDir, formatTargetDir, emptyDir } = require('../utils/index');
11
- const { FERT_CONFIG_FILENAME } = require('../../constants');
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import chalk from 'chalk';
4
+ import prompts from 'prompts';
5
+ import uuidValidator from 'uuid-validate';
6
+ import ora from 'ora';
7
+ import { cpidLookup } from '../utils/cpid-lookup.js';
8
+ import fertPackageJSON from '../../package.json' with { type: 'json' };
9
+ import { isEmptyDir, formatTargetDir, emptyDir } from '../utils/index.js';
10
+ import { FERT_CONFIG_FILENAME } from '../../constants.js';
12
11
 
13
12
  const cwd = process.cwd();
14
13
 
15
- module.exports = async (root, options = {}) => {
14
+ export async function initCommand(root, options = {}) {
16
15
  const defaultProjectName = 'madgex-{cpid}';
17
16
  const argTargetDir = root ? formatTargetDir(root) : null;
18
17
  const argClientPropertyId = options.cpid && uuidValidator(options.cpid) ? options.cpid : false;
@@ -91,7 +90,7 @@ module.exports = async (root, options = {}) => {
91
90
  console.log(`\nScaffolding project in ${chalk.bold(outDir)}…`);
92
91
 
93
92
  // copy boilerplate to output dir
94
- const templateDir = path.resolve(__dirname, '../../repo-template');
93
+ const templateDir = path.resolve(import.meta.dirname, '../../repo-template');
95
94
  fs.cpSync(templateDir, outDir, { recursive: true });
96
95
 
97
96
  // Update new package.json
@@ -119,4 +118,4 @@ module.exports = async (root, options = {}) => {
119
118
  console.log(` npm install`);
120
119
  console.log(` npm run dev`);
121
120
  console.log();
122
- };
121
+ }
@@ -1,14 +1,14 @@
1
- const fs = require('node:fs');
2
- const path = require('node:path');
3
- const Hoek = require('@hapi/hoek');
4
- const { log } = require('../../utils/logging');
5
- const axios = require('axios');
6
- const FormData = require('form-data');
7
- const ora = require('ora');
8
- const chalk = require('chalk');
9
- const { ASSET_STORE_USER_GUID } = require('../../../constants');
10
-
11
- module.exports = class AssetStoreUploader {
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import * as Hoek from '@hapi/hoek';
4
+ import axios from 'axios';
5
+ import FormData from 'form-data';
6
+ import ora from 'ora';
7
+ import chalk from 'chalk';
8
+ import { log } from '../../utils/logging.js';
9
+ import { ASSET_STORE_USER_GUID } from '../../../constants.js';
10
+
11
+ export class AssetStoreUploader {
12
12
  constructor(options = {}) {
13
13
  Hoek.assert(options.apiUrl, 'apiUrl required');
14
14
  Hoek.assert(options.apiKey, 'apiKey required');
@@ -120,4 +120,4 @@ module.exports = class AssetStoreUploader {
120
120
 
121
121
  return files;
122
122
  };
123
- };
123
+ }
@@ -1,5 +1,5 @@
1
- const { SSMClient, GetParameterCommand } = require('@aws-sdk/client-ssm');
2
- const { AWS_REGION } = require('../../../constants');
1
+ import { SSMClient, GetParameterCommand } from '@aws-sdk/client-ssm';
2
+ import { AWS_REGION } from '../../../constants.js';
3
3
 
4
4
  /**
5
5
  * Gets AWS parameter from the parameter store
@@ -13,7 +13,7 @@ const { AWS_REGION } = require('../../../constants');
13
13
  * @returns {Promise<{ value: string | undefined }>} the value of the requested AWS parameter
14
14
  *
15
15
  */
16
- const getAwsParam = async (paramName) => {
16
+ export async function getAwsParam(paramName) {
17
17
  const client = new SSMClient({
18
18
  region: AWS_REGION,
19
19
  });
@@ -34,6 +34,4 @@ const getAwsParam = async (paramName) => {
34
34
  }
35
35
 
36
36
  return result;
37
- };
38
-
39
- module.exports = getAwsParam;
37
+ }
@@ -1,21 +1,21 @@
1
- const path = require('node:path');
2
- const Hoek = require('@hapi/hoek');
3
- const chalk = require('chalk');
4
- const { resolveConfig } = require('../utils');
5
- const { log } = require('../utils/logging');
6
- const getAwsParam = require('./publish-tasks/get-aws-parameter');
7
- const AssetStoreUploader = require('./publish-tasks/asset-store-uploader');
8
- const { getCloudFrontDistributionsForDomain } = require('../utils/lookup-cf-distribution-ids');
9
- const {
1
+ import path from 'node:path';
2
+ import * as Hoek from '@hapi/hoek';
3
+ import chalk from 'chalk';
4
+ import { resolveConfig } from '../utils/index.js';
5
+ import { log } from '../utils/logging.js';
6
+ import { getAwsParam } from './publish-tasks/get-aws-parameter.js';
7
+ import { AssetStoreUploader } from './publish-tasks/asset-store-uploader.js';
8
+ import { getCloudFrontDistributionsForDomain } from '../utils/lookup-cf-distribution-ids.js';
9
+ import {
10
10
  ASSET_STORE_API,
11
11
  AWS_PARAM_NAME,
12
12
  REMOTE_UPLOAD_BASE,
13
13
  UPLOAD_DIR,
14
14
  ASSET_STORE_INVALIDATION_PATH,
15
15
  BRANDED_SITE_INVALIDATION_PATH,
16
- } = require('../../constants');
16
+ } from '../../constants.js';
17
17
 
18
- module.exports = async (options) => {
18
+ export async function publish(options) {
19
19
  const fertConfig = await resolveConfig(options);
20
20
  const validTargets = ['dev', 'prod', 'production'];
21
21
 
@@ -83,4 +83,4 @@ module.exports = async (options) => {
83
83
  } catch (error) {
84
84
  log.error('An error occurred during the publish process', error);
85
85
  }
86
- };
86
+ }