@merkur/create-widget 0.27.6 → 0.28.0
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.
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
import { execaSync } from 'execa';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import yargs from 'yargs';
|
|
9
|
+
import { hideBin } from 'yargs/helpers';
|
|
10
|
+
|
|
11
|
+
const { argv } = yargs(hideBin(process.argv));
|
|
12
|
+
|
|
13
|
+
if (argv._.length === 0) {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.log(`
|
|
16
|
+
Please specify your new project directory:
|
|
17
|
+
${chalk.blue('@merkur/create-widget')} ${chalk.green('<project-directory>')}
|
|
18
|
+
For example:
|
|
19
|
+
${chalk.blue('@merkur/create-widget')} ${chalk.green('my-widget')}`);
|
|
20
|
+
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
25
|
+
const __dirname = path.dirname(__filename);
|
|
26
|
+
|
|
27
|
+
execaSync(
|
|
28
|
+
'node',
|
|
29
|
+
[path.resolve(__dirname, '../scripts/create.mjs'), ...process.argv.slice(2)],
|
|
30
|
+
{
|
|
31
|
+
stdio: 'inherit',
|
|
32
|
+
}
|
|
33
|
+
);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/create-widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "CLI for creating merkur widget easily.",
|
|
5
5
|
"bin": {
|
|
6
|
-
"merkur-create-widget": "./bin/createWidget.
|
|
6
|
+
"merkur-create-widget": "./bin/createWidget.mjs"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "echo 'Tests pass.'",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"node": ">=12"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"chalk": "^
|
|
42
|
-
"execa": "^
|
|
43
|
-
"fs-extra": "^10.
|
|
44
|
-
"inquirer": "^8.
|
|
45
|
-
"yargs": "^17.
|
|
41
|
+
"chalk": "^5.0.1",
|
|
42
|
+
"execa": "^6.1.0",
|
|
43
|
+
"fs-extra": "^10.1.0",
|
|
44
|
+
"inquirer": "^8.2.2",
|
|
45
|
+
"yargs": "^17.4.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "8760a1cedbbfc37348055418bacbfc69199a3c06"
|
|
48
48
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import fsx from 'fs-extra';
|
|
5
|
+
import { execaSync } from 'execa';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import inquirer from 'inquirer';
|
|
8
|
+
import yargs from 'yargs';
|
|
9
|
+
import { hideBin } from 'yargs/helpers';
|
|
10
|
+
|
|
11
|
+
const { argv } = yargs(hideBin(process.argv));
|
|
12
|
+
|
|
8
13
|
const { info, error } = console;
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = path.dirname(__filename);
|
|
9
16
|
|
|
10
17
|
const dir = argv._[0];
|
|
11
18
|
|
|
@@ -97,10 +104,10 @@ function createMerkurApp(dirName, view) {
|
|
|
97
104
|
|
|
98
105
|
// Overwrite package.json with template
|
|
99
106
|
const pkgJsonPath = path.join(appRoot, 'package.json');
|
|
100
|
-
const pkgJson =
|
|
107
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath));
|
|
101
108
|
|
|
102
109
|
const packageTemplatePath = path.join(viewRoot, 'template.json');
|
|
103
|
-
const packageTemplate =
|
|
110
|
+
const packageTemplate = JSON.parse(fs.readFileSync(packageTemplatePath));
|
|
104
111
|
|
|
105
112
|
pkgJson.name = projName;
|
|
106
113
|
|
|
@@ -127,7 +134,7 @@ function createMerkurApp(dirName, view) {
|
|
|
127
134
|
console.log(chalk.dim(' Press CTRL+C to cancel.\n'));
|
|
128
135
|
|
|
129
136
|
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
130
|
-
|
|
137
|
+
execaSync(npm, ['install'], {
|
|
131
138
|
stdio: 'inherit',
|
|
132
139
|
cwd: appRoot,
|
|
133
140
|
});
|
package/template/package.json
CHANGED
|
@@ -17,28 +17,28 @@
|
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@merkur/core": "0.
|
|
21
|
-
"@merkur/integration": "0.
|
|
22
|
-
"@merkur/plugin-component": "0.
|
|
23
|
-
"@merkur/plugin-error": "0.
|
|
24
|
-
"@merkur/plugin-event-emitter": "0.
|
|
20
|
+
"@merkur/core": "0.28.0",
|
|
21
|
+
"@merkur/integration": "0.28.0",
|
|
22
|
+
"@merkur/plugin-component": "0.28.0",
|
|
23
|
+
"@merkur/plugin-error": "0.28.0",
|
|
24
|
+
"@merkur/plugin-event-emitter": "0.28.0",
|
|
25
25
|
"compression": "^1.7.4",
|
|
26
|
-
"config": "^3.3.
|
|
26
|
+
"config": "^3.3.7",
|
|
27
27
|
"cors": "^2.8.5",
|
|
28
28
|
"cross-env": "^7.0.3",
|
|
29
29
|
"ejs": "^3.1.6",
|
|
30
|
-
"express": "^4.17.
|
|
31
|
-
"express-static-gzip": "^2.1.
|
|
30
|
+
"express": "^4.17.3",
|
|
31
|
+
"express-static-gzip": "^2.1.5",
|
|
32
32
|
"got": "^11.8.2",
|
|
33
|
-
"helmet": "^
|
|
33
|
+
"helmet": "^5.0.2",
|
|
34
34
|
"morgan": "^1.10.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@merkur/tools": "0.
|
|
38
|
-
"@merkur/tool-webpack": "0.
|
|
39
|
-
"nodemon": "^2.0.
|
|
40
|
-
"webpack": "^5.
|
|
41
|
-
"webpack-cli": "^4.
|
|
37
|
+
"@merkur/tools": "0.28.0",
|
|
38
|
+
"@merkur/tool-webpack": "0.28.0",
|
|
39
|
+
"nodemon": "^2.0.15",
|
|
40
|
+
"webpack": "^5.72.0",
|
|
41
|
+
"webpack-cli": "^4.9.2"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=14.0.0"
|
|
@@ -31,7 +31,7 @@ function applyBabelLoader(config, { isProduction, environment, cache }) {
|
|
|
31
31
|
cacheIdentifier: createCacheKey(
|
|
32
32
|
environment,
|
|
33
33
|
config?.name,
|
|
34
|
-
...cache?.versionDependencies
|
|
34
|
+
...(cache?.versionDependencies ?? [])
|
|
35
35
|
),
|
|
36
36
|
cacheDirectory: true,
|
|
37
37
|
cacheCompression: false,
|
|
@@ -30,7 +30,7 @@ function applyBabelLoader(config, { isProduction, environment, cache }) {
|
|
|
30
30
|
cacheIdentifier: createCacheKey(
|
|
31
31
|
environment,
|
|
32
32
|
config?.name,
|
|
33
|
-
...cache?.versionDependencies
|
|
33
|
+
...(cache?.versionDependencies ?? [])
|
|
34
34
|
),
|
|
35
35
|
cacheDirectory: true,
|
|
36
36
|
cacheCompression: false,
|
package/bin/createWidget.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const execa = require('execa');
|
|
5
|
-
const chalk = require('chalk');
|
|
6
|
-
const argv = require('yargs').argv;
|
|
7
|
-
|
|
8
|
-
if (argv._.length === 0) {
|
|
9
|
-
// eslint-disable-next-line no-console
|
|
10
|
-
console.log(`
|
|
11
|
-
Please specify your new project directory:
|
|
12
|
-
${chalk.blue('@merkur/create-widget')} ${chalk.green('<project-directory>')}
|
|
13
|
-
For example:
|
|
14
|
-
${chalk.blue('@merkur/create-widget')} ${chalk.green('my-widget')}`);
|
|
15
|
-
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
execa.sync(
|
|
20
|
-
'node',
|
|
21
|
-
[path.resolve(__dirname, '../scripts/create.js'), ...process.argv.slice(2)],
|
|
22
|
-
{
|
|
23
|
-
stdio: 'inherit',
|
|
24
|
-
}
|
|
25
|
-
);
|