Skip to content

Commit

Permalink
Avoid loading the entire zx bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
eaviles committed Mar 3, 2023
1 parent c6339ce commit 10d4a67
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .eslintrc
Expand Up @@ -5,7 +5,11 @@
"no-bitwise": "off",
"no-console": "off",
"no-process-exit": "off",
"unicorn/no-process-exit": "off",
"node/shebang": "off"
"node/no-missing-import": ["error", { "allowModules": ["zx/core"] }],
"node/shebang": "off",
"unicorn/no-process-exit": "off"
},
"settings": {
"import/core-modules": ["zx/core"]
}
}
2 changes: 1 addition & 1 deletion lib/commands/build-docs.js
Expand Up @@ -12,7 +12,7 @@ module.exports = {
command,
describe: 'Builds the README.md file from the JSDoc in the codebase.',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');
if (process.argv[2] === command) {
process.argv.splice(2, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/build-types.js
Expand Up @@ -8,7 +8,7 @@ module.exports = {
command,
describe: 'Build the types with TypeScript.',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');
if (process.argv[2] === command) {
process.argv.splice(2, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/clean-types.js
Expand Up @@ -6,7 +6,7 @@ module.exports = {
command: path.parse(__filename).name,
describe: 'Delete all the types generated with TypeScript.',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');
$.verbose = false;
await Promise.all(
['./app', './bin', './lib'].map((i) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/eslint.js
Expand Up @@ -8,7 +8,7 @@ module.exports = {
command,
describe: 'Check the codebase with ESLint.',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');
process.env.FORCE_COLOR = '3';
if (process.argv[2] === command) {
process.argv.splice(2, 1);
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/prepare.js
Expand Up @@ -8,7 +8,7 @@ module.exports = {
command: path.parse(__filename).name,
describe: 'Run configuration and project preparation tasks',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');
$.verbose = false;
const excludesFile = pathFromCwd(__dirname, '../../shared/git-ignore.txt');
await $`git config core.excludesFile ${excludesFile}`;
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/sync.js
Expand Up @@ -9,7 +9,7 @@ module.exports = {
command: path.parse(__filename).name,
describe: 'Synchronizes the current codebase with core-commons.',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');

const pkg = await loadJsonFile('./package.json');
const { devDependencies = {}, name: targetName } = pkg;
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/test.js
Expand Up @@ -11,7 +11,7 @@ module.exports = {
command,
describe: 'Run tests with Jest.',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');
if (process.argv[2] === command) {
process.argv.splice(2, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/version.js
Expand Up @@ -6,7 +6,7 @@ module.exports = {
command: path.parse(__filename).name,
describe: 'Generate the changelog.',
handler: async () => {
const { $ } = await import('zx');
const { $ } = await import('zx/core');
$.verbose = false;
process.argv.push(
...[
Expand Down

0 comments on commit 10d4a67

Please sign in to comment.