@symbo.ls/cli 2.10.209 → 2.10.226

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 symbo.ls
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/bin/convert.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import * as esbuild from 'esbuild'
4
+ import { loadModule } from './require.js'
4
5
  import { program } from './program.js'
5
6
  import { convert } from 'domql-to-mitosis'
6
7
  import fs from 'fs'
@@ -27,7 +28,7 @@ async function mkdirp(dir) {
27
28
  program
28
29
  .command('convert')
29
30
  .description('Recursively convert and copy all DomQL components under a directory')
30
- .argument('[src]', 'Source directory. By default, it is "."', '.')
31
+ .argument('[src]', 'Source directory. By default, it is "src/"')
31
32
  .argument('[dest]', 'Destination directory. By default, it becomes the name of the desired format')
32
33
  .option('--react', 'Convert all DomQL components to React')
33
34
  .option('--angular', 'Convert all DomQL components to Angular')
@@ -93,7 +94,7 @@ program
93
94
  const component = domqlModule[key]
94
95
  component.__name = key
95
96
  const out = convert(component, desiredFormat, {
96
- verbose: (key === "ParentMode"),
97
+ verbose: false,
97
98
  exportDefault: exportCount === 1,
98
99
  returnMitosisIR: true,
99
100
  importsToRemove: uniqueImports,
package/bin/create.js CHANGED
@@ -2,59 +2,44 @@
2
2
 
3
3
  import { execSync } from 'child_process'
4
4
  import { program } from './program.js'
5
- import fs from 'fs'
5
+ import { initRepo } from './init-helpers/init-repo.js'
6
6
  import path from 'path'
7
- import { fileURLToPath } from 'url';
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = path.dirname(__filename);
10
7
 
11
- const DESIGN_SYSTEM_FILE_PATH = path.join(
12
- __dirname, 'create', 'DesignSystem.js')
13
8
  const REPO_URLS = {
14
- domql: 'https://github.com/symbo-ls/create-domql-app.git',
15
- react: 'https://github.com/symbo-ls/create-react-app.git',
16
- angular: 'https://github.com/symbo-ls/create-angular-app.git',
17
- vue2: 'https://github.com/symbo-ls/create-vue2-app.git',
18
- vue3: 'https://github.com/symbo-ls/create-vue3-app.git',
9
+ 'domql': 'https://github.com/symbo-ls/create-domql-app.git',
10
+ 'react': 'https://github.com/symbo-ls/create-react-app.git',
11
+ 'angular': 'https://github.com/symbo-ls/create-angular-app.git',
12
+ 'vue2': 'https://github.com/symbo-ls/create-vue2-app.git',
13
+ 'vue3': 'https://github.com/symbo-ls/create-vue3-app.git',
19
14
  }
20
15
 
21
16
  program
22
17
  .command('create')
23
- .description('Create a new project that uses Symbols')
24
- .argument('dest', 'Project directory name')
25
- .option('--domql', 'Use Domql in the project (default)')
26
- .option('--react', 'Use React in the project (default)')
18
+ .description('Create and initialize a new project')
19
+ .argument('dest', 'Project directory')
20
+ .option('--domql', 'Use Domql in the project')
21
+ .option('--react', 'Use React in the project (default)', true)
27
22
  .option('--angular', 'Use Angular in the project')
28
23
  .option('--vue2', 'Use Vue2 in the project')
29
24
  .option('--vue3', 'Use Vue3 in the project')
30
25
  .action(async (dest, options) => {
31
- // Determine repo to clone
32
- let cloneUrl = REPO_URLS.react
26
+ // Determine framework
27
+ let framework = 'react'
33
28
  if (options.domql) {
34
- cloneUrl = REPO_URLS.domql
29
+ framework = 'domql'
35
30
  } else if (options.angular) {
36
- cloneUrl = REPO_URLS.angular
31
+ framework = 'angular'
37
32
  } else if (options.vue2) {
38
- cloneUrl = REPO_URLS.vue2
33
+ framework = 'vue2'
39
34
  } else if (options.vue3) {
40
- cloneUrl = REPO_URLS.vue3
35
+ framework = 'vue3'
41
36
  }
37
+ let cloneUrl = REPO_URLS[framework]
42
38
 
43
39
  // Clone
44
- console.log(`Cloning ${cloneUrl} into ${dest}...`)
40
+ console.log(`Cloning ${cloneUrl} into '${dest}'...`)
45
41
  execSync(`git clone ${cloneUrl} ${dest}`)
46
42
 
47
- // Install
48
- const cwd = process.cwd()
49
- console.log('Installing NPM dependencies...')
50
- process.chdir(dest)
51
- execSync(`npm install`)
52
- process.chdir(cwd)
53
-
54
- // Copy design system file
55
- const filePath = path.join(dest, 'DesignSystem.js')
56
- console.log(`Writing DesignSystem.js to ${filePath}`)
57
- await fs.promises.copyFile(DESIGN_SYSTEM_FILE_PATH, filePath)
58
-
59
- console.log('Done!')
43
+ // Leave the rest to init
44
+ return await initRepo(dest, framework)
60
45
  })
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ import { execSync } from 'child_process'
4
+ import fs from 'fs'
5
+ import path from 'path'
6
+ import { fileURLToPath } from 'url';
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const DESIGN_SYSTEM_FILE_PATH = path.join(
10
+ __dirname, 'DesignSystem.js')
11
+
12
+ export async function initRepo(dest, framework) {
13
+ const cwd = process.cwd()
14
+
15
+ // Init NPM if necessary
16
+ if (!fs.existsSync(path.join(dest, 'package.json'))) {
17
+ process.chdir(dest)
18
+ console.log('Running npm init')
19
+ execSync(`npm init -y`)
20
+ process.chdir(cwd)
21
+ }
22
+
23
+ // TODO: inject smbls dependencies into package.json
24
+
25
+ // Install
26
+ console.log('Installing NPM dependencies...')
27
+ process.chdir(dest)
28
+ execSync(`npm install`, { stdio: ['inherit', 'inherit', 'ignore'] })
29
+ process.chdir(cwd)
30
+
31
+ // Copy design system file
32
+ const filePath = path.join(dest, 'DesignSystem.js')
33
+ console.log(`Writing DesignSystem.js to ${filePath}`)
34
+ await fs.promises.copyFile(DESIGN_SYSTEM_FILE_PATH, filePath)
35
+
36
+ console.log('Done!')
37
+ }
package/bin/init.js CHANGED
@@ -1,29 +1,32 @@
1
1
  'use strict'
2
2
 
3
- import { exec } from 'child_process'
4
- import chalk from 'chalk'
5
3
  import { program } from './program.js'
4
+ import { initRepo } from './init-helpers/init-repo.js'
6
5
 
7
6
  program
8
- .command('init [name]')
9
- .description('Initialize a repository')
10
- .option('--framework', 'Which Symbols to install (domql, react)')
11
- .action(async (framework) => {
12
- const packageName = `@symbo.ls/${framework || 'uikit'}`
13
- console.log('Creating', chalk.green.bold(packageName))
7
+ .command('init')
8
+ .description('Initialize a project')
9
+ .argument('[dest]', 'Project directory. By default, it is "."')
10
+ .option('--domql', 'Use Domql in the project')
11
+ .option('--react', 'Use React in the project (default)', true)
12
+ .option('--angular', 'Use Angular in the project')
13
+ .option('--vue2', 'Use Vue2 in the project')
14
+ .option('--vue3', 'Use Vue3 in the project')
15
+ .action(async (dest, options) => {
16
+ if (!dest) dest = '.'
14
17
 
15
- // exec(`git clone git@github.com:symbo-ls/starter-kit.git`, (error, stdout, stderr) => {
16
- // if (error) {
17
- // console.log(`error: ${error.message}`)
18
- // return
19
- // }
20
- // if (stderr) {
21
- // console.warn(`stderr: ${stderr}`)
22
- // return
23
- // }
24
- // console.log(`stdout: ${stdout}`)
25
- // console.log(chalk.green.bold(packageName), 'successfuly added!')
26
- // console.log('')
27
- // console.log(chalk.dim.underline('Now you can import components like:'), `import { Button } from "${chalk.green.bold(packageName)}""`)
28
- // })
18
+ // Determine framework
19
+ let framework = 'react'
20
+ if (options.domql) {
21
+ framework = 'domql'
22
+ } else if (options.angular) {
23
+ framework = 'angular'
24
+ } else if (options.vue2) {
25
+ framework = 'vue2'
26
+ } else if (options.vue3) {
27
+ framework = 'vue3'
28
+ }
29
+
30
+ // Leave the rest to init
31
+ return await initRepo(dest, framework)
29
32
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/cli",
3
- "version": "2.10.209",
3
+ "version": "2.10.226",
4
4
  "description": "Fetch your Symbols configuration",
5
5
  "main": "bin/fetch.js",
6
6
  "author": "Symbols",
@@ -24,5 +24,5 @@
24
24
  "node-fetch": "^3.1.0",
25
25
  "v8-compile-cache": "^2.3.0"
26
26
  },
27
- "gitHead": "35746d7c15665b6bf65866553b251a4c6fff71bf"
27
+ "gitHead": "e00b07cb7ba8e144f98dec2d296a231987478c08"
28
28
  }
File without changes