lapikit 0.0.0-insiders.b14f086 → 0.0.0-insiders.b2fe678
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/helper.js +41 -32
- package/bin/lapikit.js +10 -9
- package/bin/modules/adapter.js +3 -3
- package/package.json +4 -1
package/bin/helper.js
CHANGED
|
@@ -1,43 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
red: `\x1b[31m${text}\x1b[0m`,
|
|
3
|
-
green: `\x1b[32m${text}\x1b[0m`,
|
|
4
|
-
yellow: `\x1b[33m${text}\x1b[0m`,
|
|
5
|
-
blue: `\x1b[34m${text}\x1b[0m`,
|
|
6
|
-
purple: `\x1b[35m${text}\x1b[0m`,
|
|
7
|
-
cyan: `\x1b[36m${text}\x1b[0m`
|
|
1
|
+
const color = {
|
|
2
|
+
red: (text) => `\x1b[31m${text}\x1b[0m`,
|
|
3
|
+
green: (text) => `\x1b[32m${text}\x1b[0m`,
|
|
4
|
+
yellow: (text) => `\x1b[33m${text}\x1b[0m`,
|
|
5
|
+
blue: (text) => `\x1b[34m${text}\x1b[0m`,
|
|
6
|
+
purple: (text) => `\x1b[35m${text}\x1b[0m`,
|
|
7
|
+
cyan: (text) => `\x1b[36m${text}\x1b[0m`
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
bold: `\x1b[1m${text}\x1b[0m`,
|
|
12
|
-
underline: `\x1b[4m${text}\x1b[0m`,
|
|
13
|
-
inverse: `\x1b[7m${text}\x1b[0m`
|
|
10
|
+
const variant = {
|
|
11
|
+
bold: (text) => `\x1b[1m${text}\x1b[0m`,
|
|
12
|
+
underline: (text) => `\x1b[4m${text}\x1b[0m`,
|
|
13
|
+
inverse: (text) => `\x1b[7m${text}\x1b[0m`
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
red: `\x1b[1m\x1b[31m${text}\x1b[0m`,
|
|
18
|
-
green: `\x1b[1m\x1b[32m${text}\x1b[0m`,
|
|
19
|
-
yellow: `\x1b[1m\x1b[33m${text}\x1b[0m`,
|
|
20
|
-
blue: `\x1b[1m\x1b[34m${text}\x1b[0m`,
|
|
21
|
-
purple: `\x1b[1m\x1b[35m${text}\x1b[0m`,
|
|
22
|
-
cyan: `\x1b[1m\x1b[36m${text}\x1b[0m`
|
|
16
|
+
const bold = {
|
|
17
|
+
red: (text) => `\x1b[1m\x1b[31m${text}\x1b[0m`,
|
|
18
|
+
green: (text) => `\x1b[1m\x1b[32m${text}\x1b[0m`,
|
|
19
|
+
yellow: (text) => `\x1b[1m\x1b[33m${text}\x1b[0m`,
|
|
20
|
+
blue: (text) => `\x1b[1m\x1b[34m${text}\x1b[0m`,
|
|
21
|
+
purple: (text) => `\x1b[1m\x1b[35m${text}\x1b[0m`,
|
|
22
|
+
cyan: (text) => `\x1b[1m\x1b[36m${text}\x1b[0m`
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
red: `\x1b[7m\x1b[31m${text}\x1b[0m`,
|
|
27
|
-
green: `\x1b[7m\x1b[32m${text}\x1b[0m`,
|
|
28
|
-
yellow: `\x1b[7m\x1b[33m${text}\x1b[0m`,
|
|
29
|
-
blue: `\x1b[7m\x1b[34m${text}\x1b[0m`,
|
|
30
|
-
purple: `\x1b[7m\x1b[35m${text}\x1b[0m`,
|
|
31
|
-
cyan: `\x1b[7m\x1b[36m${text}\x1b[0m`
|
|
25
|
+
const inverse = {
|
|
26
|
+
red: (text) => `\x1b[7m\x1b[31m${text}\x1b[0m`,
|
|
27
|
+
green: (text) => `\x1b[7m\x1b[32m${text}\x1b[0m`,
|
|
28
|
+
yellow: (text) => `\x1b[7m\x1b[33m${text}\x1b[0m`,
|
|
29
|
+
blue: (text) => `\x1b[7m\x1b[34m${text}\x1b[0m`,
|
|
30
|
+
purple: (text) => `\x1b[7m\x1b[35m${text}\x1b[0m`,
|
|
31
|
+
cyan: (text) => `\x1b[7m\x1b[36m${text}\x1b[0m`
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
red: `\x1b[4m\x1b[31m${text}\x1b[0m`,
|
|
36
|
-
green: `\x1b[4m\x1b[32m${text}\x1b[0m`,
|
|
37
|
-
yellow: `\x1b[4m\x1b[33m${text}\x1b[0m`,
|
|
38
|
-
blue: `\x1b[4m\x1b[34m${text}\x1b[0m`,
|
|
39
|
-
purple: `\x1b[4m\x1b[35m${text}\x1b[0m`,
|
|
40
|
-
cyan: `\x1b[4m\x1b[36m${text}\x1b[0m`
|
|
34
|
+
const underline = {
|
|
35
|
+
red: (text) => `\x1b[4m\x1b[31m${text}\x1b[0m`,
|
|
36
|
+
green: (text) => `\x1b[4m\x1b[32m${text}\x1b[0m`,
|
|
37
|
+
yellow: (text) => `\x1b[4m\x1b[33m${text}\x1b[0m`,
|
|
38
|
+
blue: (text) => `\x1b[4m\x1b[34m${text}\x1b[0m`,
|
|
39
|
+
purple: (text) => `\x1b[4m\x1b[35m${text}\x1b[0m`,
|
|
40
|
+
cyan: (text) => `\x1b[4m\x1b[36m${text}\x1b[0m`
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const ansi = {
|
|
44
|
+
color,
|
|
45
|
+
variant,
|
|
46
|
+
bold,
|
|
47
|
+
inverse,
|
|
48
|
+
underline
|
|
41
49
|
};
|
|
42
50
|
|
|
43
51
|
export const terminal = (type = 'info', msg) => {
|
|
@@ -46,6 +54,7 @@ export const terminal = (type = 'info', msg) => {
|
|
|
46
54
|
if (type === 'error') console.error(name, ansi.bold.red('[error]'), msg);
|
|
47
55
|
else if (type === 'warn') console.warn(name, ansi.bold.yellow('[warn]'), msg);
|
|
48
56
|
else if (type === 'success') console.warn(name, ansi.bold.green('[success]'), msg);
|
|
57
|
+
else if (type === 'none') console.log(msg);
|
|
49
58
|
else console.log(name, ansi.bold.blue('[info]'), msg);
|
|
50
59
|
};
|
|
51
60
|
|
package/bin/lapikit.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import { promises as fs } from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
|
-
import {
|
|
4
|
-
import { preset } from './modules/preset';
|
|
5
|
-
import { adapterCSSConfig, adapterViteConfig } from './modules/adapter';
|
|
4
|
+
import { ansi, terminal, envTypescript } from './helper.js';
|
|
5
|
+
import { preset } from './modules/preset.js';
|
|
6
|
+
import { adapterCSSConfig, adapterViteConfig } from './modules/adapter.js';
|
|
6
7
|
|
|
7
8
|
const [, , command] = process.argv;
|
|
8
9
|
const typescriptEnabled = envTypescript();
|
|
@@ -10,8 +11,8 @@ const typescriptEnabled = envTypescript();
|
|
|
10
11
|
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
11
12
|
terminal(
|
|
12
13
|
'info',
|
|
13
|
-
`usage: ${color.yellow('npx lapikit init {cssPath}')}\n\n ${variant.bold('options:')}\n
|
|
14
|
-
- {cssPath}: (${color.cyan('src/app.css')}) customize path on your origin css file.\n\n`
|
|
14
|
+
`usage: ${ansi.color.yellow('npx lapikit init {cssPath}')}\n\n ${ansi.variant.bold('options:')}\n
|
|
15
|
+
- {cssPath}: (${ansi.color.cyan('src/app.css')}) customize path on your origin css file.\n\n`
|
|
15
16
|
);
|
|
16
17
|
process.exit(0);
|
|
17
18
|
} else if (command === 'init') {
|
|
@@ -22,9 +23,9 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
|
22
23
|
console.log(' | |___| (_| | |_) | | <| | |_ ');
|
|
23
24
|
console.log(' |______\\__,_| .__/|_|_|\\_\\_|\\__|');
|
|
24
25
|
console.log(' | | ');
|
|
25
|
-
console.log(' |_| ');
|
|
26
|
+
console.log(' |_| \n');
|
|
26
27
|
|
|
27
|
-
terminal('
|
|
28
|
+
terminal('none', `${ansi.bold.blue('LAPIKIT')} - Component Library for Svelte\n\n`);
|
|
28
29
|
|
|
29
30
|
const configPath = path.resolve(process.cwd(), 'lapikit.config.js');
|
|
30
31
|
try {
|
|
@@ -43,11 +44,11 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
|
43
44
|
|
|
44
45
|
terminal(
|
|
45
46
|
'info',
|
|
46
|
-
`${bold.blue('Thank to use lapikit, discover all posibility with lapikit on https://localhost:3000/docs')}\n\n`
|
|
47
|
+
`${ansi.bold.blue('Thank to use lapikit, discover all posibility with lapikit on https://localhost:3000/docs')}\n\n`
|
|
47
48
|
);
|
|
48
49
|
|
|
49
50
|
console.log('Github: https://github.com/nycolaide/lapikit');
|
|
50
51
|
console.log('Support the developement: https://buymeacoffee.com/nycolaide');
|
|
51
52
|
} else {
|
|
52
|
-
terminal('error', `Command not recognized. Try 'npx lapikit
|
|
53
|
+
terminal('error', `Command not recognized. Try 'npx lapikit -h'`);
|
|
53
54
|
}
|
package/bin/modules/adapter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises as fs } from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { getCssPathFromArgs, terminal } from '../helper';
|
|
3
|
+
import { getCssPathFromArgs, terminal } from '../helper.js';
|
|
4
4
|
|
|
5
5
|
const importLapikitVite = `import { lapikit } from 'lapikit/vite';`;
|
|
6
6
|
const importLapikitCss = `@import 'lapikit/css';`;
|
|
@@ -28,7 +28,7 @@ export async function adapterViteConfig(typescript) {
|
|
|
28
28
|
} catch (error) {
|
|
29
29
|
terminal(
|
|
30
30
|
'error',
|
|
31
|
-
`lapikit encountered a problem while editing vite.config.(js|ts)
|
|
31
|
+
`lapikit() encountered a problem while editing vite.config.(js|ts):\n ${error}.\n\n`
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -46,7 +46,7 @@ export async function adapterCSSConfig() {
|
|
|
46
46
|
} catch (error) {
|
|
47
47
|
terminal(
|
|
48
48
|
'error',
|
|
49
|
-
`lapikit encountered a problem while editing ${cssPath}:\n
|
|
49
|
+
`lapikit/css encountered a problem while editing ${cssPath}:\n ${error.message}.\n\n`
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lapikit",
|
|
3
|
-
"version": "0.0.0-insiders.
|
|
3
|
+
"version": "0.0.0-insiders.b2fe678",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"sideEffects": [
|
|
32
32
|
"**/*.css"
|
|
33
33
|
],
|
|
34
|
+
"bin": {
|
|
35
|
+
"lapikit": "bin/lapikit.js"
|
|
36
|
+
},
|
|
34
37
|
"svelte": "./dist/index.js",
|
|
35
38
|
"types": "./dist/index.d.ts",
|
|
36
39
|
"type": "module",
|