lincd-cli 0.1.23 → 0.2.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.
@@ -32,7 +32,7 @@ var path = require('path');
32
32
  var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
33
33
  var TerserPlugin = require('terser-webpack-plugin');
34
34
  var exec = require('child_process').exec;
35
- var CopyPlugin = require("copy-webpack-plugin");
35
+ var CopyPlugin = require('copy-webpack-plugin');
36
36
  var NODE_ENV = process.env.NODE_ENV;
37
37
  var nodeProduction = NODE_ENV == 'production';
38
38
  // const libraryName = 'lincd';
@@ -83,7 +83,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
83
83
  new CopyPlugin({
84
84
  patterns: [
85
85
  {
86
- from: "src/**/*.scss",
86
+ from: 'src/**/*.scss',
87
87
  to: function (_a) {
88
88
  var context = _a.context, absoluteFilename = _a.absoluteFilename;
89
89
  // console.log(chalk.magenta(context),chalk.magenta(absoluteFilename),process.cwd());
@@ -165,6 +165,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
165
165
  // "postcss-scss": {}, //<-- only add this back if the build gets stuck on //comments in scss files, but I dont think that will be the case anymore
166
166
  'postcss-modules': {
167
167
  // //by default postcss-modules will put out a json file right next to the original css / scss file, this method defines what classnames to use
168
+ // generateScopedName:generateScopedName.bind(null,moduleName),
168
169
  generateScopedName: utils_1.generateScopedName.bind(null, moduleName),
169
170
  globalModulePaths: [/tailwind/]
170
171
  },
@@ -327,7 +328,7 @@ function generateWebpackConfig(buildName, moduleName, config) {
327
328
  //stats:{chunks:!watch,version:!watch}//hide some info from output when in watch mode to keep it succinct
328
329
  cache: {
329
330
  // https://webpack.js.org/configuration/other-options/#cache
330
- type: "filesystem"
331
+ type: 'filesystem'
331
332
  }
332
333
  };
333
334
  }
package/lib/utils.js CHANGED
@@ -51,11 +51,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
51
51
  return (mod && mod.__esModule) ? mod : { "default": mod };
52
52
  };
53
53
  exports.__esModule = true;
54
- exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.getPackageJSON = void 0;
54
+ exports.flatten = exports.warn = exports.debug = exports.log = exports.generateScopedName = exports.getGruntConfig = exports.getPackageJSON = void 0;
55
55
  var fs = __importStar(require("fs"));
56
56
  var path = __importStar(require("path"));
57
57
  var chalk_1 = __importDefault(require("chalk"));
58
- // const {findNearestPackageJson, findNearestPackageJsonSync} = require('find-nearest-package-json');
58
+ var _a = require('find-nearest-package-json'), findNearestPackageJson = _a.findNearestPackageJson, findNearestPackageJsonSync = _a.findNearestPackageJsonSync;
59
59
  var getPackageJSON = function (root, error) {
60
60
  if (root === void 0) { root = process.cwd(); }
61
61
  if (error === void 0) { error = true; }
@@ -71,6 +71,21 @@ var getPackageJSON = function (root, error) {
71
71
  }
72
72
  };
73
73
  exports.getPackageJSON = getPackageJSON;
74
+ var getGruntConfig = function (root, error) {
75
+ if (root === void 0) { root = process.cwd(); }
76
+ if (error === void 0) { error = true; }
77
+ var gruntFile = path.join(root, 'Gruntfile.js');
78
+ if (fs.existsSync(gruntFile)) {
79
+ return require(gruntFile)();
80
+ }
81
+ else if (root === process.cwd()) {
82
+ if (error) {
83
+ console.warn('Could not find Gruntfile.js. Make sure you run this command from the root of a lincd module or a lincd yarn workspace');
84
+ process.exit();
85
+ }
86
+ }
87
+ };
88
+ exports.getGruntConfig = getGruntConfig;
74
89
  /*export function getShapesJSONLD(packageExports): Promise<string> {
75
90
  // return JSONLDWriter.stringify(getShapes(packageExports));
76
91
  }
@@ -89,14 +104,15 @@ export function getShapes(packageExports): CoreSet<SHACL_Shape> {
89
104
  }
90
105
  return shapes;
91
106
  }*/
107
+ // export function generateScopedName(moduleName,name, filename, css) {
92
108
  function generateScopedName(moduleName, name, filename, css) {
93
109
  // console.log(moduleName,name,filename,css);
94
- // var file = path.basename(filename, '.scss');
95
- // let nearestPackageJson = findNearestPackageJsonSync(filename);
96
- // let packageName = nearestPackageJson ? nearestPackageJson.data.name : packageJson.name;
97
- // return packageName.replace(/[^a-zA-Z0-9_]+/g, '_') + '_' + file + '_' + name;
110
+ var file = path.basename(filename, '.scss');
111
+ var nearestPackageJson = findNearestPackageJsonSync(filename);
112
+ var packageName = nearestPackageJson ? nearestPackageJson.data.name : moduleName;
113
+ return packageName.replace(/[^a-zA-Z0-9_]+/g, '_') + '_' + file + '_' + name;
98
114
  // process.exit();
99
- var path = require('path');
115
+ // var path = require('path');
100
116
  var file = path.basename(filename, '.scss');
101
117
  var module = filename.match(/[\\\/]modules[\\\/]([\w\-_]+)/);
102
118
  var moduleName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lincd-cli",
3
- "version": "0.1.23",
3
+ "version": "0.2.0",
4
4
  "description": "Command line tools for the lincd.js library",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
8
  "build": "npm exec tsc",
9
9
  "dev": "npm exec tsc -w"
10
10
  },
11
- "lincd_util": true,
11
+ "lincd": true,
12
12
  "keywords": [
13
13
  "lincd",
14
14
  "cli",
@@ -43,6 +43,7 @@
43
43
  "commander": "^9.4.0",
44
44
  "copy-webpack-plugin": "^11.0.0",
45
45
  "css-loader": "^6.7.1",
46
+ "find-nearest-package-json": "^2.0.1",
46
47
  "fs-extra": "^10.1.0",
47
48
  "glob": "^7.1.6",
48
49
  "grunt": "^1.3.0",
@@ -53,7 +54,7 @@
53
54
  "grunt-ts": "^6.0.0-beta.22",
54
55
  "grunt-webpack": "^5.0.0",
55
56
  "license-info-webpack-plugin": "^3.0.0",
56
- "lincd": "^0.3.6",
57
+ "lincd": "^0.4",
57
58
  "lincd-jsonld": "^0.1.8",
58
59
  "load-grunt-tasks": "^5.1.0",
59
60
  "mini-css-extract-plugin": "^2.6.1",