@openedx/frontend-base 1.0.0-alpha.1 → 1.0.0-alpha.2
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/config/types.js
CHANGED
|
@@ -12,8 +12,6 @@ var ConfigTypes;
|
|
|
12
12
|
})(ConfigTypes || (exports.ConfigTypes = ConfigTypes = {}));
|
|
13
13
|
var CommandTypes;
|
|
14
14
|
(function (CommandTypes) {
|
|
15
|
-
CommandTypes["RELEASE"] = "release";
|
|
16
|
-
CommandTypes["PACK"] = "pack";
|
|
17
15
|
CommandTypes["LINT"] = "lint";
|
|
18
16
|
CommandTypes["TEST"] = "test";
|
|
19
17
|
CommandTypes["BUILD"] = "build";
|
package/package.json
CHANGED
|
@@ -8,8 +8,6 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const types_1 = require("../types");
|
|
11
|
-
const pack_1 = __importDefault(require("./commands/pack"));
|
|
12
|
-
const release_1 = __importDefault(require("./commands/release"));
|
|
13
11
|
const ensureConfigFilenameOption_1 = require("./utils/ensureConfigFilenameOption");
|
|
14
12
|
const prettyPrintTitle_1 = __importDefault(require("./utils/prettyPrintTitle"));
|
|
15
13
|
const printUsage_1 = __importDefault(require("./utils/printUsage"));
|
|
@@ -26,18 +24,6 @@ else if ((0, fs_1.existsSync)(path_1.default.resolve(__dirname, '../../../packag
|
|
|
26
24
|
}
|
|
27
25
|
(0, prettyPrintTitle_1.default)(`Open edX CLI v${version}`);
|
|
28
26
|
switch (commandName) {
|
|
29
|
-
case types_1.CommandTypes.RELEASE:
|
|
30
|
-
(0, release_1.default)();
|
|
31
|
-
break;
|
|
32
|
-
case types_1.CommandTypes.PACK:
|
|
33
|
-
if (process.argv[2] === undefined) {
|
|
34
|
-
console.log(chalk_1.default.red(`${chalk_1.default.bold.red(commandName)} command usage: specify a peer folder where the command should install the package:
|
|
35
|
-
|
|
36
|
-
npm run pack my-project`));
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
(0, pack_1.default)();
|
|
40
|
-
break;
|
|
41
27
|
case types_1.CommandTypes.LINT:
|
|
42
28
|
(0, ensureConfigFilenameOption_1.ensureConfigFilenameOption)(types_1.ConfigTypes.LINT, ['-c', '--config']);
|
|
43
29
|
require('.bin/eslint');
|
|
@@ -78,7 +64,7 @@ switch (commandName) {
|
|
|
78
64
|
srcFoldersString = `{${srcFoldersString}}`;
|
|
79
65
|
}
|
|
80
66
|
process.argv = process.argv.concat([
|
|
81
|
-
'--format', 'node_modules/@openedx/frontend-base/dist/
|
|
67
|
+
'--format', 'node_modules/@openedx/frontend-base/tools/dist/cli/utils/formatter.js',
|
|
82
68
|
'--ignore', `${srcFoldersString}/**/*.json`,
|
|
83
69
|
'--ignore', `${srcFoldersString}/**/*.d.ts`,
|
|
84
70
|
'--out-file', './temp/formatjs/Default.messages.json',
|
|
@@ -11,15 +11,6 @@ function printUsage() {
|
|
|
11
11
|
console.log('openedx <command> <options>\n');
|
|
12
12
|
console.groupEnd();
|
|
13
13
|
console.log('Commands:\n');
|
|
14
|
-
console.group();
|
|
15
|
-
console.log(`${chalk_1.default.bold('release')}\n`);
|
|
16
|
-
console.group();
|
|
17
|
-
console.log(`Compile source code for release as a library. Compiled code is put into the dist folder.\n`);
|
|
18
|
-
console.groupEnd();
|
|
19
|
-
console.log(`${chalk_1.default.bold('pack')} <peer folder>\n`);
|
|
20
|
-
console.group();
|
|
21
|
-
console.log(`Package the dist folder as an NPM-compatible .tgz file suitable for use with npm install, then install it in the specified peer folder. The folder is assumed to be a peer of this repository, do not include a path.\n`);
|
|
22
|
-
console.groupEnd();
|
|
23
14
|
console.log(`${chalk_1.default.bold('lint')} <eslint options>\n`);
|
|
24
15
|
console.group();
|
|
25
16
|
console.log(`Runs ESLint on the source code. Requires an ${chalk_1.default.bold('eslint.config.js')} file.\n`);
|
package/tools/dist/types.js
CHANGED
|
@@ -12,8 +12,6 @@ var ConfigTypes;
|
|
|
12
12
|
})(ConfigTypes || (exports.ConfigTypes = ConfigTypes = {}));
|
|
13
13
|
var CommandTypes;
|
|
14
14
|
(function (CommandTypes) {
|
|
15
|
-
CommandTypes["RELEASE"] = "release";
|
|
16
|
-
CommandTypes["PACK"] = "pack";
|
|
17
15
|
CommandTypes["LINT"] = "lint";
|
|
18
16
|
CommandTypes["TEST"] = "test";
|
|
19
17
|
CommandTypes["BUILD"] = "build";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = pack;
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
function pack() {
|
|
10
|
-
const destination = process.argv[2];
|
|
11
|
-
(0, child_process_1.execSync)('npm run release', { stdio: 'inherit' });
|
|
12
|
-
const { filename } = JSON.parse((0, child_process_1.execSync)('npm pack --json').toString())[0];
|
|
13
|
-
(0, child_process_1.execSync)(`npm --prefix ../${destination} install ${path_1.default.resolve(process.cwd(), filename)}`, { stdio: 'inherit' });
|
|
14
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = release;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const fs_1 = require("fs");
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
function release() {
|
|
12
|
-
const tsconfigPath = path_1.default.resolve(process.cwd(), './tsconfig.json');
|
|
13
|
-
if (!(0, fs_1.existsSync)(tsconfigPath)) {
|
|
14
|
-
console.error(chalk_1.default.red('openedx release: the library must include a tsconfig.json. Aborting.'));
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
// Clean up our dist folder.
|
|
18
|
-
(0, fs_1.rmSync)(path_1.default.resolve(process.cwd(), 'dist'), { recursive: true, force: true });
|
|
19
|
-
(0, child_process_1.execSync)(`tsc --project ${path_1.default.resolve(process.cwd(), './tsconfig.json')}`, { stdio: 'inherit' });
|
|
20
|
-
// Copy all non JS/TS files from src into dist. This is so imports of our assets still work.
|
|
21
|
-
(0, child_process_1.execSync)(`rsync -aR src/**/* --exclude='*.tsx' --exclude='*.ts' --exclude='*.js' --exclude='*.jsx' dist/`);
|
|
22
|
-
// The above rsync command will put the files in dist/src - move them up a folder into dist,
|
|
23
|
-
// merging them into the compiled code there, and then delete dist/src.
|
|
24
|
-
if ((0, fs_1.existsSync)(path_1.default.resolve(process.cwd(), 'dist/src'))) {
|
|
25
|
-
(0, child_process_1.execSync)('cp -R dist/src/* dist');
|
|
26
|
-
(0, child_process_1.execSync)('rm -rf dist/src');
|
|
27
|
-
}
|
|
28
|
-
}
|