@symbo.ls/cli 2.10.253 → 2.10.272
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/convert.js +10 -8
- package/bin/create.js +6 -7
- package/bin/fetch.js +9 -9
- package/bin/init-helpers/DesignSystem.js +12 -12
- package/bin/init-helpers/init-repo.js +6 -6
- package/bin/link-all.js +1 -1
- package/bin/login.js +4 -1
- package/bin/require.js +5 -5
- package/bin/sync.js +3 -3
- package/package.json +2 -2
package/bin/convert.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import * as esbuild from 'esbuild'
|
|
4
|
-
import { loadModule } from './require.js'
|
|
5
4
|
import { program } from './program.js'
|
|
6
5
|
import { convert } from 'domql-to-mitosis'
|
|
7
6
|
import fs from 'fs'
|
|
8
7
|
import path from 'path'
|
|
9
8
|
import { JSDOM } from 'jsdom'
|
|
10
9
|
|
|
11
|
-
const jsdom = new JSDOM(
|
|
10
|
+
const jsdom = new JSDOM('<html><head></head><body></body></html>')
|
|
12
11
|
global.window = jsdom.window
|
|
13
12
|
global.document = window.document
|
|
14
13
|
|
|
15
|
-
const TMP_DIR_NAME =
|
|
14
|
+
const TMP_DIR_NAME = '.smbls_convert_tmp'
|
|
16
15
|
|
|
17
|
-
async function mkdirp(dir) {
|
|
16
|
+
async function mkdirp (dir) {
|
|
18
17
|
try {
|
|
19
18
|
return await fs.promises.mkdir(dir)
|
|
20
19
|
} catch (err) {
|
|
@@ -25,6 +24,8 @@ async function mkdirp(dir) {
|
|
|
25
24
|
return null
|
|
26
25
|
}
|
|
27
26
|
|
|
27
|
+
const IGNORED_FILES = ['index.js', 'package.json', 'node_modules', 'dist']
|
|
28
|
+
|
|
28
29
|
program
|
|
29
30
|
.command('convert')
|
|
30
31
|
.description('Recursively convert and copy all DomQL components under a directory')
|
|
@@ -54,7 +55,7 @@ program
|
|
|
54
55
|
await mkdirp(tmpDirPath)
|
|
55
56
|
await mkdirp(destPath)
|
|
56
57
|
|
|
57
|
-
const origFiles = await fs.promises.readdir(srcPath)
|
|
58
|
+
const origFiles = await (await fs.promises.readdir(srcPath)).filter(file => !IGNORED_FILES.includes(file))
|
|
58
59
|
|
|
59
60
|
// Bundle components
|
|
60
61
|
await esbuild.build({
|
|
@@ -69,7 +70,8 @@ program
|
|
|
69
70
|
// Convert components
|
|
70
71
|
const componentDirs = await fs.promises.readdir(tmpDirPath)
|
|
71
72
|
for (const componentDir of componentDirs) {
|
|
72
|
-
|
|
73
|
+
console.log(componentDirs)
|
|
74
|
+
const importDir = path.join(tmpDirPath, componentDir)
|
|
73
75
|
if ((await fs.promises.stat(importDir)).isDirectory()) {
|
|
74
76
|
// Import the module
|
|
75
77
|
const importPath = `${importDir}/index.js`
|
|
@@ -84,7 +86,7 @@ program
|
|
|
84
86
|
console.log(`Converting modules in ${componentDir}:`)
|
|
85
87
|
console.group()
|
|
86
88
|
const uniqueImports = []
|
|
87
|
-
let fileContents =
|
|
89
|
+
let fileContents = ''
|
|
88
90
|
let first = true
|
|
89
91
|
const exportCount = Object.keys(domqlModule).length
|
|
90
92
|
for (const key in domqlModule) {
|
|
@@ -111,7 +113,7 @@ program
|
|
|
111
113
|
// Write file
|
|
112
114
|
if (fileContents.length > 0) {
|
|
113
115
|
const fh = await fs.promises
|
|
114
|
-
|
|
116
|
+
.open(`${destComponentDirPath}/index.js`, 'w')
|
|
115
117
|
await fh.writeFile(fileContents, 'utf8')
|
|
116
118
|
await fh.close()
|
|
117
119
|
}
|
package/bin/create.js
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
import { execSync } from 'child_process'
|
|
4
4
|
import { program } from './program.js'
|
|
5
5
|
import { initRepo } from './init-helpers/init-repo.js'
|
|
6
|
-
import path from 'path'
|
|
7
6
|
|
|
8
7
|
const REPO_URLS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
domql: 'https://github.com/symbo-ls/starter-kit',
|
|
9
|
+
react: 'https://github.com/symbo-ls/create-react-app.git',
|
|
10
|
+
angular: 'https://github.com/symbo-ls/create-angular-app.git',
|
|
11
|
+
vue2: 'https://github.com/symbo-ls/create-vue2-app.git',
|
|
12
|
+
vue3: 'https://github.com/symbo-ls/create-vue3-app.git'
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
program
|
|
@@ -34,7 +33,7 @@ program
|
|
|
34
33
|
} else if (options.vue3) {
|
|
35
34
|
framework = 'vue3'
|
|
36
35
|
}
|
|
37
|
-
|
|
36
|
+
const cloneUrl = REPO_URLS[framework]
|
|
38
37
|
|
|
39
38
|
// Clone
|
|
40
39
|
console.log(`Cloning ${cloneUrl} into '${dest}'...`)
|
package/bin/fetch.js
CHANGED
|
@@ -13,13 +13,13 @@ const PACKAGE_PATH = process.cwd() + '/package.json'
|
|
|
13
13
|
const RC_PATH = process.cwd() + '/symbols.json'
|
|
14
14
|
const LOCAL_CONFIG_PATH = process.cwd() + '/node_modules/@symbo.ls/init/dynamic.json'
|
|
15
15
|
const DEFAULT_REMOTE_REPOSITORY = 'https://github.com/symbo-ls/default-config/'
|
|
16
|
-
const DEFAULT_REMOTE_CONFIG_PATH = 'https://api.symbols.dev/'
|
|
16
|
+
const DEFAULT_REMOTE_CONFIG_PATH = 'https://api.symbols.dev/' // eslint-disable-line
|
|
17
17
|
|
|
18
18
|
const API_URL = 'https://api.symbols.dev/' // eslint-disable-line
|
|
19
19
|
|
|
20
20
|
const pkg = loadModule(PACKAGE_PATH)
|
|
21
|
-
const
|
|
22
|
-
const
|
|
21
|
+
const rcFile = loadModule(RC_PATH) // eslint-disable-line
|
|
22
|
+
const localConfig = loadModule(LOCAL_CONFIG_PATH) // eslint-disable-line
|
|
23
23
|
|
|
24
24
|
let rc = {}
|
|
25
25
|
try {
|
|
@@ -34,16 +34,16 @@ program
|
|
|
34
34
|
.description('Install Symbols')
|
|
35
35
|
.option('--framework', 'Which Symbols to install (domql, react)')
|
|
36
36
|
.action(async (framework) => {
|
|
37
|
-
if (!
|
|
37
|
+
if (!rcFile || !localConfig) {
|
|
38
38
|
console.error('symbols.json not found in the root of the repository')
|
|
39
|
-
return
|
|
39
|
+
return
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// const packageName = `@symbo.ls/${mode || 'uikit'}`
|
|
43
43
|
const packageName = 'smbls'
|
|
44
44
|
console.log('Adding', chalk.green.bold(packageName))
|
|
45
45
|
|
|
46
|
-
if (framework === 'domql' ||
|
|
46
|
+
if (framework === 'domql' || rcFile.framework === 'domql') {
|
|
47
47
|
exec('yarn add domql@^1.15.26 --force', (error, stdout, stderr) => {
|
|
48
48
|
if (error) {
|
|
49
49
|
console.log(`error: ${error.message}`)
|
|
@@ -70,7 +70,7 @@ program
|
|
|
70
70
|
console.log('\n')
|
|
71
71
|
console.log(chalk.green.bold(packageName), 'successfuly added!')
|
|
72
72
|
console.log('')
|
|
73
|
-
console.log(chalk.dim('Now you can import components like:'),
|
|
73
|
+
console.log(chalk.dim('Now you can import components like:'), 'import { Button } from \'smbls')
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
|
|
@@ -79,8 +79,8 @@ program
|
|
|
79
79
|
.description('Fetch symbols')
|
|
80
80
|
.action(async (options) => {
|
|
81
81
|
rc.then(async data => {
|
|
82
|
-
const opts = { ...data, ...options }
|
|
83
|
-
const key = data.key || options && options.key
|
|
82
|
+
const opts = { ...data, ...options } // eslint-disable-line
|
|
83
|
+
const key = data.key || (options && options.key)
|
|
84
84
|
|
|
85
85
|
const body = await fetchRemote(key, { endpoint: 'api.symbols.dev' })
|
|
86
86
|
const { version, ...config } = body
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const CustomDesignSystem = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
color: {
|
|
3
|
+
snowWhite: '#F3F6FB'
|
|
4
|
+
},
|
|
5
|
+
theme: {},
|
|
6
|
+
typography: {},
|
|
7
|
+
space: {},
|
|
8
|
+
media: {},
|
|
9
|
+
icons: {},
|
|
10
|
+
font: {},
|
|
11
|
+
font_family: {},
|
|
12
|
+
timing: {},
|
|
13
|
+
reset: {}
|
|
14
14
|
}
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
import { execSync } from 'child_process'
|
|
4
4
|
import fs from 'fs'
|
|
5
5
|
import path from 'path'
|
|
6
|
-
import { fileURLToPath } from 'url'
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
8
|
-
const __dirname = path.dirname(__filename)
|
|
6
|
+
import { fileURLToPath } from 'url'
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
8
|
+
const __dirname = path.dirname(__filename)
|
|
9
9
|
const DESIGN_SYSTEM_FILE_PATH = path.join(
|
|
10
10
|
__dirname, 'DesignSystem.js')
|
|
11
11
|
|
|
12
|
-
export async function initRepo(dest, framework) {
|
|
12
|
+
export async function initRepo (dest, framework) {
|
|
13
13
|
const cwd = process.cwd()
|
|
14
14
|
|
|
15
15
|
// Init NPM if necessary
|
|
16
16
|
if (!fs.existsSync(path.join(dest, 'package.json'))) {
|
|
17
17
|
process.chdir(dest)
|
|
18
18
|
console.log('Running npm init')
|
|
19
|
-
execSync(
|
|
19
|
+
execSync('npm init -y')
|
|
20
20
|
process.chdir(cwd)
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ export async function initRepo(dest, framework) {
|
|
|
25
25
|
// Install
|
|
26
26
|
console.log('Installing NPM dependencies...')
|
|
27
27
|
process.chdir(dest)
|
|
28
|
-
execSync(
|
|
28
|
+
execSync('npm install', { stdio: ['inherit', 'inherit', 'ignore'] })
|
|
29
29
|
process.chdir(cwd)
|
|
30
30
|
|
|
31
31
|
// Copy design system file
|
package/bin/link-all.js
CHANGED
package/bin/login.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { program } = require('./program')
|
|
4
|
+
const API_URL = 'https://api.symbols.dev/' // eslint-disable-line
|
|
5
|
+
|
|
3
6
|
program
|
|
4
7
|
.command('login [destination]')
|
|
5
8
|
.description('Sign in to Symbols')
|
|
@@ -12,4 +15,4 @@ program
|
|
|
12
15
|
const response = await fetch(API_URL)
|
|
13
16
|
const body = await response.json()
|
|
14
17
|
console.log(body)
|
|
15
|
-
})
|
|
18
|
+
})
|
package/bin/require.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
import { createRequire } from 'module'
|
|
2
|
-
import path from 'path'
|
|
3
4
|
import fs from 'fs'
|
|
4
5
|
|
|
5
6
|
class ImportError extends Error {} /* Bring in the ability to create the 'require' method */ // eslint-disable-line
|
|
6
7
|
const require = createRequire(import.meta.url) // construct the require method
|
|
7
8
|
|
|
8
9
|
export const loadModule = async (modulePath) => {
|
|
9
|
-
if (fs.existsSync(modulePath))
|
|
10
|
-
return require(modulePath)
|
|
11
|
-
else
|
|
12
|
-
return null
|
|
10
|
+
if (fs.existsSync(modulePath)) {
|
|
11
|
+
return require(modulePath)
|
|
12
|
+
} else { return null }
|
|
13
13
|
}
|
package/bin/sync.js
CHANGED
|
@@ -19,7 +19,7 @@ program
|
|
|
19
19
|
.action(async (options) => {
|
|
20
20
|
if (!rc) {
|
|
21
21
|
console.error('symbols.json not found in the root of the repository')
|
|
22
|
-
return
|
|
22
|
+
return
|
|
23
23
|
}
|
|
24
24
|
rc.then(data => {
|
|
25
25
|
const opts = { ...data, ...options }
|
|
@@ -30,8 +30,8 @@ program
|
|
|
30
30
|
},
|
|
31
31
|
onChange: (event, data) => {
|
|
32
32
|
data = JSON.parse(data)
|
|
33
|
-
|
|
34
|
-
const {
|
|
33
|
+
const d = {}
|
|
34
|
+
const {
|
|
35
35
|
PROJECT_SYSTEM,
|
|
36
36
|
PROJECT_STATE,
|
|
37
37
|
PROJECT_COMPONENTS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/cli",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.272",
|
|
4
4
|
"description": "Fetch your Symbols configuration",
|
|
5
5
|
"main": "bin/fetch.js",
|
|
6
6
|
"author": "Symbols",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"node-fetch": "^3.1.0",
|
|
26
26
|
"v8-compile-cache": "^2.3.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "297618a17a7a449fb3af9aca3b1e638769f888a7"
|
|
29
29
|
}
|