ng-yunzai-plugin-theme
Advanced tools
+15
-4
@@ -16,11 +16,22 @@ "use strict"; | ||
| const fs_1 = require("fs"); | ||
| const path_1 = require("path"); | ||
| const primaryColorVariable = '@primary-color'; | ||
| const root = process.cwd(); | ||
| function fixConfig(config) { | ||
| var _a; | ||
| let styleSourceRoot = 'src'; | ||
| if (config.name) { | ||
| const angularJsonPath = (0, path_1.join)(root, 'angular.json'); | ||
| const sourceRoot = (_a = (0, utils_1.getJSON)(angularJsonPath)) === null || _a === void 0 ? void 0 : _a.projects[config.name].sourceRoot; | ||
| if (sourceRoot != null) { | ||
| styleSourceRoot = sourceRoot; | ||
| } | ||
| } | ||
| config = (0, utils_1.deepMergeKey)({ | ||
| variables: [], | ||
| ngZorroAntd: `./node_modules/ng-zorro-antd/`, | ||
| styleFilePath: `./src/styles.less`, | ||
| themeFilePath: `./src/styles/theme.less`, | ||
| outputFilePath: `./src/assets/color.less`, | ||
| thirdLibraryNames: ['@yelon', 'ng-zorro-antd'], | ||
| styleFilePath: `./${styleSourceRoot}/styles.less`, | ||
| themeFilePath: `./${styleSourceRoot}/styles/theme.less`, | ||
| outputFilePath: `./${styleSourceRoot}/assets/color.less`, | ||
| thirdLibaryNames: ['@yelon', 'ng-zorro-antd'], | ||
| }, false, config); | ||
@@ -27,0 +38,0 @@ if (!Array.isArray(config.variables)) { |
+12
-8
@@ -21,3 +21,4 @@ #!/usr/bin/env node | ||
| -t, --type Can be set 'themeCss', 'colorLess' | ||
| -c, --config A filepath of NG-YUNZAI config script | ||
| -n, --name Angular project name | ||
| -c, --config A filepath of NG-ALAIN config script | ||
| -d, --debug Debug mode | ||
@@ -31,2 +32,6 @@ `, | ||
| }, | ||
| name: { | ||
| type: 'string', | ||
| alias: 'n', | ||
| }, | ||
| config: { | ||
@@ -59,9 +64,8 @@ type: 'string', | ||
| } | ||
| if (cli.flags.debug === true) { | ||
| ['theme', 'colorLess'].forEach(key => { | ||
| const item = config[key] || {}; | ||
| item.debug = true; | ||
| config[key] = item; | ||
| }); | ||
| } | ||
| ['theme', 'colorLess'].forEach(key => { | ||
| if (config[key] == null) | ||
| config[key] = {}; | ||
| config[key].name = cli.flags.name; | ||
| config[key].debug = cli.flags.debug === true; | ||
| }); | ||
| if (cli.flags.type === 'themeCss') { | ||
@@ -68,0 +72,0 @@ (0, theme_css_1.buildThemeCSS)(config.theme); |
+9
-0
@@ -25,2 +25,11 @@ "use strict"; | ||
| function fixConfig(config) { | ||
| var _a; | ||
| let styleSourceRoot = 'src'; | ||
| if (config.name) { | ||
| const angularJsonPath = (0, path_1.join)(root, 'angular.json'); | ||
| const sourceRoot = (_a = (0, utils_1.getJSON)(angularJsonPath)) === null || _a === void 0 ? void 0 : _a.projects[config.name].sourceRoot; | ||
| if (sourceRoot != null) { | ||
| styleSourceRoot = sourceRoot; | ||
| } | ||
| } | ||
| config = (0, utils_1.deepMergeKey)({ | ||
@@ -27,0 +36,0 @@ additionalLibraries: [], |
+1
-0
| /// <reference types="less" /> | ||
| export interface Config { | ||
| debug?: boolean; | ||
| name?: string; | ||
| buildLessOptions?: Less.Options; | ||
| } |
+1
-0
@@ -5,1 +5,2 @@ import { Config } from './types'; | ||
| export declare function d(config: Config, message: string, data?: unknown): void; | ||
| export declare function mergePath(...args: string[]): string; |
+9
-1
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.d = exports.getJSON = exports.deepMergeKey = void 0; | ||
| exports.mergePath = exports.d = exports.getJSON = exports.deepMergeKey = void 0; | ||
| const jsonc_parser_1 = require("jsonc-parser"); | ||
@@ -58,1 +58,9 @@ const fs_1 = require("fs"); | ||
| exports.d = d; | ||
| function mergePath(...args) { | ||
| const res = args | ||
| .map(v => (v.startsWith('/') ? v.substring(1) : v)) | ||
| .map(v => (v.endsWith('/') ? v.substring(0, v.length - 1) : v)) | ||
| .join('/'); | ||
| return res; | ||
| } | ||
| exports.mergePath = mergePath; |
+5
-41
| { | ||
| "name": "ng-yunzai-plugin-theme", | ||
| "version": "15.0.2", | ||
| "version": "16.0.2", | ||
| "description": "NG-YUNZAI theme plugin", | ||
@@ -23,14 +23,7 @@ "keywords": [ | ||
| }, | ||
| "scripts": { | ||
| "tsc": "tsc", | ||
| "watch": "tsc --w", | ||
| "lint": "eslint 'lib/**/*.ts'", | ||
| "build": "bash ./build.sh", | ||
| "build:test": "bash ./build.sh -t", | ||
| "test": "TS_NODE_PROJECT=./test/tsconfig.json npm run mocha --recursive ./test/**/*.spec.ts", | ||
| "mocha": "mocha -r ts-node/register", | ||
| "release": "npm run build && cd dist && npm publish --access public" | ||
| }, | ||
| "sideEffects": false, | ||
| "dependencies": { | ||
| "meow": "^9.0.0", | ||
| "jsonc-parser": "^3.2.0", | ||
| "less": "^4.1.3", | ||
| "less-plugin-clean-css": "^1.5.1", | ||
@@ -40,32 +33,3 @@ "less-vars-to-js": "^1.3.0", | ||
| "postcss": "^8.4.18" | ||
| }, | ||
| "peerDependencies": { | ||
| "jsonc-parser": "^3.0.0", | ||
| "less": "^4.1.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@yelon/abc": "^14.1.1", | ||
| "@yelon/chart": "^14.1.1", | ||
| "@yelon/form": "^14.1.1", | ||
| "@yelon/theme": "^14.1.1", | ||
| "@yelon/bis": "^14.1.1", | ||
| "@types/chai": "^4.3.3", | ||
| "@types/less": "^3.0.3", | ||
| "@types/meow": "^6.0.0", | ||
| "@types/mocha": "^10.0.0", | ||
| "@types/node": "^14.0.27", | ||
| "@typescript-eslint/eslint-plugin": "^5.41.0", | ||
| "@typescript-eslint/parser": "^5.41.0", | ||
| "chai": "^4.3.6", | ||
| "eslint": "^8.26.0", | ||
| "jsonc-parser": "^3.2.0", | ||
| "less": "^4.1.3", | ||
| "meow": "^9.0.0", | ||
| "mocha": "^10.1.0", | ||
| "ng-zorro-antd": "^14.1.1", | ||
| "postcss": "^8.4.18", | ||
| "postcss-less": "^6.0.0", | ||
| "ts-node": "^10.9.1", | ||
| "typescript": "*" | ||
| } | ||
| } | ||
| } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
28520
0.99%0
-100%672
5.33%+ Added
+ Added