@makano/rew 1.2.75 → 1.2.76
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/lib/rew/cli/cli.js +22 -1
- package/lib/rew/cli/log.js +7 -3
- package/lib/rew/cli/utils.js +45 -26
- package/package.json +1 -2
- package/runtime.d.ts +943 -891
package/lib/rew/cli/cli.js
CHANGED
@@ -123,10 +123,31 @@ yargs(hideBin(process.argv))
|
|
123
123
|
yargs.positional('path', {
|
124
124
|
describe: 'Path of the project to create',
|
125
125
|
type: 'string',
|
126
|
+
}).option('git', {
|
127
|
+
alias: 'g',
|
128
|
+
describe: `Enable Git Option`,
|
129
|
+
type: 'boolean',
|
130
|
+
}).option('civet', {
|
131
|
+
alias: 'c',
|
132
|
+
describe: `Use civet for main`,
|
133
|
+
type: 'boolean',
|
134
|
+
}).option('types', {
|
135
|
+
alias: 't',
|
136
|
+
describe: `Create @types/rew in node modules`,
|
137
|
+
type: 'boolean',
|
138
|
+
}).option('name', {
|
139
|
+
alias: 'n',
|
140
|
+
describe: `The package name`,
|
141
|
+
type: 'string'
|
142
|
+
}).option('ignore', {
|
143
|
+
alias: 'i',
|
144
|
+
describe: `Use default options`,
|
145
|
+
type: 'boolean',
|
146
|
+
default: false
|
126
147
|
});
|
127
148
|
},
|
128
149
|
(argv) => {
|
129
|
-
require('./utils').createProject(argv.path);
|
150
|
+
require('./utils').createProject(argv.path, argv);
|
130
151
|
},
|
131
152
|
)
|
132
153
|
.command(
|
package/lib/rew/cli/log.js
CHANGED
@@ -8,7 +8,7 @@ let last = '';
|
|
8
8
|
|
9
9
|
const log = (module.exports.log = function (...toPrint) {
|
10
10
|
let prefix = start ? startPrefix : middlePrefix;
|
11
|
-
let returns = false;
|
11
|
+
let returns = false, nosep = false;
|
12
12
|
if (toPrint[toPrint.length - 1] == ':end') {
|
13
13
|
prefix = endPrefix;
|
14
14
|
toPrint.pop();
|
@@ -17,13 +17,17 @@ const log = (module.exports.log = function (...toPrint) {
|
|
17
17
|
returns = true;
|
18
18
|
toPrint.pop();
|
19
19
|
}
|
20
|
+
if (toPrint[toPrint.length - 1] == ':nosep') {
|
21
|
+
nosep = true;
|
22
|
+
toPrint.pop();
|
23
|
+
}
|
20
24
|
if (prefix == endPrefix && start) prefix = separator;
|
21
25
|
// if(last == endPrefix && prefix == separator) prefix = startPrefix;
|
22
|
-
if (!start) console.log(last == endPrefix ? startPrefix : separator);
|
26
|
+
if (!start && !returns && !nosep) console.log(last == endPrefix ? startPrefix : separator);
|
23
27
|
if (start) start = false;
|
24
28
|
last = prefix;
|
25
29
|
if (returns) return [prefix, ...toPrint].join(' ');
|
26
|
-
else console.log(prefix, ...toPrint);
|
30
|
+
else if (toPrint.length) console.log(prefix, ...toPrint);
|
27
31
|
});
|
28
32
|
|
29
33
|
module.exports.logget = function (...toPrint) {
|
package/lib/rew/cli/utils.js
CHANGED
@@ -26,6 +26,7 @@ const {
|
|
26
26
|
cachepath,
|
27
27
|
localBinPath
|
28
28
|
} = require('./helpers');
|
29
|
+
const { input } = require('../functions/stdout');
|
29
30
|
|
30
31
|
module.exports = {
|
31
32
|
conf(command, fullPath, key, value) {
|
@@ -77,13 +78,19 @@ module.exports = {
|
|
77
78
|
}
|
78
79
|
}
|
79
80
|
},
|
80
|
-
createProject: (ppath) => {
|
81
|
+
createProject: (ppath, argv) => {
|
81
82
|
const projectPath = path.join(process.cwd(), ppath);
|
82
83
|
log(''.cyan, 'Creating at'.blue, ppath.yellow);
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
|
85
|
+
const b = (value, type) => type == "boolean" ? (value.toString() == 'y' || value.toString() == "yes" ? true : false) : value;
|
86
|
+
|
87
|
+
const registerInput = (name, promptText, type, argvName, defaultValue) => {
|
88
|
+
if(type == 'boolean') defaultValue = false;
|
89
|
+
let prompted = false;
|
90
|
+
project[name] = argv[argvName] ?? (argv.ignore ? defaultValue ?? b(input(promptText, prompted = log() || true), type) : b(input(promptText, prompted = log() || true), type));
|
91
|
+
log(name.grey+'?'.grey, type == 'string' ? project[name].green : (project[name] == true ? 'yes'.cyan : 'no'.yellow), prompted ? ':nosep' : '');
|
92
|
+
}
|
93
|
+
|
87
94
|
const project = {};
|
88
95
|
const create = () => {
|
89
96
|
fs.mkdirSync(projectPath, { recursive: true });
|
@@ -97,8 +104,8 @@ module.exports = {
|
|
97
104
|
execSync('cd ' + projectPath + ' && git init . && git branch -m main', { stdio: 'ignore' });
|
98
105
|
}
|
99
106
|
if(project.intellisense){
|
100
|
-
fs.
|
101
|
-
fs.copyFileSync(path.join(__dirname, '../../../runtime.d.ts'), path.join(projectPath, '
|
107
|
+
fs.mkdirSync(path.join(projectPath, 'node_modules/@types/rew'), { recursive: true });
|
108
|
+
fs.copyFileSync(path.join(__dirname, '../../../runtime.d.ts'), path.join(projectPath, 'node_modules/@types/rew/index.d.ts'));
|
102
109
|
}
|
103
110
|
execSync('cd ' + projectPath + ' && npm init -y', { stdio: 'ignore' });
|
104
111
|
if(project.civet){
|
@@ -115,29 +122,41 @@ module.exports = {
|
|
115
122
|
// }
|
116
123
|
// });
|
117
124
|
log('Done.'.blue.bold, ':end');
|
118
|
-
rl.close();
|
119
125
|
};
|
120
126
|
if (!fs.existsSync(projectPath)) {
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
127
|
+
|
128
|
+
registerInput(
|
129
|
+
'package',
|
130
|
+
logget(' Package Name: '.blue),
|
131
|
+
'string',
|
132
|
+
'name',
|
133
|
+
path.basename(projectPath)
|
134
|
+
)
|
135
|
+
|
136
|
+
registerInput(
|
137
|
+
'intellisense',
|
138
|
+
logget(' Use intellisense declarations ? (y/N): '.magenta),
|
139
|
+
'boolean',
|
140
|
+
'types'
|
141
|
+
)
|
142
|
+
|
143
|
+
registerInput(
|
144
|
+
'civet',
|
145
|
+
logget(' Use Civet For main ? (y/N): '.blue),
|
146
|
+
'boolean',
|
147
|
+
'civet'
|
148
|
+
)
|
149
|
+
|
150
|
+
registerInput(
|
151
|
+
'git',
|
152
|
+
logget(' Use git ? (y/N): '.yellow),
|
153
|
+
'boolean',
|
154
|
+
'git'
|
155
|
+
)
|
156
|
+
|
157
|
+
create();
|
138
158
|
} else {
|
139
159
|
log(` Project ${ppath} already exists at ${projectPath}`.red.bold, ':end');
|
140
|
-
rl.close();
|
141
160
|
}
|
142
161
|
},
|
143
162
|
runApp(pathOrPackage, options) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@makano/rew",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.76",
|
4
4
|
"description": "A simple coffescript runtime and app manager",
|
5
5
|
"main": "main.js",
|
6
6
|
"directories": {
|
@@ -12,7 +12,6 @@
|
|
12
12
|
"files": [
|
13
13
|
"lib/",
|
14
14
|
"runtime.d.ts",
|
15
|
-
"jsconfig.json",
|
16
15
|
"main.js",
|
17
16
|
"README.md"
|
18
17
|
],
|