@newlogic-digital/cli 0.0.3 → 0.0.6

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/index.mjs ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+
3
+ import init from './src/commands/init/index.mjs'
4
+ import cms from './src/commands/cms/index.mjs'
5
+ import pc from 'picocolors'
6
+ import { version, name } from './src/utils.mjs'
7
+
8
+ const args = process.argv.slice(2)
9
+ const command = args[0]
10
+
11
+ if (!command) {
12
+ console.log(`
13
+ ${pc.blue(`${name} v${version}`)}
14
+
15
+ Usage:
16
+
17
+ -- init --
18
+ ${pc.green('newlogic init')} - Creates a new project in current directory
19
+ ${pc.green('newlogic init')} ${pc.yellow('<directory>')} - Creates a new project in new directory with the name ${pc.yellow('<directory>')}
20
+ ${pc.green('newlogic init ui')} - Creates a new ${pc.blue('@newlogic-digital/ui')} project in current directory
21
+ ${pc.green('newlogic init ui')} ${pc.yellow('<directory>')} - Creates a new ${pc.blue('@newlogic-digital/ui')} project in new directory with the name ${pc.yellow('<directory>')}
22
+ ${pc.green('newlogic init cms')} - Creates a new ${pc.blue('@newlogic-digital/cms')} project in current directory
23
+ ${pc.green('newlogic init cms')} ${pc.yellow('<directory>')} - Creates a new ${pc.blue('@newlogic-digital/cms')} project in new directory with the name ${pc.yellow('<directory>')}
24
+
25
+ -- cms --
26
+ ${pc.green('newlogic cms prepare')} - Copies templates and sections from ${pc.blue('@newlogic-digital/ui')} project to ${pc.blue('@newlogic-digital/cms')}
27
+ ${pc.green('newlogic cms prepare templates')} - Copies templates from ${pc.blue('@newlogic-digital/ui')} project to ${pc.blue('@newlogic-digital/cms')} even if they already exists
28
+ ${pc.green('newlogic cms prepare sections')} - Copies sections from ${pc.blue('@newlogic-digital/ui')} project to ${pc.blue('@newlogic-digital/cms')} even if they already exists
29
+ ${pc.green('newlogic cms new-section')} ${pc.yellow('<name>')} - Creates a new ${pc.blue('@newlogic-digital/cms')} section with name ${pc.yellow('<name>')}
30
+ `)
31
+ }
32
+
33
+ (async() => {
34
+ if (command === 'init') {
35
+ const action = args[1]
36
+ const name = args[2]
37
+
38
+ await init(action, name)
39
+ }
40
+
41
+ if (command === 'cms') {
42
+ const action = args[1]
43
+ const name = args[2]
44
+
45
+ await cms(action, name)
46
+ }
47
+ })()
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@newlogic-digital/cli",
3
- "version": "0.0.3",
4
- "type": "module",
5
- "main": "index.js",
3
+ "version": "0.0.6",
4
+ "main": "index.mjs",
6
5
  "bin": {
7
- "newlogic": "index.js"
6
+ "newlogic": "index.mjs"
8
7
  },
9
8
  "scripts": {
10
9
  "eslint": "eslint '**/*.mjs' --fix"
package/src/utils.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import childProcess from 'child_process'
2
- import fs from 'fs'
3
- import { dirname, resolve } from 'path'
4
- import { fileURLToPath } from 'url'
5
2
 
6
- const { version, name } = JSON.parse(fs.readFileSync(resolve(dirname((fileURLToPath(import.meta.url))), '../package.json')).toString())
3
+ const { version, name } = {
4
+ version: '0.0.5',
5
+ name: '@newlogic-digital/cli'
6
+ }
7
7
 
8
8
  const execSync = (cmd) => {
9
9
  try {