@toptal/davinci-code 1.7.5-alpha-fix-bundle-analyze-e1cf8407.5 → 1.7.5-alpha-feature-esm-migration-e551c09d.30

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.
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const cliEngine = require('@toptal/davinci-cli-shared')
3
+ import cliEngine from '@toptal/davinci-cli-shared'
4
4
 
5
- const { commands } = require('../src')
5
+ import code from '../src/index.mjs'
6
+
7
+ const { commands } = code
6
8
 
7
9
  cliEngine.loadCommands(commands, 'davinci-code')
8
10
 
package/docs/module.md CHANGED
@@ -3,9 +3,9 @@
3
3
  Creates a new module in `/modules` directory with the prepared inner structure of the module.
4
4
 
5
5
  ```bash
6
- davinci-code module module-name
6
+ davinci-code module <moduleName>
7
7
  ```
8
8
 
9
9
  Arguments:
10
10
 
11
- - `module-name` - the name of the module to create
11
+ - `moduleName` - the name of the module to create
@@ -3,7 +3,7 @@
3
3
  Creates new React component in `/modules/<module-name>/components`.
4
4
 
5
5
  ```bash
6
- davinci-code new component componentName moduleName
6
+ davinci-code new component <componentName> <moduleName>
7
7
  ```
8
8
 
9
9
  Arguments:
package/docs/new-page.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Creates new React page component in `/modules/<module-name>/pages`. Used for creating components that will be exposed to the router.
4
4
 
5
5
  ```bash
6
- davinci-code new page pageName moduleName
6
+ davinci-code new page <pageName> <moduleName>
7
7
  ```
8
8
 
9
9
  Arguments:
package/docs/stories.md CHANGED
@@ -23,4 +23,3 @@ Story files should be defined alongside their component files.
23
23
  ├── Foo.tsx
24
24
  └── Foo.stories.tsx
