@grafana/create-plugin 2.11.2 → 2.12.0-canary.658.dabaee1.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.
- package/dist/bin/run.js +13 -18
- package/dist/commands/generate/prettify-files.js +15 -70
- package/dist/commands/generate/print-success-message.js +28 -31
- package/dist/commands/generate/prompt-user.js +23 -91
- package/dist/commands/generate/update-go-sdk-and-packages.js +36 -105
- package/dist/commands/generate.command.js +122 -240
- package/dist/commands/index.js +5 -21
- package/dist/commands/migrate.command.js +71 -134
- package/dist/commands/provisioning.command.js +30 -85
- package/dist/commands/types.js +1 -2
- package/dist/commands/update.command.js +44 -97
- package/dist/commands/version.command.js +16 -57
- package/dist/constants.js +37 -32
- package/dist/utils/tests/utils.files.test.js +21 -23
- package/dist/utils/tests/utils.handlebars.test.js +24 -26
- package/dist/utils/tests/utils.npm.test.js +103 -95
- package/dist/utils/tests/utils.plugin.test.js +11 -13
- package/dist/utils/tests/utils.templates.test.js +16 -18
- package/dist/utils/utils.config.js +30 -32
- package/dist/utils/utils.console.js +25 -31
- package/dist/utils/utils.files.js +38 -104
- package/dist/utils/utils.handlebars.js +30 -65
- package/dist/utils/utils.npm.js +75 -118
- package/dist/utils/utils.os.js +3 -7
- package/dist/utils/utils.packageManager.js +31 -37
- package/dist/utils/utils.packagejson.js +13 -22
- package/dist/utils/utils.path.js +7 -14
- package/dist/utils/utils.plugin.js +6 -13
- package/dist/utils/utils.templates.js +58 -80
- package/dist/utils/utils.version.js +9 -11
- package/package.json +20 -6
- package/src/bin/run.ts +2 -2
- package/src/commands/generate/prettify-files.ts +1 -1
- package/src/commands/generate/print-success-message.ts +4 -4
- package/src/commands/generate/prompt-user.ts +2 -2
- package/src/commands/generate/update-go-sdk-and-packages.ts +2 -2
- package/src/commands/generate.command.ts +15 -15
- package/src/commands/index.ts +5 -5
- package/src/commands/migrate.command.ts +6 -6
- package/src/commands/provisioning.command.ts +6 -6
- package/src/commands/types.ts +1 -1
- package/src/commands/update.command.ts +5 -5
- package/src/commands/version.command.ts +5 -2
- package/src/constants.ts +4 -1
- package/src/utils/tests/utils.files.test.ts +2 -2
- package/src/utils/tests/utils.handlebars.test.ts +2 -2
- package/src/utils/tests/utils.npm.test.ts +43 -34
- package/src/utils/tests/utils.plugin.test.ts +2 -2
- package/src/utils/tests/utils.templates.test.ts +2 -2
- package/src/utils/utils.config.ts +3 -3
- package/src/utils/utils.console.ts +16 -11
- package/src/utils/utils.files.ts +3 -3
- package/src/utils/utils.handlebars.ts +3 -3
- package/src/utils/utils.npm.ts +3 -3
- package/src/utils/utils.packageManager.ts +3 -3
- package/src/utils/utils.packagejson.ts +5 -5
- package/src/utils/utils.path.ts +3 -3
- package/src/utils/utils.plugin.ts +2 -3
- package/src/utils/utils.templates.ts +10 -10
- package/src/utils/utils.version.ts +5 -2
- package/tsconfig.json +5 -0
- package/vitest.config.ts +10 -0
|
@@ -1,95 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
ar[i] = from[i];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getTemplateData = exports.renderTemplateFromFile = exports.compileProvisioningTemplateFile = exports.compileSingleTemplateFile = exports.compileTemplateFiles = exports.getProjectRelativeTemplatePath = exports.getTemplateFiles = void 0;
|
|
27
|
-
var glob_1 = __importDefault(require("glob"));
|
|
28
|
-
var path_1 = __importDefault(require("path"));
|
|
29
|
-
var fs_1 = __importDefault(require("fs"));
|
|
30
|
-
var mkdirp_1 = __importDefault(require("mkdirp"));
|
|
31
|
-
var utils_files_1 = require("./utils.files");
|
|
32
|
-
var utils_handlebars_1 = require("./utils.handlebars");
|
|
33
|
-
var utils_plugin_1 = require("./utils.plugin");
|
|
34
|
-
var constants_1 = require("../constants");
|
|
35
|
-
var utils_packageManager_1 = require("./utils.packageManager");
|
|
36
|
-
var utils_files_2 = require("../utils/utils.files");
|
|
37
|
-
var utils_version_1 = require("./utils.version");
|
|
38
|
-
var utils_config_1 = require("./utils.config");
|
|
39
|
-
function getTemplateFiles(pluginType, filter) {
|
|
40
|
-
var commonFiles = glob_1.default.sync("".concat(constants_1.TEMPLATE_PATHS.common, "/**"), { dot: true });
|
|
41
|
-
var pluginTypeSpecificFiles = glob_1.default.sync("".concat(constants_1.TEMPLATE_PATHS[pluginType], "/**"), { dot: true });
|
|
42
|
-
var templateFiles = (0, utils_files_1.filterOutCommonFiles)(__spreadArray(__spreadArray([], commonFiles, true), pluginTypeSpecificFiles, true), pluginType);
|
|
1
|
+
import glob from 'glob';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import mkdirp from 'mkdirp';
|
|
5
|
+
import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
|
|
6
|
+
import { renderHandlebarsTemplate } from './utils.handlebars.js';
|
|
7
|
+
import { getPluginJson } from './utils.plugin.js';
|
|
8
|
+
import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES } from '../constants.js';
|
|
9
|
+
import { getPackageManagerWithFallback } from './utils.packageManager.js';
|
|
10
|
+
import { getExportFileName } from '../utils/utils.files.js';
|
|
11
|
+
import { getVersion } from './utils.version.js';
|
|
12
|
+
import { getConfig } from './utils.config.js';
|
|
13
|
+
export function getTemplateFiles(pluginType, filter) {
|
|
14
|
+
const commonFiles = glob.sync(`${TEMPLATE_PATHS.common}/**`, { dot: true });
|
|
15
|
+
const pluginTypeSpecificFiles = glob.sync(`${TEMPLATE_PATHS[pluginType]}/**`, { dot: true });
|
|
16
|
+
const templateFiles = filterOutCommonFiles([...commonFiles, ...pluginTypeSpecificFiles], pluginType);
|
|
43
17
|
if (filter) {
|
|
44
|
-
return templateFiles.filter(
|
|
45
|
-
|
|
46
|
-
return
|
|
18
|
+
return templateFiles.filter((file) => {
|
|
19
|
+
const projectRelativePath = getProjectRelativeTemplatePath(file, pluginType);
|
|
20
|
+
return isFileStartingWith(projectRelativePath, filter);
|
|
47
21
|
});
|
|
48
22
|
}
|
|
49
23
|
return templateFiles;
|
|
50
24
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return file.replace(constants_1.TEMPLATE_PATHS.common, '').replace(constants_1.TEMPLATE_PATHS[pluginType], '').replace(/^\/+/, '');
|
|
25
|
+
export function getProjectRelativeTemplatePath(file, pluginType) {
|
|
26
|
+
return file.replace(TEMPLATE_PATHS.common, '').replace(TEMPLATE_PATHS[pluginType], '').replace(/^\/+/, '');
|
|
54
27
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
getTemplateFiles(type, filter).forEach(function (file) { return compileSingleTemplateFile(type, file, data); });
|
|
28
|
+
export function compileTemplateFiles(filter, data) {
|
|
29
|
+
const { type } = getPluginJson();
|
|
30
|
+
getTemplateFiles(type, filter).forEach((file) => compileSingleTemplateFile(type, file, data));
|
|
59
31
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!(0, utils_files_1.isFile)(templateFile)) {
|
|
32
|
+
export function compileSingleTemplateFile(pluginType, templateFile, data) {
|
|
33
|
+
if (!isFile(templateFile)) {
|
|
63
34
|
return;
|
|
64
35
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
36
|
+
const rendered = renderTemplateFromFile(templateFile, data);
|
|
37
|
+
const relativeExportPath = templateFile.replace(TEMPLATE_PATHS.common, '').replace(TEMPLATE_PATHS[pluginType], '');
|
|
38
|
+
const exportPath = path.join(EXPORT_PATH_PREFIX, path.dirname(relativeExportPath), getExportFileName(templateFile));
|
|
39
|
+
mkdirp.sync(path.dirname(exportPath));
|
|
40
|
+
fs.writeFileSync(exportPath, rendered);
|
|
70
41
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (!(0, utils_files_1.isFile)(templateFile)) {
|
|
42
|
+
export function compileProvisioningTemplateFile(pluginType, templateFile, data) {
|
|
43
|
+
if (!isFile(templateFile)) {
|
|
74
44
|
return;
|
|
75
45
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
46
|
+
const rendered = renderTemplateFromFile(templateFile, data);
|
|
47
|
+
const relativeExportPath = templateFile.replace(TEMPLATE_PATHS[pluginType], '.');
|
|
48
|
+
const exportPath = path.join(EXPORT_PATH_PREFIX, path.dirname(relativeExportPath), getExportFileName(templateFile));
|
|
49
|
+
mkdirp.sync(path.dirname(exportPath));
|
|
50
|
+
fs.writeFileSync(exportPath, rendered);
|
|
81
51
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return (0, utils_handlebars_1.renderHandlebarsTemplate)(fs_1.default.readFileSync(templateFile).toString(), data);
|
|
52
|
+
export function renderTemplateFromFile(templateFile, data) {
|
|
53
|
+
return renderHandlebarsTemplate(fs.readFileSync(templateFile).toString(), data);
|
|
85
54
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
55
|
+
export function getTemplateData() {
|
|
56
|
+
const pluginJson = getPluginJson();
|
|
57
|
+
const { features } = getConfig();
|
|
58
|
+
const currentVersion = getVersion();
|
|
59
|
+
const { packageManagerName, packageManagerVersion } = getPackageManagerWithFallback();
|
|
60
|
+
return {
|
|
61
|
+
...EXTRA_TEMPLATE_VARIABLES,
|
|
62
|
+
pluginId: pluginJson.id,
|
|
63
|
+
pluginName: pluginJson.name,
|
|
64
|
+
pluginDescription: pluginJson.info?.description,
|
|
65
|
+
hasBackend: Boolean(pluginJson.backend),
|
|
66
|
+
orgName: pluginJson.info?.author?.name,
|
|
67
|
+
pluginType: pluginJson.type,
|
|
68
|
+
packageManagerName,
|
|
69
|
+
packageManagerVersion,
|
|
70
|
+
version: currentVersion,
|
|
71
|
+
bundleGrafanaUI: features.bundleGrafanaUI,
|
|
72
|
+
};
|
|
94
73
|
}
|
|
95
|
-
exports.getTemplateData = getTemplateData;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var version = JSON.parse(pkg).version;
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
5
|
+
export function getVersion() {
|
|
6
|
+
const packageJsonPath = resolve(__dirname, '..', '..', 'package.json');
|
|
7
|
+
const pkg = readFileSync(packageJsonPath, 'utf8');
|
|
8
|
+
const { version } = JSON.parse(pkg);
|
|
10
9
|
if (!version) {
|
|
11
|
-
throw
|
|
10
|
+
throw `Could not find the version of create-plugin`;
|
|
12
11
|
}
|
|
13
12
|
return version;
|
|
14
13
|
}
|
|
15
|
-
exports.getVersion = getVersion;
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"main": "index.js",
|
|
3
|
+
"version": "2.12.0-canary.658.dabaee1.0",
|
|
5
4
|
"repository": {
|
|
6
5
|
"directory": "packages/create-plugin",
|
|
7
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -9,6 +8,13 @@
|
|
|
9
8
|
"author": "Grafana",
|
|
10
9
|
"license": "Apache-2.0",
|
|
11
10
|
"bin": "./dist/bin/run.js",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
"node": {
|
|
14
|
+
"import": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
12
18
|
"publishConfig": {
|
|
13
19
|
"registry": "https://registry.npmjs.org/",
|
|
14
20
|
"access": "public"
|
|
@@ -30,10 +36,12 @@
|
|
|
30
36
|
"generate-datasource-backend": "tsc && npm run clean-generated && CREATE_PLUGIN_DEV=true node ./dist/bin/run.js --pluginName='Sample datasource' --orgName='sample-org' --pluginDescription='This is a sample datasource.' --pluginType='datasource' --hasBackend --hasGithubWorkflows --hasGithubLevitateWorkflow",
|
|
31
37
|
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./src",
|
|
32
38
|
"lint:fix": "npm run lint -- --fix",
|
|
33
|
-
"test": "
|
|
39
|
+
"test": "vitest",
|
|
40
|
+
"test:ci": "vitest run",
|
|
34
41
|
"typecheck": "tsc --noEmit"
|
|
35
42
|
},
|
|
36
43
|
"dependencies": {
|
|
44
|
+
"@types/marked-terminal": "^6.0.1",
|
|
37
45
|
"@types/minimist": "^1.2.2",
|
|
38
46
|
"@types/mkdirp": "^1.0.2",
|
|
39
47
|
"@types/semver": "^7.3.9",
|
|
@@ -45,7 +53,7 @@
|
|
|
45
53
|
"glob": "^7.1.7",
|
|
46
54
|
"handlebars": "^4.7.8",
|
|
47
55
|
"marked": "^10.0.0",
|
|
48
|
-
"marked-terminal": "^
|
|
56
|
+
"marked-terminal": "^6.2.0",
|
|
49
57
|
"minimist": "^1.2.8",
|
|
50
58
|
"mkdirp": "^1.0.4",
|
|
51
59
|
"semver": "^7.3.5",
|
|
@@ -55,7 +63,13 @@
|
|
|
55
63
|
"devDependencies": {
|
|
56
64
|
"@types/glob": "^7.0.0",
|
|
57
65
|
"eslint-plugin-react": "^7.26.1",
|
|
58
|
-
"eslint-plugin-react-hooks": "^4.2.0"
|
|
66
|
+
"eslint-plugin-react-hooks": "^4.2.0",
|
|
67
|
+
"vitest": "^1.1.3"
|
|
68
|
+
},
|
|
69
|
+
"overrides": {
|
|
70
|
+
"@types/marked-terminal": {
|
|
71
|
+
"marked": "^10.0.0"
|
|
72
|
+
}
|
|
59
73
|
},
|
|
60
74
|
"nodemonConfig": {
|
|
61
75
|
"watch": [
|
|
@@ -73,5 +87,5 @@
|
|
|
73
87
|
"engines": {
|
|
74
88
|
"node": ">=20"
|
|
75
89
|
},
|
|
76
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "dabaee1ff0a80d59cf5ffb016b5deda96e052633"
|
|
77
91
|
}
|
package/src/bin/run.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import minimist from 'minimist';
|
|
4
|
-
import { generate, update, migrate, version, provisioning } from '../commands';
|
|
5
|
-
import { isUnsupportedPlatform } from '../utils/utils.os';
|
|
4
|
+
import { generate, update, migrate, version, provisioning } from '../commands/index.js';
|
|
5
|
+
import { isUnsupportedPlatform } from '../utils/utils.os.js';
|
|
6
6
|
|
|
7
7
|
// Exit early if operating system isn't supported.
|
|
8
8
|
if (isUnsupportedPlatform()) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { displayAsMarkdown } from '../../utils/utils.console';
|
|
2
|
-
import { normalizeId } from '../../utils/utils.handlebars';
|
|
3
|
-
import { getPackageManagerFromUserAgent } from '../../utils/utils.packageManager';
|
|
4
|
-
import { CliArgs } from '../types';
|
|
1
|
+
import { displayAsMarkdown } from '../../utils/utils.console.js';
|
|
2
|
+
import { normalizeId } from '../../utils/utils.handlebars.js';
|
|
3
|
+
import { getPackageManagerFromUserAgent } from '../../utils/utils.packageManager.js';
|
|
4
|
+
import { CliArgs } from '../types.js';
|
|
5
5
|
|
|
6
6
|
export function printGenerateSuccessMessage(answers: CliArgs) {
|
|
7
7
|
const directory = normalizeId(answers.pluginName, answers.orgName, answers.pluginType);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import minimist from 'minimist';
|
|
2
2
|
import Enquirer from 'enquirer';
|
|
3
|
-
import { PLUGIN_TYPES } from '../../constants';
|
|
4
|
-
import { CliArgs } from '../types';
|
|
3
|
+
import { PLUGIN_TYPES } from '../../constants.js';
|
|
4
|
+
import { CliArgs } from '../types.js';
|
|
5
5
|
|
|
6
6
|
export async function promptUser(argv: minimist.ParsedArgs) {
|
|
7
7
|
let answers: Partial<CliArgs> = {};
|
|
@@ -2,21 +2,21 @@ import glob from 'glob';
|
|
|
2
2
|
import minimist from 'minimist';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { mkdir, readdir, writeFile } from 'node:fs/promises';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import { EXTRA_TEMPLATE_VARIABLES, IS_DEV, PLUGIN_TYPES, TEMPLATE_PATHS } from '../constants';
|
|
7
|
-
import { getConfig } from '../utils/utils.config';
|
|
8
|
-
import { printError } from '../utils/utils.console';
|
|
9
|
-
import { directoryExists, getExportFileName, isFile } from '../utils/utils.files';
|
|
10
|
-
import { normalizeId } from '../utils/utils.handlebars';
|
|
11
|
-
import { getPackageManagerFromUserAgent, getPackageManagerInstallCmd } from '../utils/utils.packageManager';
|
|
12
|
-
import { getExportPath } from '../utils/utils.path';
|
|
13
|
-
import { renderTemplateFromFile } from '../utils/utils.templates';
|
|
14
|
-
import { getVersion } from '../utils/utils.version';
|
|
15
|
-
import { prettifyFiles } from './generate/prettify-files';
|
|
16
|
-
import { printGenerateSuccessMessage } from './generate/print-success-message';
|
|
17
|
-
import { promptUser } from './generate/prompt-user';
|
|
18
|
-
import { updateGoSdkAndModules } from './generate/update-go-sdk-and-packages';
|
|
19
|
-
import { CliArgs, TemplateData } from './types';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { EXTRA_TEMPLATE_VARIABLES, IS_DEV, PLUGIN_TYPES, TEMPLATE_PATHS } from '../constants.js';
|
|
7
|
+
import { getConfig } from '../utils/utils.config.js';
|
|
8
|
+
import { printError } from '../utils/utils.console.js';
|
|
9
|
+
import { directoryExists, getExportFileName, isFile } from '../utils/utils.files.js';
|
|
10
|
+
import { normalizeId } from '../utils/utils.handlebars.js';
|
|
11
|
+
import { getPackageManagerFromUserAgent, getPackageManagerInstallCmd } from '../utils/utils.packageManager.js';
|
|
12
|
+
import { getExportPath } from '../utils/utils.path.js';
|
|
13
|
+
import { renderTemplateFromFile } from '../utils/utils.templates.js';
|
|
14
|
+
import { getVersion } from '../utils/utils.version.js';
|
|
15
|
+
import { prettifyFiles } from './generate/prettify-files.js';
|
|
16
|
+
import { printGenerateSuccessMessage } from './generate/print-success-message.js';
|
|
17
|
+
import { promptUser } from './generate/prompt-user.js';
|
|
18
|
+
import { updateGoSdkAndModules } from './generate/update-go-sdk-and-packages.js';
|
|
19
|
+
import { CliArgs, TemplateData } from './types.js';
|
|
20
20
|
|
|
21
21
|
export const generate = async (argv: minimist.ParsedArgs) => {
|
|
22
22
|
const answers = await promptUser(argv);
|
package/src/commands/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './generate.command';
|
|
2
|
-
export * from './update.command';
|
|
3
|
-
export * from './migrate.command';
|
|
4
|
-
export * from './version.command';
|
|
5
|
-
export * from './provisioning.command';
|
|
1
|
+
export * from './generate.command.js';
|
|
2
|
+
export * from './update.command.js';
|
|
3
|
+
export * from './migrate.command.js';
|
|
4
|
+
export * from './version.command.js';
|
|
5
|
+
export * from './provisioning.command.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TEXT, MIGRATION_CONFIG } from '../constants';
|
|
2
|
-
import { displayArrayAsList, printMessage, printSuccessMessage, confirmPrompt } from '../utils/utils.console';
|
|
3
|
-
import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates';
|
|
1
|
+
import { TEXT, MIGRATION_CONFIG } from '../constants.js';
|
|
2
|
+
import { displayArrayAsList, printMessage, printSuccessMessage, confirmPrompt } from '../utils/utils.console.js';
|
|
3
|
+
import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates.js';
|
|
4
4
|
import {
|
|
5
5
|
getExportTemplateName,
|
|
6
6
|
getOnlyExistingInCwd,
|
|
7
7
|
getOnlyNotExistingInCwd,
|
|
8
8
|
removeFilesInCwd,
|
|
9
|
-
} from '../utils/utils.files';
|
|
9
|
+
} from '../utils/utils.files.js';
|
|
10
10
|
import {
|
|
11
11
|
getPackageJsonUpdatesAsText,
|
|
12
12
|
updatePackageJson,
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
updateNpmScripts,
|
|
17
17
|
cleanUpPackageJson,
|
|
18
18
|
writePackageManagerInPackageJson,
|
|
19
|
-
} from '../utils/utils.npm';
|
|
20
|
-
import { getPackageManagerWithFallback } from '../utils/utils.packageManager';
|
|
19
|
+
} from '../utils/utils.npm.js';
|
|
20
|
+
import { getPackageManagerWithFallback } from '../utils/utils.packageManager.js';
|
|
21
21
|
|
|
22
22
|
export const migrate = async () => {
|
|
23
23
|
try {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import { TEMPLATE_PATHS, TEXT } from '../constants';
|
|
5
|
-
import { getPluginJson } from '../utils/utils.plugin';
|
|
6
|
-
import { compileProvisioningTemplateFile, getTemplateData } from '../utils/utils.templates';
|
|
7
|
-
import { confirmPrompt, printMessage, printSuccessMessage, printError } from '../utils/utils.console';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import { TEMPLATE_PATHS, TEXT } from '../constants.js';
|
|
5
|
+
import { getPluginJson } from '../utils/utils.plugin.js';
|
|
6
|
+
import { compileProvisioningTemplateFile, getTemplateData } from '../utils/utils.templates.js';
|
|
7
|
+
import { confirmPrompt, printMessage, printSuccessMessage, printError } from '../utils/utils.console.js';
|
|
8
8
|
|
|
9
9
|
export const provisioning = async () => {
|
|
10
10
|
const { type } = getPluginJson();
|
package/src/commands/types.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { TEXT, UDPATE_CONFIG } from '../constants';
|
|
2
|
-
import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates';
|
|
3
|
-
import { confirmPrompt, selectPrompt, printMessage, printSuccessMessage } from '../utils/utils.console';
|
|
1
|
+
import { TEXT, UDPATE_CONFIG } from '../constants.js';
|
|
2
|
+
import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates.js';
|
|
3
|
+
import { confirmPrompt, selectPrompt, printMessage, printSuccessMessage } from '../utils/utils.console.js';
|
|
4
4
|
import {
|
|
5
5
|
updatePackageJson,
|
|
6
6
|
hasNpmDependenciesToUpdate,
|
|
7
7
|
getPackageJsonUpdatesAsText,
|
|
8
8
|
updateNpmScripts,
|
|
9
9
|
writePackageManagerInPackageJson,
|
|
10
|
-
} from '../utils/utils.npm';
|
|
11
|
-
import { getPackageManagerWithFallback } from '../utils/utils.packageManager';
|
|
10
|
+
} from '../utils/utils.npm.js';
|
|
11
|
+
import { getPackageManagerWithFallback } from '../utils/utils.packageManager.js';
|
|
12
12
|
|
|
13
13
|
export const update = async () => {
|
|
14
14
|
try {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
3
6
|
|
|
4
7
|
export const version = async () => {
|
|
5
8
|
try {
|
package/src/constants.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PLUGIN_TYPES, TEMPLATE_PATHS } from '../../constants';
|
|
2
|
-
import { filterOutCommonFiles, isFile } from '../utils.files';
|
|
1
|
+
import { PLUGIN_TYPES, TEMPLATE_PATHS } from '../../constants.js';
|
|
2
|
+
import { filterOutCommonFiles, isFile } from '../utils.files.js';
|
|
3
3
|
|
|
4
4
|
describe('Utils/Files', () => {
|
|
5
5
|
describe('filterOutCommonFiles()', () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PLUGIN_TYPES } from '../../constants';
|
|
2
|
-
import { normalizeId } from '../utils.handlebars';
|
|
1
|
+
import { PLUGIN_TYPES } from '../../constants.js';
|
|
2
|
+
import { normalizeId } from '../utils.handlebars.js';
|
|
3
3
|
|
|
4
4
|
describe('Handlebars helpers', () => {
|
|
5
5
|
describe('normalize id', () => {
|