25
25
  ```
26
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-code",
3
- "version": "1.7.5-alpha-fix-bundle-analyze-e1cf8407.5+e1cf8407",
3
+ "version": "1.7.5-alpha-feature-esm-migration-e551c09d.30+e551c09d",
4
4
  "description": "Code generation package for frontend applications",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,9 +14,9 @@
14
14
  "homepage": "https://github.com/toptal/davinci/tree/master/packages/code#readme",
15
15
  "license": "ISC",
16
16
  "bin": {
17
- "davinci-code": "./bin/davinci-code.js"
17
+ "davinci-code": "./bin/davinci-code.mjs"
18
18
  },
19
- "main": "src/index.js",
19
+ "main": "src/index.mjs",
20
20
  "files": [
21
21
  "src",
22
22
  "bin",
@@ -29,16 +29,16 @@
29
29
  "url": "git+https://github.com/toptal/davinci.git"
30
30
  },
31
31
  "scripts": {
32
- "test": "echo \"Error: run tests from root\" && exit 1"
32
+ "test": "../../bin/unit-test.bash"
33
33
  },
34
34
  "bugs": {
35
35
  "url": "https://github.com/toptal/davinci/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@toptal/davinci-cli-shared": "1.10.3-alpha-fix-bundle-analyze-e1cf8407.5+e1cf8407",
38
+ "@toptal/davinci-cli-shared": "1.10.3-alpha-feature-esm-migration-e551c09d.30+e551c09d",
39
39
  "hygen": "^6.2.11",
40
40
  "lodash.camelcase": "^4.3.0",
41
41
  "lodash.kebabcase": "^4.1.1"
42
42
  },
43
- "gitHead": "e1cf84072ed2102a43bc67c5c725e5c45ff6a36e"
43
+ "gitHead": "e551c09d98a4e340ab16afb27a42fe52a8548d00"
44
44
  }
@@ -1,9 +1,9 @@
1
- const kebabCase = require('lodash.kebabcase')
2
- const camelCase = require('lodash.camelcase')
3
- const { print } = require('@toptal/davinci-cli-shared')
1
+ import kebabCase from 'lodash.kebabcase'
2
+ import camelCase from 'lodash.camelcase'
3
+ import { print } from '@toptal/davinci-cli-shared'
4
4
 
5
- const templates = require('../templates')
6
- const { CORE_MODULE } = require('../constants')
5
+ import templates from '../templates.mjs'
6
+ import { CORE_MODULE } from '../constants.mjs'
7
7
 
8
8
  const componentCommandCreator = {
9
9
  command: 'new <templateName> [name] [moduleName]',
@@ -26,4 +26,4 @@ const componentCommandCreator = {
26
26
  },
27
27
  }
28
28
 
29
- module.exports = componentCommandCreator
29
+ export default componentCommandCreator
@@ -1,8 +1,8 @@
1
- const kebabCase = require('lodash.kebabcase')
2
- const { print } = require('@toptal/davinci-cli-shared')
1
+ import kebabCase from 'lodash.kebabcase'
2
+ import { print } from '@toptal/davinci-cli-shared'
3
3
 
4
- const templates = require('../templates')
5
- const { CORE_MODULE } = require('../constants')
4
+ import templates from '../templates.mjs'
5
+ import { CORE_MODULE } from '../constants.mjs'
6
6
 
7
7
  const moduleCommandCreator = {
8
8
  command: 'module [name]',
@@ -16,4 +16,4 @@ const moduleCommandCreator = {
16
16
  },
17
17
  }
18
18
 
19
- module.exports = moduleCommandCreator
19
+ export default moduleCommandCreator
@@ -1,7 +1,7 @@
1
- const { print } = require('@toptal/davinci-cli-shared')
2
- const fs = require('fs/promises')
1
+ import { print } from '@toptal/davinci-cli-shared'
2
+ import fs from 'fs/promises'
3
3
 
4
- const templates = require('../templates')
4
+ import templates from '../templates.mjs'
5
5
 
6
6
  const storiesCommandCreator = {
7
7
  command: 'stories <componentDirectory>',
@@ -27,4 +27,4 @@ const storiesCommandCreator = {
27
27
  },
28
28
  }
29
29
 
30
- module.exports = storiesCommandCreator
30
+ export default storiesCommandCreator
@@ -0,0 +1,5 @@
1
+ export const CORE_MODULE = 'core'
2
+
3
+ export default {
4
+ CORE_MODULE,
5
+ }
package/src/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import moduleCommandCreator from './commands/module.mjs';
2
+ import componentCommandCreator from './commands/component.mjs';
3
+ import storiesCommandCreator from './commands/stories.mjs';
4
+
5
+ export default {
6
+ commands: [
7
+ moduleCommandCreator,
8
+ storiesCommandCreator,
9
+ componentCommandCreator,
10
+ ],
11
+ };
@@ -1,6 +1,9 @@
1
- const path = require('path')
2
- const fs = require('fs')
3
- const { runSync } = require('@toptal/davinci-cli-shared')
1
+ import { fileURLToPath } from 'node:url'
2
+ import path from 'node:path'
3
+ import fs from 'fs'
4
+ import { runSync } from '@toptal/davinci-cli-shared'
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
4
7
 
5
8
  const rootDir = path.join(__dirname, '..')
6
9
  const templatesDir = path.join(rootDir, './_templates')
@@ -33,7 +36,7 @@ const generate = (template, name, moduleName) => {
33
36
  })
34
37
  }
35
38
 
36
- module.exports = {
39
+ export default {
37
40
  generateModule,
38
41
  generate,
39
42
  }
package/src/constants.js DELETED
@@ -1,5 +0,0 @@
1
- const CORE_MODULE = 'core'
2
-
3
- module.exports = {
4
- CORE_MODULE,
5
- }
package/src/index.js DELETED
@@ -1,11 +0,0 @@
1
- const moduleCommandCreator = require('./commands/module')
2
- const componentCommandCreator = require('./commands/component')
3
- const storiesCommandCreator = require('./commands/stories')
4
-
5
- module.exports = {
6
- commands: [
7
- moduleCommandCreator,
8
- storiesCommandCreator,
9
- componentCommandCreator,
10
- ],
11
- }